diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-10-21 17:14:26 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-10-21 17:14:26 +0000 |
commit | 5cb54b5adcda45c71120ec93c0bbbd558703a218 (patch) | |
tree | 9a83eead32edfd2dbfc059c9a5a994c7d404b3ce | |
parent | 37890e2f375b2b088e777877a8fc81654f59b81b (diff) | |
download | busybox-w32-5cb54b5adcda45c71120ec93c0bbbd558703a218.tar.gz busybox-w32-5cb54b5adcda45c71120ec93c0bbbd558703a218.tar.bz2 busybox-w32-5cb54b5adcda45c71120ec93c0bbbd558703a218.zip |
init: downgrade ENABLE_DEBUG_INIT to just a #define to prevent people
from selecting it in error. It has to be used ONLY for debugging
init, never in production, as resulting init has serious differences.
-rw-r--r-- | TODO_config_nommu | 1 | ||||
-rw-r--r-- | init/Config.in | 8 | ||||
-rw-r--r-- | init/init.c | 10 | ||||
-rw-r--r-- | scripts/defconfig | 1 |
4 files changed, 7 insertions, 13 deletions
diff --git a/TODO_config_nommu b/TODO_config_nommu index bdef3e91e..4ed69e07a 100644 --- a/TODO_config_nommu +++ b/TODO_config_nommu | |||
@@ -369,7 +369,6 @@ CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y | |||
369 | # Init Utilities | 369 | # Init Utilities |
370 | # | 370 | # |
371 | CONFIG_INIT=y | 371 | CONFIG_INIT=y |
372 | # CONFIG_DEBUG_INIT is not set | ||
373 | CONFIG_FEATURE_USE_INITTAB=y | 372 | CONFIG_FEATURE_USE_INITTAB=y |
374 | CONFIG_FEATURE_KILL_REMOVED=y | 373 | CONFIG_FEATURE_KILL_REMOVED=y |
375 | CONFIG_FEATURE_KILL_DELAY=1 | 374 | CONFIG_FEATURE_KILL_DELAY=1 |
diff --git a/init/Config.in b/init/Config.in index 6a45e7d3d..6b5799fe3 100644 --- a/init/Config.in +++ b/init/Config.in | |||
@@ -12,14 +12,6 @@ config INIT | |||
12 | help | 12 | help |
13 | init is the first program run when the system boots. | 13 | init is the first program run when the system boots. |
14 | 14 | ||
15 | config DEBUG_INIT | ||
16 | bool "Debugging aid" | ||
17 | default n | ||
18 | depends on INIT | ||
19 | help | ||
20 | Turn this on to disable all the dangerous | ||
21 | rebooting stuff when debugging. | ||
22 | |||
23 | config FEATURE_USE_INITTAB | 15 | config FEATURE_USE_INITTAB |
24 | bool "Support reading an inittab file" | 16 | bool "Support reading an inittab file" |
25 | default y | 17 | default y |
diff --git a/init/init.c b/init/init.c index e00a3b128..ae2dd6a7a 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -14,6 +14,10 @@ | |||
14 | #include <paths.h> | 14 | #include <paths.h> |
15 | #include <sys/reboot.h> | 15 | #include <sys/reboot.h> |
16 | 16 | ||
17 | /* Was a CONFIG_xxx option. A lot of people were building | ||
18 | * not fully functional init by switching it on! */ | ||
19 | #define DEBUG_INIT 0 | ||
20 | |||
17 | #define COMMAND_SIZE 256 | 21 | #define COMMAND_SIZE 256 |
18 | #define CONSOLE_NAME_SIZE 32 | 22 | #define CONSOLE_NAME_SIZE 32 |
19 | #define MAXENV 16 /* Number of env. vars */ | 23 | #define MAXENV 16 /* Number of env. vars */ |
@@ -103,7 +107,7 @@ static void loop_forever(void) | |||
103 | * "where" may be bitwise-or'd from L_LOG | L_CONSOLE | 107 | * "where" may be bitwise-or'd from L_LOG | L_CONSOLE |
104 | * NB: careful, we can be called after vfork! | 108 | * NB: careful, we can be called after vfork! |
105 | */ | 109 | */ |
106 | #define messageD(...) do { if (ENABLE_DEBUG_INIT) message(__VA_ARGS__); } while (0) | 110 | #define messageD(...) do { if (DEBUG_INIT) message(__VA_ARGS__); } while (0) |
107 | static void message(int where, const char *fmt, ...) | 111 | static void message(int where, const char *fmt, ...) |
108 | __attribute__ ((format(printf, 2, 3))); | 112 | __attribute__ ((format(printf, 2, 3))); |
109 | static void message(int where, const char *fmt, ...) | 113 | static void message(int where, const char *fmt, ...) |
@@ -275,7 +279,7 @@ static void open_stdio_to_tty(const char* tty_name, int exit_on_failure) | |||
275 | tty_name, strerror(errno)); | 279 | tty_name, strerror(errno)); |
276 | if (exit_on_failure) | 280 | if (exit_on_failure) |
277 | _exit(EXIT_FAILURE); | 281 | _exit(EXIT_FAILURE); |
278 | if (ENABLE_DEBUG_INIT) | 282 | if (DEBUG_INIT) |
279 | _exit(2); | 283 | _exit(2); |
280 | /* NB: we don't reach this if we were called after vfork. | 284 | /* NB: we don't reach this if we were called after vfork. |
281 | * Thus halt_reboot_pwoff() itself need not be vfork-safe. */ | 285 | * Thus halt_reboot_pwoff() itself need not be vfork-safe. */ |
@@ -788,7 +792,7 @@ int init_main(int argc UNUSED_PARAM, char **argv) | |||
788 | return kill(1, SIGHUP); | 792 | return kill(1, SIGHUP); |
789 | } | 793 | } |
790 | 794 | ||
791 | if (!ENABLE_DEBUG_INIT) { | 795 | if (!DEBUG_INIT) { |
792 | /* Expect to be invoked as init with PID=1 or be invoked as linuxrc */ | 796 | /* Expect to be invoked as init with PID=1 or be invoked as linuxrc */ |
793 | if (getpid() != 1 | 797 | if (getpid() != 1 |
794 | && (!ENABLE_FEATURE_INITRD || !strstr(applet_name, "linuxrc")) | 798 | && (!ENABLE_FEATURE_INITRD || !strstr(applet_name, "linuxrc")) |
diff --git a/scripts/defconfig b/scripts/defconfig index 96c1978ff..6cd82c3ec 100644 --- a/scripts/defconfig +++ b/scripts/defconfig | |||
@@ -367,7 +367,6 @@ CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y | |||
367 | # Init Utilities | 367 | # Init Utilities |
368 | # | 368 | # |
369 | CONFIG_INIT=y | 369 | CONFIG_INIT=y |
370 | # CONFIG_DEBUG_INIT is not set | ||
371 | CONFIG_FEATURE_USE_INITTAB=y | 370 | CONFIG_FEATURE_USE_INITTAB=y |
372 | # CONFIG_FEATURE_KILL_REMOVED is not set | 371 | # CONFIG_FEATURE_KILL_REMOVED is not set |
373 | CONFIG_FEATURE_KILL_DELAY=0 | 372 | CONFIG_FEATURE_KILL_DELAY=0 |