1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:57:45 +00:00

Kernel: disown should unblock any potential waiters

This is necessary because if a process changes the state to Stopped
or resumes from that state, a wait entry is created in the parent
process. So, if a child process does this before disown is called,
we need to clear those entries to avoid leaking references/zombies
that won't be cleaned up until the former parent exits.

This also should solve an even more unlikely corner case where another
thread is waiting on a pid that is being disowned by another thread.
This commit is contained in:
Tom 2020-12-08 19:04:05 -07:00 committed by Andreas Kling
parent bcb9363a97
commit 4bbee00650
5 changed files with 55 additions and 1 deletions

View file

@ -37,6 +37,7 @@ int Process::sys$disown(ProcessID pid)
if (process->ppid() != this->pid())
return -ECHILD;
process->m_ppid = 0;
process->disowned_by_waiter(*this);
return 0;
}
}