Hi
I don't think there will be any more 1.x releases, 1.x is no longer
maintained upstream.
You can remove -DHAVE_SIGACTION from the Makefile as well.
I'm happy enough with this, but there are a lot more to remove as
well...
On Sun, Oct 05, 2014 at 10:29:38PM +0200, Alexander Bluhm wrote:
> Hi,
>
> Can we remove the #ifdef HAVE_SIGACTION from libevent? The only
> reason to keep it, would be make merging with upstream easier. Do
> we expect any new 1.X versions from upstream?
>
> ok?
>
> bluhm
>
> Index: lib/libevent/evsignal.h
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/lib/libevent/evsignal.h,v
> retrieving revision 1.4
> diff -u -p -r1.4 evsignal.h
> --- lib/libevent/evsignal.h 21 Apr 2010 20:02:40 -0000 1.4
> +++ lib/libevent/evsignal.h 5 Oct 2014 20:21:05 -0000
> @@ -29,8 +29,6 @@
> #ifndef _EVSIGNAL_H_
> #define _EVSIGNAL_H_
>
> -typedef void (*ev_sighandler_t)(int);
> -
> struct evsignal_info {
> struct event ev_signal;
> int ev_signal_pair[2];
> @@ -38,11 +36,7 @@ struct evsignal_info {
> volatile sig_atomic_t evsignal_caught;
> struct event_list evsigevents[NSIG];
> sig_atomic_t evsigcaught[NSIG];
> -#ifdef HAVE_SIGACTION
> struct sigaction **sh_old;
> -#else
> - ev_sighandler_t **sh_old;
> -#endif
> int sh_old_max;
> };
> int evsignal_init(struct event_base *);
> Index: lib/libevent/signal.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/lib/libevent/signal.c,v
> retrieving revision 1.16
> diff -u -p -r1.16 signal.c
> --- lib/libevent/signal.c 29 Apr 2013 00:28:23 -0000 1.16
> +++ lib/libevent/signal.c 5 Oct 2014 20:06:03 -0000
> @@ -140,11 +140,7 @@ int
> _evsignal_set_handler(struct event_base *base,
> int evsignal, void (*handler)(int))
> {
> -#ifdef HAVE_SIGACTION
> struct sigaction sa;
> -#else
> - ev_sighandler_t sh;
> -#endif
> struct evsignal_info *sig = &base->sig;
> void *p;
>
> @@ -177,7 +173,6 @@ _evsignal_set_handler(struct event_base
> }
>
> /* save previous handler and setup new handler */
> -#ifdef HAVE_SIGACTION
> memset(&sa, 0, sizeof(sa));
> sa.sa_handler = handler;
> sa.sa_flags |= SA_RESTART;
> @@ -189,15 +184,6 @@ _evsignal_set_handler(struct event_base
> sig->sh_old[evsignal] = NULL;
> return (-1);
> }
> -#else
> - if ((sh = signal(evsignal, handler)) == SIG_ERR) {
> - event_warn("signal");
> - free(sig->sh_old[evsignal]);
> - sig->sh_old[evsignal] = NULL;
> - return (-1);
> - }
> - *sig->sh_old[evsignal] = sh;
> -#endif
>
> return (0);
> }
> @@ -240,26 +226,15 @@ _evsignal_restore_handler(struct event_b
> {
> int ret = 0;
> struct evsignal_info *sig = &base->sig;
> -#ifdef HAVE_SIGACTION
> struct sigaction *sh;
> -#else
> - ev_sighandler_t *sh;
> -#endif
>
> /* restore previous handler */
> sh = sig->sh_old[evsignal];
> sig->sh_old[evsignal] = NULL;
> -#ifdef HAVE_SIGACTION
> if (sigaction(evsignal, sh, NULL) == -1) {
> event_warn("sigaction");
> ret = -1;
> }
> -#else
> - if (signal(evsignal, *sh) == SIG_ERR) {
> - event_warn("signal");
> - ret = -1;
> - }
> -#endif
> free(sh);
>
> return ret;
> @@ -299,10 +274,6 @@ evsignal_handler(int sig)
>
> evsignal_base->sig.evsigcaught[sig]++;
> evsignal_base->sig.evsignal_caught = 1;
> -
> -#ifndef HAVE_SIGACTION
> - signal(sig, evsignal_handler);
> -#endif
>
> /* Wake up our notification mechanism */
> send(evsignal_base->sig.ev_signal_pair[0], "a", 1, 0);
>