From 1dc2a5313c37b21405632afdff062a9147e8510f Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 27 Nov 2018 01:13:40 +0000 Subject: [PATCH] Stop using SIG_0 Number 0 is not a valid signal number, and SIG_0 is not a valid description for a signal. * linux/signalent.h: Replace SIG_0 with 0. * linux/alpha/signalent.h: Likewise. * linux/hppa/signalent.h: Likewise. * linux/mips/signalent.h: Likewise. * linux/sparc/signalent.h: Likewise. * filter_qualify.c (sigstr_to_uint): Start iterations with number 1. * tests/fcntl-common.c (test_fcntl_others): Update expected output. * tests/kill.c (main): Likewise. * tests/ptrace.c (test_peeksiginfo): Likewise. * tests/s390_runtime_instr.c (main): Likewise. --- filter_qualify.c | 2 +- linux/alpha/signalent.h | 2 +- linux/hppa/signalent.h | 2 +- linux/mips/signalent.h | 2 +- linux/signalent.h | 2 +- linux/sparc/signalent.h | 2 +- tests/fcntl-common.c | 2 +- tests/kill.c | 2 +- tests/ptrace.c | 2 +- tests/s390_runtime_instr.c | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/filter_qualify.c b/filter_qualify.c index 69928b4e..f2bea6d0 100644 --- a/filter_qualify.c +++ b/filter_qualify.c @@ -57,7 +57,7 @@ sigstr_to_uint(const char *s) if (strncasecmp(s, "SIG", 3) == 0) s += 3; - for (int i = 0; i <= 255; ++i) { + for (int i = 1; i <= 255; ++i) { const char *name = signame(i); if (strncasecmp(name, "SIG", 3) != 0) diff --git a/linux/alpha/signalent.h b/linux/alpha/signalent.h index 174b17b8..a78e6de0 100644 --- a/linux/alpha/signalent.h +++ b/linux/alpha/signalent.h @@ -1,4 +1,4 @@ - "SIG_0", /* 0 */ + "0", /* 0 */ "SIGHUP", /* 1 */ "SIGINT", /* 2 */ "SIGQUIT", /* 3 */ diff --git a/linux/hppa/signalent.h b/linux/hppa/signalent.h index 6d699876..3e9b2d97 100644 --- a/linux/hppa/signalent.h +++ b/linux/hppa/signalent.h @@ -1,4 +1,4 @@ - "SIG_0", /* 0 */ + "0", /* 0 */ "SIGHUP", /* 1 */ "SIGINT", /* 2 */ "SIGQUIT", /* 3 */ diff --git a/linux/mips/signalent.h b/linux/mips/signalent.h index d18e5105..11dfe881 100644 --- a/linux/mips/signalent.h +++ b/linux/mips/signalent.h @@ -1,4 +1,4 @@ - "SIG_0", /* 0 */ + "0", /* 0 */ "SIGHUP", /* 1 */ "SIGINT", /* 2 */ "SIGQUIT", /* 3 */ diff --git a/linux/signalent.h b/linux/signalent.h index 112f746c..45a0df99 100644 --- a/linux/signalent.h +++ b/linux/signalent.h @@ -1,4 +1,4 @@ - "SIG_0", /* 0 */ + "0", /* 0 */ "SIGHUP", /* 1 */ "SIGINT", /* 2 */ "SIGQUIT", /* 3 */ diff --git a/linux/sparc/signalent.h b/linux/sparc/signalent.h index 83ca9ca8..39d7c85a 100644 --- a/linux/sparc/signalent.h +++ b/linux/sparc/signalent.h @@ -1,4 +1,4 @@ - "SIG_0", /* 0 */ + "0", /* 0 */ "SIGHUP", /* 1 */ "SIGINT", /* 2 */ "SIGQUIT", /* 3 */ diff --git a/tests/fcntl-common.c b/tests/fcntl-common.c index 9504527f..b492c0b1 100644 --- a/tests/fcntl-common.c +++ b/tests/fcntl-common.c @@ -346,7 +346,7 @@ test_fcntl_others(void) { 0, ARG_STR(F_SETFL), ARG_STR(O_RDWR|O_LARGEFILE) }, { 0, ARG_STR(F_NOTIFY), ARG_STR(DN_ACCESS) }, { 1, ARG_STR(F_SETLEASE), ARG_STR(F_RDLCK) }, - { 0, ARG_STR(F_SETSIG), 0, "SIG_0" }, + { 0, ARG_STR(F_SETSIG), 0, "0" }, { 1, ARG_STR(F_SETSIG), 1, "SIGHUP" } }; for (unsigned int i = 0; i < ARRAY_SIZE(set_checks); i++) { diff --git a/tests/kill.c b/tests/kill.c index cb884aa1..d2ff1df4 100644 --- a/tests/kill.c +++ b/tests/kill.c @@ -66,7 +66,7 @@ main(void) (int) big_pid, (int) big_sig, rc, errno2name()); rc = syscall(__NR_kill, (long) 0xdefaced00000000ULL | pid, 0); - printf("kill(%d, SIG_0) = %ld\n", pid, rc); + printf("kill(%d, 0) = %ld\n", pid, rc); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/ptrace.c b/tests/ptrace.c index 2ca9ceb3..be7cf66e 100644 --- a/tests/ptrace.c +++ b/tests/ptrace.c @@ -166,7 +166,7 @@ test_peeksiginfo(unsigned long pid, const unsigned long bad_request) errno = saved; perror_msg_and_fail("ptrace"); } - printf("ptrace(PTRACE_CONT, %ld, NULL, SIG_0) = 0\n", pid); + printf("ptrace(PTRACE_CONT, %ld, NULL, 0) = 0\n", pid); } } diff --git a/tests/s390_runtime_instr.c b/tests/s390_runtime_instr.c index 5d368a1a..03c27421 100644 --- a/tests/s390_runtime_instr.c +++ b/tests/s390_runtime_instr.c @@ -55,7 +55,7 @@ main(void) kernel_ulong_t sig; const char * sig_str; } start_sig_args[] = { - { 0, "SIG_0" }, + { 0, "0" }, { (kernel_ulong_t) 0xfacefeedac0ffeedULL, NULL }, { ARG_STR(SIGALRM) }, { 33, "SIGRT_1" }, -- 2.40.0