diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-06-27 21:08:15 +0400 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-06-27 21:08:15 +0400 |
commit | b01ed65ad2e46fc7747010b16e53b3a9e1a7c23a (patch) | |
tree | 2988261cdc1078ca34f71822d101aab5b482df43 /init/reboot.c | |
parent | 0b0d393347a2f4444a49afa32491068ac92cbfa3 (diff) |
Apply last_patch93 from vodz:
andersen@busybox.net wrote:
>Message: 4
>Modified Files:
> init.c
>Log Message:
>Remove code for unsupported kernel versions
Hmm. Current init.c have check >= 2.2.0 kernel one time too.
Ok. Last patch removed this point and move common init code to new file for
/init dir
Diffstat (limited to 'init/reboot.c')
-rw-r--r-- | init/reboot.c | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/init/reboot.c b/init/reboot.c index 8c380fa6a..be4b97f95 100644 --- a/init/reboot.c +++ b/init/reboot.c @@ -27,6 +27,8 @@ #include <getopt.h> #include "busybox.h" +#include "init_shared.h" + #if (__GNU_LIBRARY__ > 5) || defined(__dietlibc__) #include <sys/reboot.h> @@ -42,24 +44,12 @@ static const int RB_AUTOBOOT = 0x01234567; extern int reboot_main(int argc, char **argv) { - int delay = 0; /* delay in seconds before rebooting */ - int rc; - - while ((rc = getopt(argc, argv, "d:")) > 0) { - switch (rc) { - case 'd': - delay = atoi(optarg); - break; + char *delay; /* delay in seconds before rebooting */ - default: - bb_show_usage(); - break; - } + if(bb_getopt_ulflags(argc, argv, "d:", &delay)) { + sleep(atoi(delay)); } - if(delay > 0) - sleep(delay); - #ifdef CONFIG_USER_INIT /* Don't kill ourself */ signal(SIGTERM,SIG_IGN); @@ -83,29 +73,11 @@ extern int reboot_main(int argc, char **argv) sleep(1); sync(); - if (kernelVersion > 0 && kernelVersion <= KERNEL_VERSION(2,2,11)) { - /* bdflush, kupdate not needed for kernels >2.2.11 */ - bdflush(1, 0); - sync(); - } init_reboot(RB_AUTOBOOT); - exit(0); /* Shrug */ + return 0; /* Shrug */ #else -#ifdef CONFIG_FEATURE_INITRD - { - /* don't assume init's pid == 1 */ - long *pid = find_pid_by_name("init"); - if (!pid || *pid<=0) - pid = find_pid_by_name("linuxrc"); - if (!pid || *pid<=0) - bb_error_msg_and_die("no process killed"); - fflush(stdout); - return(kill(*pid, SIGTERM)); - } -#else - return(kill(1, SIGTERM)); -#endif + return kill_init(SIGTERM); #endif } |