diff options
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(); } |