Messages in this thread | | | From | "Manfred Spraul" <> | Subject | Re: Behavior of poll() within a module | Date | Tue, 23 Oct 2001 20:02:42 +0200 |
| |
From: "Richard B. Johnson" <root@chaos.analogic.com> > > In this module, there isn't any read() or write() event that can > clear the poll mask. Instead, the sole purpose of poll is to tell > the user-mode caller that there is new status available as a result > of an interrupt. This is a module that controls a motor. It runs > <forever> on its own. It gets new parameters via an ioctl(). It > reports exceptions (like overload conditions) using the poll > mechanism. > > The caller reads the cached status via an ioctl(). Any caller sleeping > in poll must be awakened as a result of the interrupt event. Any caller > can read the cached status at any time. If this was allowed to > clear the poll mask, only one caller would be awakened. > Ugh. ->poll must never change any state. The kernel is free to call poll multiple times (common are once, twice and three times).
Can you use a per-filp pollmask? * remove poll_active * remove poll_mask * add event counters for every possible event. poll_count_POLLIN, poll_count_POLLOUT, etc. * interrupt handler increases the counter. * ioctl() copies the value of the counters into filp->private_data->event_handled_POLL{IN,OUT} * poll sets the pollmask if filp->private_data->event_seen != info->poll_count
If filps (file descriptors) are shared between apps, then I have no idea how to fix your design.
-- Manfred
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |