[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[Libevent-users] resuming libevent2 after closing all file descriptors



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?

Please note that technically it would be very cumbersome for me to
call event_init() after the close(fd) loop.

Thanks,

Péter
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.