proc_term: delete all umalloc allocations
This commit is contained in:
parent
1864902547
commit
f56f3842b2
1 changed files with 9 additions and 3 deletions
12
sched/proc.c
12
sched/proc.c
|
|
@ -122,7 +122,7 @@ void proc_set_exec_addr(struct proc *proc, uintptr_t addr)
|
||||||
|
|
||||||
void proc_term(pid_t pid)
|
void proc_term(pid_t pid)
|
||||||
{
|
{
|
||||||
if(pid == 1) {
|
if (pid == 1) {
|
||||||
/* reboot */
|
/* reboot */
|
||||||
reboot();
|
reboot();
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +135,14 @@ void proc_term(pid_t pid)
|
||||||
|
|
||||||
rbt_delete(proc_tree, proc_node);
|
rbt_delete(proc_tree, proc_node);
|
||||||
|
|
||||||
struct rbnode *node = rbt_minimum(proc->page_map.root);
|
struct rbnode *node = rbt_minimum(proc->umalloc_tree.root);
|
||||||
|
while (node) {
|
||||||
|
struct rbnode *next = rbt_successor(node);
|
||||||
|
ufree(proc, (void *)node->key);
|
||||||
|
node = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
node = rbt_minimum(proc->page_map.root);
|
||||||
while (node) {
|
while (node) {
|
||||||
struct rbnode *next = rbt_successor(node);
|
struct rbnode *next = rbt_successor(node);
|
||||||
proc_munmap(proc, node->key);
|
proc_munmap(proc, node->key);
|
||||||
|
|
@ -395,4 +402,3 @@ void proc_init(unsigned num_cpus)
|
||||||
proc_set_current(0);
|
proc_set_current(0);
|
||||||
(void)rbt_insert(proc_tree, 0);
|
(void)rbt_insert(proc_tree, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue