1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

Kernel: Use KResultOr<size_t> throughout the TTY subsystem

Previously the VirtualConsole::on_tty_write() method would return an
incorrect value when an error had occurred. This prompted me to
update the TTY subsystem to use KResultOr<size_t> everywhere.
This commit is contained in:
Gunnar Beutner 2021-06-16 15:20:35 +02:00 committed by Andreas Kling
parent a49a15cabf
commit 1c3346e3ce
9 changed files with 29 additions and 29 deletions

View file

@ -265,7 +265,7 @@ void VirtualConsole::on_key_pressed(KeyEvent event)
});
}
ssize_t VirtualConsole::on_tty_write(const UserOrKernelBuffer& data, ssize_t size)
KResultOr<size_t> VirtualConsole::on_tty_write(const UserOrKernelBuffer& data, size_t size)
{
ScopedSpinLock global_lock(ConsoleManagement::the().tty_write_lock());
ScopedSpinLock lock(m_lock);
@ -276,9 +276,7 @@ ssize_t VirtualConsole::on_tty_write(const UserOrKernelBuffer& data, ssize_t siz
});
if (m_active)
flush_dirty_lines();
if (result.is_error())
return result.error();
return (ssize_t)result.value();
return result;
}
void VirtualConsole::set_active(bool active)