- ev_method = EVMETHOD_EPOLL;
- method_fudge = 1e-3; /* needed to compensate for epoll returning early */
- method_modify = epoll_modify;
- method_poll = epoll_poll;
+ backend_fudge = 1e-3; /* needed to compensate for epoll returning early */
+ backend_modify = epoll_modify;
+ backend_poll = epoll_poll;
+
+ epoll_eventmax = 64; /* intiial number of events receivable per poll */
+ epoll_events = (struct epoll_event *)ev_malloc (sizeof (struct epoll_event) * epoll_eventmax);
+
+ return EVBACKEND_EPOLL;
+}
+
+static void
+epoll_destroy (EV_P)
+{
+ close (epoll_fd);
+
+ ev_free (epoll_events);
+}
+
+static void
+epoll_fork (EV_P)
+{
+ close (epoll_fd);
+
+ while ((epoll_fd = epoll_create (256)) < 0)
+ syserr ("(libev) epoll_create");
+
+ fcntl (epoll_fd, F_SETFD, FD_CLOEXEC);