4

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?

Jake Badlands
  • 1,016
  • 3
  • 23
  • 46

3 Answers3

4
  • 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).
Community
  • 1
  • 1
kirelagin
  • 13,248
  • 2
  • 42
  • 57
  • 1
    message queue, or shared memory? – eduardosufan Aug 14 '13 at 22:59
  • You can use signals too to userspace :).. Only thing your kernel module should know is PID of the process which needs to trigger. I have used IOCTL to the kernel module to pass PID :). – duslabo Mar 18 '14 at 10:02
3

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.

Ottavio Campana
  • 4,088
  • 5
  • 31
  • 58
0

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. Typically the following works for me:

force_sig(SIGSEGV, current);
R.D.
  • 2,471
  • 2
  • 15
  • 21