From 5a25466437f4e6b6a005c7c444ce69f2d50990dc Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 27 Dec 2016 23:18:21 +0000 Subject: [PATCH] Move NSIG ifdefery to a separate header file * nsig.h: New file. * Makefile.am (strace_SOURCES): Add it. * signal.c: Include "nsig.h" instead of , remove NSIG workarounds. * sigreturn.c: Likewise. * syscall.c: Likewise. * tests/pselect6.c: Likewise. --- Makefile.am | 1 + nsig.h | 13 +++++++++++++ signal.c | 9 +-------- sigreturn.c | 9 +-------- syscall.c | 7 +------ tests/pselect6.c | 7 +------ 6 files changed, 18 insertions(+), 28 deletions(-) create mode 100644 nsig.h diff --git a/Makefile.am b/Makefile.am index 8444ed9c..4840b937 100644 --- a/Makefile.am +++ b/Makefile.am @@ -170,6 +170,7 @@ strace_SOURCES = \ native_defs.h \ net.c \ netlink.c \ + nsig.h \ numa.c \ oldstat.c \ open.c \ diff --git a/nsig.h b/nsig.h new file mode 100644 index 00000000..4b000424 --- /dev/null +++ b/nsig.h @@ -0,0 +1,13 @@ +#ifndef STRACE_NSIG_H +#define STRACE_NSIG_H + +#include + +#ifndef NSIG +# warning NSIG is not defined, using 32 +# define NSIG 32 +#elif NSIG < 32 +# error NSIG < 32 +#endif + +#endif /* !STRACE_NSIG_H */ diff --git a/signal.c b/signal.c index ef7bed88..4e18c6a0 100644 --- a/signal.c +++ b/signal.c @@ -32,14 +32,7 @@ */ #include "defs.h" -#include - -#ifndef NSIG -# warning NSIG is not defined, using 32 -# define NSIG 32 -#elif NSIG < 32 -# error NSIG < 32 -#endif +#include "nsig.h" /* The libc headers do not define this constant since it should only be used by the implementation. So we define it here. */ diff --git a/sigreturn.c b/sigreturn.c index f0dab0da..b2eeb7a4 100644 --- a/sigreturn.c +++ b/sigreturn.c @@ -1,5 +1,5 @@ #include "defs.h" -#include +#include "nsig.h" #include "regs.h" #include "ptrace.h" @@ -7,13 +7,6 @@ # include #endif -#ifndef NSIG -# warning NSIG is not defined, using 32 -# define NSIG 32 -#elif NSIG < 32 -# error NSIG < 32 -#endif - #include "arch_sigreturn.c" SYS_FUNC(sigreturn) diff --git a/syscall.c b/syscall.c index e696b25f..6613a1e8 100644 --- a/syscall.c +++ b/syscall.c @@ -33,8 +33,8 @@ #include "defs.h" #include "native_defs.h" +#include "nsig.h" #include -#include /* for struct iovec */ #include @@ -63,11 +63,6 @@ # define NT_PRSTATUS 1 #endif -#ifndef NSIG -# warning: NSIG is not defined, using 32 -# define NSIG 32 -#endif - #include "syscall.h" /* Define these shorthand notations to simplify the syscallent files. */ diff --git a/tests/pselect6.c b/tests/pselect6.c index b2599546..f8f10f54 100644 --- a/tests/pselect6.c +++ b/tests/pselect6.c @@ -30,9 +30,9 @@ */ #include "tests.h" +#include "nsig.h" #include #include -#include #include #include #include @@ -40,11 +40,6 @@ #ifdef __NR_pselect6 -#ifndef NSIG -# warning NSIG is not defined, using 32 -# define NSIG 32 -#endif - static fd_set set[3][0x1000000 / sizeof(fd_set)]; static void -- 2.40.0