diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-05-29 13:08:35 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-05-29 13:08:35 +0000 |
commit | 35e1a077d65f53af34f80e490efbeb2eecc6958a (patch) | |
tree | fe96a45c97f80dd32b27509cefab7098ed276912 | |
parent | 76bb97c995a52afdc8f5dc47b34784ebc23132a6 (diff) | |
download | busybox-w32-35e1a077d65f53af34f80e490efbeb2eecc6958a.tar.gz busybox-w32-35e1a077d65f53af34f80e490efbeb2eecc6958a.tar.bz2 busybox-w32-35e1a077d65f53af34f80e490efbeb2eecc6958a.zip |
- DEBUG_INIT -> config CONFIG_DEBUG_INIT
-rw-r--r-- | init/Config.in | 8 | ||||
-rw-r--r-- | init/init.c | 21 |
2 files changed, 16 insertions, 13 deletions
diff --git a/init/Config.in b/init/Config.in index 113747133..8b9179124 100644 --- a/init/Config.in +++ b/init/Config.in | |||
@@ -11,6 +11,14 @@ config CONFIG_INIT | |||
11 | help | 11 | help |
12 | init is the first program run when the system boots. | 12 | init is the first program run when the system boots. |
13 | 13 | ||
14 | config CONFIG_DEBUG_INIT | ||
15 | bool "debugging aid" | ||
16 | default n | ||
17 | depends on CONFIG_INIT | ||
18 | help | ||
19 | Turn this on to disable all the dangerous | ||
20 | rebooting stuff when debugging. | ||
21 | |||
14 | config CONFIG_FEATURE_USE_INITTAB | 22 | config CONFIG_FEATURE_USE_INITTAB |
15 | bool "Support reading an inittab file" | 23 | bool "Support reading an inittab file" |
16 | default y | 24 | default y |
diff --git a/init/init.c b/init/init.c index 928f84b91..10cb015dd 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -9,11 +9,6 @@ | |||
9 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 9 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | /* Turn this on to disable all the dangerous | ||
13 | rebooting stuff when debugging. | ||
14 | #define DEBUG_INIT | ||
15 | */ | ||
16 | |||
17 | #include <stdio.h> | 12 | #include <stdio.h> |
18 | #include <stdlib.h> | 13 | #include <stdlib.h> |
19 | #include <errno.h> | 14 | #include <errno.h> |
@@ -191,13 +186,13 @@ static void loop_forever(void) | |||
191 | 186 | ||
192 | /* Print a message to the specified device. | 187 | /* Print a message to the specified device. |
193 | * Device may be bitwise-or'd from LOG | CONSOLE */ | 188 | * Device may be bitwise-or'd from LOG | CONSOLE */ |
194 | #ifndef DEBUG_INIT | 189 | #if ENABLE_DEBUG_INIT |
195 | static inline void messageD(int ATTRIBUTE_UNUSED device, | 190 | #define messageD message |
191 | #else | ||
192 | static inline void messageD(int ATTRIBUTE_UNUSED device, | ||
196 | const char ATTRIBUTE_UNUSED *fmt, ...) | 193 | const char ATTRIBUTE_UNUSED *fmt, ...) |
197 | { | 194 | { |
198 | } | 195 | } |
199 | #else | ||
200 | #define messageD message | ||
201 | #endif | 196 | #endif |
202 | static void message(int device, const char *fmt, ...) | 197 | static void message(int device, const char *fmt, ...) |
203 | __attribute__ ((format(printf, 2, 3))); | 198 | __attribute__ ((format(printf, 2, 3))); |
@@ -253,7 +248,7 @@ static void message(int device, const char *fmt, ...) | |||
253 | if (fd >= 0) { | 248 | if (fd >= 0) { |
254 | bb_full_write(fd, msg, l); | 249 | bb_full_write(fd, msg, l); |
255 | close(fd); | 250 | close(fd); |
256 | #ifdef DEBUG_INIT | 251 | #if ENABLE_DEBUG_INIT |
257 | /* all descriptors may be closed */ | 252 | /* all descriptors may be closed */ |
258 | } else { | 253 | } else { |
259 | bb_error_msg("Bummer, can't print: "); | 254 | bb_error_msg("Bummer, can't print: "); |
@@ -655,7 +650,7 @@ static void run_actions(int action) | |||
655 | } | 650 | } |
656 | } | 651 | } |
657 | 652 | ||
658 | #ifndef DEBUG_INIT | 653 | #if !ENABLE_DEBUG_INIT |
659 | static void init_reboot(unsigned long magic) | 654 | static void init_reboot(unsigned long magic) |
660 | { | 655 | { |
661 | pid_t pid; | 656 | pid_t pid; |
@@ -816,7 +811,7 @@ static void cont_handler(int sig ATTRIBUTE_UNUSED) | |||
816 | got_cont = 1; | 811 | got_cont = 1; |
817 | } | 812 | } |
818 | 813 | ||
819 | #endif /* ! DEBUG_INIT */ | 814 | #endif /* ! ENABLE_DEBUG_INIT */ |
820 | 815 | ||
821 | static void new_init_action(int action, const char *command, const char *cons) | 816 | static void new_init_action(int action, const char *command, const char *cons) |
822 | { | 817 | { |
@@ -1026,7 +1021,7 @@ int init_main(int argc, char **argv) | |||
1026 | if (argc > 1 && !strcmp(argv[1], "-q")) { | 1021 | if (argc > 1 && !strcmp(argv[1], "-q")) { |
1027 | return kill(1,SIGHUP); | 1022 | return kill(1,SIGHUP); |
1028 | } | 1023 | } |
1029 | #ifndef DEBUG_INIT | 1024 | #if !ENABLE_DEBUG_INIT |
1030 | /* Expect to be invoked as init with PID=1 or be invoked as linuxrc */ | 1025 | /* Expect to be invoked as init with PID=1 or be invoked as linuxrc */ |
1031 | if (getpid() != 1 && | 1026 | if (getpid() != 1 && |
1032 | (!ENABLE_FEATURE_INITRD || !strstr(bb_applet_name, "linuxrc"))) | 1027 | (!ENABLE_FEATURE_INITRD || !strstr(bb_applet_name, "linuxrc"))) |