Loop forever instead of exiting.

This commit is contained in:
Matt Kraai 2001-06-03 05:55:52 +00:00
parent 62ebe2e443
commit 67a4640333
2 changed files with 24 additions and 18 deletions

21
init.c
View File

@ -185,7 +185,11 @@ static char console[32] = _PATH_CONSOLE;
static void delete_initAction(initAction * action); static void delete_initAction(initAction * action);
static void loop_forever()
{
while (1)
sleep (1);
}
/* Print a message to the specified device. /* Print a message to the specified device.
* Device may be bitwise-or'd from LOG | CONSOLE */ * Device may be bitwise-or'd from LOG | CONSOLE */
@ -611,8 +615,7 @@ static void check_memory()
goodnight: goodnight:
message(CONSOLE, message(CONSOLE,
"Sorry, your computer does not have enough memory.\r\n"); "Sorry, your computer does not have enough memory.\r\n");
while (1) loop_forever();
sleep(1);
} }
/* Run all commands to be run right before halt/reboot */ /* Run all commands to be run right before halt/reboot */
@ -679,7 +682,8 @@ static void halt_signal(int sig)
init_reboot(RB_POWER_OFF); init_reboot(RB_POWER_OFF);
else else
init_reboot(RB_HALT_SYSTEM); init_reboot(RB_HALT_SYSTEM);
exit(0);
loop_forever();
} }
static void reboot_signal(int sig) static void reboot_signal(int sig)
@ -692,7 +696,8 @@ static void reboot_signal(int sig)
sleep(2); sleep(2);
init_reboot(RB_AUTOBOOT); init_reboot(RB_AUTOBOOT);
exit(0);
loop_forever();
} }
static void ctrlaltdel_signal(int sig) static void ctrlaltdel_signal(int sig)
@ -720,8 +725,7 @@ static void new_initAction(initActionEnum action, char *process, char *cons)
newAction = calloc((size_t) (1), sizeof(initAction)); newAction = calloc((size_t) (1), sizeof(initAction));
if (!newAction) { if (!newAction) {
message(LOG | CONSOLE, "Memory allocation failure\n"); message(LOG | CONSOLE, "Memory allocation failure\n");
while (1) loop_forever();
sleep(1);
} }
newAction->nextPtr = initActionList; newAction->nextPtr = initActionList;
initActionList = newAction; initActionList = newAction;
@ -993,8 +997,7 @@ extern int init_main(int argc, char **argv)
if (initActionList == NULL) { if (initActionList == NULL) {
message(LOG | CONSOLE, message(LOG | CONSOLE,
"No more tasks for init -- sleeping forever.\n"); "No more tasks for init -- sleeping forever.\n");
while (1) loop_forever();
sleep(1);
} }
/* Now run the looping stuff for the rest of forever */ /* Now run the looping stuff for the rest of forever */

View File

@ -185,7 +185,11 @@ static char console[32] = _PATH_CONSOLE;
static void delete_initAction(initAction * action); static void delete_initAction(initAction * action);
static void loop_forever()
{
while (1)
sleep (1);
}
/* Print a message to the specified device. /* Print a message to the specified device.
* Device may be bitwise-or'd from LOG | CONSOLE */ * Device may be bitwise-or'd from LOG | CONSOLE */
@ -611,8 +615,7 @@ static void check_memory()
goodnight: goodnight:
message(CONSOLE, message(CONSOLE,
"Sorry, your computer does not have enough memory.\r\n"); "Sorry, your computer does not have enough memory.\r\n");
while (1) loop_forever();
sleep(1);
} }
/* Run all commands to be run right before halt/reboot */ /* Run all commands to be run right before halt/reboot */
@ -679,7 +682,8 @@ static void halt_signal(int sig)
init_reboot(RB_POWER_OFF); init_reboot(RB_POWER_OFF);
else else
init_reboot(RB_HALT_SYSTEM); init_reboot(RB_HALT_SYSTEM);
exit(0);
loop_forever();
} }
static void reboot_signal(int sig) static void reboot_signal(int sig)
@ -692,7 +696,8 @@ static void reboot_signal(int sig)
sleep(2); sleep(2);
init_reboot(RB_AUTOBOOT); init_reboot(RB_AUTOBOOT);
exit(0);
loop_forever();
} }
static void ctrlaltdel_signal(int sig) static void ctrlaltdel_signal(int sig)
@ -720,8 +725,7 @@ static void new_initAction(initActionEnum action, char *process, char *cons)
newAction = calloc((size_t) (1), sizeof(initAction)); newAction = calloc((size_t) (1), sizeof(initAction));
if (!newAction) { if (!newAction) {
message(LOG | CONSOLE, "Memory allocation failure\n"); message(LOG | CONSOLE, "Memory allocation failure\n");
while (1) loop_forever();
sleep(1);
} }
newAction->nextPtr = initActionList; newAction->nextPtr = initActionList;
initActionList = newAction; initActionList = newAction;
@ -993,8 +997,7 @@ extern int init_main(int argc, char **argv)
if (initActionList == NULL) { if (initActionList == NULL) {
message(LOG | CONSOLE, message(LOG | CONSOLE,
"No more tasks for init -- sleeping forever.\n"); "No more tasks for init -- sleeping forever.\n");
while (1) loop_forever();
sleep(1);
} }
/* Now run the looping stuff for the rest of forever */ /* Now run the looping stuff for the rest of forever */