diff options
author | Austin Clements <[email protected]> | 2010-09-01 00:41:25 -0400 |
---|---|---|
committer | Austin Clements <[email protected]> | 2010-09-01 00:41:25 -0400 |
commit | b0751a3e9bfce88cb07c1a540ceabf21f2d53b31 (patch) | |
tree | 061a378a3666ceef074118eab6b0ca02845b717a /usertests.c | |
parent | 5efca9054f1911e206831e16c2ca5ac8c8fc7c12 (diff) | |
download | xv6-labs-b0751a3e9bfce88cb07c1a540ceabf21f2d53b31.tar.gz xv6-labs-b0751a3e9bfce88cb07c1a540ceabf21f2d53b31.tar.bz2 xv6-labs-b0751a3e9bfce88cb07c1a540ceabf21f2d53b31.zip |
Space police
Diffstat (limited to 'usertests.c')
-rw-r--r-- | usertests.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/usertests.c b/usertests.c index 7ec03fc..946565f 100644 --- a/usertests.c +++ b/usertests.c @@ -1342,28 +1342,28 @@ sbrktest(void) printf(1, "pipe() failed\n"); exit(); } - for (i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){ - if ((pids[i] = fork()) == 0) { + for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){ + if((pids[i] = fork()) == 0) { // allocate the full 640K sbrk((640 * 1024) - (uint)sbrk(0)); write(fds[1], "x", 1); // sit around until killed - while (1) sleep(1000); + for(;;) sleep(1000); } char scratch; - if (pids[i] != -1) + if(pids[i] != -1) read(fds[0], &scratch, 1); } // if those failed allocations freed up the pages they did allocate, // we'll be able to allocate here c = sbrk(4096); - for (i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){ - if (pids[i] == -1) + for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){ + if(pids[i] == -1) continue; kill(pids[i]); wait(); } - if (c == (char*)0xffffffff) { + if(c == (char*)0xffffffff) { printf(stdout, "failed sbrk leaked memory\n"); exit(); } |