Jake Badlands
Jake Badlands

Reputation: 1026

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?

Upvotes: 4

Views: 3626

Answers (3)

R.D.
R.D.

Reputation: 2631

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);

Upvotes: 0

kirelagin
kirelagin

Reputation: 13626

  • 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).

Upvotes: 4

Ottavio Campana
Ottavio Campana

Reputation: 4188

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.

Upvotes: 3

Related Questions