aboutsummaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2001-07-23 14:52:08 +0000
committerMatt Kraai <kraai@debian.org>2001-07-23 14:52:08 +0000
commit439e3df65300100e4b63580141eaa238c30431d5 (patch)
treef74320f9994faf4d68826c95cb8d043e35d3a685 /init
parent0139ca92ff4b960e904d18bc0254499e163e2545 (diff)
downloadbusybox-w32-439e3df65300100e4b63580141eaa238c30431d5.tar.gz
busybox-w32-439e3df65300100e4b63580141eaa238c30431d5.tar.bz2
busybox-w32-439e3df65300100e4b63580141eaa238c30431d5.zip
Add support for devfs device names.
Diffstat (limited to 'init')
-rw-r--r--init/init.c26
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 {
176static initAction *initActionList = NULL; 169static initAction *initActionList = NULL;
177 170
178 171
179static char *secondConsole = VT_SECONDARY; 172static char *secondConsole = VC_2;
180static char *thirdConsole = VT_THIRD; 173static char *thirdConsole = VC_3;
181static char *fourthConsole = VT_FOURTH; 174static char *fourthConsole = VC_4;
182static char *log = VT_LOG; 175static char *log = VC_5;
183static int kernelVersion = 0; 176static int kernelVersion = 0;
184static char termType[32] = "TERM=linux"; 177static char termType[32] = "TERM=linux";
185static char console[32] = _PATH_CONSOLE; 178static 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;