]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: make SA_SIGINFO use unconditional
authorDavid Lamparter <equinox@diac24.net>
Fri, 21 Jun 2019 05:45:50 +0000 (07:45 +0200)
committerDavid Lamparter <equinox@diac24.net>
Wed, 31 Jul 2019 01:33:41 +0000 (03:33 +0200)
This has been in POSIX for ages & there's no OS left that doesn't
support this.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/log.c
lib/sigevent.c

index 48ee0f6adb0cc6c3a0414255e4f91e0a986d8e0c..399d1af0c4c73db4401ce185a9b97963698747c9 100644 (file)
--- a/lib/log.c
+++ b/lib/log.c
@@ -561,9 +561,7 @@ static void crash_write(struct fbuf *fb, char *msgstart)
 void zlog_signal(int signo, const char *action, void *siginfo_v,
                 void *program_counter)
 {
-#ifdef SA_SIGINFO
        siginfo_t *siginfo = siginfo_v;
-#endif
        time_t now;
        char buf[sizeof("DEFAULT: Received signal S at T (si_addr 0xP, PC 0xP); aborting...")
                 + 100];
@@ -577,7 +575,6 @@ void zlog_signal(int signo, const char *action, void *siginfo_v,
        msgstart = fb.pos;
 
        bprintfrr(&fb, "Received signal %d at %lld", signo, (long long)now);
-#ifdef SA_SIGINFO
        if (program_counter)
                bprintfrr(&fb, " (si_addr 0x%tx, PC 0x%tx)",
                          (ptrdiff_t)siginfo->si_addr,
@@ -585,7 +582,6 @@ void zlog_signal(int signo, const char *action, void *siginfo_v,
        else
                bprintfrr(&fb, " (si_addr 0x%tx)",
                          (ptrdiff_t)siginfo->si_addr);
-#endif /* SA_SIGINFO */
        bprintfrr(&fb, "; %s\n", action);
 
        crash_write(&fb, msgstart);
index d02b07422394aec92fb3a88cd0867679881df5d8..fcd85d0d43715f81eff4e8730b67fac8383bbdc7 100644 (file)
@@ -24,7 +24,6 @@
 #include <memory.h>
 #include <lib_errors.h>
 
-#ifdef SA_SIGINFO
 #ifdef HAVE_UCONTEXT_H
 #ifdef GNU_LINUX
 /* get REG_EIP from ucontext.h */
@@ -34,7 +33,6 @@
 #endif /* GNU_LINUX */
 #include <ucontext.h>
 #endif /* HAVE_UCONTEXT_H */
-#endif /* SA_SIGINFO */
 
 
 /* master signals descriptor struct */
@@ -158,8 +156,6 @@ static int signal_set(int signo)
                return 0;
 }
 
-#ifdef SA_SIGINFO
-
 /* XXX This function should be enhanced to support more platforms
        (it currently works only on Linux/x86). */
 static void *program_counter(void *context)
@@ -199,41 +195,19 @@ static void *program_counter(void *context)
        return NULL;
 }
 
-#endif /* SA_SIGINFO */
-
 static void __attribute__((noreturn))
-exit_handler(int signo
-#ifdef SA_SIGINFO
-            ,
-            siginfo_t *siginfo, void *context
-#endif
-            )
+exit_handler(int signo, siginfo_t *siginfo, void *context)
 {
-#ifndef SA_SIGINFO
-       void *siginfo = NULL;
-       void *pc = NULL;
-#else
        void *pc = program_counter(context);
-#endif
 
        zlog_signal(signo, "exiting...", siginfo, pc);
        _exit(128 + signo);
 }
 
 static void __attribute__((noreturn))
-core_handler(int signo
-#ifdef SA_SIGINFO
-            ,
-            siginfo_t *siginfo, void *context
-#endif
-            )
+core_handler(int signo, siginfo_t *siginfo, void *context)
 {
-#ifndef SA_SIGINFO
-       void *siginfo = NULL;
-       void *pc = NULL;
-#else
        void *pc = program_counter(context);
-#endif
 
        /* make sure we don't hang in here.  default for SIGALRM is terminate.
         * - if we're in backtrace for more than a second, abort. */
@@ -290,12 +264,7 @@ static void trap_default_signals(void)
        static const struct {
                const int *sigs;
                unsigned int nsigs;
-               void (*handler)(int signo
-#ifdef SA_SIGINFO
-                               ,
-                               siginfo_t *info, void *context
-#endif
-                               );
+               void (*handler)(int signo, siginfo_t *info, void *context);
        } sigmap[] = {
                {core_signals, array_size(core_signals), core_handler},
                {exit_signals, array_size(exit_signals), exit_handler},
@@ -316,15 +285,10 @@ static void trap_default_signals(void)
                                        act.sa_handler = SIG_IGN;
                                        act.sa_flags = 0;
                                } else {
-#ifdef SA_SIGINFO
                                        /* Request extra arguments to signal
                                         * handler. */
                                        act.sa_sigaction = sigmap[i].handler;
                                        act.sa_flags = SA_SIGINFO;
-#else
-                                       act.sa_handler = sigmap[i].handler;
-                                       act.sa_flags = 0;
-#endif
 #ifdef SA_RESETHAND
                                        /* don't try to print backtraces
                                         * recursively */