… | |
… | |
226 | unsigned char events = anfds [fd].events & (EV_READ | EV_WRITE); |
226 | unsigned char events = anfds [fd].events & (EV_READ | EV_WRITE); |
227 | |
227 | |
228 | if (anfds [fd].emask & EV_EMASK_EPERM && events) |
228 | if (anfds [fd].emask & EV_EMASK_EPERM && events) |
229 | fd_event (EV_A_ fd, events); |
229 | fd_event (EV_A_ fd, events); |
230 | else |
230 | else |
|
|
231 | { |
231 | epoll_eperms [i] = epoll_eperms [--epoll_epermcnt]; |
232 | epoll_eperms [i] = epoll_eperms [--epoll_epermcnt]; |
|
|
233 | anfds [fd].emask = 0; |
|
|
234 | } |
232 | } |
235 | } |
233 | } |
236 | } |
234 | |
237 | |
235 | int inline_size |
238 | int inline_size |
236 | epoll_init (EV_P_ int flags) |
239 | epoll_init (EV_P_ int flags) |
237 | { |
240 | { |
238 | #ifdef EPOLL_CLOEXEC |
241 | #ifdef EPOLL_CLOEXEC |
239 | backend_fd = epoll_create1 (EPOLL_CLOEXEC); |
242 | backend_fd = epoll_create1 (EPOLL_CLOEXEC); |
240 | |
243 | |
241 | if (backend_fd <= 0) |
244 | if (backend_fd < 0 && (errno == EINVAL || errno == ENOSYS)) |
242 | #endif |
245 | #endif |
243 | backend_fd = epoll_create (256); |
246 | backend_fd = epoll_create (256); |
244 | |
247 | |
245 | if (backend_fd < 0) |
248 | if (backend_fd < 0) |
246 | return 0; |
249 | return 0; |
247 | |
250 | |
248 | fcntl (backend_fd, F_SETFD, FD_CLOEXEC); |
251 | fcntl (backend_fd, F_SETFD, FD_CLOEXEC); |
249 | |
252 | |
250 | backend_mintime = 1./1024.; /* epoll does sometimes return early, this is just to avoid the worst */ |
253 | backend_mintime = 1e-3; /* epoll does sometimes return early, this is just to avoid the worst */ |
251 | backend_modify = epoll_modify; |
254 | backend_modify = epoll_modify; |
252 | backend_poll = epoll_poll; |
255 | backend_poll = epoll_poll; |
253 | |
256 | |
254 | epoll_eventmax = 64; /* initial number of events receivable per poll */ |
257 | epoll_eventmax = 64; /* initial number of events receivable per poll */ |
255 | epoll_events = (struct epoll_event *)ev_malloc (sizeof (struct epoll_event) * epoll_eventmax); |
258 | epoll_events = (struct epoll_event *)ev_malloc (sizeof (struct epoll_event) * epoll_eventmax); |