[OpenWrt-Devel] [PATCH] procd: add SIGPWR as signal
Paul Spooren
mail at aparcar.org
Fri Apr 26 11:32:45 EDT 2019
to use procd in LXC containers they have to support SIGPWR to shutdown.
Signed-off-by: Paul Spooren <mail at aparcar.org>
---
initd/init.c | 1 +
signal.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/initd/init.c b/initd/init.c
index 0349e6e..29eee50 100644
--- a/initd/init.c
+++ b/initd/init.c
@@ -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();
diff --git a/signal.c b/signal.c
index 07dda9a..9974153 100644
--- 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);
--
2.20.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list