Reputation: 412
I have a PCIe device that will send a hardware interrupt when a data buffer is ready to be read. I believe the best approach for this is to use signals but I'm not entirely sure how. What I believe I need to do is:
I'm not sure how to do either of these. How/Where do I save the PID of the user space application? How do I send a signal to that specific PID from the driver's interrupt handler (I believe I should use the kill command but I'm more interested in the syntax of getting the PID)? How do I have the user space application wait for the signal after saving its PID? Is it possible to have the user space application continue to run after saving its PID, run the signal handler function when a signal is received, and continue running where it was before the signal arrived? (similar to how an ISR works)
Upvotes: 2
Views: 5559
Reputation: 3761
This is an old question, but to manage IRQ from application userspace, the better way now is to use UIO driver and poll/select call on /dev/uioX.
Upvotes: 0
Reputation: 591
Have to handle interrupt directly in kernel. In order to pass PID to kernel, have to use the device file abstraction (e.g. ioctl()
calls), but it provides asynchronous notification through read/select as well so signal solution is replaced.
Upvotes: 0
Reputation: 556
Don't use signals for this. Implement a character device. The userspace application will open
it, then call read
and will be blocked until your driver determines there is data available.
See Linux Device Drivers chapter 3, I think.
Upvotes: 3