Nick Mathewson c281aba30e Fix a nasty bug related to use of dup() with epoll on Linux
Current versions of the Linux kernel don't seem to remove the struct
epitem for a given (file,fd) combo when the fd is closed unless the
file itself is also completely closed.  This means that if you do:
   fd = dup(fd_orig);
   add(fd);
   close(fd);
   dup2(fd_orig, fd);
   add(fd);
you will get an EEXIST when you should have gotten a success.  This
could cause warnings and dropped events when using dup and epoll.

The solution is pretty simple: when we get an EEXIST from
EPOLL_CTL_ADD, we retry with EPOLL_CTL_MOD.

Unit test included to demonstrate the bug.

Found due to the patient efforts of Gilad Benjamini; diagnosed with
help from Nicholas Marriott.
2010-10-24 11:38:29 -04:00
..
2010-10-18 14:20:06 -04:00
2010-10-05 14:29:48 -04:00
2010-10-14 14:40:40 -04:00
2010-10-21 15:33:13 -04:00
2010-08-17 13:21:05 -04:00
2010-07-19 15:16:29 +02:00
2010-10-14 14:40:40 -04:00