kernel: Prevent kernel threads from calling exit_and_signal_parent()
All checks were successful
Build and test / build (push) Successful in 1m53s

Kernel threads are supposed to use kernel_exit() instead, so it makes no sense to have an extra branch for them.
This commit is contained in:
apio 2024-06-23 22:53:30 +02:00
parent 907049c405
commit 2ce2d57eff
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -104,17 +104,14 @@ Result<SharedPtr<VFS::Inode>> Thread::resolve_atfile(int dirfd, const String& pa
[[noreturn]] void Thread::exit_and_signal_parent(int _status)
{
check(!is_kernel);
#ifndef MOON_ENABLE_TESTING_FEATURES
if (this->id == 1) fail("the init process exited");
#else
if (this->id == 1) CPU::magic_exit(_status);
#endif
if (is_kernel) {
state = ThreadState::Dying;
Scheduler::signal_reap_thread();
}
else
{
Scheduler::for_each_child(this, [](Thread* child) {
child->parent = Scheduler::init_thread();
return true;
@ -153,7 +150,7 @@ Result<SharedPtr<VFS::Inode>> Thread::resolve_atfile(int dirfd, const String& pa
}
state = ThreadState::Exited;
}
status = _status;
kernel_yield();
unreachable();