Browse Source

*** empty log message ***

master
Marc Alexander Lehmann 2 years ago
parent
commit
0a50867d48
  1. 33
      ev_epoll.c

33
ev_epoll.c

@ -235,21 +235,32 @@ epoll_poll (EV_P_ ev_tstamp timeout)
}
}
inline_size
int
epoll_init (EV_P_ int flags)
static int
ev_epoll_create (void)
{
int fd;
#if defined EPOLL_CLOEXEC && !defined __ANDROID__
backend_fd = epoll_create1 (EPOLL_CLOEXEC);
fd = epoll_create1 (EPOLL_CLOEXEC);
if (backend_fd < 0 && (errno == EINVAL || errno == ENOSYS))
if (fd < 0 && (errno == EINVAL || errno == ENOSYS))
#endif
backend_fd = epoll_create (256);
{
fd = epoll_create (256);
if (backend_fd < 0)
return 0;
if (fd >= 0)
fcntl (fd, F_SETFD, FD_CLOEXEC);
}
fcntl (backend_fd, F_SETFD, FD_CLOEXEC);
return fd;
}
inline_size
int
epoll_init (EV_P_ int flags)
{
if ((backend_fd = ev_epoll_create ()) < 0)
return 0;
backend_mintime = 1e-3; /* epoll does sometimes return early, this is just to avoid the worst */
backend_modify = epoll_modify;
@ -275,11 +286,9 @@ epoll_fork (EV_P)
{
close (backend_fd);
while ((backend_fd = epoll_create (256)) < 0)
while ((backend_fd = ev_epoll_create ()) < 0)
ev_syserr ("(libev) epoll_create");
fcntl (backend_fd, F_SETFD, FD_CLOEXEC);
fd_rearm_all (EV_A);
}

Loading…
Cancel
Save