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>
This commit is contained in:
Denys Vlasenko 2011-01-03 12:51:13 +01:00
parent 92ffe0571a
commit 7b276fc175

View File

@ -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) {
if (!name[5])
return SIGRTMAX;
if (name[5] == '-') {
i = bb_strtou(name + 6, NULL, 10);
if (!errno && i <= SIGRTMAX - SIGRTMIN)
return SIGRTMAX - i;
}
}
/* 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 SIGRTMIN;
return __SIGRTMIN;
if (name[5] == '+') {
i = bb_strtou(name + 6, NULL, 10);
if (!errno && i <= SIGRTMAX - SIGRTMIN)
return SIGRTMIN + i;
if (!errno && i <= __SIGRTMAX - __SIGRTMIN)
return __SIGRTMIN + i;
}
}
else if (strncasecmp(name, "RTMAX", 5) == 0) {
if (!name[5])
return __SIGRTMAX;
if (name[5] == '-') {
i = bb_strtou(name + 6, NULL, 10);
if (!errno && i <= __SIGRTMAX - __SIGRTMIN)
return __SIGRTMAX - i;
}
}
# endif