Re: Fw: epoll and fork()

From: Davide Libenzi
Date: Tue Mar 02 2004 - 10:08:22 EST


>
> Is there a defined behaviour for what happens when a process with an epoll
> fd forks?
>
> I've an app that inherits an epoll fd from its parent, and then
> unregisters some file descriptors from the epoll set. This seems to have
> the nasty side effect of unregistering the same file descriptors from the
> parent process as well. Surely this can't be right?

epoll does register the underlying file* not the fd, so this is the
expected behaviour. Inheriting an fd, and epoll is no exception, simply
bumps a counter, so both parent and child epoll fd shares the same context.
Sorry but what behaviour do you expect by unregistering an fd pushed by
the parent from inside a child? Events work exactly the same. Since the
context is shared, events are delivered only once.



- Davide


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