kernel: Prevent kernel threads from calling exit_and_signal_parent()
All checks were successful
Build and test / build (push) Successful in 1m53s
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:
parent
907049c405
commit
2ce2d57eff
@ -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)
|
[[noreturn]] void Thread::exit_and_signal_parent(int _status)
|
||||||
{
|
{
|
||||||
|
check(!is_kernel);
|
||||||
|
|
||||||
#ifndef MOON_ENABLE_TESTING_FEATURES
|
#ifndef MOON_ENABLE_TESTING_FEATURES
|
||||||
if (this->id == 1) fail("the init process exited");
|
if (this->id == 1) fail("the init process exited");
|
||||||
#else
|
#else
|
||||||
if (this->id == 1) CPU::magic_exit(_status);
|
if (this->id == 1) CPU::magic_exit(_status);
|
||||||
#endif
|
#endif
|
||||||
if (is_kernel) {
|
|
||||||
state = ThreadState::Dying;
|
|
||||||
Scheduler::signal_reap_thread();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Scheduler::for_each_child(this, [](Thread* child) {
|
Scheduler::for_each_child(this, [](Thread* child) {
|
||||||
child->parent = Scheduler::init_thread();
|
child->parent = Scheduler::init_thread();
|
||||||
return true;
|
return true;
|
||||||
@ -153,7 +150,7 @@ Result<SharedPtr<VFS::Inode>> Thread::resolve_atfile(int dirfd, const String& pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
state = ThreadState::Exited;
|
state = ThreadState::Exited;
|
||||||
}
|
|
||||||
status = _status;
|
status = _status;
|
||||||
kernel_yield();
|
kernel_yield();
|
||||||
unreachable();
|
unreachable();
|
||||||
|
Loading…
Reference in New Issue
Block a user