Orion
Barry Moving signal handlers into separate namespace 7ae31b0 (2 years, 4 months ago)diff --git a/task/task.c b/task/task.c index 294b3cc..4657c4f 100644 --- a/task/task.c +++ b/task/task.c @@ -189,6 +189,15 @@ clone(int flags) child->tls->back = file_get(parent->tls->back); } + /* Signal handlers */ + if (flags & CLONE_SIGHAND) { + child->signals = parent->signals; + child->signals->usage++; + } else { + child->signals = kmalloc(sizeof(SigHandlers)); + child->signals->usage = 1; + } + /* Split tasks here */ uintptr_t esp, ebp, eip; eip = read_eip(); @@ -232,10 +241,11 @@ terminate(void) } vm_destroy_region(current->stack); - /* Clean unread IPC messages */ - /* TODO */ - /* Clean signals */ + if (--current->signals->usage == 0) + kfree(current->signals); + + /* Clean unread IPC messages */ /* TODO */ /* Deschedule */ @@ -412,9 +422,11 @@ init_tasking(void) current->vm->regions = NULL; current->vm->usage = 1; - /* Inter-Process Communication Namespace */ - /* Signals Namespace */ + current->signals = kmalloc(sizeof(SigHandlers)); + current->signals->usage = 1; + + /* Inter-Process Communication Namespace */ register_interrupt(0, timer_handler); }