summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsc <rsc>2009-05-31 00:31:20 +0000
committerrsc <rsc>2009-05-31 00:31:20 +0000
commitdae9b0d48a94683c0a49e88e4b739482788d7175 (patch)
tree1319b4d936ee730c5f4e1ec28e74dd5170e6e24b
parent19333efb9eb634f17bea41d0cec8ee28c595cce8 (diff)
downloadxv6-labs-dae9b0d48a94683c0a49e88e4b739482788d7175.tar.gz
xv6-labs-dae9b0d48a94683c0a49e88e4b739482788d7175.tar.bz2
xv6-labs-dae9b0d48a94683c0a49e88e4b739482788d7175.zip
missed this file in last checkin
-rw-r--r--sysproc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sysproc.c b/sysproc.c
index 990a426..da01b5b 100644
--- a/sysproc.c
+++ b/sysproc.c
@@ -1,4 +1,5 @@
#include "types.h"
+#include "x86.h"
#include "defs.h"
#include "param.h"
#include "mmu.h"
@@ -13,6 +14,9 @@ sys_fork(void)
if((np = copyproc(cp)) == 0)
return -1;
pid = np->pid;
+
+ // Clear %eax so that fork returns 0 in the child.
+ np->tf->eax = 0;
np->state = RUNNABLE;
return pid;
}
@@ -54,7 +58,8 @@ sys_sbrk(void)
if(argint(0, &n) < 0)
return -1;
- if((addr = growproc(n)) < 0)
+ addr = cp->sz;
+ if(growproc(n) < 0)
return -1;
return addr;
}