aboutsummaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-12-03 09:19:54 +0000
committerEric Andersen <andersen@codepoet.org>1999-12-03 09:19:54 +0000
commitb186d980d6060195d01048bb3a083739137b6c21 (patch)
treef64b2d63850be12ce3081b2000784aa57ac29656 /init
parent77619b9dda2b0550fea519fba05f7d9790ef7eaf (diff)
downloadbusybox-w32-b186d980d6060195d01048bb3a083739137b6c21.tar.gz
busybox-w32-b186d980d6060195d01048bb3a083739137b6c21.tar.bz2
busybox-w32-b186d980d6060195d01048bb3a083739137b6c21.zip
Stuf
Diffstat (limited to 'init')
-rw-r--r--init/init.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/init/init.c b/init/init.c
index 7258d3151..088a890cc 100644
--- a/init/init.c
+++ b/init/init.c
@@ -29,6 +29,7 @@
29#include <errno.h> 29#include <errno.h>
30#include <signal.h> 30#include <signal.h>
31#include <termios.h> 31#include <termios.h>
32#include <paths.h>
32#include <sys/types.h> 33#include <sys/types.h>
33#include <sys/fcntl.h> 34#include <sys/fcntl.h>
34#include <sys/wait.h> 35#include <sys/wait.h>
@@ -44,7 +45,6 @@
44#include <sys/syslog.h> 45#include <sys/syslog.h>
45#endif 46#endif
46 47
47#define DEV_CONSOLE "/dev/console" /* Logical system console */
48#define VT_PRIMARY "/dev/tty1" /* Primary virtual console */ 48#define VT_PRIMARY "/dev/tty1" /* Primary virtual console */
49#define VT_SECONDARY "/dev/tty2" /* Virtual console */ 49#define VT_SECONDARY "/dev/tty2" /* Virtual console */
50#define VT_LOG "/dev/tty3" /* Virtual console */ 50#define VT_LOG "/dev/tty3" /* Virtual console */
@@ -52,11 +52,10 @@
52#define SERIAL_CON1 "/dev/ttyS1" /* Serial console */ 52#define SERIAL_CON1 "/dev/ttyS1" /* Serial console */
53#define SHELL "/bin/sh" /* Default shell */ 53#define SHELL "/bin/sh" /* Default shell */
54#define INITSCRIPT "/etc/init.d/rcS" /* Initscript. */ 54#define INITSCRIPT "/etc/init.d/rcS" /* Initscript. */
55#define PATH_DEFAULT "PATH=/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin"
56 55
57#define LOG 0x1 56#define LOG 0x1
58#define CONSOLE 0x2 57#define CONSOLE 0x2
59static char *console = DEV_CONSOLE; 58static char *console = _PATH_CONSOLE;
60static char *second_console = VT_SECONDARY; 59static char *second_console = VT_SECONDARY;
61static char *log = VT_LOG; 60static char *log = VT_LOG;
62static int kernel_version = 0; 61static int kernel_version = 0;
@@ -126,7 +125,7 @@ void message(int device, char *fmt, ...)
126 125
127 if (device & CONSOLE) { 126 if (device & CONSOLE) {
128 /* Always send console messages to /dev/console so people will see them. */ 127 /* Always send console messages to /dev/console so people will see them. */
129 if ((fd = device_open(DEV_CONSOLE, O_WRONLY|O_NOCTTY|O_NDELAY)) >= 0) { 128 if ((fd = device_open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY|O_NDELAY)) >= 0) {
130 va_start(arguments, fmt); 129 va_start(arguments, fmt);
131 vdprintf(fd, fmt, arguments); 130 vdprintf(fd, fmt, arguments);
132 va_end(arguments); 131 va_end(arguments);
@@ -242,7 +241,7 @@ static void console_init()
242 /* this is linux virtual tty */ 241 /* this is linux virtual tty */
243 snprintf( the_console, sizeof the_console, "/dev/tty%d", vt.v_active ); 242 snprintf( the_console, sizeof the_console, "/dev/tty%d", vt.v_active );
244 } else { 243 } else {
245 console = DEV_CONSOLE; 244 console = _PATH_CONSOLE;
246 tried_devcons++; 245 tried_devcons++;
247 } 246 }
248 } 247 }
@@ -251,7 +250,7 @@ static void console_init()
251 /* Can't open selected console -- try /dev/console */ 250 /* Can't open selected console -- try /dev/console */
252 if (!tried_devcons) { 251 if (!tried_devcons) {
253 tried_devcons++; 252 tried_devcons++;
254 console = DEV_CONSOLE; 253 console = _PATH_CONSOLE;
255 continue; 254 continue;
256 } 255 }
257 /* Can't open selected console -- try vt1 */ 256 /* Can't open selected console -- try vt1 */
@@ -421,6 +420,7 @@ static void halt_signal(int sig)
421 "The system is halted. Press CTRL-ALT-DEL or turn off power\r\n"); 420 "The system is halted. Press CTRL-ALT-DEL or turn off power\r\n");
422 sync(); 421 sync();
423#ifndef DEBUG_INIT 422#ifndef DEBUG_INIT
423 while (1) sleep(1);
424 reboot(RB_HALT_SYSTEM); 424 reboot(RB_HALT_SYSTEM);
425 //reboot(RB_POWER_OFF); 425 //reboot(RB_POWER_OFF);
426#endif 426#endif
@@ -432,6 +432,7 @@ static void reboot_signal(int sig)
432 shutdown_system(); 432 shutdown_system();
433 message(CONSOLE, "Please stand by while rebooting the system.\r\n"); 433 message(CONSOLE, "Please stand by while rebooting the system.\r\n");
434 sync(); 434 sync();
435 while (1) sleep(1);
435#ifndef DEBUG_INIT 436#ifndef DEBUG_INIT
436 reboot(RB_AUTOBOOT); 437 reboot(RB_AUTOBOOT);
437#endif 438#endif
@@ -502,7 +503,7 @@ extern int init_main(int argc, char **argv)
502 setsid(); 503 setsid();
503 504
504 /* Make sure PATH is set to something sane */ 505 /* Make sure PATH is set to something sane */
505 putenv(PATH_DEFAULT); 506 putenv(_PATH_STDPATH);
506 507
507 508
508 /* Hello world */ 509 /* Hello world */