Re: Async user space notification from kernel?

Sam Roberts (sam@cogent.ca)
Thu, 26 Aug 1999 13:53:19 -0400


Previously, Erik Andersen wrote in list.linux.kernel:
> On Thu, Aug 26, 1999 at 03:39:44PM +0100, Tigran Aivazian wrote:
> > Hi,
> >
> > You just said:
> > > What is the best way to have the kernel notify a user space daemon
> > > that some event has occured without user space resorting to polling an
> > > ioctl(ugh)?
> >
>
> The Linux device driver can easily be notified asyncronously when the
> button is pushed. It sits silently waiting till the button is pushed. So
> now the device driver knows something interesting has happened, but user
> space doesn't.

I'd do this with select(). What was your objection to it? It seems perfect.
If your driver is for an 8bit card, and you only want to wait on a state
change of bit 3 you could:

ioctl() // tell driver that you're interested in state change of bit 3
select() // use the exceptional state to indicate interesting thing has happened
ioctl() // ask current state of digital inputs

But by the way, what makes you think ioctls aren't interruptible? I have
a driver with a number of blocking ioctls, seems to be working fine, so far,
and I can kill blocked clients with ctl-C (sigint). They just get waken
from their waitqueue...

If there is a problem with this, I'd really like to know!

Sam

--
Sam Roberts (sam@cogent.ca), Cogent Real-Time Systems (www.cogent.ca)
"News is very popular among its readers." - RFC 977 (NNTP)

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/