Based on 4dffec1459f50ac9f8f67ccfcb79836b4ed5a50e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 24 Oct 2014 13:44:45 +0200 Subject: [PATCH] manager: Linux on hppa has fewer rtsigs, hence avoid using the higher ones there https://bugs.freedesktop.org/show_bug.cgi?id=84931 --- src/core/manager.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) --- src/core/manager.c +++ src/core/manager.c 2014-10-29 14:02:28.635837997 +0000 @@ -340,11 +340,14 @@ static int manager_setup_signals(Manager assert(m); - /* We are not interested in SIGSTOP and friends. */ assert_se(sigaction(SIGCHLD, &sa, NULL) == 0); - assert_se(sigemptyset(&mask) == 0); + /* We make liberal use of realtime signals here. On + * Linux/glibc we have 30 of them (with the exception of Linux + * on hppa, see below), between SIGRTMIN+0 ... SIGRTMIN+30 + * (aka SIGRTMAX). */ + assert_se(sigemptyset(&mask) == 0); sigset_add_many(&mask, SIGCHLD, /* Child died */ SIGTERM, /* Reexecute daemon */ @@ -354,6 +357,7 @@ static int manager_setup_signals(Manager SIGINT, /* Kernel sends us this on control-alt-del */ SIGWINCH, /* Kernel sends us this on kbrequest (alt-arrowup) */ SIGPWR, /* Some kernel drivers and upsd send us this on power failure */ + SIGRTMIN+0, /* systemd: start default.target */ SIGRTMIN+1, /* systemd: isolate rescue.target */ SIGRTMIN+2, /* systemd: isolate emergency.target */ @@ -361,19 +365,40 @@ static int manager_setup_signals(Manager SIGRTMIN+4, /* systemd: start poweroff.target */ SIGRTMIN+5, /* systemd: start reboot.target */ SIGRTMIN+6, /* systemd: start kexec.target */ + + /* ... space for more special targets ... */ + SIGRTMIN+13, /* systemd: Immediate halt */ SIGRTMIN+14, /* systemd: Immediate poweroff */ SIGRTMIN+15, /* systemd: Immediate reboot */ SIGRTMIN+16, /* systemd: Immediate kexec */ + + /* ... space for more immediate system state changes ... */ + SIGRTMIN+20, /* systemd: enable status messages */ SIGRTMIN+21, /* systemd: disable status messages */ SIGRTMIN+22, /* systemd: set log level to LOG_DEBUG */ SIGRTMIN+23, /* systemd: set log level to LOG_INFO */ SIGRTMIN+24, /* systemd: Immediate exit (--user only) */ + + /* .. one free signal here ... */ + +#if !defined(__hppa64__) && !defined(__hppa__) + /* Apparently Linux on hppa has fewer RT + * signals (SIGRTMAX is SIGRTMIN+25 there), + * hence let's not try to make use of them + * here. Since these commands are accessible + * by different means and only really a safety + * net, the missing functionality on hppa + * shouldn't matter. */ + SIGRTMIN+26, /* systemd: set log target to journal-or-kmsg */ SIGRTMIN+27, /* systemd: set log target to console */ SIGRTMIN+28, /* systemd: set log target to kmsg */ SIGRTMIN+29, /* systemd: set log target to syslog-or-kmsg */ + + /* ... one free signal here SIGRTMIN+30 ... */ +#endif -1); assert_se(sigprocmask(SIG_SETMASK, &mask, NULL) == 0);