2010/5/3 Péter Szabó <pts...@gmail.com>: > Hi, > > I'm doing the following with libevent 2.0.4 on Linux: > > strcut event_base *base = event_init() > ... /* not registering any events */ > for (int fd = 3; fd < 256; ++fd) close(fd); > event_reinit(base); > ... > This eventually reports the following warning: > > [warn] Epoll ADD on fd 7 failed. Old events were 0; read change was > 1; write change was 0.: Bad file descriptor > > From ls -l /pro/self/fd, it seems that libevent opens a socketpair on > fds 7 and 8, which I close with close(fd), but event_reinit(base) > doesn't create the new socketpair. Do you think it would be possible > to recreate the socketpairs?
Can you say more about why you closing all these fds, including ones that belong to the event base? Libevent doesn't like you to close its socketpair fds any more than it will like it if you're closing its epoll fd, or any more than it would like it if you call free() on the internals of the event_base. In any case, re-grabbing *all* resources isn't the point of event_reinit(). The event_reinit() function is only supposed to be called after a fork() to re-acquire or re-register any resources that aren't inherited by a child process; it is not an alias for calling event_base_free() and event_base_new(). > Please note that technically it would be very cumbersome for me to > call event_init() after the close(fd) loop. What about the newer functions that obsolete event_init(), like event_base_new()? yrs, -- Nick *********************************************************************** To unsubscribe, send an e-mail to majord...@freehaven.net with unsubscribe libevent-users in the body.