diff options
author | Zack Weinberg <zackw@panix.com> | 2011-08-11 09:34:51 -0700 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-08-30 15:33:02 -0400 |
commit | 148458e0a1fd25e167aa2ef229d1c9a70b27c3e9 (patch) | |
tree | bb7f1973ee0429a1f61021aeee5a85bd6d8ce786 /kqueue.c | |
parent | 46f1769d41c1220d80cea20b405b5ce896858349 (diff) | |
download | libevent-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.c | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -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); |