summaryrefslogtreecommitdiff
path: root/usertests.c
diff options
context:
space:
mode:
authorAustin Clements <[email protected]>2010-09-01 00:41:25 -0400
committerAustin Clements <[email protected]>2010-09-01 00:41:25 -0400
commitb0751a3e9bfce88cb07c1a540ceabf21f2d53b31 (patch)
tree061a378a3666ceef074118eab6b0ca02845b717a /usertests.c
parent5efca9054f1911e206831e16c2ca5ac8c8fc7c12 (diff)
downloadxv6-labs-b0751a3e9bfce88cb07c1a540ceabf21f2d53b31.tar.gz
xv6-labs-b0751a3e9bfce88cb07c1a540ceabf21f2d53b31.tar.bz2
xv6-labs-b0751a3e9bfce88cb07c1a540ceabf21f2d53b31.zip
Space police
Diffstat (limited to 'usertests.c')
-rw-r--r--usertests.c14
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();
}