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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial