fork: properly set up child process
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
ec4e9fc27d
commit
b926d50365
6 changed files with 73 additions and 25 deletions
|
|
@ -71,6 +71,13 @@ static int copy_parent(struct proc *new, struct proc *parent)
|
|||
|
||||
spinlock_release(&parent->mem_lock);
|
||||
|
||||
if (parent->fd_array_size) {
|
||||
spinlock_acquire(&parent->fd_lock);
|
||||
new->fd_array_size = parent->fd_array_size;
|
||||
new->fdt = kalloc(new->fd_array_size * sizeof(struct file), ALLOC_KERN);
|
||||
spinlock_release(&parent->fd_lock);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue