views:

112

answers:

1

Hi All,

I might be approaching this all wrong but...

I have a linux kernel device driver that handles an external interrupt and currently performs a printk() when it occurs.

What I would like to do is tell a user space app that this event has occurred so it can wake up and do some stuff.

Is it possible (/simple /good practice) to set the SIGUSR1 from within the kernel and then capture it from user space via

signal (SIGUSR1, <handler function>);

Thanks

+2  A: 

This doesn't sound like a very good idea. If it is even possible, you'd have to somehow give the driver the process id of the user-space guy so the driver could finagle getting a signal to it.

I would create a /dev/xxx, open it, and the driver could make the file descriptor active when the event occurs. Maybe even provide more information.

Richard Pennington
Yes, this is good advice. Have your device register a character device; the userspace program then opens the corresponding device node and blocks in `read` or `select`; the device driver makes a message (maybe even just a single byte) available to read when the interrupt occurs, and wakes up the userspace application.
caf