From: Niels Provos Date: Thu, 13 Jun 2002 01:54:07 +0000 (+0000) Subject: make kqueue signal callback work with sigchld. cast and better timeout. X-Git-Tag: release-1.1b~142 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3821c7e2015e95f7b6479fe94c15940186db9017;p=libevent make kqueue signal callback work with sigchld. cast and better timeout. svn:r27 --- diff --git a/event.h b/event.h index 6079f9ad..a9ad3ec5 100644 --- a/event.h +++ b/event.h @@ -112,7 +112,7 @@ struct eventop { int (*dispatch)(void *, struct timeval *); }; -#define TIMEOUT_DEFAULT {0, 250000L} +#define TIMEOUT_DEFAULT {5, 0} void event_init(void); int event_dispatch(void); diff --git a/kqueue.c b/kqueue.c index 38960dec..c7a9a427 100644 --- a/kqueue.c +++ b/kqueue.c @@ -164,6 +164,12 @@ kq_insert(struct kqop *kqop, struct kevent *kev) return (0); } +static void +kq_sighandler(int sig) +{ + /* Do nothing here */ +} + int kq_dispatch(void *arg, struct timeval *tv) { @@ -275,7 +281,7 @@ kq_add(void *arg, struct event *ev) if (kq_insert(kqop, &kev) == -1) return (-1); - if (signal(nsignal, SIG_IGN) == SIG_ERR) + if (signal(nsignal, kq_sighandler) == SIG_ERR) return (-1); ev->ev_flags |= EVLIST_X_KQINKERNEL; @@ -324,7 +330,7 @@ kq_del(void *arg, struct event *ev) int nsignal = EVENT_SIGNAL(ev); memset(&kev, 0, sizeof(kev)); - kev.ident = signal; + kev.ident = (int)signal; kev.filter = EVFILT_SIGNAL; kev.flags = EV_DELETE;