|
wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
|
x86_64 Linux direct syscalls. More...
Go to the source code of this file.
Macros | |
| #define | SYS_read 0 |
| read(2) syscall number | |
| #define | SYS_write 1 |
| write(2) syscall number | |
| #define | SYS_close 3 |
| close(2) syscall number | |
| #define | SYS_newfstatat 262 |
| newfstatat(2) syscall number | |
| #define | SYS_pread64 17 |
| pread64(2) syscall number | |
| #define | SYS_mmap 9 |
| mmap(2) syscall number | |
| #define | SYS_mprotect 10 |
| mprotect(2) syscall number | |
| #define | SYS_munmap 11 |
| munmap(2) syscall number | |
| #define | SYS_rt_sigaction 13 |
| rt_sigaction(2) syscall number | |
| #define | SYS_rt_sigprocmask 14 |
| rt_sigprocmask(2) syscall number | |
| #define | SYS_rt_sigreturn 15 |
| rt_sigreturn(2) syscall number | |
| #define | SYS_socket 41 |
| socket(2) syscall number | |
| #define | SYS_sendmsg 46 |
| sendmsg(2) syscall number | |
| #define | SYS_sendto 44 |
| sendto(2) syscall number | |
| #define | SYS_recvfrom 45 |
| recvfrom(2) syscall number | |
| #define | SYS_bind 49 |
| bind(2) syscall number | |
| #define | SYS_recvmmsg 299 |
| recvmmsg(2) syscall number | |
| #define | SYS_setsockopt 54 |
| setsockopt(2) syscall number | |
| #define | SYS_clone 56 |
| clone(2) syscall number | |
| #define | SYS_exit 60 |
| exit(2) syscall number | |
| #define | SYS_gettid 186 |
| gettid(2) syscall number | |
| #define | SYS_futex 202 |
| futex(2) syscall number | |
| #define | SYS_sched_setaffinity 203 |
| sched_setaffinity(2) syscall number | |
| #define | SYS_sched_getaffinity 204 |
| sched_getaffinity(2) syscall number | |
| #define | SYS_clock_gettime 228 |
| clock_gettime(2) syscall number | |
| #define | SYS_openat 257 |
| openat(2) syscall number | |
| #define | SYS_mkdirat 258 |
| mkdirat(2) syscall number | |
| #define | SYS_getrandom 318 |
| getrandom(2) syscall number | |
| #define | SYS_fork 57 |
| fork(2) syscall number | |
| #define | SYS_wait4 61 |
| wait4(2) syscall number | |
| #define | SYS_exit_group 231 |
| exit_group(2) syscall number | |
| #define | SIGTERM 15 |
| Signal numbers used by this SDK (Linux, all architectures). | |
| #define | SA_RESTORER 0x04000000u |
| x86_64 Linux rt_sigaction(2) requires SA_RESTORER plus a userspace trampoline that issues rt_sigreturn(2); the kernel refuses a bare handler with no restorer. | |
| #define | syscall2(n, a, b) |
| Two-argument syscall: syscall6() with the trailing arguments zeroed. | |
| #define | syscall3(n, a, b, c) |
| Three-argument syscall: syscall6() with the trailing arguments zeroed. | |
| #define | syscall4(n, a, b, c, d) |
| Four-argument syscall: syscall6() with the trailing arguments zeroed. | |
| #define | syscall5(n, a, b, c, d, e) |
| Five-argument syscall: syscall6() with the trailing argument zeroed. | |
| #define | syscall1(n, a) |
| One-argument syscall: syscall6() with the trailing arguments zeroed. | |
Typedefs | |
| typedef unsigned long | u64 |
| unsigned 64-bit integer | |
| typedef long | i64 |
| signed 64-bit integer | |
| typedef unsigned int | u32 |
| unsigned 32-bit integer | |
| typedef int | i32 |
| signed 32-bit integer | |
| typedef unsigned short | u16 |
| unsigned 16-bit integer | |
| typedef unsigned char | u8 |
| unsigned 8-bit integer / byte | |
| typedef i64 | ssz |
| signed size (ssize_t equivalent) | |
| typedef u64 | usz |
| unsigned size (size_t equivalent) | |
Functions | |
| static i64 | syscall6 (i64 n, i64 a, i64 b, i64 c, i64 d, i64 e, i64 f) |
| Six-argument raw x86_64 Linux syscall. | |
x86_64 Linux direct syscalls.
No libc.
Also defines the SDK's fixed-width integer types: with no libc there is no <stdint.h>, so every other header builds on the typedefs here.
| #define SIGTERM 15 |
Signal numbers used by this SDK (Linux, all architectures).
termination request
| #define syscall1 | ( | n, | |
| a ) |
One-argument syscall: syscall6() with the trailing arguments zeroed.
| #define syscall2 | ( | n, | |
| a, | |||
| b ) |
Two-argument syscall: syscall6() with the trailing arguments zeroed.
| #define syscall3 | ( | n, | |
| a, | |||
| b, | |||
| c ) |
Three-argument syscall: syscall6() with the trailing arguments zeroed.
| #define syscall4 | ( | n, | |
| a, | |||
| b, | |||
| c, | |||
| d ) |
| #define syscall5 | ( | n, | |
| a, | |||
| b, | |||
| c, | |||
| d, | |||
| e ) |
Six-argument raw x86_64 Linux syscall.
Arguments follow the x86_64 syscall ABI register order: number in rax, then rdi, rsi, rdx, r10, r8, r9. rcx/r11 are clobbered by the syscall instruction. The syscall1/syscall3 wrappers pass 0 for their unused trailing arguments.
| n | syscall number (one of the SYS_* constants) |
| a | 1st argument (rdi) |
| b | 2nd argument (rsi) |
| c | 3rd argument (rdx) |
| d | 4th argument (r10) |
| e | 5th argument (r8) |
| f | 6th argument (r9) |