| Index: fusl/src/internal/syscall.h
|
| diff --git a/fusl/src/internal/syscall.h b/fusl/src/internal/syscall.h
|
| index ff3cf53a8cbed53f1d05862e0ee9d56ae345a5e5..56ed3280147184839cf53914f2224bee03a016cb 100644
|
| --- a/fusl/src/internal/syscall.h
|
| +++ b/fusl/src/internal/syscall.h
|
| @@ -13,64 +13,86 @@
|
| #endif
|
|
|
| #ifndef __scc
|
| -#define __scc(X) ((long) (X))
|
| +#define __scc(X) ((long)(X))
|
| typedef long syscall_arg_t;
|
| #endif
|
|
|
| -__attribute__((visibility("hidden")))
|
| -long __syscall_ret(unsigned long), __syscall(syscall_arg_t, ...),
|
| - __syscall_cp(syscall_arg_t, syscall_arg_t, syscall_arg_t, syscall_arg_t,
|
| - syscall_arg_t, syscall_arg_t, syscall_arg_t);
|
| +__attribute__((visibility("hidden"))) long __syscall_ret(unsigned long),
|
| + __syscall(syscall_arg_t, ...), __syscall_cp(syscall_arg_t,
|
| + syscall_arg_t,
|
| + syscall_arg_t,
|
| + syscall_arg_t,
|
| + syscall_arg_t,
|
| + syscall_arg_t,
|
| + syscall_arg_t);
|
|
|
| #ifdef SYSCALL_NO_INLINE
|
| #define __syscall0(n) (__syscall)(n)
|
| -#define __syscall1(n,a) (__syscall)(n,__scc(a))
|
| -#define __syscall2(n,a,b) (__syscall)(n,__scc(a),__scc(b))
|
| -#define __syscall3(n,a,b,c) (__syscall)(n,__scc(a),__scc(b),__scc(c))
|
| -#define __syscall4(n,a,b,c,d) (__syscall)(n,__scc(a),__scc(b),__scc(c),__scc(d))
|
| -#define __syscall5(n,a,b,c,d,e) (__syscall)(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e))
|
| -#define __syscall6(n,a,b,c,d,e,f) (__syscall)(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),__scc(f))
|
| +#define __syscall1(n, a) (__syscall)(n, __scc(a))
|
| +#define __syscall2(n, a, b) (__syscall)(n, __scc(a), __scc(b))
|
| +#define __syscall3(n, a, b, c) (__syscall)(n, __scc(a), __scc(b), __scc(c))
|
| +#define __syscall4(n, a, b, c, d) \
|
| + (__syscall)(n, __scc(a), __scc(b), __scc(c), __scc(d))
|
| +#define __syscall5(n, a, b, c, d, e) \
|
| + (__syscall)(n, __scc(a), __scc(b), __scc(c), __scc(d), __scc(e))
|
| +#define __syscall6(n, a, b, c, d, e, f) \
|
| + (__syscall)(n, __scc(a), __scc(b), __scc(c), __scc(d), __scc(e), __scc(f))
|
| #else
|
| -#define __syscall1(n,a) __syscall1(n,__scc(a))
|
| -#define __syscall2(n,a,b) __syscall2(n,__scc(a),__scc(b))
|
| -#define __syscall3(n,a,b,c) __syscall3(n,__scc(a),__scc(b),__scc(c))
|
| -#define __syscall4(n,a,b,c,d) __syscall4(n,__scc(a),__scc(b),__scc(c),__scc(d))
|
| -#define __syscall5(n,a,b,c,d,e) __syscall5(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e))
|
| -#define __syscall6(n,a,b,c,d,e,f) __syscall6(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),__scc(f))
|
| -#endif
|
| -#define __syscall7(n,a,b,c,d,e,f,g) (__syscall)(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),__scc(f),__scc(g))
|
| -
|
| -#define __SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,...) n
|
| -#define __SYSCALL_NARGS(...) __SYSCALL_NARGS_X(__VA_ARGS__,7,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 __syscall1(n, a) __syscall1(n, __scc(a))
|
| +#define __syscall2(n, a, b) __syscall2(n, __scc(a), __scc(b))
|
| +#define __syscall3(n, a, b, c) __syscall3(n, __scc(a), __scc(b), __scc(c))
|
| +#define __syscall4(n, a, b, c, d) \
|
| + __syscall4(n, __scc(a), __scc(b), __scc(c), __scc(d))
|
| +#define __syscall5(n, a, b, c, d, e) \
|
| + __syscall5(n, __scc(a), __scc(b), __scc(c), __scc(d), __scc(e))
|
| +#define __syscall6(n, a, b, c, d, e, f) \
|
| + __syscall6(n, __scc(a), __scc(b), __scc(c), __scc(d), __scc(e), __scc(f))
|
| +#endif
|
| +#define __syscall7(n, a, b, c, d, e, f, g) \
|
| + (__syscall)(n, __scc(a), __scc(b), __scc(c), __scc(d), __scc(e), __scc(f), \
|
| + __scc(g))
|
| +
|
| +#define __SYSCALL_NARGS_X(a, b, c, d, e, f, g, h, n, ...) n
|
| +#define __SYSCALL_NARGS(...) \
|
| + __SYSCALL_NARGS_X(__VA_ARGS__, 7, 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__))
|
|
|
| #define socketcall __socketcall
|
| #define socketcall_cp __socketcall_cp
|
|
|
| -#define __syscall_cp0(n) (__syscall_cp)(n,0,0,0,0,0,0)
|
| -#define __syscall_cp1(n,a) (__syscall_cp)(n,__scc(a),0,0,0,0,0)
|
| -#define __syscall_cp2(n,a,b) (__syscall_cp)(n,__scc(a),__scc(b),0,0,0,0)
|
| -#define __syscall_cp3(n,a,b,c) (__syscall_cp)(n,__scc(a),__scc(b),__scc(c),0,0,0)
|
| -#define __syscall_cp4(n,a,b,c,d) (__syscall_cp)(n,__scc(a),__scc(b),__scc(c),__scc(d),0,0)
|
| -#define __syscall_cp5(n,a,b,c,d,e) (__syscall_cp)(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),0)
|
| -#define __syscall_cp6(n,a,b,c,d,e,f) (__syscall_cp)(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),__scc(f))
|
| -
|
| -#define __syscall_cp(...) __SYSCALL_DISP(__syscall_cp,__VA_ARGS__)
|
| +#define __syscall_cp0(n) (__syscall_cp)(n, 0, 0, 0, 0, 0, 0)
|
| +#define __syscall_cp1(n, a) (__syscall_cp)(n, __scc(a), 0, 0, 0, 0, 0)
|
| +#define __syscall_cp2(n, a, b) (__syscall_cp)(n, __scc(a), __scc(b), 0, 0, 0, 0)
|
| +#define __syscall_cp3(n, a, b, c) \
|
| + (__syscall_cp)(n, __scc(a), __scc(b), __scc(c), 0, 0, 0)
|
| +#define __syscall_cp4(n, a, b, c, d) \
|
| + (__syscall_cp)(n, __scc(a), __scc(b), __scc(c), __scc(d), 0, 0)
|
| +#define __syscall_cp5(n, a, b, c, d, e) \
|
| + (__syscall_cp)(n, __scc(a), __scc(b), __scc(c), __scc(d), __scc(e), 0)
|
| +#define __syscall_cp6(n, a, b, c, d, e, f) \
|
| + (__syscall_cp)(n, __scc(a), __scc(b), __scc(c), __scc(d), __scc(e), __scc(f))
|
| +
|
| +#define __syscall_cp(...) __SYSCALL_DISP(__syscall_cp, __VA_ARGS__)
|
| #define syscall_cp(...) __syscall_ret(__syscall_cp(__VA_ARGS__))
|
|
|
| #ifndef SYSCALL_USE_SOCKETCALL
|
| -#define __socketcall(nm,a,b,c,d,e,f) syscall(SYS_##nm, a, b, c, d, e, f)
|
| -#define __socketcall_cp(nm,a,b,c,d,e,f) syscall_cp(SYS_##nm, a, b, c, d, e, f)
|
| +#define __socketcall(nm, a, b, c, d, e, f) syscall(SYS_##nm, a, b, c, d, e, f)
|
| +#define __socketcall_cp(nm, a, b, c, d, e, f) \
|
| + syscall_cp(SYS_##nm, a, b, c, d, e, f)
|
| #else
|
| -#define __socketcall(nm,a,b,c,d,e,f) syscall(SYS_socketcall, __SC_##nm, \
|
| - ((long [6]){ (long)a, (long)b, (long)c, (long)d, (long)e, (long)f }))
|
| -#define __socketcall_cp(nm,a,b,c,d,e,f) syscall_cp(SYS_socketcall, __SC_##nm, \
|
| - ((long [6]){ (long)a, (long)b, (long)c, (long)d, (long)e, (long)f }))
|
| +#define __socketcall(nm, a, b, c, d, e, f) \
|
| + syscall(SYS_socketcall, __SC_##nm, \
|
| + ((long[6]){(long)a, (long)b, (long)c, (long)d, (long)e, (long)f}))
|
| +#define __socketcall_cp(nm, a, b, c, d, e, f) \
|
| + syscall_cp( \
|
| + SYS_socketcall, __SC_##nm, \
|
| + ((long[6]){(long)a, (long)b, (long)c, (long)d, (long)e, (long)f}))
|
| #endif
|
|
|
| /* fixup legacy 16-bit junk */
|
| @@ -116,7 +138,6 @@ long __syscall_ret(unsigned long), __syscall(syscall_arg_t, ...),
|
| #define SYS_setfsgid SYS_setfsgid32
|
| #endif
|
|
|
| -
|
| /* fixup legacy 32-bit-vs-lfs64 junk */
|
|
|
| #ifdef SYS_fcntl64
|
| @@ -201,43 +222,50 @@ long __syscall_ret(unsigned long), __syscall(syscall_arg_t, ...),
|
|
|
| /* socketcall calls */
|
|
|
| -#define __SC_socket 1
|
| -#define __SC_bind 2
|
| -#define __SC_connect 3
|
| -#define __SC_listen 4
|
| -#define __SC_accept 5
|
| +#define __SC_socket 1
|
| +#define __SC_bind 2
|
| +#define __SC_connect 3
|
| +#define __SC_listen 4
|
| +#define __SC_accept 5
|
| #define __SC_getsockname 6
|
| #define __SC_getpeername 7
|
| -#define __SC_socketpair 8
|
| -#define __SC_send 9
|
| -#define __SC_recv 10
|
| -#define __SC_sendto 11
|
| -#define __SC_recvfrom 12
|
| -#define __SC_shutdown 13
|
| -#define __SC_setsockopt 14
|
| -#define __SC_getsockopt 15
|
| -#define __SC_sendmsg 16
|
| -#define __SC_recvmsg 17
|
| -#define __SC_accept4 18
|
| -#define __SC_recvmmsg 19
|
| -#define __SC_sendmmsg 20
|
| +#define __SC_socketpair 8
|
| +#define __SC_send 9
|
| +#define __SC_recv 10
|
| +#define __SC_sendto 11
|
| +#define __SC_recvfrom 12
|
| +#define __SC_shutdown 13
|
| +#define __SC_setsockopt 14
|
| +#define __SC_getsockopt 15
|
| +#define __SC_sendmsg 16
|
| +#define __SC_recvmsg 17
|
| +#define __SC_accept4 18
|
| +#define __SC_recvmmsg 19
|
| +#define __SC_sendmmsg 20
|
|
|
| #ifdef SYS_open
|
| -#define __sys_open2(x,pn,fl) __syscall2(SYS_open, pn, (fl)|O_LARGEFILE)
|
| -#define __sys_open3(x,pn,fl,mo) __syscall3(SYS_open, pn, (fl)|O_LARGEFILE, mo)
|
| -#define __sys_open_cp2(x,pn,fl) __syscall_cp2(SYS_open, pn, (fl)|O_LARGEFILE)
|
| -#define __sys_open_cp3(x,pn,fl,mo) __syscall_cp3(SYS_open, pn, (fl)|O_LARGEFILE, mo)
|
| +#define __sys_open2(x, pn, fl) __syscall2(SYS_open, pn, (fl) | O_LARGEFILE)
|
| +#define __sys_open3(x, pn, fl, mo) \
|
| + __syscall3(SYS_open, pn, (fl) | O_LARGEFILE, mo)
|
| +#define __sys_open_cp2(x, pn, fl) \
|
| + __syscall_cp2(SYS_open, pn, (fl) | O_LARGEFILE)
|
| +#define __sys_open_cp3(x, pn, fl, mo) \
|
| + __syscall_cp3(SYS_open, pn, (fl) | O_LARGEFILE, mo)
|
| #else
|
| -#define __sys_open2(x,pn,fl) __syscall3(SYS_openat, AT_FDCWD, pn, (fl)|O_LARGEFILE)
|
| -#define __sys_open3(x,pn,fl,mo) __syscall4(SYS_openat, AT_FDCWD, pn, (fl)|O_LARGEFILE, mo)
|
| -#define __sys_open_cp2(x,pn,fl) __syscall_cp3(SYS_openat, AT_FDCWD, pn, (fl)|O_LARGEFILE)
|
| -#define __sys_open_cp3(x,pn,fl,mo) __syscall_cp4(SYS_openat, AT_FDCWD, pn, (fl)|O_LARGEFILE, mo)
|
| +#define __sys_open2(x, pn, fl) \
|
| + __syscall3(SYS_openat, AT_FDCWD, pn, (fl) | O_LARGEFILE)
|
| +#define __sys_open3(x, pn, fl, mo) \
|
| + __syscall4(SYS_openat, AT_FDCWD, pn, (fl) | O_LARGEFILE, mo)
|
| +#define __sys_open_cp2(x, pn, fl) \
|
| + __syscall_cp3(SYS_openat, AT_FDCWD, pn, (fl) | O_LARGEFILE)
|
| +#define __sys_open_cp3(x, pn, fl, mo) \
|
| + __syscall_cp4(SYS_openat, AT_FDCWD, pn, (fl) | O_LARGEFILE, mo)
|
| #endif
|
|
|
| -#define __sys_open(...) __SYSCALL_DISP(__sys_open,,__VA_ARGS__)
|
| +#define __sys_open(...) __SYSCALL_DISP(__sys_open, , __VA_ARGS__)
|
| #define sys_open(...) __syscall_ret(__sys_open(__VA_ARGS__))
|
|
|
| -#define __sys_open_cp(...) __SYSCALL_DISP(__sys_open_cp,,__VA_ARGS__)
|
| +#define __sys_open_cp(...) __SYSCALL_DISP(__sys_open_cp, , __VA_ARGS__)
|
| #define sys_open_cp(...) __syscall_ret(__sys_open_cp(__VA_ARGS__))
|
|
|
| #endif
|
|
|