wok-next annotate busybox/stuff/patches/shutdown.u @ rev 21723

busybox: update patches
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Sep 01 10:44:52 2020 +0000 (2020-09-01)
parents 2ef4101ba8f7
children
rev   line source
pascal@21723 1 --- busybox-1.31/init/halt.c
pascal@21723 2 +++ busybox-1.31/init/halt.c
pascal@21723 3 @@ -59,6 +59,7 @@
al@19875 4 // APPLET_ODDNAME:name main location suid_type help
al@19875 5 //applet:IF_POWEROFF(APPLET_ODDNAME(poweroff, halt, BB_DIR_SBIN, BB_SUID_DROP, poweroff))
al@19875 6 //applet:IF_REBOOT( APPLET_ODDNAME(reboot, halt, BB_DIR_SBIN, BB_SUID_DROP, reboot))
al@19875 7 +//applet:IF_REBOOT( APPLET_ODDNAME(shutdown, halt, BB_DIR_SBIN, BB_SUID_DROP, shutdown))
al@19875 8
al@19875 9 //kbuild:lib-$(CONFIG_HALT) += halt.o
al@19875 10 //kbuild:lib-$(CONFIG_POWEROFF) += halt.o
pascal@21723 11 @@ -90,6 +91,15 @@
al@19875 12 //usage: "\n -d SEC Delay interval"
al@19875 13 //usage: "\n -n Do not sync"
al@19875 14 //usage: "\n -f Force (don't go through init)"
al@19875 15 +//usage:
al@19875 16 +//usage:#define shutdown_trivial_usage
al@19875 17 +//usage: "[-rhHP]"
al@19875 18 +//usage:#define shutdown_full_usage "\n\n"
al@19875 19 +//usage: "Bring the system down\n"
al@19875 20 +//usage: "\n -r Do reboot"
al@19875 21 +//usage: "\n -h Do poweroff"
al@19875 22 +//usage: "\n -H Do halt"
al@19875 23 +//usage: "\n -P Do poweroff"
al@19875 24
al@19875 25 #include "libbb.h"
al@19875 26 #include "reboot.h"
pascal@21723 27 @@ -164,6 +174,7 @@
al@19875 28 int halt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
al@19875 29 int halt_main(int argc UNUSED_PARAM, char **argv)
al@19875 30 {
al@19875 31 + enum { HALT=0, POWEROFF=1, REBOOT=2, SHUTDOWN=3 };
al@19875 32 static const int magic[] = {
al@19875 33 RB_HALT_SYSTEM,
al@19875 34 RB_POWER_OFF,
pascal@21723 35 @@ -184,15 +195,26 @@
al@19875 36 if (!ENABLE_HALT && !ENABLE_POWEROFF && ENABLE_REBOOT)
al@19875 37 which = 2;
al@19875 38 else
al@19875 39 - for (which = 0; "hpr"[which] != applet_name[0]; which++)
al@19875 40 + for (which = 0; "hprs"[which] != applet_name[0]; which++)
al@19875 41 continue;
al@19875 42
al@19875 43 + if (which == SHUTDOWN) {
al@19875 44 + which = REBOOT;
al@19875 45 + switch (getopt32(argv, "rhPH")) {
al@19875 46 + case 2:
al@19875 47 + case 4: which = POWEROFF; break;
al@19875 48 + case 8: which = HALT;
al@19875 49 + }
al@19875 50 + flags = 0;
al@19875 51 + }
al@19875 52 + else {
al@19875 53 /* Parse and handle arguments */
al@19875 54 /* We support -w even if !ENABLE_FEATURE_WTMP,
al@19875 55 * in order to not break scripts.
al@19875 56 * -i (shut down network interfaces) is ignored.
al@19875 57 */
al@19875 58 flags = getopt32(argv, "d:+nfwi", &delay);
al@19875 59 + }
al@19875 60
al@19875 61 sleep(delay);
al@19875 62