mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 03:35:09 +00:00
Kernel: Use a lookup table for syscalls
Instead of the big ugly switch statement, build a lookup table using the syscall enumeration macro. This greatly simplifies the syscall implementation. :^)
This commit is contained in:
parent
874ebbe4a5
commit
fbeb1ab15b
5 changed files with 69 additions and 277 deletions
|
@ -5,6 +5,7 @@
|
|||
#include <AK/Types.h>
|
||||
#include <Kernel/Arch/i386/CPU.h>
|
||||
#include <Kernel/Arch/i386/PIT.h>
|
||||
#include <Kernel/Console.h>
|
||||
#include <Kernel/Devices/NullDevice.h>
|
||||
#include <Kernel/Devices/RandomDevice.h>
|
||||
#include <Kernel/FileSystem/Custody.h>
|
||||
|
@ -3196,3 +3197,26 @@ int Process::sys$clock_nanosleep(const Syscall::SC_clock_nanosleep_params* param
|
|||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
int Process::sys$sync()
|
||||
{
|
||||
VFS::the().sync();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$putch(char ch)
|
||||
{
|
||||
Console::the().put_char(ch);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$yield()
|
||||
{
|
||||
return Scheduler::yield();
|
||||
}
|
||||
|
||||
int Process::sys$beep()
|
||||
{
|
||||
Scheduler::beep();
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue