Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | diff --git a/ipc/chromium/src/third_party/libevent/kqueue.c b/ipc/chromium/src/third_party/libevent/kqueue.c |
michael@0 | 2 | --- a/ipc/chromium/src/third_party/libevent/kqueue.c |
michael@0 | 3 | +++ b/ipc/chromium/src/third_party/libevent/kqueue.c |
michael@0 | 4 | @@ -158,26 +158,20 @@ kq_init(struct event_base *base) |
michael@0 | 5 | base->evsigsel = &kqsigops; |
michael@0 | 6 | |
michael@0 | 7 | return (kqueueop); |
michael@0 | 8 | err: |
michael@0 | 9 | if (kqueueop) |
michael@0 | 10 | kqop_free(kqueueop); |
michael@0 | 11 | |
michael@0 | 12 | return (NULL); |
michael@0 | 13 | } |
michael@0 | 14 | |
michael@0 | 15 | -static void |
michael@0 | 16 | -kq_sighandler(int sig) |
michael@0 | 17 | -{ |
michael@0 | 18 | - /* Do nothing here */ |
michael@0 | 19 | -} |
michael@0 | 20 | - |
michael@0 | 21 | #define ADD_UDATA 0x30303 |
michael@0 | 22 | |
michael@0 | 23 | static void |
michael@0 | 24 | kq_setup_kevent(struct kevent *out, evutil_socket_t fd, int filter, short change) |
michael@0 | 25 | { |
michael@0 | 26 | memset(out, 0, sizeof(struct kevent)); |
michael@0 | 27 | out->ident = fd; |
michael@0 | 28 | out->filter = filter; |
michael@0 | 29 | |
michael@0 | 30 | if (change & EV_CHANGE_ADD) { |
michael@0 | 31 | @@ -431,24 +425,31 @@ kq_sig_add(struct event_base *base, int |
michael@0 | 32 | kev.ident = nsignal; |
michael@0 | 33 | kev.filter = EVFILT_SIGNAL; |
michael@0 | 34 | kev.flags = EV_ADD; |
michael@0 | 35 | |
michael@0 | 36 | /* Be ready for the signal if it is sent any |
michael@0 | 37 | * time between now and the next call to |
michael@0 | 38 | * kq_dispatch. */ |
michael@0 | 39 | if (kevent(kqop->kq, &kev, 1, NULL, 0, &timeout) == -1) |
michael@0 | 40 | return (-1); |
michael@0 | 41 | |
michael@0 | 42 | - /* XXXX The manpage suggest we could use SIG_IGN instead of a |
michael@0 | 43 | - * do-nothing handler */ |
michael@0 | 44 | - if (_evsig_set_handler(base, nsignal, kq_sighandler) == -1) |
michael@0 | 45 | + /* Backported from |
michael@0 | 46 | + * https://github.com/nmathewson/Libevent/commit/148458e0a1fd25e167aa2ef229d1c9a70b27c3e9 */ |
michael@0 | 47 | + /* We can set the handler for most signals to SIG_IGN and |
michael@0 | 48 | + * still have them reported to us in the queue. However, |
michael@0 | 49 | + * if the handler for SIGCHLD is SIG_IGN, the system reaps |
michael@0 | 50 | + * zombie processes for us, and we don't get any notification. |
michael@0 | 51 | + * This appears to be the only signal with this quirk. */ |
michael@0 | 52 | + if (_evsig_set_handler(base, nsignal, |
michael@0 | 53 | + nsignal == SIGCHLD ? SIG_DFL : SIG_IGN) == -1) { |
michael@0 | 54 | return (-1); |
michael@0 | 55 | + } |
michael@0 | 56 | |
michael@0 | 57 | return (0); |
michael@0 | 58 | } |
michael@0 | 59 | |
michael@0 | 60 | static int |
michael@0 | 61 | kq_sig_del(struct event_base *base, int nsignal, short old, short events, void *p) |
michael@0 | 62 | { |
michael@0 | 63 | struct kqop *kqop = base->evbase; |
michael@0 | 64 | struct kevent kev; |
michael@0 | 65 |