diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-03-19 21:36:10 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-03-19 21:36:10 -0400 |
commit | 685e40bb09f5f24a2af54ea09c97328808f76990 (patch) | |
tree | 73bbf60045bb3a9c8af4f2639e8adb2ad1ea6994 /include | |
parent | 462dbfc20788a6c9dd1ea4bb1cef086aa189615a (diff) | |
download | musl-685e40bb09f5f24a2af54ea09c97328808f76990.tar.gz musl-685e40bb09f5f24a2af54ea09c97328808f76990.tar.bz2 musl-685e40bb09f5f24a2af54ea09c97328808f76990.tar.xz musl-685e40bb09f5f24a2af54ea09c97328808f76990.zip |
syscall overhaul part two - unify public and internal syscall interface
with this patch, the syscallN() functions are no longer needed; a
variadic syscall() macro allows syscalls with anywhere from 0 to 6
arguments to be made with a single macro name. also, manually casting
each non-integer argument with (long) is no longer necessary; the
casts are hidden in the macros.
some source files which depended on being able to define the old macro
SYSCALL_RETURNS_ERRNO have been modified to directly use __syscall()
instead of syscall(). references to SYSCALL_SIGSET_SIZE and SYSCALL_LL
have also been changed.
x86_64 has not been tested, and may need a follow-up commit to fix any
minor bugs/oversights.
Diffstat (limited to 'include')
-rw-r--r-- | include/sys/syscall.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/include/sys/syscall.h b/include/sys/syscall.h index a8fec678..c86135a3 100644 --- a/include/sys/syscall.h +++ b/include/sys/syscall.h @@ -4,11 +4,27 @@ extern "C" { #endif +long __syscall_ret(long); +long __syscall(long, ...); +long syscall(long, ...); #include <bits/syscall.h> -long syscall(long, ...); +#define __syscall1(n,a) __syscall1(n,(long)(a)) +#define __syscall2(n,a,b) __syscall2(n,(long)(a),(long)(b)) +#define __syscall3(n,a,b,c) __syscall3(n,(long)(a),(long)(b),(long)(c)) +#define __syscall4(n,a,b,c,d) __syscall4(n,(long)(a),(long)(b),(long)(c),(long)(d)) +#define __syscall5(n,a,b,c,d,e) __syscall5(n,(long)(a),(long)(b),(long)(c),(long)(d),(long)(e)) +#define __syscall6(n,a,b,c,d,e,f) __syscall6(n,(long)(a),(long)(b),(long)(c),(long)(d),(long)(e),(long)(f)) + +#define __SYSCALL_NARGS_X(a,b,c,d,e,f,g,n,...) n +#define __SYSCALL_NARGS(...) __SYSCALL_NARGS_X(__VA_ARGS__,6,5,4,3,2,1,0) +#define __SYSCALL_CONCAT_X(a,b) a##b +#define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X(a,b) +#define __SYSCALL_DISP(b,...) __SYSCALL_CONCAT(b,__SYSCALL_NARGS(__VA_ARGS__))(__VA_ARGS__) +#define __syscall(...) __SYSCALL_DISP(__syscall,__VA_ARGS__) +#define syscall(...) __syscall_ret(__syscall(__VA_ARGS__)) #ifdef __cplusplus } |