18 lines
395 B
C++
18 lines
395 B
C++
#include "sys/Syscall.h"
|
|
#include "thread/Scheduler.h"
|
|
|
|
Result<u64> sys_exit(Registers*, SyscallArgs args)
|
|
{
|
|
u8 status = (u8)args[0];
|
|
|
|
Thread* current = Scheduler::current();
|
|
|
|
Scheduler::for_each_child((pid_t)current->id, [](Thread* child) { child->parent_id = 1; });
|
|
|
|
current->status = status;
|
|
current->state = ThreadState::Exited;
|
|
|
|
kernel_yield();
|
|
unreachable();
|
|
}
|