Fix #352: separate runlevel S from runlevel 0

Due to an old design decision runlevel S was encoded internally as '0',
meaning it was the same as halt/poweroff.  If you want to run scripts at
system shutdown this was less then ideal since it meant your scripts
also ran at bootstrap.

This change is quite invasive.  It introduces INIT_LEVEL (10) as the
value for runlevel S, meaning all code that parses and/or evaluates
anything for runlevel 0/S was affected and had to be reworked.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2023-04-22 15:11:27 +02:00
1 parent 80191f2fd5
commit e00fda5dc3
12 files changed
+67 -47

No files matched your search

+4 -4
View File
@@ -429,7 +429,7 @@ static void sighup_cb(uev_t *w, void *arg, int events)
return;
}
if (runlevel == 0 || runlevel == 6) {
if (IS_RESERVED_RUNLEVEL(runlevel)) {
warnx("SIGHUP ignored in runlevel S and 6.");
return;
}
@@ -485,7 +485,7 @@ static void sigusr1_cb(uev_t *w, void *arg, int events)
return;
}
if (runlevel == 0 || runlevel == 6) {
if (IS_RESERVED_RUNLEVEL(runlevel)) {
warnx("SIGUSR1 ignored in runlevel S and 6.");
return;
}
@@ -506,7 +506,7 @@ static void sigusr2_cb(uev_t *w, void *arg, int events)
return;
}
if (runlevel == 0 || runlevel == 6) {
if (IS_RESERVED_RUNLEVEL(runlevel)) {
warnx("SIGUSR2 ignored in runlevel S and 6.");
return;
}
@@ -526,7 +526,7 @@ static void sigterm_cb(uev_t *w, void *arg, int events)
return;
}
if (runlevel == 0 || runlevel == 6) {
if (IS_RESERVED_RUNLEVEL(runlevel)) {
warnx("SIGTERM ignored in runlevel S and 6.");
return;
}