Messages in this thread | | | Date | Mon, 7 Jul 2003 15:12:27 -0700 (PDT) | From | Davide Libenzi <> | Subject | Re: epoll vs stdin/stdout |
| |
On Mon, 7 Jul 2003, Eric Varsanyi wrote:
> On Mon, Jul 07, 2003 at 11:57:02AM -0700, Davide Libenzi wrote: > > Events caught by epoll comes from a file* since that is the abstraction > > the kernel handles. Events really happen on the file* and there's no way > > if you dup()ing 1000 times a single fd, to say that events are for fd = 122. > > It is useful/mildly common at the app level to want to get read events > for fd0 and write avail events for fd1. An app that might want to deal > with reads from stdin in one process and writes to stdout in another > (something like "team" perhaps) would have trouble here too. > > Epoll's API/impl is great as it is IMO, not suggesting need for change, I was > hoping there was a good standard trick someone worked up to get around > this specifc end case of stdin/stdout usually being dups but sometimes > not. Porting my event system over to use epoll was easy/straightforward > except for this one minor hitch. > > I considered: > - using a second epoll object just for one of the fd's (to inspire > delivery of the event to 2 wait queues in the kernel); a little > ugly because of need to stack another epfd under the main one > just for stdout write events > > - select() on (0, 1, epfd) and just use epoll with a timeout of 0 > when select fires to gather bulk of events; morally similar to > previous but using select (which I want to just get away from) > > - make the app use stdin as its output (this is what I ended up doing); > breaks redirection of stdout but that doesn't matter to this app
Any of the above. Pls wait for an incoming patch ...
- Davide
- 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/
| |