Kernel/userspace: Implement KD_LOADFONT and loadfont program

This commit is contained in:
2024-07-03 09:02:49 +03:00
parent 940fb0d1fd
commit 5dc441c4af
6 changed files with 61 additions and 0 deletions

View File

@@ -11,6 +11,7 @@
#include <fcntl.h>
#include <string.h>
#include <stropts.h>
#include <sys/banan-os.h>
#include <sys/sysmacros.h>
@@ -122,6 +123,22 @@ namespace Kernel
return {};
}
BAN::ErrorOr<long> TTY::ioctl_impl(int request, void* argument)
{
switch (request)
{
case KD_LOADFONT:
{
auto absolute_path = TRY(Process::current().absolute_path_of(BAN::StringView(reinterpret_cast<const char*>(argument))));
auto new_font = TRY(LibFont::Font::load(absolute_path));
set_font(new_font);
return 0;
}
default:
return BAN::Error::from_errno(EINVAL);
}
}
void TTY::on_key_event(LibInput::KeyEvent event)
{
LockGuard _(m_mutex);