diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-08-01 01:54:09 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-03 18:54:23 +0200 |
commit | 43f930d3aacf64b4cbf28e95bd4ef8292e2e6011 (patch) | |
tree | 96340553ef11ada053d31d657b76961947e2a298 /Kernel/TTY/MasterPTY.h | |
parent | f816abcbad4903a815612986fd9d8172bcb752c3 (diff) | |
download | serenity-43f930d3aacf64b4cbf28e95bd4ef8292e2e6011.zip |
Kernel: Convert MasterPTY creation to use DoubleBuffer factory
In order to remove the public DoubleBuffer constructor, we need to
convert the callers to the factory instead, allowing the caller to
observe OOM.
Diffstat (limited to 'Kernel/TTY/MasterPTY.h')
-rw-r--r-- | Kernel/TTY/MasterPTY.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Kernel/TTY/MasterPTY.h b/Kernel/TTY/MasterPTY.h index a1c9274046..5ec21dced4 100644 --- a/Kernel/TTY/MasterPTY.h +++ b/Kernel/TTY/MasterPTY.h @@ -16,7 +16,7 @@ class SlavePTY; class MasterPTY final : public CharacterDevice { public: - explicit MasterPTY(unsigned index); + [[nodiscard]] static RefPtr<MasterPTY> try_create(unsigned index); virtual ~MasterPTY() override; unsigned index() const { return m_index; } @@ -33,6 +33,7 @@ public: virtual String device_name() const override; private: + explicit MasterPTY(unsigned index, NonnullOwnPtr<DoubleBuffer> buffer); // ^CharacterDevice virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override; @@ -46,7 +47,7 @@ private: RefPtr<SlavePTY> m_slave; unsigned m_index; bool m_closed { false }; - DoubleBuffer m_buffer; + NonnullOwnPtr<DoubleBuffer> m_buffer; String m_pts_name; }; |