简体   繁体   English

如何通过信号(send_sig_info)将数据从 kernel 发送到用户空间?

[英]How to send data from kernel to userspace through signals (send_sig_info)?

Does anyone know how to send data from a kernel module to a userspace app, via signals?有谁知道如何通过信号将数据从 kernel 模块发送到用户空间应用程序? Actually, I have a kernel module that uses the function send_sig_info() to notify a userspace app (registered through ioctl) about some events happening in the kernel space.实际上,我有一个 kernel 模块,它使用 function send_sig_info()通知用户空间应用程序(通过 ioctl 注册)关于 Z50484C19F1AFDAF33841A0D821ED 空间中发生的一些事件。 I would like to include some data that describe those events in the siginfo data structure (particularly, via the si_ptr field, if I'm not mistaken).我想在siginfo数据结构中包含一些描述这些事件的数据(特别是通过si_ptr字段,如果我没记错的话)。 Is there any sample code that does that?是否有任何示例代码可以做到这一点? Besides, what about memory freeing?此外,memory 释放呢? Normally, it should be done by the userspace app, right?, So?通常,它应该由用户空间应用程序完成,对吧?,那么? how can the userspace app frees memory that was allocated by the kernel.用户空间应用程序如何释放由 kernel 分配的 memory。 Any hint related to this problem is most welcomed.任何与此问题相关的提示都非常受欢迎。 Thank you.谢谢你。

PS: This post is focused on using signals and not other IPC techniques, such as Netlink or shared memory. PS:这篇文章的重点是使用信号而不是其他 IPC 技术,例如 Netlink 或共享 memory。

I don't think it is possible to send data from kernel to userspace application through signals.我认为不可能通过信号将数据从 kernel 发送到用户空间应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM