fork: properly set up child process

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-07-22 00:06:57 -04:00
commit b926d50365
6 changed files with 73 additions and 25 deletions

View file

@ -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;
}