1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:08:10 +00:00

Kernel/TTY: Don't return NonnullLockRefPtr when creating MasterPTY

We can just return a normal NonnullRefPtr because nobody needs an actual
*LockRefPtrs here anymore.
This commit is contained in:
Liav A 2023-07-08 14:45:57 +03:00 committed by Andrew Kaster
parent 82428e2a05
commit b49f2937f0
2 changed files with 4 additions and 4 deletions

View file

@ -16,12 +16,12 @@
namespace Kernel { namespace Kernel {
ErrorOr<NonnullLockRefPtr<MasterPTY>> MasterPTY::try_create(unsigned int index) ErrorOr<NonnullRefPtr<MasterPTY>> MasterPTY::try_create(unsigned int index)
{ {
auto buffer = TRY(DoubleBuffer::try_create("MasterPTY: Buffer"sv)); auto buffer = TRY(DoubleBuffer::try_create("MasterPTY: Buffer"sv));
auto master_pty = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) MasterPTY(index, move(buffer)))); auto master_pty = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) MasterPTY(index, move(buffer))));
auto credentials = Process::current().credentials(); auto credentials = Process::current().credentials();
auto slave_pty = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) SlavePTY(*master_pty, credentials->uid(), credentials->gid(), index))); auto slave_pty = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) SlavePTY(*master_pty, credentials->uid(), credentials->gid(), index)));
master_pty->m_slave.with([&slave_pty](auto& slave) { master_pty->m_slave.with([&slave_pty](auto& slave) {
slave = *slave_pty; slave = *slave_pty;
}); });

View file

@ -16,7 +16,7 @@ class SlavePTY;
class MasterPTY final : public CharacterDevice { class MasterPTY final : public CharacterDevice {
public: public:
static ErrorOr<NonnullLockRefPtr<MasterPTY>> try_create(unsigned index); static ErrorOr<NonnullRefPtr<MasterPTY>> try_create(unsigned index);
virtual ~MasterPTY() override; virtual ~MasterPTY() override;
unsigned index() const { return m_index; } unsigned index() const { return m_index; }