Reputation: 1582
A device that produces an interrupt is managed by a handler in the kernel. I need to send a message with a flag, so that the user application receives the notification of an interruption has occurred, and thus can perform a procedure. For example, wake up a process. How do I do this?
Upvotes: 4
Views: 2345
Reputation: 1267
I prefer to use Netlink as an IPC between kernel and user-space. Just make sure to allocate the message using GFP_ATOMIC (in netlink_broadcast) to make sure you don't sleep in the irq. Have a look here for an Netlink tutorial.
Upvotes: 2
Reputation: 613
IMHO the POSIX style solution would be to write a device driver that receives the interrupts in the kernel. The user space program would open a device file and icoctl() or read() from it, blocking until at least one event had arrived. I suggest, that the user space program should actually read a bit more:
This would help you, to see when your program is misisng events (e.g. because it has ben deleayed in the previous cycle).
Upvotes: 2