aboutsummaryrefslogtreecommitdiff
path: root/toys/other/reboot.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/other/reboot.c')
-rw-r--r--toys/other/reboot.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/toys/other/reboot.c b/toys/other/reboot.c
index a1358886..9193ba4e 100644
--- a/toys/other/reboot.c
+++ b/toys/other/reboot.c
@@ -2,7 +2,7 @@
*
* Copyright 2013 Elie De Brauwer <eliedebrauwer@gmail.com>
-USE_REBOOT(NEWTOY(reboot, "n", TOYFLAG_SBIN|TOYFLAG_NEEDROOT))
+USE_REBOOT(NEWTOY(reboot, "fn", TOYFLAG_SBIN|TOYFLAG_NEEDROOT))
USE_REBOOT(OLDTOY(halt, reboot, TOYFLAG_SBIN|TOYFLAG_NEEDROOT))
USE_REBOOT(OLDTOY(poweroff, reboot, TOYFLAG_SBIN|TOYFLAG_NEEDROOT))
@@ -10,10 +10,11 @@ config REBOOT
bool "reboot"
default y
help
- usage: reboot/halt/poweroff [-n]
+ usage: reboot/halt/poweroff [-fn]
Restart, halt or powerdown the system.
+ -f Don't signal init
-n Don't sync before stopping the system.
*/
@@ -24,8 +25,12 @@ config REBOOT
void reboot_main(void)
{
int types[] = {RB_AUTOBOOT, RB_HALT_SYSTEM, RB_POWER_OFF};
+ int sigs[] = {SIGINT, SIGUSR1, SIGUSR2};
if (!(toys.optflags & FLAG_n)) sync();
- toys.exitval = reboot(types[stridx("hp", *toys.which->name)+1]);
+ if (toys.optflags & FLAG_f)
+ toys.exitval = reboot(types[stridx("hp", *toys.which->name)+1]);
+ else
+ toys.exitval = kill(1, sigs[stridx("hp", *toys.which->name)+1]);
}