aboutsummaryrefslogtreecommitdiff
path: root/libbb/u_signal_names.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-12-04 10:20:48 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-12-04 10:20:48 +0000
commitc689fcfdb00a5a3a05f433806eeb10cf4c1e6f7d (patch)
tree20a0c1da6a68ba6e95b12c04591ee1fae38a790d /libbb/u_signal_names.c
parent5f934b07853658069435a4b42c17277e6478c534 (diff)
downloadbusybox-w32-c689fcfdb00a5a3a05f433806eeb10cf4c1e6f7d.tar.gz
busybox-w32-c689fcfdb00a5a3a05f433806eeb10cf4c1e6f7d.tar.bz2
busybox-w32-c689fcfdb00a5a3a05f433806eeb10cf4c1e6f7d.zip
Make signal table a bit smaller
get_signum 136 151 +15 signals 224 192 -32
Diffstat (limited to 'libbb/u_signal_names.c')
-rw-r--r--libbb/u_signal_names.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libbb/u_signal_names.c b/libbb/u_signal_names.c
index 43015b7a1..c741f81d7 100644
--- a/libbb/u_signal_names.c
+++ b/libbb/u_signal_names.c
@@ -11,10 +11,9 @@
11 11
12#define KILL_MAX_SIG 32 12#define KILL_MAX_SIG 32
13 13
14static const char signals[KILL_MAX_SIG][7] = { 14static const char signals[KILL_MAX_SIG][6] = {
15 // SUSv3 says kill must support these, and specifies the numerical values, 15 // SUSv3 says kill must support these, and specifies the numerical values,
16 // http://www.opengroup.org/onlinepubs/009695399/utilities/kill.html 16 // http://www.opengroup.org/onlinepubs/009695399/utilities/kill.html
17 // TODO: "[SIG]EXIT" shouldn't work for kill, right?
18 // {0, "EXIT"}, {1, "HUP"}, {2, "INT"}, {3, "QUIT"}, 17 // {0, "EXIT"}, {1, "HUP"}, {2, "INT"}, {3, "QUIT"},
19 // {6, "ABRT"}, {9, "KILL"}, {14, "ALRM"}, {15, "TERM"} 18 // {6, "ABRT"}, {9, "KILL"}, {14, "ALRM"}, {15, "TERM"}
20 // And Posix adds the following: 19 // And Posix adds the following:
@@ -25,6 +24,8 @@ static const char signals[KILL_MAX_SIG][7] = {
25 24
26/* Believe it or not, but some arches have more than 32 SIGs! 25/* Believe it or not, but some arches have more than 32 SIGs!
27 * HPPA: SIGSTKFLT == 36. We don't include those. */ 26 * HPPA: SIGSTKFLT == 36. We don't include those. */
27
28/* NB: longest (6-char) names are NOT nul-terminated */
28 [0] = "EXIT", 29 [0] = "EXIT",
29#if defined SIGHUP && SIGHUP < KILL_MAX_SIG 30#if defined SIGHUP && SIGHUP < KILL_MAX_SIG
30 [SIGHUP ] = "HUP", 31 [SIGHUP ] = "HUP",
@@ -132,8 +133,10 @@ int get_signum(const char *name)
132 return i; 133 return i;
133 if (strncasecmp(name, "SIG", 3) == 0) 134 if (strncasecmp(name, "SIG", 3) == 0)
134 name += 3; 135 name += 3;
136 if (strlen(name) > 6)
137 return -1;
135 for (i = 0; i < ARRAY_SIZE(signals); i++) 138 for (i = 0; i < ARRAY_SIZE(signals); i++)
136 if (strcasecmp(name, signals[i]) == 0) 139 if (strncasecmp(name, signals[i], 6) == 0)
137 return i; 140 return i;
138 141
139#if ENABLE_DESKTOP && (defined(SIGIOT) || defined(SIGIO)) 142#if ENABLE_DESKTOP && (defined(SIGIOT) || defined(SIGIO))