proc: free pages and fds after proc termination

This commit is contained in:
Michael Shaw 2023-11-22 21:55:52 -05:00
commit aac47e60f3
6 changed files with 38 additions and 24 deletions

View file

@ -64,6 +64,14 @@ void proc_term(pid_t pid)
struct proc *proc = (void *)proc_node->value;
rbt_delete(proc_tree, proc_node);
struct rbnode *map_node = rbt_minimum(proc->page_map.root);
while (map_node) {
struct rbnode *next = rbt_successor(map_node);
proc_munmap(proc, map_node->key);
map_node = next;
}
slab_free(proc_slab, proc);
} else {
kprintf(LOG_ERROR "proc: proc_term: proc %u not found\n", pid);