1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 18:55:09 +00:00

Kernel: Port more code to KResult and KResultOr<T>.

This commit is contained in:
Andreas Kling 2019-03-06 22:14:31 +01:00
parent 3079ef01ce
commit 028afabf6b
15 changed files with 155 additions and 198 deletions

View file

@ -26,17 +26,15 @@ PTYMultiplexer::~PTYMultiplexer()
{
}
RetainPtr<FileDescriptor> PTYMultiplexer::open(int& error, int options)
KResultOr<Retained<FileDescriptor>> PTYMultiplexer::open(int options)
{
LOCKER(m_lock);
if (m_freelist.is_empty()) {
error = -EBUSY;
return nullptr;
}
if (m_freelist.is_empty())
return KResult(-EBUSY);
auto master_index = m_freelist.take_last();
auto master = adopt(*new MasterPTY(master_index));
dbgprintf("PTYMultiplexer::open: Vending master %u\n", master->index());
return VFS::the().open(move(master), error, options);
return VFS::the().open(move(master), options);
}
void PTYMultiplexer::notify_master_destroyed(Badge<MasterPTY>, unsigned index)