2019-01-15 06:30:19 +01:00
|
|
|
#pragma once
|
|
|
|
|
2019-04-03 12:28:45 +02:00
|
|
|
#include <Kernel/TTY/TTY.h>
|
2019-01-15 06:30:19 +01:00
|
|
|
|
|
|
|
class MasterPTY;
|
|
|
|
|
|
|
|
class SlavePTY final : public TTY {
|
|
|
|
public:
|
|
|
|
virtual ~SlavePTY() override;
|
|
|
|
|
2019-02-25 21:19:57 +01:00
|
|
|
void on_master_write(const byte*, ssize_t);
|
2019-01-16 13:36:10 +01:00
|
|
|
unsigned index() const { return m_index; }
|
2019-01-15 06:30:19 +01:00
|
|
|
|
2019-01-30 00:49:20 +01: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 02:33:01 +01:00
|
|
|
private:
|
|
|
|
// ^TTY
|
|
|
|
virtual String tty_name() const override;
|
2019-02-25 21:19:57 +01:00
|
|
|
virtual ssize_t on_tty_write(const byte*, ssize_t) override;
|
2019-01-21 02:33:01 +01:00
|
|
|
|
|
|
|
// ^CharacterDevice
|
2019-02-05 12:27:32 +01:00
|
|
|
virtual bool can_read(Process&) const override;
|
2019-02-25 21:19:57 +01:00
|
|
|
virtual ssize_t read(Process&, byte*, ssize_t) override;
|
2019-01-15 09:17:22 +01:00
|
|
|
virtual bool can_write(Process&) const override;
|
2019-01-21 02:33:01 +01:00
|
|
|
virtual const char* class_name() const override { return "SlavePTY"; }
|
2019-01-30 18:26:19 +01:00
|
|
|
virtual void close() override;
|
2019-01-15 06:30:19 +01:00
|
|
|
|
2019-01-16 02:11:50 +01:00
|
|
|
friend class MasterPTY;
|
|
|
|
SlavePTY(MasterPTY&, unsigned index);
|
|
|
|
|
2019-01-30 19:05:59 +01:00
|
|
|
RetainPtr<MasterPTY> m_master;
|
2019-01-15 06:30:19 +01:00
|
|
|
unsigned m_index;
|
2019-01-30 00:49:20 +01:00
|
|
|
InodeIdentifier m_devpts_inode_id;
|
2019-04-16 00:35:02 +02:00
|
|
|
String m_tty_name;
|
2019-01-15 06:30:19 +01:00
|
|
|
};
|
|
|
|
|