mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 17:25:07 +00:00
Kernel: sys$waitpid() only needs the waitee thread in the stopped case
If the waitee process is dead, we don't need to inspect the thread. This fixes an issue with sys$waitpid() failing before reap() since dead processes will have no remaining threads alive.
This commit is contained in:
parent
f4302b58fb
commit
8b49804895
1 changed files with 3 additions and 4 deletions
|
@ -2318,14 +2318,13 @@ pid_t Process::sys$waitpid(pid_t waitee, int* wstatus, int options)
|
|||
if (!waitee_process)
|
||||
return -ECHILD;
|
||||
|
||||
auto* waitee_thread = Thread::from_tid(waitee_pid);
|
||||
if (!waitee_thread)
|
||||
return -ECHILD;
|
||||
|
||||
ASSERT(waitee_process);
|
||||
if (waitee_process->is_dead()) {
|
||||
exit_status = reap(*waitee_process);
|
||||
} else {
|
||||
auto* waitee_thread = Thread::from_tid(waitee_pid);
|
||||
if (!waitee_thread)
|
||||
return -ECHILD;
|
||||
ASSERT(waitee_thread->state() == Thread::State::Stopped);
|
||||
exit_status = (waitee_thread->m_stop_signal << 8) | 0x7f;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue