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

Kernel: Closing a MasterPTY should generate a TTY hangup.

This commit is contained in:
Andreas Kling 2019-02-05 12:55:19 +01:00
parent 378e20c535
commit 2a0700af9a
4 changed files with 13 additions and 3 deletions

View file

@ -3,6 +3,7 @@
#include "PTYMultiplexer.h"
#include <Kernel/Process.h>
#include <LibC/errno_numbers.h>
#include <LibC/signal_numbers.h>
MasterPTY::MasterPTY(unsigned index)
: CharacterDevice(10, index)
@ -73,8 +74,11 @@ bool MasterPTY::can_write_from_slave() const
void MasterPTY::close()
{
if (retain_count() == 2) {
InterruptDisabler disabler;
// After the closing FileDescriptor dies, slave is the only thing keeping me alive.
// From this point, let's consider ourselves closed.
m_closed = true;
m_slave->hang_up();
}
}