aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2001-06-03 05:55:52 +0000
committerMatt Kraai <kraai@debian.org>2001-06-03 05:55:52 +0000
commit67a464033345d0fcabfda06ed5d4532da6702ecf (patch)
tree808abb28ed8b2c703697676ec882bfad4ac1010f
parent62ebe2e443cbbd45ffd78ad815630e1c9d058d47 (diff)
downloadbusybox-w32-67a464033345d0fcabfda06ed5d4532da6702ecf.tar.gz
busybox-w32-67a464033345d0fcabfda06ed5d4532da6702ecf.tar.bz2
busybox-w32-67a464033345d0fcabfda06ed5d4532da6702ecf.zip
Loop forever instead of exiting.
-rw-r--r--init.c21
-rw-r--r--init/init.c21
2 files changed, 24 insertions, 18 deletions
diff --git a/init.c b/init.c
index 370ee7294..6369ef959 100644
--- a/init.c
+++ b/init.c
@@ -185,7 +185,11 @@ static char console[32] = _PATH_CONSOLE;
185 185
186static void delete_initAction(initAction * action); 186static void delete_initAction(initAction * action);
187 187
188 188static void loop_forever()
189{
190 while (1)
191 sleep (1);
192}
189 193
190/* Print a message to the specified device. 194/* Print a message to the specified device.
191 * Device may be bitwise-or'd from LOG | CONSOLE */ 195 * Device may be bitwise-or'd from LOG | CONSOLE */
@@ -611,8 +615,7 @@ static void check_memory()
611 goodnight: 615 goodnight:
612 message(CONSOLE, 616 message(CONSOLE,
613 "Sorry, your computer does not have enough memory.\r\n"); 617 "Sorry, your computer does not have enough memory.\r\n");
614 while (1) 618 loop_forever();
615 sleep(1);
616} 619}
617 620
618/* Run all commands to be run right before halt/reboot */ 621/* Run all commands to be run right before halt/reboot */
@@ -679,7 +682,8 @@ static void halt_signal(int sig)
679 init_reboot(RB_POWER_OFF); 682 init_reboot(RB_POWER_OFF);
680 else 683 else
681 init_reboot(RB_HALT_SYSTEM); 684 init_reboot(RB_HALT_SYSTEM);
682 exit(0); 685
686 loop_forever();
683} 687}
684 688
685static void reboot_signal(int sig) 689static void reboot_signal(int sig)
@@ -692,7 +696,8 @@ static void reboot_signal(int sig)
692 sleep(2); 696 sleep(2);
693 697
694 init_reboot(RB_AUTOBOOT); 698 init_reboot(RB_AUTOBOOT);
695 exit(0); 699
700 loop_forever();
696} 701}
697 702
698static void ctrlaltdel_signal(int sig) 703static void ctrlaltdel_signal(int sig)
@@ -720,8 +725,7 @@ static void new_initAction(initActionEnum action, char *process, char *cons)
720 newAction = calloc((size_t) (1), sizeof(initAction)); 725 newAction = calloc((size_t) (1), sizeof(initAction));
721 if (!newAction) { 726 if (!newAction) {
722 message(LOG | CONSOLE, "Memory allocation failure\n"); 727 message(LOG | CONSOLE, "Memory allocation failure\n");
723 while (1) 728 loop_forever();
724 sleep(1);
725 } 729 }
726 newAction->nextPtr = initActionList; 730 newAction->nextPtr = initActionList;
727 initActionList = newAction; 731 initActionList = newAction;
@@ -993,8 +997,7 @@ extern int init_main(int argc, char **argv)
993 if (initActionList == NULL) { 997 if (initActionList == NULL) {
994 message(LOG | CONSOLE, 998 message(LOG | CONSOLE,
995 "No more tasks for init -- sleeping forever.\n"); 999 "No more tasks for init -- sleeping forever.\n");
996 while (1) 1000 loop_forever();
997 sleep(1);
998 } 1001 }
999 1002
1000 /* Now run the looping stuff for the rest of forever */ 1003 /* Now run the looping stuff for the rest of forever */
diff --git a/init/init.c b/init/init.c
index 370ee7294..6369ef959 100644
--- a/init/init.c
+++ b/init/init.c
@@ -185,7 +185,11 @@ static char console[32] = _PATH_CONSOLE;
185 185
186static void delete_initAction(initAction * action); 186static void delete_initAction(initAction * action);
187 187
188 188static void loop_forever()
189{
190 while (1)
191 sleep (1);
192}
189 193
190/* Print a message to the specified device. 194/* Print a message to the specified device.
191 * Device may be bitwise-or'd from LOG | CONSOLE */ 195 * Device may be bitwise-or'd from LOG | CONSOLE */
@@ -611,8 +615,7 @@ static void check_memory()
611 goodnight: 615 goodnight:
612 message(CONSOLE, 616 message(CONSOLE,
613 "Sorry, your computer does not have enough memory.\r\n"); 617 "Sorry, your computer does not have enough memory.\r\n");
614 while (1) 618 loop_forever();
615 sleep(1);
616} 619}
617 620
618/* Run all commands to be run right before halt/reboot */ 621/* Run all commands to be run right before halt/reboot */
@@ -679,7 +682,8 @@ static void halt_signal(int sig)
679 init_reboot(RB_POWER_OFF); 682 init_reboot(RB_POWER_OFF);
680 else 683 else
681 init_reboot(RB_HALT_SYSTEM); 684 init_reboot(RB_HALT_SYSTEM);
682 exit(0); 685
686 loop_forever();
683} 687}
684 688
685static void reboot_signal(int sig) 689static void reboot_signal(int sig)
@@ -692,7 +696,8 @@ static void reboot_signal(int sig)
692 sleep(2); 696 sleep(2);
693 697
694 init_reboot(RB_AUTOBOOT); 698 init_reboot(RB_AUTOBOOT);
695 exit(0); 699
700 loop_forever();
696} 701}
697 702
698static void ctrlaltdel_signal(int sig) 703static void ctrlaltdel_signal(int sig)
@@ -720,8 +725,7 @@ static void new_initAction(initActionEnum action, char *process, char *cons)
720 newAction = calloc((size_t) (1), sizeof(initAction)); 725 newAction = calloc((size_t) (1), sizeof(initAction));
721 if (!newAction) { 726 if (!newAction) {
722 message(LOG | CONSOLE, "Memory allocation failure\n"); 727 message(LOG | CONSOLE, "Memory allocation failure\n");
723 while (1) 728 loop_forever();
724 sleep(1);
725 } 729 }
726 newAction->nextPtr = initActionList; 730 newAction->nextPtr = initActionList;
727 initActionList = newAction; 731 initActionList = newAction;
@@ -993,8 +997,7 @@ extern int init_main(int argc, char **argv)
993 if (initActionList == NULL) { 997 if (initActionList == NULL) {
994 message(LOG | CONSOLE, 998 message(LOG | CONSOLE,
995 "No more tasks for init -- sleeping forever.\n"); 999 "No more tasks for init -- sleeping forever.\n");
996 while (1) 1000 loop_forever();
997 sleep(1);
998 } 1001 }
999 1002
1000 /* Now run the looping stuff for the rest of forever */ 1003 /* Now run the looping stuff for the rest of forever */