diff options
author | Rich Felker <dalias@aerifal.cx> | 2014-05-24 22:54:05 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2014-05-24 22:54:05 -0400 |
commit | 594c827a22124ae550b9a877b8188e0898dff8db (patch) | |
tree | f48f403bf1b6aa543f20783fa501c573aaa3a63e /src/internal/syscall.h | |
parent | 44d28e55121f9a7d736df59c09b963e17c8c4cfa (diff) | |
download | musl-594c827a22124ae550b9a877b8188e0898dff8db.tar.gz musl-594c827a22124ae550b9a877b8188e0898dff8db.tar.bz2 musl-594c827a22124ae550b9a877b8188e0898dff8db.tar.xz musl-594c827a22124ae550b9a877b8188e0898dff8db.zip |
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.
Diffstat (limited to 'src/internal/syscall.h')
-rw-r--r-- | src/internal/syscall.h | 18 |
1 files changed, 18 insertions, 0 deletions
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__)) |