]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
musl: core: there is one less usable signal when built with musl
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 6 Sep 2025 23:53:07 +0000 (08:53 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 12 Nov 2025 23:02:05 +0000 (08:02 +0900)
musl internally reserves one more signal, hence we can only use 29
signals.

src/core/manager.c
src/test/test-signal-util.c

index b501d3f1c5b34897df927045d456eb615ee225dc..deed863e188e8e2a834c546f7584c5dc17119732 100644 (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);
 
index 7d069a7fb24082fe6c103080ff2d97cded0c86d5..822556022d9f5374fc6aa975db0826f08a588f83 100644 (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) {