1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:17:44 +00:00

Kernel: Expose the signal that stopped a thread via sys$waitpid()

This commit is contained in:
Andreas Kling 2020-01-27 20:47:10 +01:00
parent 638fe6f84a
commit 5163c5cc63
3 changed files with 11 additions and 2 deletions

View file

@ -2318,12 +2318,16 @@ 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 {
ASSERT(waitee_process->any_thread().state() == Thread::State::Stopped);
exit_status = 0x7f;
ASSERT(waitee_thread->state() == Thread::State::Stopped);
exit_status = (waitee_thread->m_stop_signal << 8) | 0x7f;
}
if (wstatus)