aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorturret <turret@duck.com>2023-12-18 16:07:45 -0600
committerturret <turret@duck.com>2023-12-18 16:07:45 -0600
commit22cacb4dc96faae8814a9696805314c0fcc455ba (patch)
treeac846cc45620798a0bc4538334d7d6da271a7115
parentf6408accfeef91c743e62d99b2b53bfa1d8ff337 (diff)
downloaddiscord-bot-skeleton-22cacb4dc96faae8814a9696805314c0fcc455ba.tar.gz
discord-bot-skeleton-22cacb4dc96faae8814a9696805314c0fcc455ba.tar.bz2
discord-bot-skeleton-22cacb4dc96faae8814a9696805314c0fcc455ba.zip
init: panic on no more subsystems
-rw-r--r--init/init.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/init/init.c b/init/init.c
index 29c2128..c2ae3c4 100644
--- a/init/init.c
+++ b/init/init.c
@@ -10,6 +10,7 @@
#include <util.h>
extern int subsystem_handle_term(int pid);
+extern int subsystem_count;
int mainpid = 0;
long stack_size = 8192 * 512;
char *token;
@@ -89,7 +90,7 @@ int main(void)
sigaddset(&set, SIGCHLD);
sigprocmask(SIG_BLOCK, &set, NULL);
- while(1) {
+ while(subsystem_count > 0) {
sigwaitinfo(&set, &siginfo);
int sig = siginfo.si_signo;
if(sig == SIGCHLD) {
@@ -99,4 +100,6 @@ int main(void)
print(LOG_WARNING "init: failed to reap process %d", process);
}
}
+
+ panic("init: no more subsystems");
}