aboutsummaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorBogdan Purcareata <bogdan.purcareata@freescale.com>2013-11-26 13:54:48 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2013-11-26 13:54:48 +0100
commit760fc6debcba8cb5ca8d8e2252fac3757c453e11 (patch)
treefde19f0e554fd9839a3cfcd2cb20385f6e77c24b /init
parentcffe28ef876a6fe8a8154321bf5feb409d87cf1a (diff)
downloadbusybox-w32-760fc6debcba8cb5ca8d8e2252fac3757c453e11.tar.gz
busybox-w32-760fc6debcba8cb5ca8d8e2252fac3757c453e11.tar.bz2
busybox-w32-760fc6debcba8cb5ca8d8e2252fac3757c453e11.zip
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 <bogdan.purcareata@freescale.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'init')
-rw-r--r--init/init.c7
1 files changed, 4 insertions, 3 deletions
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)
789 * and only one will be remembered and acted upon. 789 * and only one will be remembered and acted upon.
790 */ 790 */
791 791
792/* The SIGUSR[12]/SIGTERM handler */ 792/* The SIGPWR/SIGUSR[12]/SIGTERM handler */
793static void halt_reboot_pwoff(int sig) NORETURN; 793static void halt_reboot_pwoff(int sig) NORETURN;
794static void halt_reboot_pwoff(int sig) 794static void halt_reboot_pwoff(int sig)
795{ 795{
@@ -1103,8 +1103,8 @@ int init_main(int argc UNUSED_PARAM, char **argv)
1103 1103
1104 /* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined, 1104 /* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined,
1105 * then parse_inittab() simply adds in some default 1105 * then parse_inittab() simply adds in some default
1106 * actions(i.e., INIT_SCRIPT and a pair 1106 * actions (i.e., INIT_SCRIPT and a pair
1107 * of "askfirst" shells */ 1107 * of "askfirst" shells) */
1108 parse_inittab(); 1108 parse_inittab();
1109 } 1109 }
1110 1110
@@ -1135,6 +1135,7 @@ int init_main(int argc UNUSED_PARAM, char **argv)
1135 struct sigaction sa; 1135 struct sigaction sa;
1136 1136
1137 bb_signals(0 1137 bb_signals(0
1138 + (1 << SIGPWR) /* halt */
1138 + (1 << SIGUSR1) /* halt */ 1139 + (1 << SIGUSR1) /* halt */
1139 + (1 << SIGTERM) /* reboot */ 1140 + (1 << SIGTERM) /* reboot */
1140 + (1 << SIGUSR2) /* poweroff */ 1141 + (1 << SIGUSR2) /* poweroff */