mirror of
https://github.com/fluencelabs/musl
synced 2025-07-30 22:01:57 +00:00
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.
This commit is contained in:
@@ -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__))
|
||||
|
Reference in New Issue
Block a user