mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Kernel: Detach the traced process on process exit
Currently, when a process which has a tracee exits, nothing will happen, leaving the tracee unable to be attached again. This will call the stop_tracing function on any process which is traced by the exiting process and sending the SIGSTOP signal making the traced process wait for a SIGCONT (just as Linux does)
This commit is contained in:
parent
780e84f2e1
commit
8456dc87d8
Notes:
sideshowbarker
2024-07-19 17:29:22 +09:00
Author: https://github.com/cbsirb 🔰 Commit: https://github.com/SerenityOS/serenity/commit/8456dc87d8e Pull-request: https://github.com/SerenityOS/serenity/pull/5521 Reviewed-by: https://github.com/itamar8910 ✅
1 changed files with 16 additions and 0 deletions
|
@ -543,6 +543,22 @@ void Process::die()
|
|||
return IterationDecision::Continue;
|
||||
});
|
||||
|
||||
{
|
||||
ScopedSpinLock lock(g_processes_lock);
|
||||
for (auto* process = g_processes->head(); process;) {
|
||||
auto* next_process = process->next();
|
||||
if (process->has_tracee_thread(m_pid)) {
|
||||
dbgln_if(PROCESS_DEBUG, "Process {} ({}) is attached by {} ({}) which will exit", process->name(), process->pid(), name(), pid());
|
||||
process->stop_tracing();
|
||||
auto err = process->send_signal(SIGSTOP, this);
|
||||
if (err.is_error())
|
||||
dbgln("Failed to send the SIGSTOP signal to {} ({})", process->name(), process->pid());
|
||||
}
|
||||
|
||||
process = next_process;
|
||||
}
|
||||
}
|
||||
|
||||
kill_all_threads();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue