From: Bogdan Purcareata Date: Tue, 26 Nov 2013 12:54:48 +0000 (+0100) Subject: init: halt on SIGPWR too X-Git-Tag: 1_22_0~29 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=760fc6debcba8cb5ca8d8e2252fac3757c453e11;p=oweals%2Fbusybox.git init: halt on SIGPWR too Most init processes implement a handler for SIGPWR that gracefully stops all child processes when shutting down a machine. Some other technologies rely on this signal - e.g. Busybox powered LXC containers. This patch makes busybox init halt when receiving SIGPWR. Signed-off-by: Bogdan Purcareata Signed-off-by: Denys Vlasenko --- diff --git a/init/init.c b/init/init.c index c63bba1ff..d29328c36 100644 --- a/init/init.c +++ b/init/init.c @@ -789,7 +789,7 @@ static void run_shutdown_and_kill_processes(void) * and only one will be remembered and acted upon. */ -/* The SIGUSR[12]/SIGTERM handler */ +/* The SIGPWR/SIGUSR[12]/SIGTERM handler */ static void halt_reboot_pwoff(int sig) NORETURN; static void halt_reboot_pwoff(int sig) { @@ -1103,8 +1103,8 @@ int init_main(int argc UNUSED_PARAM, char **argv) /* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined, * then parse_inittab() simply adds in some default - * actions(i.e., INIT_SCRIPT and a pair - * of "askfirst" shells */ + * actions (i.e., INIT_SCRIPT and a pair + * of "askfirst" shells) */ parse_inittab(); } @@ -1135,6 +1135,7 @@ int init_main(int argc UNUSED_PARAM, char **argv) struct sigaction sa; bb_signals(0 + + (1 << SIGPWR) /* halt */ + (1 << SIGUSR1) /* halt */ + (1 << SIGTERM) /* reboot */ + (1 << SIGUSR2) /* poweroff */