mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
tcb_destroy() in pager and fs0 now caters for shared structures.
This commit is contained in:
@@ -148,6 +148,11 @@ void tcb_destroy(struct tcb *task)
|
||||
{
|
||||
global_remove_task(task);
|
||||
|
||||
if (--task->fs_data->tcb_refs == 0)
|
||||
kfree(task->fs_data);
|
||||
if (--task->files->tcb_refs == 0)
|
||||
kfree(task->files);
|
||||
|
||||
kfree(task);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ void global_add_task(struct tcb *task)
|
||||
list_add_tail(&task->list, &global_tasks.list);
|
||||
global_tasks.total++;
|
||||
}
|
||||
|
||||
void global_remove_task(struct tcb *task)
|
||||
{
|
||||
BUG_ON(list_empty(&task->list));
|
||||
@@ -115,6 +116,11 @@ int tcb_destroy(struct tcb *task)
|
||||
{
|
||||
global_remove_task(task);
|
||||
|
||||
if (--task->vm_area_head->tcb_refs == 0)
|
||||
kfree(task->vm_area_head);
|
||||
if (--task->files->tcb_refs == 0)
|
||||
kfree(task->files);
|
||||
|
||||
kfree(task);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user