summaryrefslogtreecommitdiff
path: root/src/user/app
diff options
context:
space:
mode:
authordzwdz2022-08-13 17:52:23 +0200
committerdzwdz2022-08-13 17:52:23 +0200
commit822ff022ba9caf03c26bd9260d1db3869018211b (patch)
treeb2268120de5652906b2439a986fbcb4423de46ea /src/user/app
parentd69d7614ea8b9720f934a94249ee8199bbcaf70c (diff)
user/init: restart the shell processes
Diffstat (limited to 'src/user/app')
-rw-r--r--src/user/app/init/init.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/user/app/init/init.c b/src/user/app/init/init.c
index ee8554f..d9dabc6 100644
--- a/src/user/app/init/init.c
+++ b/src/user/app/init/init.c
@@ -19,8 +19,16 @@ void redirect(const char *exe, const char *out, const char *in) {
if (!freopen(in, "r", stdin))
die(" couldn't open %s\n", in);
termcook();
- execv(exe, NULL);
- die("couldn't start %s\n", exe);
+
+ for (;;) {
+ if (!fork()) {
+ execv(exe, NULL);
+ fprintf(stderr, "init: couldn't start %s\n", exe);
+ _syscall_sleep(5000);
+ exit(1);
+ }
+ _syscall_await();
+ }
}
}
@@ -74,8 +82,8 @@ int main(void) {
close(killswitch_pipe[0]);
redirect("/bin/shell", "/kdev/com1", "/kdev/com1");
redirect("/bin/shell", "/vtty", "/keyboard");
- _syscall_await();
- printf("init: restarting children not yet implemented\n");
+ // TODO busy loop without no children
+ for (;;) _syscall_await();
exit(1);
}