mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:27:34 +00:00
Kernel: Reading from a slave PTY should give EOF if master PTY is closed.
This commit is contained in:
parent
3accdb0e93
commit
378e20c535
5 changed files with 35 additions and 7 deletions
|
@ -11,24 +11,25 @@ public:
|
|||
explicit MasterPTY(unsigned index);
|
||||
virtual ~MasterPTY() override;
|
||||
|
||||
// ^CharacterDevice
|
||||
virtual ssize_t read(Process&, byte*, size_t) override;
|
||||
virtual ssize_t write(Process&, const byte*, size_t) override;
|
||||
virtual bool can_read(Process&) const override;
|
||||
virtual bool can_write(Process&) const override;
|
||||
virtual bool is_master_pty() const override { return true; }
|
||||
|
||||
unsigned index() const { return m_index; }
|
||||
String pts_name() const;
|
||||
void on_slave_write(const byte*, size_t);
|
||||
bool can_write_from_slave() const;
|
||||
void notify_slave_closed(Badge<SlavePTY>);
|
||||
bool is_closed() const { return m_closed; }
|
||||
|
||||
private:
|
||||
// ^CharacterDevice
|
||||
virtual ssize_t read(Process&, byte*, size_t) override;
|
||||
virtual ssize_t write(Process&, const byte*, size_t) override;
|
||||
virtual bool can_read(Process&) const override;
|
||||
virtual bool can_write(Process&) const override;
|
||||
virtual void close() override;
|
||||
virtual bool is_master_pty() const override { return true; }
|
||||
virtual const char* class_name() const override { return "MasterPTY"; }
|
||||
|
||||
RetainPtr<SlavePTY> m_slave;
|
||||
unsigned m_index;
|
||||
bool m_closed { false };
|
||||
DoubleBuffer m_buffer;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue