diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-01-30 18:26:19 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-01-30 18:47:18 +0100 |
commit | b4e478aa508407b999766efea882e4ec4f2f3b6d (patch) | |
tree | f25cc9faa4c7e57a0d46f10532358f176164707d /Kernel/PTYMultiplexer.h | |
parent | 027d26cd5d6dbfceef0c2ade42a51068dcdcf43f (diff) | |
download | serenity-b4e478aa508407b999766efea882e4ec4f2f3b6d.zip |
Deallocate PTY's when they close.
This required a fair bit of plumbing. The CharacterDevice::close() virtual
will now be closed by ~FileDescriptor(), allowing device implementations to
do custom cleanup at that point.
One big problem remains: if the master PTY is closed before the slave PTY,
we go into crashy land.
Diffstat (limited to 'Kernel/PTYMultiplexer.h')
-rw-r--r-- | Kernel/PTYMultiplexer.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Kernel/PTYMultiplexer.h b/Kernel/PTYMultiplexer.h index ee338fd135..c2062c2db7 100644 --- a/Kernel/PTYMultiplexer.h +++ b/Kernel/PTYMultiplexer.h @@ -1,6 +1,7 @@ #pragma once #include <Kernel/CharacterDevice.h> +#include <AK/Badge.h> #include <AK/Lock.h> class MasterPTY; @@ -11,6 +12,9 @@ public: PTYMultiplexer(); virtual ~PTYMultiplexer() override; + static PTYMultiplexer& the(); + static void initialize_statics(); + // ^CharacterDevice virtual RetainPtr<FileDescriptor> open(int& error, int options) override; virtual ssize_t read(Process&, byte*, size_t) override { return 0; } @@ -18,6 +22,8 @@ public: virtual bool can_read(Process&) const override { return true; } virtual bool can_write(Process&) const override { return true; } + void notify_master_destroyed(Badge<MasterPTY>, unsigned index); + private: // ^CharacterDevice virtual const char* class_name() const override { return "PTYMultiplexer"; } |