diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-06-02 10:43:17 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-06-02 10:43:17 +0000 |
commit | cf1f2ace391269655a80e42b692749da0c3d4047 (patch) | |
tree | cd871aae0a271402a63ac7f8cb03bc8f9271e9e9 | |
parent | 3132e9d830218b2aa3baa1b89fdb9cf9421fb866 (diff) | |
download | busybox-w32-cf1f2ace391269655a80e42b692749da0c3d4047.tar.gz busybox-w32-cf1f2ace391269655a80e42b692749da0c3d4047.tar.bz2 busybox-w32-cf1f2ace391269655a80e42b692749da0c3d4047.zip |
- fix CONFIG_DEBUG_INIT compile failure
-rw-r--r-- | init/init.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/init/init.c b/init/init.c index 0290f667a..b3d1f6d36 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -9,6 +9,7 @@ | |||
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 | #include "busybox.h" | ||
12 | #include <stdio.h> | 13 | #include <stdio.h> |
13 | #include <stdlib.h> | 14 | #include <stdlib.h> |
14 | #include <errno.h> | 15 | #include <errno.h> |
@@ -24,7 +25,6 @@ | |||
24 | #include <sys/types.h> | 25 | #include <sys/types.h> |
25 | #include <sys/wait.h> | 26 | #include <sys/wait.h> |
26 | #include <sys/reboot.h> | 27 | #include <sys/reboot.h> |
27 | #include "busybox.h" | ||
28 | 28 | ||
29 | #include "init_shared.h" | 29 | #include "init_shared.h" |
30 | 30 | ||
@@ -138,12 +138,14 @@ struct init_action { | |||
138 | 138 | ||
139 | /* Static variables */ | 139 | /* Static variables */ |
140 | static struct init_action *init_action_list = NULL; | 140 | static struct init_action *init_action_list = NULL; |
141 | static char console[CONSOLE_BUFF_SIZE] = _PATH_CONSOLE; | 141 | static char console[CONSOLE_BUFF_SIZE] = CONSOLE_DEV; |
142 | 142 | ||
143 | #ifndef CONFIG_SYSLOGD | 143 | #ifndef CONFIG_SYSLOGD |
144 | static char *log_console = VC_5; | 144 | static char *log_console = VC_5; |
145 | #endif | 145 | #endif |
146 | #if !ENABLE_DEBUG_INIT | ||
146 | static sig_atomic_t got_cont = 0; | 147 | static sig_atomic_t got_cont = 0; |
148 | #endif | ||
147 | 149 | ||
148 | enum { | 150 | enum { |
149 | LOG = 0x1, | 151 | LOG = 0x1, |
@@ -156,7 +158,7 @@ enum { | |||
156 | #endif | 158 | #endif |
157 | 159 | ||
158 | #ifndef RB_HALT_SYSTEM | 160 | #ifndef RB_HALT_SYSTEM |
159 | RB_HALT_SYSTEM = 0xcdef0123, | 161 | RB_HALT_SYSTEM = 0xcdef0123, /* FIXME: this overflows enum */ |
160 | RB_ENABLE_CAD = 0x89abcdef, | 162 | RB_ENABLE_CAD = 0x89abcdef, |
161 | RB_DISABLE_CAD = 0, | 163 | RB_DISABLE_CAD = 0, |
162 | RB_POWER_OFF = 0x4321fedc, | 164 | RB_POWER_OFF = 0x4321fedc, |
@@ -175,8 +177,9 @@ static const char * const environment[] = { | |||
175 | /* Function prototypes */ | 177 | /* Function prototypes */ |
176 | static void delete_init_action(struct init_action *a); | 178 | static void delete_init_action(struct init_action *a); |
177 | static int waitfor(const struct init_action *a, pid_t pid); | 179 | static int waitfor(const struct init_action *a, pid_t pid); |
180 | #if !ENABLE_DEBUG_INIT | ||
178 | static void shutdown_signal(int sig); | 181 | static void shutdown_signal(int sig); |
179 | 182 | #endif | |
180 | 183 | ||
181 | static void loop_forever(void) | 184 | static void loop_forever(void) |
182 | { | 185 | { |
@@ -242,7 +245,7 @@ static void message(int device, const char *fmt, ...) | |||
242 | #endif | 245 | #endif |
243 | 246 | ||
244 | if (device & CONSOLE) { | 247 | if (device & CONSOLE) { |
245 | int fd = device_open(_PATH_CONSOLE, | 248 | int fd = device_open(CONSOLE_DEV, |
246 | O_WRONLY | O_NOCTTY | O_NONBLOCK); | 249 | O_WRONLY | O_NOCTTY | O_NONBLOCK); |
247 | /* Always send console messages to /dev/console so people will see them. */ | 250 | /* Always send console messages to /dev/console so people will see them. */ |
248 | if (fd >= 0) { | 251 | if (fd >= 0) { |
@@ -327,7 +330,7 @@ static void console_init(void) | |||
327 | /* this is linux virtual tty */ | 330 | /* this is linux virtual tty */ |
328 | snprintf(console, sizeof(console) - 1, VC_FORMAT, vt.v_active); | 331 | snprintf(console, sizeof(console) - 1, VC_FORMAT, vt.v_active); |
329 | } else { | 332 | } else { |
330 | safe_strncpy(console, _PATH_CONSOLE, sizeof(console)); | 333 | safe_strncpy(console, CONSOLE_DEV, sizeof(console)); |
331 | tried++; | 334 | tried++; |
332 | } | 335 | } |
333 | } | 336 | } |
@@ -335,7 +338,7 @@ static void console_init(void) | |||
335 | while ((fd = open(console, O_RDONLY | O_NONBLOCK)) < 0 && tried < 2) { | 338 | while ((fd = open(console, O_RDONLY | O_NONBLOCK)) < 0 && tried < 2) { |
336 | /* Can't open selected console -- try | 339 | /* Can't open selected console -- try |
337 | logical system console and VT_MASTER */ | 340 | logical system console and VT_MASTER */ |
338 | safe_strncpy(console, (tried == 0 ? _PATH_CONSOLE : CURRENT_VC), | 341 | safe_strncpy(console, (tried == 0 ? CONSOLE_DEV : CURRENT_VC), |
339 | sizeof(console)); | 342 | sizeof(console)); |
340 | tried++; | 343 | tried++; |
341 | } | 344 | } |
@@ -383,7 +386,7 @@ static void fixup_argv(int argc, char **argv, char *new_argv0) | |||
383 | } | 386 | } |
384 | 387 | ||
385 | /* Open the new terminal device */ | 388 | /* Open the new terminal device */ |
386 | static void open_new_terminal(const char *device, char fail) { | 389 | static void open_new_terminal(const char * const device, const int fail) { |
387 | struct stat sb; | 390 | struct stat sb; |
388 | 391 | ||
389 | if ((device_open(device, O_RDWR)) < 0) { | 392 | if ((device_open(device, O_RDWR)) < 0) { |
@@ -395,7 +398,11 @@ static void open_new_terminal(const char *device, char fail) { | |||
395 | if (fail) | 398 | if (fail) |
396 | _exit(1); | 399 | _exit(1); |
397 | /* else */ | 400 | /* else */ |
401 | #if !ENABLE_DEBUG_INIT | ||
398 | shutdown_signal(SIGUSR1); | 402 | shutdown_signal(SIGUSR1); |
403 | #else | ||
404 | _exit(2); | ||
405 | #endif | ||
399 | } | 406 | } |
400 | } | 407 | } |
401 | 408 | ||