mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 10:08:10 +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,7 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Badge.h>
|
||||
#include <Kernel/CharacterDevice.h>
|
||||
#include "DoubleBuffer.h"
|
||||
#include <Kernel/DoubleBuffer.h>
|
||||
|
||||
class SlavePTY;
|
||||
|
||||
|
@ -21,12 +22,13 @@ public:
|
|||
String pts_name() const;
|
||||
void on_slave_write(const byte*, size_t);
|
||||
bool can_write_from_slave() const;
|
||||
void notify_slave_closed(Badge<SlavePTY>);
|
||||
|
||||
private:
|
||||
// ^CharacterDevice
|
||||
virtual const char* class_name() const override { return "MasterPTY"; }
|
||||
|
||||
SlavePTY& m_slave;
|
||||
RetainPtr<SlavePTY> m_slave;
|
||||
unsigned m_index;
|
||||
DoubleBuffer m_buffer;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue