From: Robert Kuban Date: Mon, 15 Aug 2022 13:43:34 +0000 (+0200) Subject: Add patch to replace open with openat with AT_FDCWD X-Git-Tag: RELEASE-0.11.0~16 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=84f96d701cfb91bd12d09ab19783d66821a8c675;p=unikraft%2Flibs%2Fmusl.git Add patch to replace open with openat with AT_FDCWD This patch replaces calls to the open systemcall with the openat systemcall with the AT_FDCWD argument if SYS_open is not defined, similar to the original musl code. This is necessary as the open systemcall is not available on aarch64. Signed-off-by: Robert Kuban Reviewed-by: Eduard Vintilă Reviewed-by: Razvan Virtan Reviewed-by: Razvan Deaconescu Approved-by: Razvan Deaconescu Tested-by: Unikraft CI GitHub-Closes: #6 --- diff --git a/patches/0020-use_openat_ifndef_SYS_open.patch b/patches/0020-use_openat_ifndef_SYS_open.patch new file mode 100644 index 0000000..fb35f76 --- /dev/null +++ b/patches/0020-use_openat_ifndef_SYS_open.patch @@ -0,0 +1,28 @@ +diff --git a/src/internal/syscall.h b/src/internal/syscall.h +index 5bdb9ea9..c27e4915 100644 +--- a/src/internal/syscall.h ++++ b/src/internal/syscall.h +@@ -201,7 +201,11 @@ long __syscall_ret(unsigned long), __syscall(uk_syscall_arg_t, ...), + #define __SC_recvmmsg 19 + #define __SC_sendmmsg 20 + ++#ifdef SYS_open + #define __sys_open(...) uk_syscall_r_static(SYS_open, __VA_ARGS__) ++#else ++#define __sys_open(...) uk_syscall_r_static(SYS_openat, AT_FDCWD,__VA_ARGS__) ++#endif + #define sys_open(...) __syscall_ret(__sys_open(__VA_ARGS__)) + + /** +@@ -209,7 +213,11 @@ long __syscall_ret(unsigned long), __syscall(uk_syscall_arg_t, ...), + * However, we currently don't support this operation. + * Hence, we stick to the basic uk_syscall + */ ++#ifdef SYS_open + #define __sys_open_cp(...) uk_syscall_r_static(SYS_open, __VA_ARGS__) ++#else ++#define __sys_open_cp(...) uk_syscall_r_static(SYS_openat, AT_FDCWD, __VA_ARGS__) ++#endif + #define sys_open_cp(...) __syscall_ret(__sys_open_cp(__VA_ARGS__)) + + #endif