summaryrefslogtreecommitdiff
path: root/kqueue.c
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2011-08-11 09:34:51 -0700
committerNick Mathewson <nickm@torproject.org>2011-08-30 15:33:02 -0400
commit148458e0a1fd25e167aa2ef229d1c9a70b27c3e9 (patch)
treebb7f1973ee0429a1f61021aeee5a85bd6d8ce786 /kqueue.c
parent46f1769d41c1220d80cea20b405b5ce896858349 (diff)
downloadlibevent-148458e0a1fd25e167aa2ef229d1c9a70b27c3e9.tar.gz
Use SIG_IGN instead of a do-nothing handler for signal events with kqueue
Diffstat (limited to 'kqueue.c')
-rw-r--r--kqueue.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/kqueue.c b/kqueue.c
index b0772dc1..dc61ae39 100644
--- a/kqueue.c
+++ b/kqueue.c
@@ -164,12 +164,6 @@ err:
return (NULL);
}
-static void
-kq_sighandler(int sig)
-{
- /* Do nothing here */
-}
-
#define ADD_UDATA 0x30303
static void
@@ -432,9 +426,13 @@ kq_sig_add(struct event_base *base, int nsignal, short old, short events, void *
if (kevent(kqop->kq, &kev, 1, NULL, 0, &timeout) == -1)
return (-1);
- /* XXXX The manpage suggest we could use SIG_IGN instead of a
- * do-nothing handler */
- if (_evsig_set_handler(base, nsignal, kq_sighandler) == -1)
+ /* We can set the handler for most signals to SIG_IGN and
+ * still have them reported to us in the queue. However,
+ * if the handler for SIGCHLD is SIG_IGN, the system reaps
+ * zombie processes for us, and we don't get any notification.
+ * This appears to be the only signal with this quirk. */
+ if (_evsig_set_handler(base, nsignal,
+ nsignal == SIGCHLD ? SIG_DFL : SIG_IGN) == -1)
return (-1);
return (0);