X-Git-Url: https://git.llucax.com/software/libev.git/blobdiff_plain/fd6d7a01bca4544f5674438b189ba5ec1bce98af..49a82c163f76e2916974ec3eac8d395662e7187b:/ev_epoll.c diff --git a/ev_epoll.c b/ev_epoll.c index b3b546f..da2b5bc 100644 --- a/ev_epoll.c +++ b/ev_epoll.c @@ -13,9 +13,7 @@ epoll_modify (int fd, int oev, int nev) (nev & EV_READ ? EPOLLIN : 0) | (nev & EV_WRITE ? EPOLLOUT : 0); - fprintf (stderr, "reify %d,%d,%d m%d (r=%d)\n", fd, oev, nev, mode,//D - epoll_ctl (epoll_fd, mode, fd, &ev) - );//D + epoll_ctl (epoll_fd, mode, fd, &ev); } void epoll_postfork_child (void) @@ -23,6 +21,7 @@ void epoll_postfork_child (void) int fd; epoll_fd = epoll_create (256); + fcntl (epoll_fd, F_SETFD, FD_CLOEXEC); /* re-register interest in fds */ for (fd = 0; fd < anfdmax; ++fd) @@ -57,20 +56,20 @@ static void epoll_poll (ev_tstamp timeout) } } -int epoll_init (int flags) +void epoll_init (int flags) { epoll_fd = epoll_create (256); if (epoll_fd < 0) - return 0; + return; + + fcntl (epoll_fd, F_SETFD, FD_CLOEXEC); - ev_method = EVMETHOD_EPOLL; + ev_method = EVMETHOD_EPOLL; method_fudge = 1e-3; /* needed to compensate for epoll returning early */ method_modify = epoll_modify; method_poll = epoll_poll; eventmax = 64; /* intiial number of events receivable per poll */ events = malloc (sizeof (struct epoll_event) * eventmax); - - return 1; }