1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 19:15:06 +00:00

Kernel: Move signal handlers from being thread state to process state

POSIX requires that sigaction() and friends set a _process-wide_ signal
handler, so move signal handlers and flags inside Process.
This also fixes a "pid/tid confusion" FIXME, as we can now send the
signal to the process and let that decide which thread should get the
signal (which is the thread with tid==pid, but that's now the Process's
problem).
Note that each thread still retains its signal mask, as that is local to
each thread.
This commit is contained in:
Ali Mohammad Pur 2022-02-24 22:25:49 +03:30 committed by Andreas Kling
parent 18b9d02edd
commit cf63447044
5 changed files with 19 additions and 19 deletions

View file

@ -612,10 +612,9 @@ void Process::finalize()
m_state.store(State::Dead, AK::MemoryOrder::memory_order_release);
{
// FIXME: PID/TID BUG
if (auto parent_thread = Thread::from_tid(ppid().value())) {
if (parent_thread->process().is_user_process() && (parent_thread->m_signal_action_data[SIGCHLD].flags & SA_NOCLDWAIT) != SA_NOCLDWAIT)
parent_thread->send_signal(SIGCHLD, this);
if (auto parent_process = Process::from_pid(ppid())) {
if (parent_process->is_user_process() && (parent_process->m_signal_action_data[SIGCHLD].flags & SA_NOCLDWAIT) != SA_NOCLDWAIT)
(void)parent_process->send_signal(SIGCHLD, this);
}
}