aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbb/u_signal_names.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/libbb/u_signal_names.c b/libbb/u_signal_names.c
index 53ccdd1a7..93cebe2fb 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