From 594c827a22124ae550b9a877b8188e0898dff8db Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 24 May 2014 22:54:05 -0400 Subject: support kernels with no SYS_open syscall, only SYS_openat open is handled specially because it is used from so many places, in so many variants (2 or 3 arguments, setting errno or not, and cancellable or not). trying to do it as a function would not only increase bloat, but would also risk subtle breakage. this is the first step towards supporting "new" archs where linux lacks "old" syscalls. --- src/internal/syscall.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/internal/syscall.h') diff --git a/src/internal/syscall.h b/src/internal/syscall.h index 914b0d18..9dd92995 100644 --- a/src/internal/syscall.h +++ b/src/internal/syscall.h @@ -187,3 +187,21 @@ long __syscall_ret(unsigned long), __syscall(syscall_arg_t, ...), #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) +#else +#define __sys_open2(x,pn,fl) __syscall2(SYS_openat, AT_FDCWD, pn, (fl)|O_LARGEFILE) +#define __sys_open3(x,pn,fl,mo) __syscall3(SYS_openat, AT_FDCWD, pn, (fl)|O_LARGEFILE, mo) +#define __sys_open_cp2(x,pn,fl) __syscall_cp2(SYS_openat, AT_FDCWD, pn, (fl)|O_LARGEFILE) +#define __sys_open_cp3(x,pn,fl,mo) __syscall_cp3(SYS_openat, AT_FDCWD, pn, (fl)|O_LARGEFILE, mo) +#endif + +#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_ret(__sys_open_cp(__VA_ARGS__)) -- cgit v1.2.1