[英]How to send a “signal” from kernel module to user-space application?
I have a Linux kernel module which contains the interrupt handler, and would like to somehow notify the user-space application after the interrupt was handled. 我有一个Linux内核模块,其中包含中断处理程序,并希望在处理完中断后以某种方式通知用户空间应用程序。 Please tell me, how to do it? 请告诉我,怎么做?
Netlink socket is a special IPC used for transferring information between kernel and user-space processes. Netlink套接字是一种特殊的IPC,用于在内核和用户空间进程之间传输信息。 It provides a full-duplex communication link between the two by way of standard socket APIs for user-space processes and a special kernel API for kernel modules. 它通过用于用户空间进程的标准套接字API和用于内核模块的特殊内核API在两者之间提供全双工通信链接。 Netlink socket uses the address family AF_NETLINK, as compared to AF_INET used by TCP/IP socket. 与TCP / IP套接字使用的AF_INET相比,Netlink套接字使用地址族AF_NETLINK。 Each netlink socket feature defines its own protocol type in the kernel header file include/linux/netlink.h. 每个netlink套接字功能在内核头文件include / linux / netlink.h中定义自己的协议类型。
I'm directly answering this question as it's the top result in Google for "kernel send signal to user space". 我正在直接回答这个问题,因为这是谷歌“向用户空间发送内核信号”的最佳结果。
I typically use signal to kill the userspace process to examine it's stack as it calls ioctls. 我通常使用signal来杀死用户空间进程,以便在调用ioctl时检查它的堆栈。 Typically the following works for me: 通常,以下内容适用于我:
force_sig(SIGSEGV, current);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.