diff options
author | Erik Andersen <andersen@codepoet.org> | 2000-01-25 18:13:53 +0000 |
---|---|---|
committer | Erik Andersen <andersen@codepoet.org> | 2000-01-25 18:13:53 +0000 |
commit | 3fe39dce5d1a0b0946878c66bbd7f694c5aa38ea (patch) | |
tree | 32b6129967a8b5c922b72843efc7fc6683287181 /init | |
parent | bf3a838aaca4ab34d2739438fa44d0dbb04e9862 (diff) | |
download | busybox-w32-3fe39dce5d1a0b0946878c66bbd7f694c5aa38ea.tar.gz busybox-w32-3fe39dce5d1a0b0946878c66bbd7f694c5aa38ea.tar.bz2 busybox-w32-3fe39dce5d1a0b0946878c66bbd7f694c5aa38ea.zip |
Some busybox updates. See the changelog for details if you care.
-Erik
Diffstat (limited to 'init')
-rw-r--r-- | init/init.c | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/init/init.c b/init/init.c index b0a85829d..5b80cc561 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -488,9 +488,14 @@ static void shutdown_system(void) | |||
488 | static void halt_signal(int sig) | 488 | static void halt_signal(int sig) |
489 | { | 489 | { |
490 | shutdown_system(); | 490 | shutdown_system(); |
491 | message(CONSOLE, | 491 | message(CONSOLE, "The system is halted. Press %s or turn off power\r\n", |
492 | "The system is halted. Press CTRL-ALT-DEL or turn off power\r\n"); | 492 | (secondConsole == NULL) /* serial console */ |
493 | ? "Reset" : "CTRL-ALT-DEL"); | ||
493 | sync(); | 494 | sync(); |
495 | |||
496 | /* allow time for last message to reach serial console */ | ||
497 | sleep(2); | ||
498 | |||
494 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) | 499 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) |
495 | if (sig == SIGUSR2) | 500 | if (sig == SIGUSR2) |
496 | reboot(RB_POWER_OFF); | 501 | reboot(RB_POWER_OFF); |
@@ -505,6 +510,10 @@ static void reboot_signal(int sig) | |||
505 | shutdown_system(); | 510 | shutdown_system(); |
506 | message(CONSOLE, "Please stand by while rebooting the system.\r\n"); | 511 | message(CONSOLE, "Please stand by while rebooting the system.\r\n"); |
507 | sync(); | 512 | sync(); |
513 | |||
514 | /* allow time for last message to reach serial console */ | ||
515 | sleep(2); | ||
516 | |||
508 | reboot(RB_AUTOBOOT); | 517 | reboot(RB_AUTOBOOT); |
509 | exit(0); | 518 | exit(0); |
510 | } | 519 | } |
@@ -580,7 +589,9 @@ static void check_chroot(int sig) | |||
580 | /* execute init in the (hopefully) new root */ | 589 | /* execute init in the (hopefully) new root */ |
581 | execve("/sbin/init",argv_init,envp_init); | 590 | execve("/sbin/init",argv_init,envp_init); |
582 | 591 | ||
583 | message(CONSOLE, "ERROR: Could not exec new init. Hit ctrl+alt+delete to reboot.\r\n"); | 592 | message(CONSOLE, "ERROR: Could not exec new init. Press %s to reboot.\r\n", |
593 | (secondConsole == NULL) /* serial console */ | ||
594 | ? "Reset" : "CTRL-ALT-DEL"); | ||
584 | return; | 595 | return; |
585 | } | 596 | } |
586 | #endif /* BB_FEATURE_INIT_CHROOT */ | 597 | #endif /* BB_FEATURE_INIT_CHROOT */ |
@@ -592,11 +603,14 @@ void new_initAction (initActionEnum action, | |||
592 | { | 603 | { |
593 | initAction* newAction; | 604 | initAction* newAction; |
594 | 605 | ||
606 | if (*cons == '\0') | ||
607 | cons = console; | ||
608 | |||
595 | /* If BusyBox detects that a serial console is in use, | 609 | /* If BusyBox detects that a serial console is in use, |
596 | * then entries containing non-empty id fields will _not_ be run. | 610 | * then entries not refering to the console or null devices will _not_ be run. |
597 | * The exception to this rule is the null device. | 611 | * The exception to this rule is the null device. |
598 | */ | 612 | */ |
599 | if (secondConsole == NULL && (*cons != '\0' || strncmp(cons, "null", 4))) | 613 | if (secondConsole == NULL && strcmp(cons, console) && strcmp(cons, "/dev/null")) |
600 | return; | 614 | return; |
601 | 615 | ||
602 | newAction = calloc ((size_t)(1), sizeof(initAction)); | 616 | newAction = calloc ((size_t)(1), sizeof(initAction)); |
@@ -608,10 +622,7 @@ void new_initAction (initActionEnum action, | |||
608 | initActionList = newAction; | 622 | initActionList = newAction; |
609 | strncpy( newAction->process, process, 255); | 623 | strncpy( newAction->process, process, 255); |
610 | newAction->action = action; | 624 | newAction->action = action; |
611 | if (*cons != '\0') { | 625 | strncpy(newAction->console, cons, 255); |
612 | strncpy(newAction->console, cons, 255); | ||
613 | } else | ||
614 | strncpy(newAction->console, console, 255); | ||
615 | newAction->pid = 0; | 626 | newAction->pid = 0; |
616 | // message(LOG|CONSOLE, "process='%s' action='%d' console='%s'\n", | 627 | // message(LOG|CONSOLE, "process='%s' action='%d' console='%s'\n", |
617 | // newAction->process, newAction->action, newAction->console); | 628 | // newAction->process, newAction->action, newAction->console); |
@@ -620,9 +631,13 @@ void new_initAction (initActionEnum action, | |||
620 | void delete_initAction (initAction *action) | 631 | void delete_initAction (initAction *action) |
621 | { | 632 | { |
622 | initAction *a, *b=NULL; | 633 | initAction *a, *b=NULL; |
623 | for( a=initActionList ; a; b=a, a=a->nextPtr) { | 634 | for( a=initActionList ; a ; b=a, a=a->nextPtr) { |
624 | if (a == action && b != NULL) { | 635 | if (a == action) { |
625 | b->nextPtr=a->nextPtr; | 636 | if (b==NULL) { |
637 | initActionList=a->nextPtr; | ||
638 | } else { | ||
639 | b->nextPtr=a->nextPtr; | ||
640 | } | ||
626 | free( a); | 641 | free( a); |
627 | break; | 642 | break; |
628 | } | 643 | } |
@@ -805,8 +820,8 @@ extern int init_main(int argc, char **argv) | |||
805 | /* Ask first then start a shell on tty2 */ | 820 | /* Ask first then start a shell on tty2 */ |
806 | if (secondConsole != NULL) | 821 | if (secondConsole != NULL) |
807 | new_initAction( ASKFIRST, SHELL, secondConsole); | 822 | new_initAction( ASKFIRST, SHELL, secondConsole); |
808 | /* Ask first then start a shell on tty1 */ | 823 | /* Start a shell on tty1 */ |
809 | new_initAction( ASKFIRST, SHELL, console); | 824 | new_initAction( RESPAWN, SHELL, console); |
810 | } else { | 825 | } else { |
811 | /* Not in single user mode -- see what inittab says */ | 826 | /* Not in single user mode -- see what inittab says */ |
812 | 827 | ||