diff options
Diffstat (limited to 'init.c')
-rw-r--r-- | init.c | 64 |
1 files changed, 14 insertions, 50 deletions
@@ -123,13 +123,6 @@ void message(int device, char *fmt, ...) | |||
123 | void set_term( int fd) | 123 | void set_term( int fd) |
124 | { | 124 | { |
125 | struct termios tty; | 125 | struct termios tty; |
126 | #if 0 | ||
127 | static const char control_characters[] = { | ||
128 | '\003', '\034', '\177', '\025', '\004', '\0', | ||
129 | '\1', '\0', '\021', '\023', '\032', '\0', '\022', | ||
130 | '\017', '\027', '\026', '\0' | ||
131 | }; | ||
132 | #endif | ||
133 | static const char control_characters[] = { | 126 | static const char control_characters[] = { |
134 | '\003', '\034', '\177', '\030', '\004', '\0', | 127 | '\003', '\034', '\177', '\030', '\004', '\0', |
135 | '\1', '\0', '\021', '\023', '\032', '\0', '\022', | 128 | '\1', '\0', '\021', '\023', '\032', '\0', '\022', |
@@ -160,44 +153,6 @@ void set_term( int fd) | |||
160 | tcsetattr(fd, TCSANOW, &tty); | 153 | tcsetattr(fd, TCSANOW, &tty); |
161 | } | 154 | } |
162 | 155 | ||
163 | /* Set terminal settings to reasonable defaults */ | ||
164 | void set_term_old( int fd) | ||
165 | { | ||
166 | struct termios tty; | ||
167 | |||
168 | ioctl(fd, TCGETA, &tty); | ||
169 | |||
170 | tty.c_cflag &= CBAUD|CBAUDEX|CSIZE|CSTOPB|PARENB|PARODD; | ||
171 | tty.c_cflag |= HUPCL|CLOCAL; | ||
172 | |||
173 | tty.c_cc[VINTR] = 3; | ||
174 | tty.c_cc[VQUIT] = 28; | ||
175 | tty.c_cc[VERASE] = 127; | ||
176 | //tty.c_cc[VKILL] = 21; | ||
177 | tty.c_cc[VKILL] = 24; | ||
178 | tty.c_cc[VEOF] = 4; | ||
179 | tty.c_cc[VTIME] = 0; | ||
180 | tty.c_cc[VMIN] = 1; | ||
181 | tty.c_cc[VSWTC] = 0; | ||
182 | tty.c_cc[VSTART] = 17; | ||
183 | tty.c_cc[VSTOP] = 19; | ||
184 | tty.c_cc[VSUSP] = 26; | ||
185 | tty.c_cc[VEOL] = 0; | ||
186 | tty.c_cc[VREPRINT] = 18; | ||
187 | tty.c_cc[VDISCARD] = 15; | ||
188 | tty.c_cc[VWERASE] = 23; | ||
189 | tty.c_cc[VLNEXT] = 22; | ||
190 | tty.c_cc[VEOL2] = 0; | ||
191 | |||
192 | |||
193 | tty.c_line = 0; | ||
194 | tty.c_iflag = IGNPAR|ICRNL|IXON|IXOFF|IXANY; | ||
195 | tty.c_oflag = OPOST|ONLCR; | ||
196 | tty.c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK|ECHOCTL|ECHOPRT|ECHOKE|IEXTEN; | ||
197 | |||
198 | ioctl(fd, TCSETA, &tty); | ||
199 | } | ||
200 | |||
201 | /* How much memory does this machine have? */ | 156 | /* How much memory does this machine have? */ |
202 | static int mem_total() | 157 | static int mem_total() |
203 | { | 158 | { |
@@ -395,7 +350,12 @@ static void shutdown_system(void) | |||
395 | waitfor(run( swap_off_cmd, console, FALSE)); | 350 | waitfor(run( swap_off_cmd, console, FALSE)); |
396 | waitfor(run( umount_cmd, console, FALSE)); | 351 | waitfor(run( umount_cmd, console, FALSE)); |
397 | sync(); | 352 | sync(); |
398 | bdflush(1, 0); | 353 | message(CONSOLE, "Skipping bdflush\r\n"); |
354 | if (get_kernel_revision() <= 2 * 65536 + 2 * 256 + 11) { | ||
355 | /* bdflush, kupdate not needed for kernels >2.2.11 */ | ||
356 | bdflush(1, 0); | ||
357 | sync(); | ||
358 | } | ||
399 | } | 359 | } |
400 | 360 | ||
401 | static void halt_signal(int sig) | 361 | static void halt_signal(int sig) |
@@ -518,15 +478,19 @@ extern int init_main(int argc, char **argv) | |||
518 | if (wpid > 0 ) { | 478 | if (wpid > 0 ) { |
519 | message(LOG, "pid %d exited, status=%x.\n", wpid, status); | 479 | message(LOG, "pid %d exited, status=%x.\n", wpid, status); |
520 | } | 480 | } |
481 | /* Don't respawn init script if it exits */ | ||
521 | if (wpid == pid1) { | 482 | if (wpid == pid1) { |
522 | pid1 = 0; | 483 | if (run_rc == FALSE) { |
523 | if (run_rc == TRUE) { | 484 | pid1 = 0; |
524 | /* Don't respawn init script if it exits, | 485 | } |
525 | * Start a shell instead. */ | 486 | #if 0 |
487 | /* Turn this on to start a shell on the console if the init script exits.... */ | ||
488 | else { | ||
526 | run_rc=FALSE; | 489 | run_rc=FALSE; |
527 | wait_for_enter=TRUE; | 490 | wait_for_enter=TRUE; |
528 | tty0_commands=shell_commands; | 491 | tty0_commands=shell_commands; |
529 | } | 492 | } |
493 | #endif | ||
530 | } | 494 | } |
531 | if (wpid == pid2) { | 495 | if (wpid == pid2) { |
532 | pid2 = 0; | 496 | pid2 = 0; |