Skip to content
Snippets Groups Projects
Commit 39c84ccf authored by rsc's avatar rsc
Browse files

fix wait bug in init

parent f8f7fcbe
No related branches found
No related tags found
No related merge requests found
......@@ -11,10 +11,6 @@ main.c:
cpus[0] -> cpus[bcpu]
init.c:
should while(wait() >= 0);
not just wait();
proc.c:
comment at top of scheduler() should say
via longjmp back to the scheduler
......
......@@ -11,7 +11,7 @@ char *sh_args[] = { "sh", 0 };
int
main(void)
{
int pid;
int pid, wpid;
if(open("console", O_RDWR) < 0){
mknod("console", T_DEV, 1, 1);
......@@ -21,6 +21,7 @@ main(void)
dup(0); // stderr
for(;;){
puts("init: starting sh\n");
pid = fork();
if(pid < 0){
puts("init: fork failed\n");
......@@ -30,8 +31,8 @@ main(void)
exec("sh", sh_args);
puts("init: exec sh failed\n");
exit();
} else {
wait();
}
while((wpid=wait()) >= 0 && wpid != pid)
;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment