X-Git-Url: https://git.llucax.com/software/libev.git/blobdiff_plain/f123911c49df152e9b27ab4df77b12a03b6abfa2..678c8c54d0ce967d8f1db3e575aed61879279975:/ev_select.c diff --git a/ev_select.c b/ev_select.c index a0db3b6..5738fe5 100644 --- a/ev_select.c +++ b/ev_select.c @@ -42,11 +42,8 @@ #include #include -static unsigned char *vec_ri, *vec_ro, *vec_wi, *vec_wo; -static int vec_max; - static void -select_modify (int fd, int oev, int nev) +select_modify (EV_P_ int fd, int oev, int nev) { int offs = fd >> 3; int mask = 1 << (fd & 7); @@ -75,7 +72,7 @@ select_modify (int fd, int oev, int nev) } static void -select_poll (ev_tstamp timeout) +select_poll (EV_P_ ev_tstamp timeout) { struct timeval tv; int res; @@ -110,7 +107,7 @@ select_poll (ev_tstamp timeout) events |= byte_w & (1 << bit) ? EV_WRITE : 0; if (events) - fd_event (idx * 8 + bit, events); + fd_event (EV_A_ idx * 8 + bit, events); } } } @@ -118,18 +115,19 @@ select_poll (ev_tstamp timeout) else if (res < 0) { if (errno == EBADF) - fd_ebadf (); + fd_ebadf (EV_A); else if (errno == ENOMEM) - fd_enomem (); + fd_enomem (EV_A); } } -static void -select_init (int flags) +static int +select_init (EV_P_ int flags) { - ev_method = EVMETHOD_SELECT; method_fudge = 1e-2; /* needed to compensate for select returning early, very conservative */ method_modify = select_modify; method_poll = select_poll; + + return EVMETHOD_SELECT; }