mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
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.
This commit is contained in:
parent
027d26cd5d
commit
b4e478aa50
19 changed files with 104 additions and 12 deletions
|
@ -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"; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue