-static void (*method_modify)(int fd, int oev, int nev);
-static void (*method_poll)(ev_tstamp timeout);
+static void (*method_modify)(EV_P_ int fd, int oev, int nev);
+static void (*method_poll)(EV_P_ ev_tstamp timeout);
+
+static int activecnt; /* number of active events */
+
+#if EV_USE_SELECT
+static unsigned char *vec_ri, *vec_ro, *vec_wi, *vec_wo;
+static int vec_max;
+#endif
+
+#if EV_USEV_POLL
+static struct pollfd *polls;
+static int pollmax, pollcnt;
+static int *pollidxs; /* maps fds into structure indices */
+static int pollidxmax;
+#endif
+
+#if EV_USE_EPOLL
+static int epoll_fd = -1;
+
+static struct epoll_event *events;
+static int eventmax;
+#endif
+
+#if EV_USE_KQUEUE
+static int kqueue_fd;
+static struct kevent *kqueue_changes;
+static int kqueue_changemax, kqueue_changecnt;
+static struct kevent *kqueue_events;
+static int kqueue_eventmax;
+#endif