diff options
author | Erik Andersen <andersen@codepoet.org> | 2000-01-07 11:40:44 +0000 |
---|---|---|
committer | Erik Andersen <andersen@codepoet.org> | 2000-01-07 11:40:44 +0000 |
commit | 96e2abd0849c1980dad10013ef0d17027554ef9f (patch) | |
tree | b4313983e7883b477552c881868bc6709f9857d0 | |
parent | 286b0de74da3cba56b8cc7961a19044eb45969b2 (diff) | |
download | busybox-w32-96e2abd0849c1980dad10013ef0d17027554ef9f.tar.gz busybox-w32-96e2abd0849c1980dad10013ef0d17027554ef9f.tar.bz2 busybox-w32-96e2abd0849c1980dad10013ef0d17027554ef9f.zip |
Init is now even more perfect then before.
-Erik
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | busybox.def.h | 13 | ||||
-rw-r--r-- | busybox.spec | 2 | ||||
-rw-r--r-- | examples/busybox.spec | 2 | ||||
-rw-r--r-- | init.c | 46 | ||||
-rw-r--r-- | init/init.c | 46 | ||||
-rwxr-xr-x | reg_test.sh | 40 |
7 files changed, 74 insertions, 81 deletions
@@ -80,12 +80,8 @@ LIBRARIES= | |||
80 | OBJECTS=$(shell ./busybox.sh) | 80 | OBJECTS=$(shell ./busybox.sh) |
81 | CFLAGS+= -DBB_VER='"$(VERSION)"' | 81 | CFLAGS+= -DBB_VER='"$(VERSION)"' |
82 | CFLAGS+= -DBB_BT='"$(BUILDTIME)"' | 82 | CFLAGS+= -DBB_BT='"$(BUILDTIME)"' |
83 | ifdef BB_INIT_RC_EXIT_CMD | ||
84 | CFLAGS += -DBB_INIT_CMD_IF_RC_SCRIPT_EXITS=${BB_INIT_RC_EXIT_CMD} | ||
85 | endif | ||
86 | |||
87 | ifdef BB_INIT_SCRIPT | 83 | ifdef BB_INIT_SCRIPT |
88 | CFLAGS += -DBB_INIT_SCRIPT=${BB_INIT_SCRIPT} | 84 | CFLAGS += -DINIT_SCRIPT=${BB_INIT_SCRIPT} |
89 | endif | 85 | endif |
90 | 86 | ||
91 | all: busybox busybox.links | 87 | all: busybox busybox.links |
diff --git a/busybox.def.h b/busybox.def.h index 032146519..834555302 100644 --- a/busybox.def.h +++ b/busybox.def.h | |||
@@ -88,6 +88,12 @@ | |||
88 | // | 88 | // |
89 | // | 89 | // |
90 | // | 90 | // |
91 | // Don't turn BB_UTILITY off. It contains support code | ||
92 | // that compiles to 0 if everything else if turned off. | ||
93 | #define BB_UTILITY | ||
94 | // | ||
95 | // | ||
96 | // | ||
91 | // This is where feature definitions go. Generally speaking, | 97 | // This is where feature definitions go. Generally speaking, |
92 | // turning this stuff off makes things a bit smaller (and less | 98 | // turning this stuff off makes things a bit smaller (and less |
93 | // pretty/useful). | 99 | // pretty/useful). |
@@ -113,10 +119,3 @@ | |||
113 | //Enable init being called as /linuxrc | 119 | //Enable init being called as /linuxrc |
114 | #define BB_FEATURE_LINUXRC | 120 | #define BB_FEATURE_LINUXRC |
115 | // | 121 | // |
116 | // | ||
117 | // | ||
118 | // Don't turn BB_UTILITY off. It contains support code | ||
119 | // that compiles to 0 if everything else if turned off. | ||
120 | #define BB_UTILITY | ||
121 | // | ||
122 | // | ||
diff --git a/busybox.spec b/busybox.spec index a8520074e..d1a702642 100644 --- a/busybox.spec +++ b/busybox.spec | |||
@@ -21,7 +21,7 @@ embedded system. | |||
21 | %setup -q -n %{Name}-%{Version} | 21 | %setup -q -n %{Name}-%{Version} |
22 | 22 | ||
23 | %Build | 23 | %Build |
24 | BB_INIT_RC_EXIT_CMD=\"/bin/sh\" BB_INIT_SCRIPT=\"/etc/rc.d/init.d/rcS\" make | 24 | BB_INIT_SCRIPT='\"/etc/rc.d/init.d/rcS\"' make |
25 | 25 | ||
26 | %Install | 26 | %Install |
27 | rm -rf $RPM_BUILD_ROOT | 27 | rm -rf $RPM_BUILD_ROOT |
diff --git a/examples/busybox.spec b/examples/busybox.spec index a8520074e..d1a702642 100644 --- a/examples/busybox.spec +++ b/examples/busybox.spec | |||
@@ -21,7 +21,7 @@ embedded system. | |||
21 | %setup -q -n %{Name}-%{Version} | 21 | %setup -q -n %{Name}-%{Version} |
22 | 22 | ||
23 | %Build | 23 | %Build |
24 | BB_INIT_RC_EXIT_CMD=\"/bin/sh\" BB_INIT_SCRIPT=\"/etc/rc.d/init.d/rcS\" make | 24 | BB_INIT_SCRIPT='\"/etc/rc.d/init.d/rcS\"' make |
25 | 25 | ||
26 | %Install | 26 | %Install |
27 | rm -rf $RPM_BUILD_ROOT | 27 | rm -rf $RPM_BUILD_ROOT |
@@ -61,9 +61,11 @@ | |||
61 | #define VT_LOG "/dev/tty3" /* Virtual console */ | 61 | #define VT_LOG "/dev/tty3" /* Virtual console */ |
62 | #define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */ | 62 | #define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */ |
63 | #define SERIAL_CON1 "/dev/ttyS1" /* Serial console */ | 63 | #define SERIAL_CON1 "/dev/ttyS1" /* Serial console */ |
64 | #define SHELL "-sh" /* Default shell */ | 64 | #define SHELL "/bin/sh" /* Default shell */ |
65 | #define INITTAB "/etc/inittab" /* inittab file location */ | 65 | #define INITTAB "/etc/inittab" /* inittab file location */ |
66 | #ifndef INIT_SCRIPT | ||
66 | #define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */ | 67 | #define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */ |
68 | #endif | ||
67 | 69 | ||
68 | #define LOG 0x1 | 70 | #define LOG 0x1 |
69 | #define CONSOLE 0x2 | 71 | #define CONSOLE 0x2 |
@@ -330,6 +332,7 @@ static pid_t run(char* command, | |||
330 | "\nPlease press Enter to activate this console. "; | 332 | "\nPlease press Enter to activate this console. "; |
331 | 333 | ||
332 | if ((pid = fork()) == 0) { | 334 | if ((pid = fork()) == 0) { |
335 | int fd; | ||
333 | pid_t shell_pgid = getpid (); | 336 | pid_t shell_pgid = getpid (); |
334 | 337 | ||
335 | /* Clean up */ | 338 | /* Clean up */ |
@@ -338,17 +341,14 @@ static pid_t run(char* command, | |||
338 | close(2); | 341 | close(2); |
339 | setsid(); | 342 | setsid(); |
340 | 343 | ||
341 | if (device_open(terminal, O_RDWR) < 0) { | 344 | if ((fd=device_open(terminal, O_RDWR)) < 0) { |
342 | message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal); | 345 | message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal); |
343 | exit(1); | 346 | exit(1); |
344 | } | 347 | } |
345 | dup(0); | 348 | dup(fd); |
346 | dup(0); | 349 | dup(fd); |
347 | /* Grab control of the terminal. */ | 350 | set_term(fd); |
348 | if (tcsetpgrp (0, getpgrp()) < 0) { | 351 | tcsetpgrp (fd, getpgrp()); |
349 | message(LOG|CONSOLE, "tcsetpgrp error: %s\r\n", strerror(errno)); | ||
350 | } | ||
351 | set_term(0); | ||
352 | 352 | ||
353 | /* Reset signal handlers set for parent process */ | 353 | /* Reset signal handlers set for parent process */ |
354 | signal(SIGUSR1, SIG_DFL); | 354 | signal(SIGUSR1, SIG_DFL); |
@@ -497,7 +497,7 @@ static void reboot_signal(int sig) | |||
497 | 497 | ||
498 | #endif | 498 | #endif |
499 | 499 | ||
500 | void new_initAction (const struct initActionType *a, | 500 | void new_initAction (initActionEnum action, |
501 | char* process, char* cons) | 501 | char* process, char* cons) |
502 | { | 502 | { |
503 | initAction* newAction; | 503 | initAction* newAction; |
@@ -517,7 +517,7 @@ void new_initAction (const struct initActionType *a, | |||
517 | newAction->nextPtr = initActionList; | 517 | newAction->nextPtr = initActionList; |
518 | initActionList = newAction; | 518 | initActionList = newAction; |
519 | strncpy( newAction->process, process, 255); | 519 | strncpy( newAction->process, process, 255); |
520 | newAction->action = a->action; | 520 | newAction->action = action; |
521 | if (*cons != '\0') { | 521 | if (*cons != '\0') { |
522 | strncpy(newAction->console, cons, 255); | 522 | strncpy(newAction->console, cons, 255); |
523 | } else | 523 | } else |
@@ -561,12 +561,12 @@ void parse_inittab(void) | |||
561 | /* No inittab file -- set up some default behavior */ | 561 | /* No inittab file -- set up some default behavior */ |
562 | #endif | 562 | #endif |
563 | /* Askfirst shell on tty1 */ | 563 | /* Askfirst shell on tty1 */ |
564 | new_initAction( &(actions[3]), SHELL, console ); | 564 | new_initAction( ASKFIRST, SHELL, console ); |
565 | /* Askfirst shell on tty2 */ | 565 | /* Askfirst shell on tty2 */ |
566 | if (second_console != NULL) | 566 | if (second_console != NULL) |
567 | new_initAction( &(actions[3]), SHELL, second_console ); | 567 | new_initAction( ASKFIRST, SHELL, second_console ); |
568 | /* sysinit */ | 568 | /* sysinit */ |
569 | new_initAction( &(actions[0]), INIT_SCRIPT, console ); | 569 | new_initAction( SYSINIT, INIT_SCRIPT, console ); |
570 | 570 | ||
571 | return; | 571 | return; |
572 | #ifdef BB_FEATURE_USE_INITTAB | 572 | #ifdef BB_FEATURE_USE_INITTAB |
@@ -584,7 +584,6 @@ void parse_inittab(void) | |||
584 | 584 | ||
585 | /* Keep a copy around for posterity's sake (and error msgs) */ | 585 | /* Keep a copy around for posterity's sake (and error msgs) */ |
586 | strcpy(lineAsRead, buf); | 586 | strcpy(lineAsRead, buf); |
587 | message(LOG|CONSOLE, "read='%s'\n", lineAsRead); | ||
588 | 587 | ||
589 | /* Grab the ID field */ | 588 | /* Grab the ID field */ |
590 | s=p; | 589 | s=p; |
@@ -628,7 +627,7 @@ message(LOG|CONSOLE, "read='%s'\n", lineAsRead); | |||
628 | } | 627 | } |
629 | s = tmpConsole; | 628 | s = tmpConsole; |
630 | } | 629 | } |
631 | new_initAction( a, q, s); | 630 | new_initAction( a->action, q, s); |
632 | foundIt=TRUE; | 631 | foundIt=TRUE; |
633 | } | 632 | } |
634 | a++; | 633 | a++; |
@@ -712,9 +711,9 @@ extern int init_main(int argc, char **argv) | |||
712 | { | 711 | { |
713 | /* Ask first then start a shell on tty2 */ | 712 | /* Ask first then start a shell on tty2 */ |
714 | if (second_console != NULL) | 713 | if (second_console != NULL) |
715 | new_initAction( &(actions[3]), SHELL, second_console); | 714 | new_initAction( ASKFIRST, SHELL, second_console); |
716 | /* Ask first then start a shell on tty1 */ | 715 | /* Ask first then start a shell on tty1 */ |
717 | new_initAction( &(actions[3]), SHELL, console); | 716 | new_initAction( ASKFIRST, SHELL, console); |
718 | } else { | 717 | } else { |
719 | /* Not in single user mode -- see what inittab says */ | 718 | /* Not in single user mode -- see what inittab says */ |
720 | 719 | ||
@@ -731,7 +730,7 @@ extern int init_main(int argc, char **argv) | |||
731 | /* First run the sysinit command */ | 730 | /* First run the sysinit command */ |
732 | for( a=initActionList ; a; a=a->nextPtr) { | 731 | for( a=initActionList ; a; a=a->nextPtr) { |
733 | if (a->action == SYSINIT) { | 732 | if (a->action == SYSINIT) { |
734 | waitfor(a->process, console, FALSE); | 733 | waitfor(a->process, a->console, FALSE); |
735 | /* Now remove the "sysinit" entry from the list */ | 734 | /* Now remove the "sysinit" entry from the list */ |
736 | delete_initAction( a); | 735 | delete_initAction( a); |
737 | } | 736 | } |
@@ -739,7 +738,7 @@ extern int init_main(int argc, char **argv) | |||
739 | /* Next run anything that wants to block */ | 738 | /* Next run anything that wants to block */ |
740 | for( a=initActionList ; a; a=a->nextPtr) { | 739 | for( a=initActionList ; a; a=a->nextPtr) { |
741 | if (a->action == WAIT) { | 740 | if (a->action == WAIT) { |
742 | waitfor(a->process, console, FALSE); | 741 | waitfor(a->process, a->console, FALSE); |
743 | /* Now remove the "wait" entry from the list */ | 742 | /* Now remove the "wait" entry from the list */ |
744 | delete_initAction( a); | 743 | delete_initAction( a); |
745 | } | 744 | } |
@@ -747,7 +746,7 @@ extern int init_main(int argc, char **argv) | |||
747 | /* Next run anything to be run only once */ | 746 | /* Next run anything to be run only once */ |
748 | for( a=initActionList ; a; a=a->nextPtr) { | 747 | for( a=initActionList ; a; a=a->nextPtr) { |
749 | if (a->action == ONCE) { | 748 | if (a->action == ONCE) { |
750 | run(a->process, console, FALSE); | 749 | run(a->process, a->console, FALSE); |
751 | /* Now remove the "once" entry from the list */ | 750 | /* Now remove the "once" entry from the list */ |
752 | delete_initAction( a); | 751 | delete_initAction( a); |
753 | } | 752 | } |
@@ -760,7 +759,6 @@ extern int init_main(int argc, char **argv) | |||
760 | 759 | ||
761 | /* Now run the looping stuff for the rest of forever */ | 760 | /* Now run the looping stuff for the rest of forever */ |
762 | while (1) { | 761 | while (1) { |
763 | message(LOG|CONSOLE, "Looping\n"); | ||
764 | for( a=initActionList ; a; a=a->nextPtr) { | 762 | for( a=initActionList ; a; a=a->nextPtr) { |
765 | /* Only run stuff with pid==0. If they have | 763 | /* Only run stuff with pid==0. If they have |
766 | * a pid, that means they are still running */ | 764 | * a pid, that means they are still running */ |
@@ -768,11 +766,11 @@ extern int init_main(int argc, char **argv) | |||
768 | switch(a->action) { | 766 | switch(a->action) { |
769 | case RESPAWN: | 767 | case RESPAWN: |
770 | /* run the respawn stuff */ | 768 | /* run the respawn stuff */ |
771 | a->pid = run(a->process, console, FALSE); | 769 | a->pid = run(a->process, a->console, FALSE); |
772 | break; | 770 | break; |
773 | case ASKFIRST: | 771 | case ASKFIRST: |
774 | /* run the askfirst stuff */ | 772 | /* run the askfirst stuff */ |
775 | a->pid = run(a->process, console, TRUE); | 773 | a->pid = run(a->process, a->console, TRUE); |
776 | break; | 774 | break; |
777 | /* silence the compiler's incessant whining */ | 775 | /* silence the compiler's incessant whining */ |
778 | default: | 776 | default: |
diff --git a/init/init.c b/init/init.c index 0472208c5..88b8ed1c1 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -61,9 +61,11 @@ | |||
61 | #define VT_LOG "/dev/tty3" /* Virtual console */ | 61 | #define VT_LOG "/dev/tty3" /* Virtual console */ |
62 | #define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */ | 62 | #define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */ |
63 | #define SERIAL_CON1 "/dev/ttyS1" /* Serial console */ | 63 | #define SERIAL_CON1 "/dev/ttyS1" /* Serial console */ |
64 | #define SHELL "-sh" /* Default shell */ | 64 | #define SHELL "/bin/sh" /* Default shell */ |
65 | #define INITTAB "/etc/inittab" /* inittab file location */ | 65 | #define INITTAB "/etc/inittab" /* inittab file location */ |
66 | #ifndef INIT_SCRIPT | ||
66 | #define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */ | 67 | #define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */ |
68 | #endif | ||
67 | 69 | ||
68 | #define LOG 0x1 | 70 | #define LOG 0x1 |
69 | #define CONSOLE 0x2 | 71 | #define CONSOLE 0x2 |
@@ -330,6 +332,7 @@ static pid_t run(char* command, | |||
330 | "\nPlease press Enter to activate this console. "; | 332 | "\nPlease press Enter to activate this console. "; |
331 | 333 | ||
332 | if ((pid = fork()) == 0) { | 334 | if ((pid = fork()) == 0) { |
335 | int fd; | ||
333 | pid_t shell_pgid = getpid (); | 336 | pid_t shell_pgid = getpid (); |
334 | 337 | ||
335 | /* Clean up */ | 338 | /* Clean up */ |
@@ -338,17 +341,14 @@ static pid_t run(char* command, | |||
338 | close(2); | 341 | close(2); |
339 | setsid(); | 342 | setsid(); |
340 | 343 | ||
341 | if (device_open(terminal, O_RDWR) < 0) { | 344 | if ((fd=device_open(terminal, O_RDWR)) < 0) { |
342 | message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal); | 345 | message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal); |
343 | exit(1); | 346 | exit(1); |
344 | } | 347 | } |
345 | dup(0); | 348 | dup(fd); |
346 | dup(0); | 349 | dup(fd); |
347 | /* Grab control of the terminal. */ | 350 | set_term(fd); |
348 | if (tcsetpgrp (0, getpgrp()) < 0) { | 351 | tcsetpgrp (fd, getpgrp()); |
349 | message(LOG|CONSOLE, "tcsetpgrp error: %s\r\n", strerror(errno)); | ||
350 | } | ||
351 | set_term(0); | ||
352 | 352 | ||
353 | /* Reset signal handlers set for parent process */ | 353 | /* Reset signal handlers set for parent process */ |
354 | signal(SIGUSR1, SIG_DFL); | 354 | signal(SIGUSR1, SIG_DFL); |
@@ -497,7 +497,7 @@ static void reboot_signal(int sig) | |||
497 | 497 | ||
498 | #endif | 498 | #endif |
499 | 499 | ||
500 | void new_initAction (const struct initActionType *a, | 500 | void new_initAction (initActionEnum action, |
501 | char* process, char* cons) | 501 | char* process, char* cons) |
502 | { | 502 | { |
503 | initAction* newAction; | 503 | initAction* newAction; |
@@ -517,7 +517,7 @@ void new_initAction (const struct initActionType *a, | |||
517 | newAction->nextPtr = initActionList; | 517 | newAction->nextPtr = initActionList; |
518 | initActionList = newAction; | 518 | initActionList = newAction; |
519 | strncpy( newAction->process, process, 255); | 519 | strncpy( newAction->process, process, 255); |
520 | newAction->action = a->action; | 520 | newAction->action = action; |
521 | if (*cons != '\0') { | 521 | if (*cons != '\0') { |
522 | strncpy(newAction->console, cons, 255); | 522 | strncpy(newAction->console, cons, 255); |
523 | } else | 523 | } else |
@@ -561,12 +561,12 @@ void parse_inittab(void) | |||
561 | /* No inittab file -- set up some default behavior */ | 561 | /* No inittab file -- set up some default behavior */ |
562 | #endif | 562 | #endif |
563 | /* Askfirst shell on tty1 */ | 563 | /* Askfirst shell on tty1 */ |
564 | new_initAction( &(actions[3]), SHELL, console ); | 564 | new_initAction( ASKFIRST, SHELL, console ); |
565 | /* Askfirst shell on tty2 */ | 565 | /* Askfirst shell on tty2 */ |
566 | if (second_console != NULL) | 566 | if (second_console != NULL) |
567 | new_initAction( &(actions[3]), SHELL, second_console ); | 567 | new_initAction( ASKFIRST, SHELL, second_console ); |
568 | /* sysinit */ | 568 | /* sysinit */ |
569 | new_initAction( &(actions[0]), INIT_SCRIPT, console ); | 569 | new_initAction( SYSINIT, INIT_SCRIPT, console ); |
570 | 570 | ||
571 | return; | 571 | return; |
572 | #ifdef BB_FEATURE_USE_INITTAB | 572 | #ifdef BB_FEATURE_USE_INITTAB |
@@ -584,7 +584,6 @@ void parse_inittab(void) | |||
584 | 584 | ||
585 | /* Keep a copy around for posterity's sake (and error msgs) */ | 585 | /* Keep a copy around for posterity's sake (and error msgs) */ |
586 | strcpy(lineAsRead, buf); | 586 | strcpy(lineAsRead, buf); |
587 | message(LOG|CONSOLE, "read='%s'\n", lineAsRead); | ||
588 | 587 | ||
589 | /* Grab the ID field */ | 588 | /* Grab the ID field */ |
590 | s=p; | 589 | s=p; |
@@ -628,7 +627,7 @@ message(LOG|CONSOLE, "read='%s'\n", lineAsRead); | |||
628 | } | 627 | } |
629 | s = tmpConsole; | 628 | s = tmpConsole; |
630 | } | 629 | } |
631 | new_initAction( a, q, s); | 630 | new_initAction( a->action, q, s); |
632 | foundIt=TRUE; | 631 | foundIt=TRUE; |
633 | } | 632 | } |
634 | a++; | 633 | a++; |
@@ -712,9 +711,9 @@ extern int init_main(int argc, char **argv) | |||
712 | { | 711 | { |
713 | /* Ask first then start a shell on tty2 */ | 712 | /* Ask first then start a shell on tty2 */ |
714 | if (second_console != NULL) | 713 | if (second_console != NULL) |
715 | new_initAction( &(actions[3]), SHELL, second_console); | 714 | new_initAction( ASKFIRST, SHELL, second_console); |
716 | /* Ask first then start a shell on tty1 */ | 715 | /* Ask first then start a shell on tty1 */ |
717 | new_initAction( &(actions[3]), SHELL, console); | 716 | new_initAction( ASKFIRST, SHELL, console); |
718 | } else { | 717 | } else { |
719 | /* Not in single user mode -- see what inittab says */ | 718 | /* Not in single user mode -- see what inittab says */ |
720 | 719 | ||
@@ -731,7 +730,7 @@ extern int init_main(int argc, char **argv) | |||
731 | /* First run the sysinit command */ | 730 | /* First run the sysinit command */ |
732 | for( a=initActionList ; a; a=a->nextPtr) { | 731 | for( a=initActionList ; a; a=a->nextPtr) { |
733 | if (a->action == SYSINIT) { | 732 | if (a->action == SYSINIT) { |
734 | waitfor(a->process, console, FALSE); | 733 | waitfor(a->process, a->console, FALSE); |
735 | /* Now remove the "sysinit" entry from the list */ | 734 | /* Now remove the "sysinit" entry from the list */ |
736 | delete_initAction( a); | 735 | delete_initAction( a); |
737 | } | 736 | } |
@@ -739,7 +738,7 @@ extern int init_main(int argc, char **argv) | |||
739 | /* Next run anything that wants to block */ | 738 | /* Next run anything that wants to block */ |
740 | for( a=initActionList ; a; a=a->nextPtr) { | 739 | for( a=initActionList ; a; a=a->nextPtr) { |
741 | if (a->action == WAIT) { | 740 | if (a->action == WAIT) { |
742 | waitfor(a->process, console, FALSE); | 741 | waitfor(a->process, a->console, FALSE); |
743 | /* Now remove the "wait" entry from the list */ | 742 | /* Now remove the "wait" entry from the list */ |
744 | delete_initAction( a); | 743 | delete_initAction( a); |
745 | } | 744 | } |
@@ -747,7 +746,7 @@ extern int init_main(int argc, char **argv) | |||
747 | /* Next run anything to be run only once */ | 746 | /* Next run anything to be run only once */ |
748 | for( a=initActionList ; a; a=a->nextPtr) { | 747 | for( a=initActionList ; a; a=a->nextPtr) { |
749 | if (a->action == ONCE) { | 748 | if (a->action == ONCE) { |
750 | run(a->process, console, FALSE); | 749 | run(a->process, a->console, FALSE); |
751 | /* Now remove the "once" entry from the list */ | 750 | /* Now remove the "once" entry from the list */ |
752 | delete_initAction( a); | 751 | delete_initAction( a); |
753 | } | 752 | } |
@@ -760,7 +759,6 @@ extern int init_main(int argc, char **argv) | |||
760 | 759 | ||
761 | /* Now run the looping stuff for the rest of forever */ | 760 | /* Now run the looping stuff for the rest of forever */ |
762 | while (1) { | 761 | while (1) { |
763 | message(LOG|CONSOLE, "Looping\n"); | ||
764 | for( a=initActionList ; a; a=a->nextPtr) { | 762 | for( a=initActionList ; a; a=a->nextPtr) { |
765 | /* Only run stuff with pid==0. If they have | 763 | /* Only run stuff with pid==0. If they have |
766 | * a pid, that means they are still running */ | 764 | * a pid, that means they are still running */ |
@@ -768,11 +766,11 @@ extern int init_main(int argc, char **argv) | |||
768 | switch(a->action) { | 766 | switch(a->action) { |
769 | case RESPAWN: | 767 | case RESPAWN: |
770 | /* run the respawn stuff */ | 768 | /* run the respawn stuff */ |
771 | a->pid = run(a->process, console, FALSE); | 769 | a->pid = run(a->process, a->console, FALSE); |
772 | break; | 770 | break; |
773 | case ASKFIRST: | 771 | case ASKFIRST: |
774 | /* run the askfirst stuff */ | 772 | /* run the askfirst stuff */ |
775 | a->pid = run(a->process, console, TRUE); | 773 | a->pid = run(a->process, a->console, TRUE); |
776 | break; | 774 | break; |
777 | /* silence the compiler's incessant whining */ | 775 | /* silence the compiler's incessant whining */ |
778 | default: | 776 | default: |
diff --git a/reg_test.sh b/reg_test.sh index 0a30ae305..2a73fc511 100755 --- a/reg_test.sh +++ b/reg_test.sh | |||
@@ -6,26 +6,22 @@ rm -rf testdir | |||
6 | ./busybox cp tar.c testdir | 6 | ./busybox cp tar.c testdir |
7 | 7 | ||
8 | if ! eval diff -u tar.c testdir ; then | 8 | if ! eval diff -u tar.c testdir ; then |
9 | echo " " | ||
10 | echo "Bummer. File copy failed." | 9 | echo "Bummer. File copy failed." |
11 | exit 0 | 10 | exit 0 |
12 | else | 11 | else |
13 | echo "Cool. File copy is ok." | 12 | echo "Cool. File copy is ok." |
14 | fi | 13 | fi |
15 | echo " " | ||
16 | 14 | ||
17 | rm -rf testdir | 15 | rm -rf testdir |
18 | mkdir -p testdir/foo | 16 | mkdir -p testdir/foo |
19 | ./busybox cp tar.c testdir/foo | 17 | ./busybox cp tar.c testdir/foo |
20 | 18 | ||
21 | if ! eval diff -u tar.c testdir/foo/tar.c ; then | 19 | if ! eval diff -u tar.c testdir/foo/tar.c ; then |
22 | echo " " | ||
23 | echo "Bummer. File copy to a directory failed." | 20 | echo "Bummer. File copy to a directory failed." |
24 | exit 0 | 21 | exit 0 |
25 | else | 22 | else |
26 | echo "Cool. File copy to a directory is ok." | 23 | echo "Cool. File copy to a directory is ok." |
27 | fi | 24 | fi |
28 | echo " " | ||
29 | 25 | ||
30 | 26 | ||
31 | rm -rf testdir | 27 | rm -rf testdir |
@@ -33,13 +29,11 @@ mkdir -p testdir/foo | |||
33 | ./busybox cp tar.c testdir/foo/ | 29 | ./busybox cp tar.c testdir/foo/ |
34 | 30 | ||
35 | if ! eval diff -u tar.c testdir/foo/tar.c ; then | 31 | if ! eval diff -u tar.c testdir/foo/tar.c ; then |
36 | echo " " | ||
37 | echo "Bummer. File copy to a directory w/ a '/' failed." | 32 | echo "Bummer. File copy to a directory w/ a '/' failed." |
38 | exit 0 | 33 | exit 0 |
39 | else | 34 | else |
40 | echo "Cool. File copy to a directory w/ a '/' is ok." | 35 | echo "Cool. File copy to a directory w/ a '/' is ok." |
41 | fi | 36 | fi |
42 | echo " " | ||
43 | 37 | ||
44 | 38 | ||
45 | rm -rf testdir X11 | 39 | rm -rf testdir X11 |
@@ -47,63 +41,53 @@ cp -a /etc/X11 . | |||
47 | ./busybox cp -a X11 testdir | 41 | ./busybox cp -a X11 testdir |
48 | 42 | ||
49 | if ! eval diff -ur X11 testdir ; then | 43 | if ! eval diff -ur X11 testdir ; then |
50 | echo " " | ||
51 | echo "Bummer. Local dir copy failed." | 44 | echo "Bummer. Local dir copy failed." |
52 | exit 0 | 45 | exit 0 |
53 | else | 46 | else |
54 | echo "Cool. Local dir copy is ok." | 47 | echo "Cool. Local dir copy is ok." |
55 | fi | 48 | fi |
56 | echo " " | ||
57 | 49 | ||
58 | rm -rf testdir X11 | 50 | rm -rf testdir X11 |
59 | cp -a /etc/X11 . | 51 | cp -a /etc/X11 . |
60 | ./busybox cp -a X11 testdir/ | 52 | ./busybox cp -a X11 testdir/ |
61 | 53 | ||
62 | if ! eval diff -ur X11 testdir ; then | 54 | if ! eval diff -ur X11 testdir ; then |
63 | echo " " | ||
64 | echo "Bummer. Local dir copy w/ a '/' failed." | 55 | echo "Bummer. Local dir copy w/ a '/' failed." |
65 | exit 0 | 56 | exit 0 |
66 | else | 57 | else |
67 | echo "Cool. Local dir copy w/ a '/' is ok." | 58 | echo "Cool. Local dir copy w/ a '/' is ok." |
68 | fi | 59 | fi |
69 | echo " " | ||
70 | 60 | ||
71 | rm -rf testdir X11 | 61 | rm -rf testdir X11 |
72 | cp -a /etc/X11 . | 62 | cp -a /etc/X11 . |
73 | ./busybox cp -a X11/ testdir | 63 | ./busybox cp -a X11/ testdir |
74 | 64 | ||
75 | if ! eval diff -ur X11 testdir ; then | 65 | if ! eval diff -ur X11 testdir ; then |
76 | echo " " | ||
77 | echo "Bummer. Local dir copy w/ a src '/' failed." | 66 | echo "Bummer. Local dir copy w/ a src '/' failed." |
78 | exit 0 | 67 | exit 0 |
79 | else | 68 | else |
80 | echo "Cool. Local dir copy w/ a src '/' is ok." | 69 | echo "Cool. Local dir copy w/ a src '/' is ok." |
81 | fi | 70 | fi |
82 | echo " " | ||
83 | 71 | ||
84 | rm -rf testdir X11 | 72 | rm -rf testdir X11 |
85 | cp -a /etc/X11 . | 73 | cp -a /etc/X11 . |
86 | ./busybox cp -a X11/ testdir/ | 74 | ./busybox cp -a X11/ testdir/ |
87 | 75 | ||
88 | if ! eval diff -ur X11 testdir ; then | 76 | if ! eval diff -ur X11 testdir ; then |
89 | echo " " | ||
90 | echo "Bummer. Local dir copy w/ 2x '/'s failed." | 77 | echo "Bummer. Local dir copy w/ 2x '/'s failed." |
91 | exit 0 | 78 | exit 0 |
92 | else | 79 | else |
93 | echo "Cool. Local dir copy w/ 2x '/'s is ok." | 80 | echo "Cool. Local dir copy w/ 2x '/'s is ok." |
94 | fi | 81 | fi |
95 | echo " " | ||
96 | 82 | ||
97 | rm -rf testdir X11 | 83 | rm -rf testdir X11 |
98 | ./busybox cp -a /etc/X11 testdir | 84 | ./busybox cp -a /etc/X11 testdir |
99 | if ! eval diff -ur /etc/X11 testdir ; then | 85 | if ! eval diff -ur /etc/X11 testdir ; then |
100 | echo " " | ||
101 | echo "Bummer. Remote dir copy failed." | 86 | echo "Bummer. Remote dir copy failed." |
102 | exit 0 | 87 | exit 0 |
103 | else | 88 | else |
104 | echo "Cool. Remote dir copy is ok." | 89 | echo "Cool. Remote dir copy is ok." |
105 | fi | 90 | fi |
106 | echo " " | ||
107 | 91 | ||
108 | 92 | ||
109 | rm -rf testdir X11 | 93 | rm -rf testdir X11 |
@@ -111,13 +95,11 @@ mkdir -p testdir/foo | |||
111 | 95 | ||
112 | ./busybox cp -a /etc/X11 testdir/foo | 96 | ./busybox cp -a /etc/X11 testdir/foo |
113 | if ! eval diff -ur /etc/X11 testdir/foo ; then | 97 | if ! eval diff -ur /etc/X11 testdir/foo ; then |
114 | echo " " | ||
115 | echo "Bummer. Remote dir copy to a directory failed." | 98 | echo "Bummer. Remote dir copy to a directory failed." |
116 | exit 0 | 99 | exit 0 |
117 | else | 100 | else |
118 | echo "Cool. Remote dir copy to a directory is ok." | 101 | echo "Cool. Remote dir copy to a directory is ok." |
119 | fi | 102 | fi |
120 | echo " " | ||
121 | 103 | ||
122 | 104 | ||
123 | rm -rf testdir X11 | 105 | rm -rf testdir X11 |
@@ -125,7 +107,6 @@ mkdir -p testdir/foo | |||
125 | 107 | ||
126 | ./busybox cp -a /etc/X11 testdir/foo/ | 108 | ./busybox cp -a /etc/X11 testdir/foo/ |
127 | if ! eval diff -ur /etc/X11 testdir/foo ; then | 109 | if ! eval diff -ur /etc/X11 testdir/foo ; then |
128 | echo " " | ||
129 | echo "Bummer. Remote dir copy to a directory w/ a '/' failed." | 110 | echo "Bummer. Remote dir copy to a directory w/ a '/' failed." |
130 | exit 0 | 111 | exit 0 |
131 | else | 112 | else |
@@ -134,3 +115,24 @@ fi | |||
134 | 115 | ||
135 | rm -rf testdir | 116 | rm -rf testdir |
136 | 117 | ||
118 | |||
119 | rm -rf foo bar | ||
120 | mkdir foo | ||
121 | mkdir bar | ||
122 | |||
123 | if ! eval ./busybox cp README foo ; then | ||
124 | echo "Bummer. cp README foo failed." | ||
125 | exit 0 | ||
126 | else | ||
127 | echo "Cool. cp README foo is ok." | ||
128 | fi | ||
129 | |||
130 | if ! eval ./busybox cp foo/README bar ; then | ||
131 | echo "Bummer. cp foo/README bar failed." | ||
132 | exit 0 | ||
133 | else | ||
134 | echo "Cool. cp foo/README bar is ok." | ||
135 | fi | ||
136 | |||
137 | rm -rf foo bar | ||
138 | |||