… | |
… | |
40 | ev.data.u64 = fd; /* use u64 to fully initialise the struct, for nicer strace etc. */ |
40 | ev.data.u64 = fd; /* use u64 to fully initialise the struct, for nicer strace etc. */ |
41 | ev.events = |
41 | ev.events = |
42 | (nev & EV_READ ? EPOLLIN : 0) |
42 | (nev & EV_READ ? EPOLLIN : 0) |
43 | | (nev & EV_WRITE ? EPOLLOUT : 0); |
43 | | (nev & EV_WRITE ? EPOLLOUT : 0); |
44 | |
44 | |
45 | epoll_ctl (epoll_fd, mode, fd, &ev); |
45 | if (epoll_ctl (epoll_fd, mode, fd, &ev)) |
|
|
46 | if (errno != ENOENT /* on ENOENT the fd went away, so try to do the right thing */ |
|
|
47 | || (nev && epoll_ctl (epoll_fd, EPOLL_CTL_ADD, fd, &ev))) |
|
|
48 | fd_kill (EV_A_ fd); |
46 | } |
49 | } |
47 | |
50 | |
48 | static void |
51 | static void |
49 | epoll_poll (EV_P_ ev_tstamp timeout) |
52 | epoll_poll (EV_P_ ev_tstamp timeout) |
50 | { |
53 | { |