summaryrefslogtreecommitdiff
path: root/ev_kqueue.c
diff options
context:
space:
mode:
authorroot <root>2007-11-03 16:23:11 +0000
committerroot <root>2007-11-03 16:23:11 +0000
commit519de1603b2d56fb11c3a94d48d2483988d91a7d (patch)
tree31d6d8f3e92c01ffc51270c423af6c6f32d54ed1 /ev_kqueue.c
parent34a787b55768ddae6645862dc60434188e1fad8d (diff)
*** empty log message ***
Diffstat (limited to 'ev_kqueue.c')
-rw-r--r--ev_kqueue.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/ev_kqueue.c b/ev_kqueue.c
index 8785d10..2ed5104 100644
--- a/ev_kqueue.c
+++ b/ev_kqueue.c
@@ -1,4 +1,3 @@
-
/*
* Copyright 2007 Marc Alexander Lehmann <libev@schmorp.de>
* Copyright 2000-2002 Niels Provos <provos@citi.umich.edu>
@@ -56,10 +55,14 @@ kqueue_change (int fd, int filter, int flags, int fflags)
ke->fflags = fflags;
}
+#ifndef NOTE_EOF
+# define NOTE_EOF 0
+#endif
+
static void
kqueue_modify (int fd, int oev, int nev)
{
- if ((oev ^ new) & EV_READ)
+ if ((oev ^ nev) & EV_READ)
{
if (nev & EV_READ)
kqueue_change (fd, EVFILT_READ, EV_ADD, NOTE_EOF);
@@ -67,7 +70,7 @@ kqueue_modify (int fd, int oev, int nev)
kqueue_change (fd, EVFILT_READ, EV_DELETE, 0);
}
- if ((oev ^ new) & EV_WRITE)
+ if ((oev ^ nev) & EV_WRITE)
{
if (nev & EV_WRITE)
kqueue_change (fd, EVFILT_WRITE, EV_ADD, NOTE_EOF);
@@ -106,14 +109,14 @@ kqueue_poll (ev_tstamp timeout)
* an event we are still processing. In that case
* the data field is set to ENOENT.
*/
- if (events [i].data == EBADF)
- fd_kill (events [i].ident);
+ if (kq_events [i].data == EBADF)
+ fd_kill (kq_events [i].ident);
}
else
fd_event (
- events [i].ident,
- events [i].filter == EVFILT_READ ? EV_READ
- : events [i].filter == EVFILT_WRITE ? EV_WRITE
+ kq_events [i].ident,
+ kq_events [i].filter == EVFILT_READ ? EV_READ
+ : kq_events [i].filter == EVFILT_WRITE ? EV_WRITE
: 0
);
}
@@ -127,7 +130,7 @@ kqueue_poll (ev_tstamp timeout)
}
static void
-kqueue_init (struct event_base *base)
+kqueue_init (int flags)
{
struct kevent ch, ev;
@@ -142,7 +145,7 @@ kqueue_init (struct event_base *base)
/*
* If kqueue works, then kevent will succeed, and it will
- * stick an error in events[0]. If kqueue is broken, then
+ * stick an error in ev. If kqueue is broken, then
* kevent will fail.
*/
if (kevent (kq_fd, &ch, 1, &ev, 1, 0) != 1