Quiz 11
Consider the following code:
1 int fork(void) {
2 struct proc *np;
3 struct proc *curproc = myproc();
4 np->pgdir = copyuvm(curproc->pgdir, curproc->sz);
5 *np->tf = *curproc->tf;
6 np->tf->eax = 0;
7 for(int i = 0; i < NOFILE; i++)
8 if(curproc->ofile[i])
9 np->ofile[i] = filedup(curproc->ofile[i]);
10 np->state = RUNNABLE;
11 return np->pid;
12 }