diff options
author | dzwdz | 2022-05-06 13:33:37 +0200 |
---|---|---|
committer | dzwdz | 2022-05-06 13:33:37 +0200 |
commit | 530d2292182ae4e35e4a13929831a6803f517128 (patch) | |
tree | 23fa1e052f57a74cb6db8d8998332991b5bc7906 /src/kernel | |
parent | 292e55a3c344e649d271cfb3c9063ac8b2484de6 (diff) |
kernel/proc: simplify `process_free()`
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/proc.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/kernel/proc.c b/src/kernel/proc.c index 2a35acc..54efe85 100644 --- a/src/kernel/proc.c +++ b/src/kernel/proc.c @@ -94,18 +94,8 @@ void process_free(struct process *p) { assert(p->state == PS_DEAD); assert(!p->child); - // also could be done on kill - vfs_mount_remref(p->mount); - p->mount = NULL; - - if (p->controlled) { - vfs_backend_refdown(p->controlled); - p->controlled = NULL; - } - if (!p->parent) return; process_forget(p); - pagedir_free(p->pages); // TODO could be done on kill kfree(p); } @@ -244,9 +234,15 @@ void process_kill(struct process *p, int ret) { for (handle_t h = 0; h < HANDLE_MAX; h++) handle_close(p->handles[h]); + vfs_mount_remref(p->mount); + p->mount = NULL; + process_transition(p, PS_DEAD); p->death_msg = ret; + if (p->parent) + pagedir_free(p->pages); // TODO put init's pages in the allocator + // TODO VULN unbounded recursion struct process *c2; for (struct process *c = p->child; c; c = c2) { |