1 #include <sys/syscall.h>
5 #define _SYMSTR(str) #str
6 #define SYMSTR(str) _SYMSTR(str)
8 #define SYMVER(compat_sym, orig_sym, ver_sym) \
9 __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@LIBAIO_" SYMSTR(ver_sym));
11 #define DEFSYMVER(compat_sym, orig_sym, ver_sym) \
12 __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@@LIBAIO_" SYMSTR(ver_sym));
15 #include "syscall-i386.h"
16 #elif defined(__x86_64__)
17 #include "syscall-x86_64.h"
18 #elif defined(__ia64__)
19 #include "syscall-ia64.h"
20 #elif defined(__PPC__)
21 #include "syscall-ppc.h"
22 #elif defined(__s390__)
23 #include "syscall-s390.h"
24 #elif defined(__alpha__)
25 #include "syscall-alpha.h"
26 #elif defined(__arm__)
27 #include "syscall-arm.h"
28 #elif defined(__sparc__)
29 #include "syscall-sparc.h"
30 #elif defined(__aarch64__) || defined(__loongarch__) || defined(__riscv)
31 #include "syscall-generic.h"
33 #warning "using system call numbers from sys/syscall.h"
36 #define _body_io_syscall(sname, args...) \
38 int ret, saved_errno; \
39 saved_errno = errno; \
40 ret= syscall(__NR_##sname, ## args); \
43 errno = saved_errno; \
48 #define io_syscall1(type,fname,sname,type1,arg1) \
49 type fname(type1 arg1) \
50 _body_io_syscall(sname, (long)arg1)
52 #define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \
53 type fname(type1 arg1,type2 arg2) \
54 _body_io_syscall(sname, (long)arg1, (long)arg2)
56 #define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \
57 type fname(type1 arg1,type2 arg2,type3 arg3) \
58 _body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3)
60 #define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
61 type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
62 _body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3, (long)arg4)
64 #define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, type5,arg5) \
65 type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
66 _body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3, (long)arg4, (long)arg5)
68 #define io_syscall6(type,fname,sname,type1,arg1,type2,arg2,type3,arg3, \
69 type4,arg4,type5,arg5,type6,arg6) \
70 type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \
72 _body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3, (long)arg4, \
73 (long)arg5, (long)arg6)