1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

Kernel+LibC: Remove the isatty() syscall

This can be implemented entirely in userspace by calling tcgetattr().
To avoid screwing up the syscall indexes, this patch also adds a
mechanism for removing a syscall without shifting the index of other
syscalls.

Note that ports will still have to be rebuilt after this change,
as their LibC code will try to make the isatty() syscall on startup.
This commit is contained in:
Andreas Kling 2019-11-17 20:01:03 +01:00
parent 3d558f47b0
commit 3da6d89d1f
6 changed files with 19 additions and 14 deletions

View file

@ -50,7 +50,7 @@ typedef u32 socklen_t;
__ENUMERATE_SYSCALL(execve) \
__ENUMERATE_SYSCALL(geteuid) \
__ENUMERATE_SYSCALL(getegid) \
__ENUMERATE_SYSCALL(isatty) \
__ENUMERATE_REMOVED_SYSCALL(isatty) \
__ENUMERATE_SYSCALL(getdtablesize) \
__ENUMERATE_SYSCALL(dup) \
__ENUMERATE_SYSCALL(dup2) \
@ -144,9 +144,12 @@ namespace Syscall {
enum Function {
#undef __ENUMERATE_SYSCALL
#undef __ENUMERATE_REMOVED_SYSCALL
#define __ENUMERATE_REMOVED_SYSCALL(x) SC_##x,
#define __ENUMERATE_SYSCALL(x) SC_##x,
ENUMERATE_SYSCALLS
#undef __ENUMERATE_SYSCALL
#undef __ENUMERATE_REMOVED_SYSCALL
__Count
};
@ -154,11 +157,16 @@ inline constexpr const char* to_string(Function function)
{
switch (function) {
#undef __ENUMERATE_SYSCALL
#undef __ENUMERATE_REMOVED_SYSCALL
#define __ENUMERATE_REMOVED_SYSCALL(x) \
case SC_##x: \
return #x " (removed)";
#define __ENUMERATE_SYSCALL(x) \
case SC_##x: \
return #x;
ENUMERATE_SYSCALLS
#undef __ENUMERATE_SYSCALL
#undef __ENUMERATE_REMOVED_SYSCALL
default:
break;
}
@ -291,6 +299,8 @@ inline u32 invoke(Function function, T1 arg1, T2 arg2, T3 arg3)
#undef __ENUMERATE_SYSCALL
#define __ENUMERATE_SYSCALL(x) using Syscall::SC_##x;
#define __ENUMERATE_REMOVED_SYSCALL(x)
ENUMERATE_SYSCALLS
#undef __ENUMERATE_SYSCALL
#undef __ENUMERATE_REMOVED_SYSCALL
#define syscall Syscall::invoke