summaryrefslogtreecommitdiff
path: root/src/kernel/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/proc.c')
-rw-r--r--src/kernel/proc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/kernel/proc.c b/src/kernel/proc.c
index ba19943..90570b8 100644
--- a/src/kernel/proc.c
+++ b/src/kernel/proc.c
@@ -72,6 +72,9 @@ struct process *process_fork(struct process *parent, int flags) {
// no overflow check - if you manage to get 2^32 references to a handle you have bigger problems
}
+ assert(child->mount);
+ child->mount->refs++;
+
child->id = next_pid++;
return child;
@@ -104,6 +107,10 @@ void process_free(struct process *p) {
while (p->child)
process_free(p->child);
+ // also could be done on kill
+ vfs_mount_remref(p->mount);
+ p->mount = NULL;
+
if (!p->parent) return;
process_forget(p);
pagedir_free(p->pages); // TODO could be done on kill