ipc/chromium/src/third_party/libevent-avoid-empty-sighandler.patch

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/chromium/src/third_party/libevent-avoid-empty-sighandler.patch	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,65 @@
     1.4 +diff --git a/ipc/chromium/src/third_party/libevent/kqueue.c b/ipc/chromium/src/third_party/libevent/kqueue.c
     1.5 +--- a/ipc/chromium/src/third_party/libevent/kqueue.c
     1.6 ++++ b/ipc/chromium/src/third_party/libevent/kqueue.c
     1.7 +@@ -158,26 +158,20 @@ kq_init(struct event_base *base)
     1.8 + 	base->evsigsel = &kqsigops;
     1.9 + 
    1.10 + 	return (kqueueop);
    1.11 + err:
    1.12 + 	if (kqueueop)
    1.13 + 		kqop_free(kqueueop);
    1.14 + 
    1.15 + 	return (NULL);
    1.16 + }
    1.17 + 
    1.18 +-static void
    1.19 +-kq_sighandler(int sig)
    1.20 +-{
    1.21 +-	/* Do nothing here */
    1.22 +-}
    1.23 +-
    1.24 + #define ADD_UDATA 0x30303
    1.25 + 
    1.26 + static void
    1.27 + kq_setup_kevent(struct kevent *out, evutil_socket_t fd, int filter, short change)
    1.28 + {
    1.29 + 	memset(out, 0, sizeof(struct kevent));
    1.30 + 	out->ident = fd;
    1.31 + 	out->filter = filter;
    1.32 + 
    1.33 + 	if (change & EV_CHANGE_ADD) {
    1.34 +@@ -431,24 +425,31 @@ kq_sig_add(struct event_base *base, int 
    1.35 + 	kev.ident = nsignal;
    1.36 + 	kev.filter = EVFILT_SIGNAL;
    1.37 + 	kev.flags = EV_ADD;
    1.38 + 
    1.39 + 	/* Be ready for the signal if it is sent any
    1.40 + 	 * time between now and the next call to
    1.41 + 	 * kq_dispatch. */
    1.42 + 	if (kevent(kqop->kq, &kev, 1, NULL, 0, &timeout) == -1)
    1.43 + 		return (-1);
    1.44 + 
    1.45 +-	/* XXXX The manpage suggest we could use SIG_IGN instead of a
    1.46 +-	 * do-nothing handler */
    1.47 +-	if (_evsig_set_handler(base, nsignal, kq_sighandler) == -1)
    1.48 ++	/* Backported from
    1.49 ++	 * https://github.com/nmathewson/Libevent/commit/148458e0a1fd25e167aa2ef229d1c9a70b27c3e9 */
    1.50 ++	/* We can set the handler for most signals to SIG_IGN and
    1.51 ++	 * still have them reported to us in the queue.  However,
    1.52 ++	 * if the handler for SIGCHLD is SIG_IGN, the system reaps
    1.53 ++	 * zombie processes for us, and we don't get any notification.
    1.54 ++	 * This appears to be the only signal with this quirk. */
    1.55 ++	if (_evsig_set_handler(base, nsignal,
    1.56 ++	                       nsignal == SIGCHLD ? SIG_DFL : SIG_IGN) == -1) {
    1.57 + 		return (-1);
    1.58 ++	}
    1.59 + 
    1.60 + 	return (0);
    1.61 + }
    1.62 + 
    1.63 + static int
    1.64 + kq_sig_del(struct event_base *base, int nsignal, short old, short events, void *p)
    1.65 + {
    1.66 + 	struct kqop *kqop = base->evbase;
    1.67 + 	struct kevent kev;
    1.68 + 

mercurial