aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-03-20 14:57:50 +0000
committerEric Andersen <andersen@codepoet.org>2002-03-20 14:57:50 +0000
commitb0cc0a6ca879781c3899731c70eb3261252c7fe3 (patch)
treef59f7d68d1d3b7c26a29041469be1579cb1aa2dd
parent889a301a0c992cef843322ba7d2af62fcf44ab2a (diff)
downloadbusybox-w32-b0cc0a6ca879781c3899731c70eb3261252c7fe3.tar.gz
busybox-w32-b0cc0a6ca879781c3899731c70eb3261252c7fe3.tar.bz2
busybox-w32-b0cc0a6ca879781c3899731c70eb3261252c7fe3.zip
Rewind messages to avoid weird formatting, and fix a bug with
CONFIG_FEATURE_EXTRA_QUIET, which was broken
-rw-r--r--init/init.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/init/init.c b/init/init.c
index 408dd1f95..8f449257a 100644
--- a/init/init.c
+++ b/init/init.c
@@ -167,7 +167,7 @@ static char console[32] = _PATH_CONSOLE;
167static sig_atomic_t got_cont = 0; 167static sig_atomic_t got_cont = 0;
168static const int LOG = 0x1; 168static const int LOG = 0x1;
169static const int CONSOLE = 0x2; 169static const int CONSOLE = 0x2;
170#if defined BB_FEATURE_EXTRA_QUIET 170#if defined CONFIG_FEATURE_EXTRA_QUIET
171static const int MAYBE_CONSOLE = 0x0; 171static const int MAYBE_CONSOLE = 0x0;
172#else 172#else
173#define MAYBE_CONSOLE CONSOLE 173#define MAYBE_CONSOLE CONSOLE
@@ -391,7 +391,7 @@ static void console_init(void)
391 if (strcmp( termType, "TERM=linux" ) == 0) 391 if (strcmp( termType, "TERM=linux" ) == 0)
392 safe_strncpy(termType, "TERM=vt102", sizeof(termType)); 392 safe_strncpy(termType, "TERM=vt102", sizeof(termType));
393 message(LOG | CONSOLE, 393 message(LOG | CONSOLE,
394 "serial console detected. Disabling virtual terminals.\n"); 394 "\rserial console detected. Disabling virtual terminals.\n");
395 } 395 }
396 close(fd); 396 close(fd);
397 } 397 }
@@ -438,7 +438,7 @@ static void check_memory(void)
438 438
439 goodnight: 439 goodnight:
440 message(CONSOLE, 440 message(CONSOLE,
441 "Sorry, your computer does not have enough memory.\n"); 441 "\rSorry, your computer does not have enough memory.\n");
442 loop_forever(); 442 loop_forever();
443} 443}
444 444
@@ -506,11 +506,11 @@ static pid_t run(struct init_action *a)
506 /* Open the new terminal device */ 506 /* Open the new terminal device */
507 if ((fd = device_open(a->terminal, O_RDWR|O_NOCTTY)) < 0) { 507 if ((fd = device_open(a->terminal, O_RDWR|O_NOCTTY)) < 0) {
508 if (stat(a->terminal, &sb) != 0) { 508 if (stat(a->terminal, &sb) != 0) {
509 message(LOG | CONSOLE, "device '%s' does not exist.\n", 509 message(LOG | CONSOLE, "\rdevice '%s' does not exist.\n",
510 a->terminal); 510 a->terminal);
511 _exit(1); 511 _exit(1);
512 } 512 }
513 message(LOG | CONSOLE, "Bummer, can't open %s\n", a->terminal); 513 message(LOG | CONSOLE, "\rBummer, can't open %s\n", a->terminal);
514 _exit(1); 514 _exit(1);
515 } 515 }
516 /* Make sure the terminal will act fairly normal for us */ 516 /* Make sure the terminal will act fairly normal for us */
@@ -554,7 +554,7 @@ static pid_t run(struct init_action *a)
554 554
555 /* Use a temporary process to steal the controlling tty. */ 555 /* Use a temporary process to steal the controlling tty. */
556 if ((pid = fork()) < 0) { 556 if ((pid = fork()) < 0) {
557 message(LOG | CONSOLE, "Can't fork!\n"); 557 message(LOG | CONSOLE, "\rCan't fork!\n");
558 _exit(1); 558 _exit(1);
559 } 559 }
560 if (pid == 0) { 560 if (pid == 0) {
@@ -659,7 +659,7 @@ static pid_t run(struct init_action *a)
659 execve(cmdpath, cmd, environment); 659 execve(cmdpath, cmd, environment);
660 660
661 /* We're still here? Some error happened. */ 661 /* We're still here? Some error happened. */
662 message(LOG | CONSOLE, "Bummer, could not run '%s': %s\n", cmdpath, 662 message(LOG | CONSOLE, "\rBummer, could not run '%s': %s\n", cmdpath,
663 strerror(errno)); 663 strerror(errno));
664 _exit(-1); 664 _exit(-1);
665 } 665 }
@@ -731,16 +731,16 @@ static void shutdown_system(void)
731 /* Allow Ctrl-Alt-Del to reboot system. */ 731 /* Allow Ctrl-Alt-Del to reboot system. */
732 init_reboot(RB_ENABLE_CAD); 732 init_reboot(RB_ENABLE_CAD);
733 733
734 message(CONSOLE|LOG, "\nThe system is going down NOW !!\n"); 734 message(CONSOLE|LOG, "\n\rThe system is going down NOW !!\n");
735 sync(); 735 sync();
736 736
737 /* Send signals to every process _except_ pid 1 */ 737 /* Send signals to every process _except_ pid 1 */
738 message(CONSOLE|LOG, "Sending SIGTERM to all processes.\n"); 738 message(CONSOLE|LOG, "\rSending SIGTERM to all processes.\n");
739 kill(-1, SIGTERM); 739 kill(-1, SIGTERM);
740 sleep(1); 740 sleep(1);
741 sync(); 741 sync();
742 742
743 message(CONSOLE|LOG, "Sending SIGKILL to all processes.\n"); 743 message(CONSOLE|LOG, "\rSending SIGKILL to all processes.\n");
744 kill(-1, SIGKILL); 744 kill(-1, SIGKILL);
745 sleep(1); 745 sleep(1);
746 746
@@ -762,10 +762,10 @@ static void exec_signal(int sig)
762 tmp = a->next; 762 tmp = a->next;
763 if (a->action & RESTART) { 763 if (a->action & RESTART) {
764 shutdown_system(); 764 shutdown_system();
765 message(CONSOLE|LOG, "Trying to re-exec %s\n", a->command); 765 message(CONSOLE|LOG, "\rTrying to re-exec %s\n", a->command);
766 execl(a->command, a->command, NULL); 766 execl(a->command, a->command, NULL);
767 767
768 message(CONSOLE|LOG, "execl of %s failed: %s\n", 768 message(CONSOLE|LOG, "\rexec of '%s' failed: %s\n",
769 a->command, sys_errlist[errno]); 769 a->command, sys_errlist[errno]);
770 sync(); 770 sync();
771 sleep(2); 771 sleep(2);
@@ -781,10 +781,10 @@ static void halt_signal(int sig)
781 message(CONSOLE|LOG, 781 message(CONSOLE|LOG,
782#if #cpu(s390) 782#if #cpu(s390)
783 /* Seems the s390 console is Wierd(tm). */ 783 /* Seems the s390 console is Wierd(tm). */
784 "The system is halted. You may reboot now.\n" 784 "\rThe system is halted. You may reboot now.\n"
785#else 785#else
786 /* secondConsole is NULL for a serial console */ 786 /* secondConsole is NULL for a serial console */
787 "The system is halted. Press %s or turn off power\n", 787 "\rThe system is halted. Press %s or turn off power\n",
788 (secondConsole == NULL)? "Reset" : "CTRL-ALT-DEL" 788 (secondConsole == NULL)? "Reset" : "CTRL-ALT-DEL"
789#endif 789#endif
790 ); 790 );
@@ -804,7 +804,7 @@ static void halt_signal(int sig)
804static void reboot_signal(int sig) 804static void reboot_signal(int sig)
805{ 805{
806 shutdown_system(); 806 shutdown_system();
807 message(CONSOLE|LOG, "Please stand by while rebooting the system.\n"); 807 message(CONSOLE|LOG, "\rPlease stand by while rebooting the system.\n");
808 sync(); 808 sync();
809 809
810 /* allow time for last message to reach serial console */ 810 /* allow time for last message to reach serial console */
@@ -858,7 +858,7 @@ static void new_init_action(int action, char *command, char *cons)
858 858
859 new_action = calloc((size_t) (1), sizeof(struct init_action)); 859 new_action = calloc((size_t) (1), sizeof(struct init_action));
860 if (!new_action) { 860 if (!new_action) {
861 message(LOG | CONSOLE, "Memory allocation failure\n"); 861 message(LOG | CONSOLE, "\rMemory allocation failure\n");
862 loop_forever(); 862 loop_forever();
863 } 863 }
864 864
@@ -963,7 +963,7 @@ static void parse_inittab(void)
963 /* Separate the ID field from the runlevels */ 963 /* Separate the ID field from the runlevels */
964 runlev = strchr(id, ':'); 964 runlev = strchr(id, ':');
965 if (runlev == NULL || *(runlev + 1) == '\0') { 965 if (runlev == NULL || *(runlev + 1) == '\0') {
966 message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead); 966 message(LOG | CONSOLE, "\rBad inittab entry: %s\n", lineAsRead);
967 continue; 967 continue;
968 } else { 968 } else {
969 *runlev = '\0'; 969 *runlev = '\0';
@@ -973,7 +973,7 @@ static void parse_inittab(void)
973 /* Separate the runlevels from the action */ 973 /* Separate the runlevels from the action */
974 action = strchr(runlev, ':'); 974 action = strchr(runlev, ':');
975 if (action == NULL || *(action + 1) == '\0') { 975 if (action == NULL || *(action + 1) == '\0') {
976 message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead); 976 message(LOG | CONSOLE, "\rBad inittab entry: %s\n", lineAsRead);
977 continue; 977 continue;
978 } else { 978 } else {
979 *action = '\0'; 979 *action = '\0';
@@ -983,7 +983,7 @@ static void parse_inittab(void)
983 /* Separate the action from the command */ 983 /* Separate the action from the command */
984 command = strchr(action, ':'); 984 command = strchr(action, ':');
985 if (command == NULL || *(command + 1) == '\0') { 985 if (command == NULL || *(command + 1) == '\0') {
986 message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead); 986 message(LOG | CONSOLE, "\rBad inittab entry: %s\n", lineAsRead);
987 continue; 987 continue;
988 } else { 988 } else {
989 *command = '\0'; 989 *command = '\0';
@@ -1008,7 +1008,7 @@ static void parse_inittab(void)
1008 continue; 1008 continue;
1009 else { 1009 else {
1010 /* Choke on an unknown action */ 1010 /* Choke on an unknown action */
1011 message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead); 1011 message(LOG | CONSOLE, "\rBad inittab entry: %s\n", lineAsRead);
1012 } 1012 }
1013 } 1013 }
1014 return; 1014 return;
@@ -1080,7 +1080,7 @@ extern int init_main(int argc, char **argv)
1080 putenv("PATH="_PATH_STDPATH); 1080 putenv("PATH="_PATH_STDPATH);
1081 1081
1082 /* Hello world */ 1082 /* Hello world */
1083 message(MAYBE_CONSOLE|LOG, "init started: %s\n", full_version); 1083 message(MAYBE_CONSOLE|LOG, "\rinit started: %s\n", full_version);
1084 1084
1085 /* Make sure there is enough memory to do something useful. */ 1085 /* Make sure there is enough memory to do something useful. */
1086 check_memory(); 1086 check_memory();
@@ -1123,7 +1123,7 @@ extern int init_main(int argc, char **argv)
1123 1123
1124 /* If there is nothing else to do, stop */ 1124 /* If there is nothing else to do, stop */
1125 if (init_action_list == NULL) { 1125 if (init_action_list == NULL) {
1126 message(LOG | CONSOLE, "No more tasks for init -- sleeping forever.\n"); 1126 message(LOG | CONSOLE, "\rNo more tasks for init -- sleeping forever.\n");
1127 loop_forever(); 1127 loop_forever();
1128 } 1128 }
1129 1129