wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
syscall.h
Go to the documentation of this file.
1
#ifndef QUIC_SYS_SYSCALL_H
2
#define QUIC_SYS_SYSCALL_H
3
11
12
typedef
unsigned
long
u64
;
13
typedef
long
i64
;
14
typedef
unsigned
int
u32
;
15
typedef
int
i32
;
16
typedef
unsigned
short
u16
;
17
typedef
unsigned
char
u8
;
18
typedef
i64
ssz
;
19
typedef
u64
usz
;
20
21
#define SYS_read 0
22
#define SYS_write 1
23
#define SYS_close 3
24
#define SYS_newfstatat 262
25
#define SYS_pread64 17
26
#define SYS_mmap 9
27
#define SYS_mprotect 10
28
#define SYS_munmap 11
29
#define SYS_rt_sigaction 13
30
#define SYS_rt_sigprocmask 14
31
#define SYS_rt_sigreturn 15
32
#define SYS_socket 41
33
#define SYS_sendmsg 46
34
#define SYS_sendto 44
35
#define SYS_recvfrom 45
36
#define SYS_bind 49
37
#define SYS_recvmmsg 299
38
#define SYS_setsockopt 54
39
#define SYS_clone 56
40
#define SYS_exit 60
41
#define SYS_gettid 186
42
#define SYS_futex 202
43
#define SYS_sched_setaffinity 203
44
#define SYS_sched_getaffinity 204
45
#define SYS_clock_gettime 228
46
#define SYS_openat 257
47
#define SYS_mkdirat 258
48
#define SYS_getrandom 318
49
#define SYS_fork 57
50
#define SYS_wait4 61
51
#define SYS_exit_group 231
52
54
#define SIGTERM 15
55
59
#define SA_RESTORER 0x04000000u
60
78
static
inline
i64
syscall6
(
i64
n,
i64
a,
i64
b,
i64
c,
i64
d,
i64
e,
i64
f) {
79
i64
ret;
80
register
i64
r10 __asm__(
"r10"
) = d;
81
register
i64
r8 __asm__(
"r8"
) = e;
82
register
i64
r9 __asm__(
"r9"
) = f;
83
__asm__
volatile
(
"syscall"
84
:
"=a"
(ret)
85
:
"a"
(n),
"D"
(a),
"S"
(b),
"d"
(c),
"r"
(r10),
"r"
(r8),
"r"
(r9)
86
:
"rcx"
,
"r11"
,
"memory"
);
87
return
ret;
88
}
89
91
#define syscall2(n, a, b) syscall6((n), (i64)(a), (i64)(b), 0, 0, 0, 0)
93
#define syscall3(n, a, b, c) \
94
syscall6((n), (i64)(a), (i64)(b), (i64)(c), 0, 0, 0)
95
96
#define syscall4(n, a, b, c, d) \
97
syscall6((n), (i64)(a), (i64)(b), (i64)(c), (i64)(d), 0, 0)
98
99
#define syscall5(n, a, b, c, d, e) \
100
syscall6((n), (i64)(a), (i64)(b), (i64)(c), (i64)(d), (i64)(e), 0)
101
102
#define syscall1(n, a) syscall6((n), (i64)(a), 0, 0, 0, 0, 0)
103
104
#endif
u32
unsigned int u32
unsigned 32-bit integer
Definition
syscall.h:14
i64
long i64
signed 64-bit integer
Definition
syscall.h:13
i32
int i32
signed 32-bit integer
Definition
syscall.h:15
syscall6
static i64 syscall6(i64 n, i64 a, i64 b, i64 c, i64 d, i64 e, i64 f)
Six-argument raw x86_64 Linux syscall.
Definition
syscall.h:78
usz
u64 usz
unsigned size (size_t equivalent)
Definition
syscall.h:19
u16
unsigned short u16
unsigned 16-bit integer
Definition
syscall.h:16
ssz
i64 ssz
signed size (ssize_t equivalent)
Definition
syscall.h:18
u8
unsigned char u8
unsigned 8-bit integer / byte
Definition
syscall.h:17
u64
unsigned long u64
unsigned 64-bit integer
Definition
syscall.h:12
common
platform
sys
syscall.h
Generated by
1.16.1