musl: core: there is one less usable signal when built with musl

musl internally reserves one more signal, hence we can only use 29
signals.
This commit is contained in:
Yu Watanabe
2025-09-07 08:53:07 +09:00
parent ebbc0ea7fd
commit 3866923a68
2 changed files with 7 additions and 5 deletions

View File

@@ -526,8 +526,9 @@ static int manager_setup_signals(Manager *m) {
assert_se(sigaction(SIGCHLD, &sa, NULL) == 0);
/* We make liberal use of realtime signals here. On Linux/glibc we have 30 of them, between
* SIGRTMIN+0 ... SIGRTMIN+30 (aka SIGRTMAX). */
/* We make liberal use of realtime signals here. On Linux we have 29 of them, between
* SIGRTMIN+0 ... SIGRTMIN+29. The glibc has one more (SIGRTMAX is SIGRTMIN+30),
* but musl does not (SIGRTMAX is SIGRTMIN+29). */
assert_se(sigemptyset(&mask) == 0);
sigset_add_many(&mask,
@@ -572,7 +573,7 @@ static int manager_setup_signals(Manager *m) {
SIGRTMIN+28, /* systemd: set log target to kmsg */
SIGRTMIN+29, /* systemd: set log target to syslog-or-kmsg (obsolete) */
/* ... one free signal here SIGRTMIN+30 ... */
/* ... one free signal here SIGRTMIN+30 (glibc only) ... */
-1);
assert_se(sigprocmask(SIG_SETMASK, &mask, NULL) == 0);

View File

@@ -13,8 +13,9 @@ TEST(rt_signals) {
info(SIGRTMIN);
info(SIGRTMAX);
/* We use signals SIGRTMIN+0 to SIGRTMIN+30 unconditionally */
assert_se(SIGRTMAX - SIGRTMIN >= 30);
/* We use signals SIGRTMIN+0 to SIGRTMIN+29 unconditionally. SIGRTMIN+30 can be used only when
* built with glibc. */
assert_se(SIGRTMAX - SIGRTMIN >= 29);
}
static void test_signal_to_string_one(int val) {