dnl Checks for header files.
AC_HEADER_STDC
-AC_CHECK_HEADERS(poll.h signal.h unistd.h sys/epoll.h sys/time.h sys/queue.h sys/event.h)
+AC_CHECK_HEADERS(inttypes.h stdint.h poll.h signal.h unistd.h sys/epoll.h sys/time.h sys/queue.h sys/event.h)
if test "x$ac_cv_header_sys_queue_h" = "xyes"; then
AC_MSG_CHECKING(for TAILQ_FOREACH in sys/queue.h)
AC_EGREP_CPP(yes,
#include <unistd.h>
#include <errno.h>
#include <err.h>
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
#ifdef USE_LOG
#include "log.h"
#define log_error warn
#endif
+#ifdef HAVE_INTTYPES_H
+#define INTPTR(x) (intptr_t)x
+#else
+#define INTPTR(x) x
+#endif
+
#include "event.h"
extern struct event_list timequeue;
which |= EV_WRITE;
} else if (events[i].filter == EVFILT_SIGNAL) {
which |= EV_SIGNAL;
- } else
- events[i].filter = 0;
+ }
if (!which)
continue;
+ if (!(ev->ev_events & EV_PERSIST))
+ event_del(ev);
+
event_active(ev, which,
ev->ev_events & EV_SIGNAL ? events[i].data : 1);
}
- for (i = 0; i < res; i++) {
- /* XXX */
- int ncalls, evres;
-
- if (events[i].flags & EV_ERROR || events[i].filter == NULL)
- continue;
-
- ev = (struct event *)events[i].udata;
- if (ev->ev_events & EV_PERSIST)
- continue;
-
- ncalls = 0;
- if (ev->ev_flags & EVLIST_ACTIVE) {
- ncalls = ev->ev_ncalls;
- evres = ev->ev_res;
- }
- ev->ev_flags &= ~EVLIST_X_KQINKERNEL;
- event_del(ev);
-
- if (ncalls)
- event_active(ev, evres, ncalls);
- }
-
return (0);
}
kev.flags = EV_ADD;
if (!(ev->ev_events & EV_PERSIST))
kev.flags |= EV_ONESHOT;
- kev.udata = ev;
+ kev.udata = INTPTR(ev);
if (kq_insert(kqop, &kev) == -1)
return (-1);
kev.flags = EV_ADD;
if (!(ev->ev_events & EV_PERSIST))
kev.flags |= EV_ONESHOT;
- kev.udata = ev;
+ kev.udata = INTPTR(ev);
if (kq_insert(kqop, &kev) == -1)
return (-1);
kev.flags = EV_ADD;
if (!(ev->ev_events & EV_PERSIST))
kev.flags |= EV_ONESHOT;
- kev.udata = ev;
+ kev.udata = INTPTR(ev);
if (kq_insert(kqop, &kev) == -1)
return (-1);