diff options
author | Robin Burchell <robin+git@viroteck.net> | 2019-05-28 11:53:16 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-05-28 17:31:20 +0200 |
commit | 0dc9af5f7e26b0dfa42cb75c900b9ef7a2192425 (patch) | |
tree | 93dbbbeb714f258bd7fb044633eb83bdcd908286 /Kernel/Syscall.h | |
parent | c11351ac507f863699d78aec46a77bd4d59e743c (diff) | |
download | serenity-0dc9af5f7e26b0dfa42cb75c900b9ef7a2192425.zip |
Add clang-format file
Also run it across the whole tree to get everything using the One True Style.
We don't yet run this in an automated fashion as it's a little slow, but
there is a snippet to do so in makeall.sh.
Diffstat (limited to 'Kernel/Syscall.h')
-rw-r--r-- | Kernel/Syscall.h | 244 |
1 files changed, 129 insertions, 115 deletions
diff --git a/Kernel/Syscall.h b/Kernel/Syscall.h index 2d093f6a74..c6ff1bc686 100644 --- a/Kernel/Syscall.h +++ b/Kernel/Syscall.h @@ -3,116 +3,116 @@ #include <AK/Types.h> #include <LibC/fd_set.h> -#define ENUMERATE_SYSCALLS \ - __ENUMERATE_SYSCALL(sleep) \ - __ENUMERATE_SYSCALL(yield) \ - __ENUMERATE_SYSCALL(putch) \ - __ENUMERATE_SYSCALL(open) \ - __ENUMERATE_SYSCALL(close) \ - __ENUMERATE_SYSCALL(read) \ - __ENUMERATE_SYSCALL(lseek) \ - __ENUMERATE_SYSCALL(kill) \ - __ENUMERATE_SYSCALL(getuid) \ - __ENUMERATE_SYSCALL(exit) \ - __ENUMERATE_SYSCALL(getgid) \ - __ENUMERATE_SYSCALL(getpid) \ - __ENUMERATE_SYSCALL(waitpid) \ - __ENUMERATE_SYSCALL(mmap) \ - __ENUMERATE_SYSCALL(munmap) \ - __ENUMERATE_SYSCALL(get_dir_entries) \ - __ENUMERATE_SYSCALL(lstat) \ - __ENUMERATE_SYSCALL(getcwd) \ - __ENUMERATE_SYSCALL(gettimeofday) \ - __ENUMERATE_SYSCALL(gethostname) \ - __ENUMERATE_SYSCALL(chdir) \ - __ENUMERATE_SYSCALL(uname) \ - __ENUMERATE_SYSCALL(set_mmap_name) \ - __ENUMERATE_SYSCALL(readlink) \ - __ENUMERATE_SYSCALL(write) \ - __ENUMERATE_SYSCALL(ttyname_r) \ - __ENUMERATE_SYSCALL(stat) \ - __ENUMERATE_SYSCALL(getsid) \ - __ENUMERATE_SYSCALL(setsid) \ - __ENUMERATE_SYSCALL(getpgid) \ - __ENUMERATE_SYSCALL(setpgid) \ - __ENUMERATE_SYSCALL(getpgrp) \ - __ENUMERATE_SYSCALL(fork) \ - __ENUMERATE_SYSCALL(execve) \ - __ENUMERATE_SYSCALL(geteuid) \ - __ENUMERATE_SYSCALL(getegid) \ - __ENUMERATE_SYSCALL(isatty) \ - __ENUMERATE_SYSCALL(getdtablesize) \ - __ENUMERATE_SYSCALL(dup) \ - __ENUMERATE_SYSCALL(dup2) \ - __ENUMERATE_SYSCALL(sigaction) \ - __ENUMERATE_SYSCALL(getppid) \ - __ENUMERATE_SYSCALL(umask) \ - __ENUMERATE_SYSCALL(getgroups) \ - __ENUMERATE_SYSCALL(setgroups) \ - __ENUMERATE_SYSCALL(sigreturn) \ - __ENUMERATE_SYSCALL(sigprocmask) \ - __ENUMERATE_SYSCALL(sigpending) \ - __ENUMERATE_SYSCALL(pipe) \ - __ENUMERATE_SYSCALL(killpg) \ - __ENUMERATE_SYSCALL(setuid) \ - __ENUMERATE_SYSCALL(setgid) \ - __ENUMERATE_SYSCALL(alarm) \ - __ENUMERATE_SYSCALL(fstat) \ - __ENUMERATE_SYSCALL(access) \ - __ENUMERATE_SYSCALL(fcntl) \ - __ENUMERATE_SYSCALL(ioctl) \ - __ENUMERATE_SYSCALL(mkdir) \ - __ENUMERATE_SYSCALL(times) \ - __ENUMERATE_SYSCALL(utime) \ - __ENUMERATE_SYSCALL(sync) \ - __ENUMERATE_SYSCALL(ptsname_r) \ - __ENUMERATE_SYSCALL(select) \ - __ENUMERATE_SYSCALL(unlink) \ - __ENUMERATE_SYSCALL(poll) \ - __ENUMERATE_SYSCALL(read_tsc) \ - __ENUMERATE_SYSCALL(rmdir) \ - __ENUMERATE_SYSCALL(chmod) \ - __ENUMERATE_SYSCALL(usleep) \ - __ENUMERATE_SYSCALL(socket) \ - __ENUMERATE_SYSCALL(bind) \ - __ENUMERATE_SYSCALL(accept) \ - __ENUMERATE_SYSCALL(listen) \ - __ENUMERATE_SYSCALL(connect) \ - __ENUMERATE_SYSCALL(create_shared_buffer) \ - __ENUMERATE_SYSCALL(get_shared_buffer) \ - __ENUMERATE_SYSCALL(release_shared_buffer) \ - __ENUMERATE_SYSCALL(link) \ - __ENUMERATE_SYSCALL(chown) \ - __ENUMERATE_SYSCALL(fchmod) \ - __ENUMERATE_SYSCALL(symlink) \ - __ENUMERATE_SYSCALL(restore_signal_mask) \ +#define ENUMERATE_SYSCALLS \ + __ENUMERATE_SYSCALL(sleep) \ + __ENUMERATE_SYSCALL(yield) \ + __ENUMERATE_SYSCALL(putch) \ + __ENUMERATE_SYSCALL(open) \ + __ENUMERATE_SYSCALL(close) \ + __ENUMERATE_SYSCALL(read) \ + __ENUMERATE_SYSCALL(lseek) \ + __ENUMERATE_SYSCALL(kill) \ + __ENUMERATE_SYSCALL(getuid) \ + __ENUMERATE_SYSCALL(exit) \ + __ENUMERATE_SYSCALL(getgid) \ + __ENUMERATE_SYSCALL(getpid) \ + __ENUMERATE_SYSCALL(waitpid) \ + __ENUMERATE_SYSCALL(mmap) \ + __ENUMERATE_SYSCALL(munmap) \ + __ENUMERATE_SYSCALL(get_dir_entries) \ + __ENUMERATE_SYSCALL(lstat) \ + __ENUMERATE_SYSCALL(getcwd) \ + __ENUMERATE_SYSCALL(gettimeofday) \ + __ENUMERATE_SYSCALL(gethostname) \ + __ENUMERATE_SYSCALL(chdir) \ + __ENUMERATE_SYSCALL(uname) \ + __ENUMERATE_SYSCALL(set_mmap_name) \ + __ENUMERATE_SYSCALL(readlink) \ + __ENUMERATE_SYSCALL(write) \ + __ENUMERATE_SYSCALL(ttyname_r) \ + __ENUMERATE_SYSCALL(stat) \ + __ENUMERATE_SYSCALL(getsid) \ + __ENUMERATE_SYSCALL(setsid) \ + __ENUMERATE_SYSCALL(getpgid) \ + __ENUMERATE_SYSCALL(setpgid) \ + __ENUMERATE_SYSCALL(getpgrp) \ + __ENUMERATE_SYSCALL(fork) \ + __ENUMERATE_SYSCALL(execve) \ + __ENUMERATE_SYSCALL(geteuid) \ + __ENUMERATE_SYSCALL(getegid) \ + __ENUMERATE_SYSCALL(isatty) \ + __ENUMERATE_SYSCALL(getdtablesize) \ + __ENUMERATE_SYSCALL(dup) \ + __ENUMERATE_SYSCALL(dup2) \ + __ENUMERATE_SYSCALL(sigaction) \ + __ENUMERATE_SYSCALL(getppid) \ + __ENUMERATE_SYSCALL(umask) \ + __ENUMERATE_SYSCALL(getgroups) \ + __ENUMERATE_SYSCALL(setgroups) \ + __ENUMERATE_SYSCALL(sigreturn) \ + __ENUMERATE_SYSCALL(sigprocmask) \ + __ENUMERATE_SYSCALL(sigpending) \ + __ENUMERATE_SYSCALL(pipe) \ + __ENUMERATE_SYSCALL(killpg) \ + __ENUMERATE_SYSCALL(setuid) \ + __ENUMERATE_SYSCALL(setgid) \ + __ENUMERATE_SYSCALL(alarm) \ + __ENUMERATE_SYSCALL(fstat) \ + __ENUMERATE_SYSCALL(access) \ + __ENUMERATE_SYSCALL(fcntl) \ + __ENUMERATE_SYSCALL(ioctl) \ + __ENUMERATE_SYSCALL(mkdir) \ + __ENUMERATE_SYSCALL(times) \ + __ENUMERATE_SYSCALL(utime) \ + __ENUMERATE_SYSCALL(sync) \ + __ENUMERATE_SYSCALL(ptsname_r) \ + __ENUMERATE_SYSCALL(select) \ + __ENUMERATE_SYSCALL(unlink) \ + __ENUMERATE_SYSCALL(poll) \ + __ENUMERATE_SYSCALL(read_tsc) \ + __ENUMERATE_SYSCALL(rmdir) \ + __ENUMERATE_SYSCALL(chmod) \ + __ENUMERATE_SYSCALL(usleep) \ + __ENUMERATE_SYSCALL(socket) \ + __ENUMERATE_SYSCALL(bind) \ + __ENUMERATE_SYSCALL(accept) \ + __ENUMERATE_SYSCALL(listen) \ + __ENUMERATE_SYSCALL(connect) \ + __ENUMERATE_SYSCALL(create_shared_buffer) \ + __ENUMERATE_SYSCALL(get_shared_buffer) \ + __ENUMERATE_SYSCALL(release_shared_buffer) \ + __ENUMERATE_SYSCALL(link) \ + __ENUMERATE_SYSCALL(chown) \ + __ENUMERATE_SYSCALL(fchmod) \ + __ENUMERATE_SYSCALL(symlink) \ + __ENUMERATE_SYSCALL(restore_signal_mask) \ __ENUMERATE_SYSCALL(get_shared_buffer_size) \ - __ENUMERATE_SYSCALL(seal_shared_buffer) \ - __ENUMERATE_SYSCALL(sendto) \ - __ENUMERATE_SYSCALL(recvfrom) \ - __ENUMERATE_SYSCALL(getsockopt) \ - __ENUMERATE_SYSCALL(setsockopt) \ - __ENUMERATE_SYSCALL(create_thread) \ - __ENUMERATE_SYSCALL(gettid) \ - __ENUMERATE_SYSCALL(donate) \ - __ENUMERATE_SYSCALL(rename) \ - __ENUMERATE_SYSCALL(shm_open) \ - __ENUMERATE_SYSCALL(shm_close) \ - __ENUMERATE_SYSCALL(ftruncate) \ - __ENUMERATE_SYSCALL(systrace) \ - __ENUMERATE_SYSCALL(exit_thread) \ - __ENUMERATE_SYSCALL(mknod) \ - __ENUMERATE_SYSCALL(writev) \ - __ENUMERATE_SYSCALL(beep) \ - __ENUMERATE_SYSCALL(getsockname) \ - __ENUMERATE_SYSCALL(getpeername) \ - + __ENUMERATE_SYSCALL(seal_shared_buffer) \ + __ENUMERATE_SYSCALL(sendto) \ + __ENUMERATE_SYSCALL(recvfrom) \ + __ENUMERATE_SYSCALL(getsockopt) \ + __ENUMERATE_SYSCALL(setsockopt) \ + __ENUMERATE_SYSCALL(create_thread) \ + __ENUMERATE_SYSCALL(gettid) \ + __ENUMERATE_SYSCALL(donate) \ + __ENUMERATE_SYSCALL(rename) \ + __ENUMERATE_SYSCALL(shm_open) \ + __ENUMERATE_SYSCALL(shm_close) \ + __ENUMERATE_SYSCALL(ftruncate) \ + __ENUMERATE_SYSCALL(systrace) \ + __ENUMERATE_SYSCALL(exit_thread) \ + __ENUMERATE_SYSCALL(mknod) \ + __ENUMERATE_SYSCALL(writev) \ + __ENUMERATE_SYSCALL(beep) \ + __ENUMERATE_SYSCALL(getsockname) \ + __ENUMERATE_SYSCALL(getpeername) namespace Syscall { -enum Function { +enum Function +{ #undef __ENUMERATE_SYSCALL -#define __ENUMERATE_SYSCALL(x) SC_ ##x , +#define __ENUMERATE_SYSCALL(x) SC_##x, ENUMERATE_SYSCALLS #undef __ENUMERATE_SYSCALL }; @@ -121,8 +121,10 @@ inline constexpr const char* to_string(Function function) { switch (function) { #undef __ENUMERATE_SYSCALL -#define __ENUMERATE_SYSCALL(x) case SC_ ##x: return #x; - ENUMERATE_SYSCALLS +#define __ENUMERATE_SYSCALL(x) \ + case SC_##x: \ + return #x; + ENUMERATE_SYSCALLS #undef __ENUMERATE_SYSCALL } return "Unknown"; @@ -152,7 +154,7 @@ struct SC_sendto_params { const void* data; size_t data_length; int flags; - const void* addr; // const sockaddr* + const void* addr; // const sockaddr* size_t addr_length; // socklen_t }; @@ -161,7 +163,7 @@ struct SC_recvfrom_params { void* buffer; size_t buffer_length; int flags; - void* addr; // sockaddr* + void* addr; // sockaddr* void* addr_length; // socklen_t* }; @@ -187,7 +189,10 @@ int sync(); inline dword invoke(Function function) { dword result; - asm volatile("int $0x82":"=a"(result):"a"(function):"memory"); + asm volatile("int $0x82" + : "=a"(result) + : "a"(function) + : "memory"); return result; } @@ -195,7 +200,10 @@ template<typename T1> inline dword invoke(Function function, T1 arg1) { dword result; - asm volatile("int $0x82":"=a"(result):"a"(function),"d"((dword)arg1):"memory"); + asm volatile("int $0x82" + : "=a"(result) + : "a"(function), "d"((dword)arg1) + : "memory"); return result; } @@ -203,7 +211,10 @@ template<typename T1, typename T2> inline dword invoke(Function function, T1 arg1, T2 arg2) { dword result; - asm volatile("int $0x82":"=a"(result):"a"(function),"d"((dword)arg1),"c"((dword)arg2):"memory"); + asm volatile("int $0x82" + : "=a"(result) + : "a"(function), "d"((dword)arg1), "c"((dword)arg2) + : "memory"); return result; } @@ -211,7 +222,10 @@ template<typename T1, typename T2, typename T3> inline dword invoke(Function function, T1 arg1, T2 arg2, T3 arg3) { dword result; - asm volatile("int $0x82":"=a"(result):"a"(function),"d"((dword)arg1),"c"((dword)arg2),"b"((dword)arg3):"memory"); + asm volatile("int $0x82" + : "=a"(result) + : "a"(function), "d"((dword)arg1), "c"((dword)arg2), "b"((dword)arg3) + : "memory"); return result; } #endif @@ -219,7 +233,7 @@ inline dword invoke(Function function, T1 arg1, T2 arg2, T3 arg3) } #undef __ENUMERATE_SYSCALL -#define __ENUMERATE_SYSCALL(x) using Syscall::SC_ ##x; - ENUMERATE_SYSCALLS +#define __ENUMERATE_SYSCALL(x) using Syscall::SC_##x; +ENUMERATE_SYSCALLS #undef __ENUMERATE_SYSCALL #define syscall Syscall::invoke |