Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. Please tell me, how to do it?

like image 560
Jake Badlands Avatar asked Oct 24 '25 15:10

Jake Badlands


2 Answers

  • You can always use normal sockets, like UDP or UNIX.
  • You can export this information via /proc or /sys (see this question).
  • You can use Netlink (see this question).
like image 137
kirelagin Avatar answered Oct 27 '25 05:10

kirelagin


Use the netlink.

Netlink socket is a special IPC used for transferring information between kernel and user-space processes. 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. Netlink socket uses the address family AF_NETLINK, as compared to AF_INET used by TCP/IP socket. Each netlink socket feature defines its own protocol type in the kernel header file include/linux/netlink.h.

like image 26
Ottavio Campana Avatar answered Oct 27 '25 06:10

Ottavio Campana



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!