Kernel: Process should release its TTY immediately on exit

Don't wait for someone to wait() on a dead process before releasing its
TTY object. This fixes the child process death detection used by the
Terminal application, which relies on getting an EOF on the master PTY
in order to know it's time to wait() on the child process. :^)
This commit is contained in:
Andreas Kling 2019-11-10 08:49:23 +01:00
parent bbc2f5205f
commit 07806d1273
Notes: sideshowbarker 2024-07-19 11:17:48 +09:00

View file

@ -2272,6 +2272,12 @@ void Process::finalize()
void Process::die()
{
// Let go of the TTY, otherwise a slave PTY may keep the master PTY from
// getting an EOF when the last process using the slave PTY dies.
// If the master PTY owner relies on an EOF to know when to wait() on a
// slave owner, we have to allow the PTY pair to be torn down.
m_tty = nullptr;
if (m_tracer)
m_tracer->set_dead();