diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-06-27 17:08:15 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-06-27 17:08:15 +0000 |
commit | 2734533491d99fc7628492f88f560c0f08ccdafe (patch) | |
tree | 2988261cdc1078ca34f71822d101aab5b482df43 /init/reboot.c | |
parent | 0196e2600734d0c1deb4807b0d545a562537bc80 (diff) | |
download | busybox-w32-2734533491d99fc7628492f88f560c0f08ccdafe.tar.gz busybox-w32-2734533491d99fc7628492f88f560c0f08ccdafe.tar.bz2 busybox-w32-2734533491d99fc7628492f88f560c0f08ccdafe.zip |
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
git-svn-id: svn://busybox.net/trunk/busybox@7008 69ca8d6d-28ef-0310-b511-8ec308f3f277
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 @@ | |||
27 | #include <getopt.h> | 27 | #include <getopt.h> |
28 | 28 | ||
29 | #include "busybox.h" | 29 | #include "busybox.h" |
30 | #include "init_shared.h" | ||
31 | |||
30 | 32 | ||
31 | #if (__GNU_LIBRARY__ > 5) || defined(__dietlibc__) | 33 | #if (__GNU_LIBRARY__ > 5) || defined(__dietlibc__) |
32 | #include <sys/reboot.h> | 34 | #include <sys/reboot.h> |
@@ -42,24 +44,12 @@ static const int RB_AUTOBOOT = 0x01234567; | |||
42 | 44 | ||
43 | extern int reboot_main(int argc, char **argv) | 45 | extern int reboot_main(int argc, char **argv) |
44 | { | 46 | { |
45 | int delay = 0; /* delay in seconds before rebooting */ | 47 | char *delay; /* delay in seconds before rebooting */ |
46 | int rc; | ||
47 | |||
48 | while ((rc = getopt(argc, argv, "d:")) > 0) { | ||
49 | switch (rc) { | ||
50 | case 'd': | ||
51 | delay = atoi(optarg); | ||
52 | break; | ||
53 | 48 | ||
54 | default: | 49 | if(bb_getopt_ulflags(argc, argv, "d:", &delay)) { |
55 | bb_show_usage(); | 50 | sleep(atoi(delay)); |
56 | break; | ||
57 | } | ||
58 | } | 51 | } |
59 | 52 | ||
60 | if(delay > 0) | ||
61 | sleep(delay); | ||
62 | |||
63 | #ifdef CONFIG_USER_INIT | 53 | #ifdef CONFIG_USER_INIT |
64 | /* Don't kill ourself */ | 54 | /* Don't kill ourself */ |
65 | signal(SIGTERM,SIG_IGN); | 55 | signal(SIGTERM,SIG_IGN); |
@@ -83,29 +73,11 @@ extern int reboot_main(int argc, char **argv) | |||
83 | sleep(1); | 73 | sleep(1); |
84 | 74 | ||
85 | sync(); | 75 | sync(); |
86 | if (kernelVersion > 0 && kernelVersion <= KERNEL_VERSION(2,2,11)) { | ||
87 | /* bdflush, kupdate not needed for kernels >2.2.11 */ | ||
88 | bdflush(1, 0); | ||
89 | sync(); | ||
90 | } | ||
91 | 76 | ||
92 | init_reboot(RB_AUTOBOOT); | 77 | init_reboot(RB_AUTOBOOT); |
93 | exit(0); /* Shrug */ | 78 | return 0; /* Shrug */ |
94 | #else | 79 | #else |
95 | #ifdef CONFIG_FEATURE_INITRD | 80 | return kill_init(SIGTERM); |
96 | { | ||
97 | /* don't assume init's pid == 1 */ | ||
98 | long *pid = find_pid_by_name("init"); | ||
99 | if (!pid || *pid<=0) | ||
100 | pid = find_pid_by_name("linuxrc"); | ||
101 | if (!pid || *pid<=0) | ||
102 | bb_error_msg_and_die("no process killed"); | ||
103 | fflush(stdout); | ||
104 | return(kill(*pid, SIGTERM)); | ||
105 | } | ||
106 | #else | ||
107 | return(kill(1, SIGTERM)); | ||
108 | #endif | ||
109 | #endif | 81 | #endif |
110 | } | 82 | } |
111 | 83 | ||