diff options
| author | kraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-07-23 14:52:08 +0000 |
|---|---|---|
| committer | kraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-07-23 14:52:08 +0000 |
| commit | b340b7d47d2c9904efd7eb47df3c79bc7a4a3650 (patch) | |
| tree | f74320f9994faf4d68826c95cb8d043e35d3a685 /init | |
| parent | 7ccc7ee19df28a1c3b48f1163ff80737cdab7474 (diff) | |
| download | busybox-w32-b340b7d47d2c9904efd7eb47df3c79bc7a4a3650.tar.gz busybox-w32-b340b7d47d2c9904efd7eb47df3c79bc7a4a3650.tar.bz2 busybox-w32-b340b7d47d2c9904efd7eb47df3c79bc7a4a3650.zip | |
Add support for devfs device names.
git-svn-id: svn://busybox.net/trunk/busybox@3136 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'init')
| -rw-r--r-- | init/init.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/init/init.c b/init/init.c index ec144ea85..f397b7e0a 100644 --- a/init/init.c +++ b/init/init.c | |||
| @@ -117,13 +117,6 @@ static const int RB_AUTOBOOT = 0x01234567; | |||
| 117 | #endif | 117 | #endif |
| 118 | 118 | ||
| 119 | 119 | ||
| 120 | #define VT_PRIMARY "/dev/tty1" /* Primary virtual console */ | ||
| 121 | #define VT_SECONDARY "/dev/tty2" /* Virtual console */ | ||
| 122 | #define VT_THIRD "/dev/tty3" /* Virtual console */ | ||
| 123 | #define VT_FOURTH "/dev/tty4" /* Virtual console */ | ||
| 124 | #define VT_LOG "/dev/tty5" /* Virtual console */ | ||
| 125 | #define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */ | ||
| 126 | #define SERIAL_CON1 "/dev/ttyS1" /* Serial console */ | ||
| 127 | #define SHELL "/bin/sh" /* Default shell */ | 120 | #define SHELL "/bin/sh" /* Default shell */ |
| 128 | #define LOGIN_SHELL "-" SHELL /* Default login shell */ | 121 | #define LOGIN_SHELL "-" SHELL /* Default login shell */ |
| 129 | #define INITTAB "/etc/inittab" /* inittab file location */ | 122 | #define INITTAB "/etc/inittab" /* inittab file location */ |
| @@ -176,10 +169,10 @@ struct initActionTag { | |||
| 176 | static initAction *initActionList = NULL; | 169 | static initAction *initActionList = NULL; |
| 177 | 170 | ||
| 178 | 171 | ||
| 179 | static char *secondConsole = VT_SECONDARY; | 172 | static char *secondConsole = VC_2; |
| 180 | static char *thirdConsole = VT_THIRD; | 173 | static char *thirdConsole = VC_3; |
| 181 | static char *fourthConsole = VT_FOURTH; | 174 | static char *fourthConsole = VC_4; |
| 182 | static char *log = VT_LOG; | 175 | static char *log = VC_5; |
| 183 | static int kernelVersion = 0; | 176 | static int kernelVersion = 0; |
| 184 | static char termType[32] = "TERM=linux"; | 177 | static char termType[32] = "TERM=linux"; |
| 185 | static char console[32] = _PATH_CONSOLE; | 178 | static char console[32] = _PATH_CONSOLE; |
| @@ -341,20 +334,19 @@ static void console_init() | |||
| 341 | else if ((s = getenv("console")) != NULL) { | 334 | else if ((s = getenv("console")) != NULL) { |
| 342 | /* remap tty[ab] to /dev/ttyS[01] */ | 335 | /* remap tty[ab] to /dev/ttyS[01] */ |
| 343 | if (strcmp(s, "ttya") == 0) | 336 | if (strcmp(s, "ttya") == 0) |
| 344 | safe_strncpy(console, SERIAL_CON0, sizeof(console)); | 337 | safe_strncpy(console, SC_0, sizeof(console)); |
| 345 | else if (strcmp(s, "ttyb") == 0) | 338 | else if (strcmp(s, "ttyb") == 0) |
| 346 | safe_strncpy(console, SERIAL_CON1, sizeof(console)); | 339 | safe_strncpy(console, SC_1, sizeof(console)); |
| 347 | } | 340 | } |
| 348 | #endif | 341 | #endif |
| 349 | else { | 342 | else { |
| 350 | /* 2.2 kernels: identify the real console backend and try to use it */ | 343 | /* 2.2 kernels: identify the real console backend and try to use it */ |
| 351 | if (ioctl(0, TIOCGSERIAL, &sr) == 0) { | 344 | if (ioctl(0, TIOCGSERIAL, &sr) == 0) { |
| 352 | /* this is a serial console */ | 345 | /* this is a serial console */ |
| 353 | snprintf(console, sizeof(console) - 1, "/dev/ttyS%d", sr.line); | 346 | snprintf(console, sizeof(console) - 1, SC_FORMAT, sr.line); |
| 354 | } else if (ioctl(0, VT_GETSTATE, &vt) == 0) { | 347 | } else if (ioctl(0, VT_GETSTATE, &vt) == 0) { |
| 355 | /* this is linux virtual tty */ | 348 | /* this is linux virtual tty */ |
| 356 | snprintf(console, sizeof(console) - 1, "/dev/tty%d", | 349 | snprintf(console, sizeof(console) - 1, VC_FORMAT, vt.v_active); |
| 357 | vt.v_active); | ||
| 358 | } else { | 350 | } else { |
| 359 | safe_strncpy(console, _PATH_CONSOLE, sizeof(console)); | 351 | safe_strncpy(console, _PATH_CONSOLE, sizeof(console)); |
| 360 | tried_devcons++; | 352 | tried_devcons++; |
| @@ -371,7 +363,7 @@ static void console_init() | |||
| 371 | /* Can't open selected console -- try vt1 */ | 363 | /* Can't open selected console -- try vt1 */ |
| 372 | if (!tried_vtprimary) { | 364 | if (!tried_vtprimary) { |
| 373 | tried_vtprimary++; | 365 | tried_vtprimary++; |
| 374 | safe_strncpy(console, VT_PRIMARY, sizeof(console)); | 366 | safe_strncpy(console, VC_1, sizeof(console)); |
| 375 | continue; | 367 | continue; |
| 376 | } | 368 | } |
| 377 | break; | 369 | break; |
