mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:07:36 +00:00
Kernel: Move TTY-related files into Kernel/TTY/.
This commit is contained in:
parent
f9864940eb
commit
9fca94269e
17 changed files with 16 additions and 16 deletions
36
Kernel/TTY/MasterPTY.h
Normal file
36
Kernel/TTY/MasterPTY.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Badge.h>
|
||||
#include <Kernel/CharacterDevice.h>
|
||||
#include <Kernel/DoubleBuffer.h>
|
||||
|
||||
class SlavePTY;
|
||||
|
||||
class MasterPTY final : public CharacterDevice {
|
||||
public:
|
||||
explicit MasterPTY(unsigned index);
|
||||
virtual ~MasterPTY() override;
|
||||
|
||||
unsigned index() const { return m_index; }
|
||||
String pts_name() const;
|
||||
ssize_t on_slave_write(const byte*, ssize_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*, ssize_t) override;
|
||||
virtual ssize_t write(Process&, const byte*, ssize_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 int ioctl(Process&, unsigned request, unsigned arg) override;
|
||||
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