From a803312eb4cbe95ce36b91cfd7c3eb793c189b5a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 6 Jan 2020 14:34:28 +0100 Subject: [PATCH] Kernel: Send SIGCHLD to the thread with same PID as my PPID Instead of delivering SIGCHLD to "any thread" in the process with PPID, send it to the thread with the same TID as my PPID. --- Kernel/Process.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 2fad5451b6..855e1fb160 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -2611,13 +2611,12 @@ void Process::finalize() disown_all_shared_buffers(); { InterruptDisabler disabler; - if (auto* parent_process = Process::from_pid(m_ppid)) { - // FIXME(Thread): What should we do here? Should we look at all threads' signal actions? - if (parent_process->thread_count() && parent_process->any_thread().m_signal_action_data[SIGCHLD].flags & SA_NOCLDWAIT) { + if (auto* parent_thread = Thread::from_tid(m_ppid)) { + if (parent_thread->m_signal_action_data[SIGCHLD].flags & SA_NOCLDWAIT) { // NOTE: If the parent doesn't care about this process, let it go. m_ppid = 0; } else { - parent_process->send_signal(SIGCHLD, this); + parent_thread->send_signal(SIGCHLD, this); } } }