procd: add SIGPWR as signal
authorPaul Spooren <mail@aparcar.org>
Fri, 26 Apr 2019 15:32:45 +0000 (17:32 +0200)
committerDaniel Golle <daniel@makrotopia.org>
Fri, 26 Apr 2019 15:50:32 +0000 (17:50 +0200)
to use procd in LXC containers they have to support SIGPWR to shutdown.

Signed-off-by: Paul Spooren <mail@aparcar.org>
initd/init.c
signal.c

index 0349e6e9d77ef57288a10108326b2f8a43499d8a..29eee5050cf969a98470c5dad46a03a8f68434f7 100644 (file)
@@ -77,6 +77,7 @@ main(int argc, char **argv)
        sigaction(SIGTERM, &sa_shutdown, NULL);
        sigaction(SIGUSR1, &sa_shutdown, NULL);
        sigaction(SIGUSR2, &sa_shutdown, NULL);
+       sigaction(SIGPWR, &sa_shutdown, NULL);
 
        early();
        cmdline();
index 07dda9a4c890e9106a56ec089c6f8bfcdefb22a0..9974153200a48b649f965bdd867fb7fc2a0b9d2c 100644 (file)
--- a/signal.c
+++ b/signal.c
@@ -44,6 +44,7 @@ static void signal_shutdown(int signal, siginfo_t *siginfo, void *data)
                break;
        case SIGUSR1:
        case SIGUSR2:
+       case SIGPWR:
                event = RB_POWER_OFF;
                msg = "poweroff";
                break;
@@ -90,6 +91,7 @@ void procd_signal(void)
        sigaction(SIGINT, &sa_shutdown, NULL);
        sigaction(SIGUSR1, &sa_shutdown, NULL);
        sigaction(SIGUSR2, &sa_shutdown, NULL);
+       sigaction(SIGPWR, &sa_shutdown, NULL);
        sigaction(SIGSEGV, &sa_crash, NULL);
        sigaction(SIGBUS, &sa_crash, NULL);
        sigaction(SIGHUP, &sa_dummy, NULL);