Kernel: Add load_keymap syscall and load Finnish keymap in init
This commit is contained in:
parent
8f89519bcf
commit
51214ea1bf
Binary file not shown.
|
@ -146,6 +146,8 @@ namespace Kernel
|
||||||
|
|
||||||
BAN::ErrorOr<long> sys_clock_gettime(clockid_t, timespec*);
|
BAN::ErrorOr<long> sys_clock_gettime(clockid_t, timespec*);
|
||||||
|
|
||||||
|
BAN::ErrorOr<long> sys_load_keymap(const char* path);
|
||||||
|
|
||||||
TTY& tty() { ASSERT(m_controlling_terminal); return *m_controlling_terminal; }
|
TTY& tty() { ASSERT(m_controlling_terminal); return *m_controlling_terminal; }
|
||||||
|
|
||||||
static Process& current() { return Thread::current().process(); }
|
static Process& current() { return Thread::current().process(); }
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <kernel/FS/ProcFS/FileSystem.h>
|
#include <kernel/FS/ProcFS/FileSystem.h>
|
||||||
#include <kernel/FS/VirtualFileSystem.h>
|
#include <kernel/FS/VirtualFileSystem.h>
|
||||||
#include <kernel/IDT.h>
|
#include <kernel/IDT.h>
|
||||||
|
#include <kernel/Input/KeyboardLayout.h>
|
||||||
#include <kernel/InterruptController.h>
|
#include <kernel/InterruptController.h>
|
||||||
#include <kernel/LockGuard.h>
|
#include <kernel/LockGuard.h>
|
||||||
#include <kernel/Memory/FileBackedRegion.h>
|
#include <kernel/Memory/FileBackedRegion.h>
|
||||||
|
@ -1253,6 +1254,17 @@ namespace Kernel
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BAN::ErrorOr<long> Process::sys_load_keymap(const char* path)
|
||||||
|
{
|
||||||
|
LockGuard _(m_lock);
|
||||||
|
TRY(validate_string_access(path));
|
||||||
|
|
||||||
|
auto absolute_path = TRY(absolute_path_of(path));
|
||||||
|
TRY(Input::KeyboardLayout::get().load_from_file(absolute_path));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
BAN::ErrorOr<long> Process::sys_signal(int signal, void (*handler)(int))
|
BAN::ErrorOr<long> Process::sys_signal(int signal, void (*handler)(int))
|
||||||
{
|
{
|
||||||
if (signal < _SIGMIN || signal > _SIGMAX)
|
if (signal < _SIGMIN || signal > _SIGMAX)
|
||||||
|
|
|
@ -210,6 +210,9 @@ namespace Kernel
|
||||||
case SYS_CHOWN:
|
case SYS_CHOWN:
|
||||||
ret = Process::current().sys_chown((const char*)arg1, (uid_t)arg2, (gid_t)arg3);
|
ret = Process::current().sys_chown((const char*)arg1, (uid_t)arg2, (gid_t)arg3);
|
||||||
break;
|
break;
|
||||||
|
case SYS_LOAD_KEYMAP:
|
||||||
|
ret = Process::current().sys_load_keymap((const char*)arg1);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
dwarnln("Unknown syscall {}", syscall);
|
dwarnln("Unknown syscall {}", syscall);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -34,6 +34,8 @@ return value: 0 on success, -1 on failure and errno set to the error
|
||||||
int tty_ctrl(int fildes, int command, int flags);
|
int tty_ctrl(int fildes, int command, int flags);
|
||||||
int poweroff(int command);
|
int poweroff(int command);
|
||||||
|
|
||||||
|
int load_keymap(const char* path);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -62,6 +62,7 @@ __BEGIN_DECLS
|
||||||
#define SYS_MSYNC 61
|
#define SYS_MSYNC 61
|
||||||
#define SYS_PREAD 62
|
#define SYS_PREAD 62
|
||||||
#define SYS_CHOWN 63
|
#define SYS_CHOWN 63
|
||||||
|
#define SYS_LOAD_KEYMAP 64
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -11,3 +11,8 @@ int poweroff(int command)
|
||||||
{
|
{
|
||||||
return syscall(SYS_POWEROFF, command);
|
return syscall(SYS_POWEROFF, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int load_keymap(const char* path)
|
||||||
|
{
|
||||||
|
return syscall(SYS_LOAD_KEYMAP, path);
|
||||||
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/banan-os.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
|
|
||||||
void initialize_stdio()
|
void initialize_stdio()
|
||||||
|
@ -25,6 +26,9 @@ int main()
|
||||||
if (signal(SIGINT, [](int) {}) == SIG_ERR)
|
if (signal(SIGINT, [](int) {}) == SIG_ERR)
|
||||||
perror("signal");
|
perror("signal");
|
||||||
|
|
||||||
|
if (load_keymap("/usr/share/keymaps/fi.keymap") == -1)
|
||||||
|
perror("load_keymap");
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
termios termios;
|
termios termios;
|
||||||
|
|
Loading…
Reference in New Issue