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?
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 (eg because it has ben deleayed in the previous cycle).
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.