mirror of
https://github.com/systemd/systemd.git
synced 2024-10-30 23:21:22 +03:00
pid1: make use of high rt signals on hppa with newer kernels
Back in 4dffec1459
we stopped using SIGRTMIN+26
and higher on hppa because they were not available. Then they became available
in linux 3.18:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1f25df2eff5b25f52c139d3ff31bc883eee9a0ab
Instead of hard-coding the list based on architecture, let's use a runtime
check like signal(7) says.
(A note about implementation: RTSIG_IF_AVAILABLE is defined to take the full
signal and not just an offset from SIGRTMIN so that it's still possible to
grep for SIGRTMIN\+.)
Add a simple "test" to print the signal values.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=84931.
This commit is contained in:
parent
cd001016a1
commit
8750ac0238
@ -426,6 +426,8 @@ static int enable_special_signals(Manager *m) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define RTSIG_IF_AVAILABLE(signum) (signum <= SIGRTMAX ? signum : -1)
|
||||
|
||||
static int manager_setup_signals(Manager *m) {
|
||||
struct sigaction sa = {
|
||||
.sa_handler = SIG_DFL,
|
||||
@ -479,22 +481,22 @@ static int manager_setup_signals(Manager *m) {
|
||||
|
||||
/* .. 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. */
|
||||
/* Apparently Linux on hppa had fewer RT signals until v3.18,
|
||||
* SIGRTMAX was SIGRTMIN+25, and then SIGRTMIN was lowered,
|
||||
* see commit v3.17-7614-g1f25df2eff.
|
||||
*
|
||||
* We cannot unconditionally make use of those signals here,
|
||||
* so let's use a runtime check. 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 (obsolete) */
|
||||
RTSIG_IF_AVAILABLE(SIGRTMIN+26), /* systemd: set log target to journal-or-kmsg */
|
||||
RTSIG_IF_AVAILABLE(SIGRTMIN+27), /* systemd: set log target to console */
|
||||
RTSIG_IF_AVAILABLE(SIGRTMIN+28), /* systemd: set log target to kmsg */
|
||||
RTSIG_IF_AVAILABLE(SIGRTMIN+29), /* systemd: set log target to syslog-or-kmsg (obsolete) */
|
||||
|
||||
/* ... one free signal here SIGRTMIN+30 ... */
|
||||
#endif
|
||||
-1);
|
||||
assert_se(sigprocmask(SIG_SETMASK, &mask, NULL) == 0);
|
||||
|
||||
|
@ -21,10 +21,21 @@
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "macro.h"
|
||||
#include "signal-util.h"
|
||||
#include "process-util.h"
|
||||
|
||||
#define info(sig) log_info(#sig " = " STRINGIFY(sig) " = %d", sig)
|
||||
|
||||
static void test_rt_signals(void) {
|
||||
info(SIGRTMIN);
|
||||
info(SIGRTMAX);
|
||||
|
||||
/* We use signals SIGRTMIN+0 to SIGRTMIN+24 unconditionally */
|
||||
assert(SIGRTMAX - SIGRTMIN >= 24);
|
||||
}
|
||||
|
||||
static void test_block_signals(void) {
|
||||
sigset_t ss;
|
||||
|
||||
@ -62,6 +73,7 @@ static void test_ignore_signals(void) {
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
test_rt_signals();
|
||||
test_block_signals();
|
||||
test_ignore_signals();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user