diff options
| author | rsc <rsc> | 2007-08-08 08:39:23 +0000 | 
|---|---|---|
| committer | rsc <rsc> | 2007-08-08 08:39:23 +0000 | 
| commit | 39c84ccf48ca854eca47917a7585d0a2ce32f74a (patch) | |
| tree | 4b5799f49e64f2506b9c5742e580da7a77766ecf | |
| parent | f8f7fcbebdae7d3c8ac697373d0769d1ccfc31ae (diff) | |
| download | xv6-labs-39c84ccf48ca854eca47917a7585d0a2ce32f74a.tar.gz xv6-labs-39c84ccf48ca854eca47917a7585d0a2ce32f74a.tar.bz2 xv6-labs-39c84ccf48ca854eca47917a7585d0a2ce32f74a.zip | |
fix wait bug in init
| -rw-r--r-- | BUGS | 4 | ||||
| -rw-r--r-- | init.c | 7 | 
2 files changed, 4 insertions, 7 deletions
| @@ -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) +      ;    }  } | 
