diff options
author | Denys Vlasenko | 2011-01-03 12:51:13 +0100 |
---|---|---|
committer | Denys Vlasenko | 2011-01-03 12:51:13 +0100 |
commit | 7b276fc17594b89040f1eda054858860c1dc1522 (patch) | |
tree | 3f70f419e82343f3017871882c215b779b326208 /libbb/u_signal_names.c | |
parent | 92ffe0571a49077f06fc65bf0ada753b30fd8a53 (diff) | |
download | busybox-7b276fc17594b89040f1eda054858860c1dc1522.zip busybox-7b276fc17594b89040f1eda054858860c1dc1522.tar.gz |
kill[all[5]],pkill: more correct, and smaller, SIGRTMIN/MAX code
function old new delta
__libc_current_sigrtmin 6 - -6
__libc_current_sigrtmax 6 - -6
get_signum 339 295 -44
------------------------------------------------------------------------------
(add/remove: 0/3 grow/shrink: 0/1 up/down: 0/-56) Total: -56 bytes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'libbb/u_signal_names.c')
-rw-r--r-- | libbb/u_signal_names.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/libbb/u_signal_names.c b/libbb/u_signal_names.c index 53ccdd1..93cebe2 100644 --- a/libbb/u_signal_names.c +++ b/libbb/u_signal_names.c @@ -161,22 +161,31 @@ int FAST_FUNC get_signum(const char *name) #if ENABLE_FEATURE_RTMINMAX # if defined(SIGRTMIN) && defined(SIGRTMAX) - if (strncasecmp(name, "RTMAX", 5) == 0) { +/* libc may use some rt sigs for pthreads and therefore "remap" SIGRTMIN/MAX, + * but we want to use "raw" SIGRTMIN/MAX. Underscored names, if exist, provide + * them. If they don't exist, fall back to non-underscored ones: */ +# if !defined(__SIGRTMIN) +# define __SIGRTMIN SIGRTMIN +# endif +# if !defined(__SIGRTMAX) +# define __SIGRTMAX SIGRTMAX +# endif + if (strncasecmp(name, "RTMIN", 5) == 0) { if (!name[5]) - return SIGRTMAX; - if (name[5] == '-') { + return __SIGRTMIN; + if (name[5] == '+') { i = bb_strtou(name + 6, NULL, 10); - if (!errno && i <= SIGRTMAX - SIGRTMIN) - return SIGRTMAX - i; + if (!errno && i <= __SIGRTMAX - __SIGRTMIN) + return __SIGRTMIN + i; } } - if (strncasecmp(name, "RTMIN", 5) == 0) { + else if (strncasecmp(name, "RTMAX", 5) == 0) { if (!name[5]) - return SIGRTMIN; - if (name[5] == '+') { + return __SIGRTMAX; + if (name[5] == '-') { i = bb_strtou(name + 6, NULL, 10); - if (!errno && i <= SIGRTMAX - SIGRTMIN) - return SIGRTMIN + i; + if (!errno && i <= __SIGRTMAX - __SIGRTMIN) + return __SIGRTMAX - i; } } # endif |