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>
This commit is contained in:
Denys Vlasenko 2010-12-30 01:17:03 +01:00
parent 90615a0c5c
commit 2753aae0e8
2 changed files with 38 additions and 6 deletions

View File

@ -135,7 +135,7 @@ config FEATURE_NON_POSIX_CP
and create a regular file. This does not conform to POSIX, and create a regular file. This does not conform to POSIX,
but prevents a symlink attack. but prevents a symlink attack.
Similarly, "cp file device" will not send file's data Similarly, "cp file device" will not send file's data
to the device. to the device. (To do that, use "cat file >device")
config FEATURE_VERBOSE_CP_MESSAGE config FEATURE_VERBOSE_CP_MESSAGE
bool "Give more precise messages when copy fails (cp, mv etc)" bool "Give more precise messages when copy fails (cp, mv etc)"

View File

@ -7,6 +7,13 @@
* Licensed under GPLv2 or later, see file LICENSE in this source tree. * Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/ */
//config:config FEATURE_RTMINMAX
//config: bool "Support RTMIN[+n] and RTMAX[-n] signal names"
//config: default y
//config: help
//config: Support RTMIN[+n] and RTMAX[-n] signal names
//config: in kill, killall etc. This costs ~250 bytes.
#include "libbb.h" #include "libbb.h"
/* Believe it or not, but some arches have more than 32 SIGs! /* Believe it or not, but some arches have more than 32 SIGs!
@ -134,20 +141,45 @@ int FAST_FUNC get_signum(const char *name)
if (strcasecmp(name, signals[i]) == 0) if (strcasecmp(name, signals[i]) == 0)
return i; return i;
#if ENABLE_DESKTOP && (defined(SIGIOT) || defined(SIGIO)) #if ENABLE_DESKTOP
# if defined(SIGIOT) || defined(SIGIO)
/* SIGIO[T] are aliased to other names, /* SIGIO[T] are aliased to other names,
* thus cannot be stored in the signals[] array. * thus cannot be stored in the signals[] array.
* Need special code to recognize them */ * Need special code to recognize them */
if ((name[0] | 0x20) == 'i' && (name[1] | 0x20) == 'o') { if ((name[0] | 0x20) == 'i' && (name[1] | 0x20) == 'o') {
#ifdef SIGIO # ifdef SIGIO
if (!name[2]) if (!name[2])
return SIGIO; return SIGIO;
#endif # endif
#ifdef SIGIOT # ifdef SIGIOT
if ((name[2] | 0x20) == 't' && !name[3]) if ((name[2] | 0x20) == 't' && !name[3])
return SIGIOT; return SIGIOT;
#endif # endif
} }
# endif
#endif
#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;
}
}
if (strncasecmp(name, "RTMIN", 5) == 0) {
if (!name[5])
return SIGRTMIN;
if (name[5] == '+') {
i = bb_strtou(name + 6, NULL, 10);
if (!errno && i <= SIGRTMAX - SIGRTMIN)
return SIGRTMIN + i;
}
}
# endif
#endif #endif
return -1; return -1;