aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-12-30 01:17:03 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-12-30 01:17:03 +0100
commit2753aae0e8728f527bedf103b1207857b7c3e151 (patch)
tree81a721b4e9aa1884e0f25db7e0310b7c6037bc62
parent90615a0c5c326fa3cf78fc719f7b16207f47395a (diff)
downloadbusybox-w32-2753aae0e8728f527bedf103b1207857b7c3e151.tar.gz
busybox-w32-2753aae0e8728f527bedf103b1207857b7c3e151.tar.bz2
busybox-w32-2753aae0e8728f527bedf103b1207857b7c3e151.zip
libbb: optionally support RTMIN[+n] and RTMAX[-n] signal names
function old new delta get_signum 140 336 +196 __libc_allocate_rtsig - 56 +56 __libc_current_sigrtmin - 6 +6 __libc_current_sigrtmax - 6 +6 current_rtmin - 4 +4 current_rtmax - 4 +4 bbconfig_config_bz2 4961 4962 +1 ------------------------------------------------------------------------------ (add/remove: 6/0 grow/shrink: 2/0 up/down: 273/0) Total: 273 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--libbb/Config.src2
-rw-r--r--libbb/u_signal_names.c42
2 files changed, 38 insertions, 6 deletions
diff --git a/libbb/Config.src b/libbb/Config.src
index f6c7a11ea..85892d3fe 100644
--- a/libbb/Config.src
+++ b/libbb/Config.src
@@ -135,7 +135,7 @@ config FEATURE_NON_POSIX_CP
135 and create a regular file. This does not conform to POSIX, 135 and create a regular file. This does not conform to POSIX,
136 but prevents a symlink attack. 136 but prevents a symlink attack.
137 Similarly, "cp file device" will not send file's data 137 Similarly, "cp file device" will not send file's data
138 to the device. 138 to the device. (To do that, use "cat file >device")
139 139
140config FEATURE_VERBOSE_CP_MESSAGE 140config FEATURE_VERBOSE_CP_MESSAGE
141 bool "Give more precise messages when copy fails (cp, mv etc)" 141 bool "Give more precise messages when copy fails (cp, mv etc)"
diff --git a/libbb/u_signal_names.c b/libbb/u_signal_names.c
index 9263859f5..53ccdd1a7 100644
--- a/libbb/u_signal_names.c
+++ b/libbb/u_signal_names.c
@@ -7,6 +7,13 @@
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10//config:config FEATURE_RTMINMAX
11//config: bool "Support RTMIN[+n] and RTMAX[-n] signal names"
12//config: default y
13//config: help
14//config: Support RTMIN[+n] and RTMAX[-n] signal names
15//config: in kill, killall etc. This costs ~250 bytes.
16
10#include "libbb.h" 17#include "libbb.h"
11 18
12/* Believe it or not, but some arches have more than 32 SIGs! 19/* Believe it or not, but some arches have more than 32 SIGs!
@@ -134,20 +141,45 @@ int FAST_FUNC get_signum(const char *name)
134 if (strcasecmp(name, signals[i]) == 0) 141 if (strcasecmp(name, signals[i]) == 0)
135 return i; 142 return i;
136 143
137#if ENABLE_DESKTOP && (defined(SIGIOT) || defined(SIGIO)) 144#if ENABLE_DESKTOP
145# if defined(SIGIOT) || defined(SIGIO)
138 /* SIGIO[T] are aliased to other names, 146 /* SIGIO[T] are aliased to other names,
139 * thus cannot be stored in the signals[] array. 147 * thus cannot be stored in the signals[] array.
140 * Need special code to recognize them */ 148 * Need special code to recognize them */
141 if ((name[0] | 0x20) == 'i' && (name[1] | 0x20) == 'o') { 149 if ((name[0] | 0x20) == 'i' && (name[1] | 0x20) == 'o') {
142#ifdef SIGIO 150# ifdef SIGIO
143 if (!name[2]) 151 if (!name[2])
144 return SIGIO; 152 return SIGIO;
145#endif 153# endif
146#ifdef SIGIOT 154# ifdef SIGIOT
147 if ((name[2] | 0x20) == 't' && !name[3]) 155 if ((name[2] | 0x20) == 't' && !name[3])
148 return SIGIOT; 156 return SIGIOT;
149#endif 157# endif
158 }
159# endif
160#endif
161
162#if ENABLE_FEATURE_RTMINMAX
163# if defined(SIGRTMIN) && defined(SIGRTMAX)
164 if (strncasecmp(name, "RTMAX", 5) == 0) {
165 if (!name[5])
166 return SIGRTMAX;
167 if (name[5] == '-') {
168 i = bb_strtou(name + 6, NULL, 10);
169 if (!errno && i <= SIGRTMAX - SIGRTMIN)
170 return SIGRTMAX - i;
171 }
172 }
173 if (strncasecmp(name, "RTMIN", 5) == 0) {
174 if (!name[5])
175 return SIGRTMIN;
176 if (name[5] == '+') {
177 i = bb_strtou(name + 6, NULL, 10);
178 if (!errno && i <= SIGRTMAX - SIGRTMIN)
179 return SIGRTMIN + i;
180 }
150 } 181 }
182# endif
151#endif 183#endif
152 184
153 return -1; 185 return -1;