summaryrefslogtreecommitdiff
path: root/Kernel/PTYMultiplexer.h
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/PTYMultiplexer.h')
-rw-r--r--Kernel/PTYMultiplexer.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/Kernel/PTYMultiplexer.h b/Kernel/PTYMultiplexer.h
new file mode 100644
index 0000000000..4646fc7f05
--- /dev/null
+++ b/Kernel/PTYMultiplexer.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <VirtualFileSystem/CharacterDevice.h>
+#include <AK/Lock.h>
+
+class MasterPTY;
+
+class PTYMultiplexer final : public CharacterDevice {
+ AK_MAKE_ETERNAL
+public:
+ PTYMultiplexer();
+ virtual ~PTYMultiplexer() override;
+
+ // ^CharacterDevice
+ virtual RetainPtr<FileDescriptor> open(int& error, int options) override;
+ virtual ssize_t read(Process&, byte*, size_t) override { return 0; }
+ virtual ssize_t write(Process&, const byte*, size_t) override { return 0; }
+ virtual bool can_read(Process&) const override { return true; }
+ virtual bool can_write(Process&) const override { return true; }
+
+private:
+ SpinLock m_lock;
+ Vector<RetainPtr<MasterPTY>> m_freelist;
+};