diff options
Diffstat (limited to 'user')
| -rw-r--r-- | user/usertests.c | 35 | 
1 files changed, 35 insertions, 0 deletions
| diff --git a/user/usertests.c b/user/usertests.c index 199346c..9d46b1a 100644 --- a/user/usertests.c +++ b/user/usertests.c @@ -507,6 +507,40 @@ twochildren(void)  }  void +forkforkfork(void) +{ +  printf(1, "forkforkfork test\n"); + +  unlink("stopforking"); + +  int pid = fork(); +  if(pid < 0){ +    printf(1, "fork failed"); +    exit(); +  } +  if(pid == 0){ +    while(1){ +      int fd = open("stopforking", 0); +      if(fd >= 0){ +        exit(); +      } +      if(fork() < 0){ +        close(open("stopforking", O_CREATE|O_RDWR)); +      } +    } + +    exit(); +  } + +  sleep(2); +  close(open("stopforking", O_CREATE|O_RDWR)); +  wait(); +  sleep(1); + +  printf(1, "forkforkfork ok\n"); +} + +void  mem(void)  {    void *m1, *m2; @@ -1824,6 +1858,7 @@ main(int argc, char *argv[])    reparent();    twochildren(); +  forkforkfork();    argptest();    createdelete(); | 
