1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 09:14:58 +00:00

Kernel: Implement the setkeymap() syscall.

This commit is contained in:
Hüseyin ASLITÜRK 2019-11-23 10:48:07 +03:00 committed by Andreas Kling
parent 28ada30783
commit 794ca16cca
5 changed files with 54 additions and 3 deletions

View file

@ -7,6 +7,7 @@
#include <Kernel/Arch/i386/PIT.h>
#include <Kernel/Console.h>
#include <Kernel/Devices/NullDevice.h>
#include <Kernel/Devices/KeyboardDevice.h>
#include <Kernel/Devices/RandomDevice.h>
#include <Kernel/FileSystem/Custody.h>
#include <Kernel/FileSystem/DevPtsFS.h>
@ -3276,6 +3277,22 @@ int Process::sys$getrandom(void* buffer, size_t buffer_size, unsigned int flags
return 0;
}
int Process::sys$setkeymap(char* map, char* shift_map, char* alt_map)
{
if (!is_superuser())
return -EPERM;
if (!validate_read(map, 0x80))
return -EFAULT;
if (!validate_read(shift_map, 0x80))
return -EFAULT;
if (!validate_read(alt_map, 0x80))
return -EFAULT;
KeyboardDevice::the().set_maps(map, shift_map, alt_map);
return 0;
}
int Process::sys$clock_gettime(clockid_t clock_id, timespec* ts)
{
if (!validate_write_typed(ts))