blob: aa4a27daf0851ae642f615b821886696643313a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#pragma once
#include <VirtualFileSystem/CharacterDevice.h>
#include "DoubleBuffer.h"
class SlavePTY;
class MasterPTY final : public CharacterDevice {
public:
explicit MasterPTY(unsigned index);
virtual ~MasterPTY() override;
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);
private:
SlavePTY& m_slave;
unsigned m_index;
DoubleBuffer m_buffer;
};
|