2019-01-15 08:30:19 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "TTY.h"
|
|
|
|
|
|
|
|
class MasterPTY;
|
|
|
|
|
|
|
|
class SlavePTY final : public TTY {
|
|
|
|
public:
|
|
|
|
virtual ~SlavePTY() override;
|
|
|
|
|
|
|
|
void on_master_write(const byte*, size_t);
|
2019-01-16 15:36:10 +03:00
|
|
|
unsigned index() const { return m_index; }
|
2019-01-15 08:30:19 +03:00
|
|
|
|
2019-01-30 02:49:20 +03:00
|
|
|
InodeIdentifier devpts_inode_id() const { return m_devpts_inode_id; }
|
|
|
|
void set_devpts_inode_id(InodeIdentifier inode_id) { m_devpts_inode_id = inode_id; }
|
|
|
|
|
2019-01-21 04:33:01 +03:00
|
|
|
private:
|
|
|
|
// ^TTY
|
|
|
|
virtual String tty_name() const override;
|
2019-02-05 15:09:01 +03:00
|
|
|
virtual ssize_t on_tty_write(const byte*, size_t) override;
|
2019-01-21 04:33:01 +03:00
|
|
|
|
|
|
|
// ^CharacterDevice
|
2019-02-05 14:27:32 +03:00
|
|
|
virtual bool can_read(Process&) const override;
|
|
|
|
virtual ssize_t read(Process&, byte*, size_t) override;
|
2019-01-15 11:17:22 +03:00
|
|
|
virtual bool can_write(Process&) const override;
|
2019-01-21 04:33:01 +03:00
|
|
|
virtual const char* class_name() const override { return "SlavePTY"; }
|
2019-01-30 20:26:19 +03:00
|
|
|
virtual void close() override;
|
2019-01-15 08:30:19 +03:00
|
|
|
|
2019-01-16 04:11:50 +03:00
|
|
|
friend class MasterPTY;
|
|
|
|
SlavePTY(MasterPTY&, unsigned index);
|
|
|
|
|
2019-01-30 21:05:59 +03:00
|
|
|
RetainPtr<MasterPTY> m_master;
|
2019-01-15 08:30:19 +03:00
|
|
|
unsigned m_index;
|
2019-01-30 02:49:20 +03:00
|
|
|
InodeIdentifier m_devpts_inode_id;
|
2019-01-15 08:30:19 +03:00
|
|
|
};
|
|
|
|
|