libevent looping

Anatoly Vorobey mellon@pobox.com
Fri, 5 Sep 2003 10:48:21 +0300


On Thu, Sep 04, 2003 at 07:34:51PM -0700, Brad Fitzpatrick wrote:
> I forgot to mention:  0x3 is the fd of the server socket, it'd seem, since
> daemon() closes and reopens std{out,in,err} to /dev/null.
> 
> So maybe Linux 2.4.21 has a new event type for server sockets?
> I googled and saw talk of POLLRDHUP or something?  (yeah, I really don't
> know...)

No, 0x3 is the epoll file descriptor, created by the call to 
epoll_create().  We make that call (indirectly, by calling 
libevent's event_init()) before we daemonize, that's why it's 0x3, the 
next available after the standard 0,1,2 that haven't been closed.

The socket fd's, including the server sockets, all hide inside that
structure

> > epoll_wait(0x3, 0x80accb8, 0x2000, 0x1ad) = 1
                    ^^^^^^^^^

which (I believe) we weren't able to inspect at runtime yet when
the bug occurred.

-- 
avva