]> xenbits.xensource.com Git - unikraft/libs/musl.git/commitdiff
Add patch to replace open with openat with AT_FDCWD
authorRobert Kuban <robert.kuban@opensynergy.com>
Mon, 15 Aug 2022 13:43:34 +0000 (15:43 +0200)
committerUnikraft <monkey@unikraft.io>
Thu, 24 Nov 2022 19:37:39 +0000 (19:37 +0000)
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 <robert.kuban@opensynergy.com>
Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #6

patches/0020-use_openat_ifndef_SYS_open.patch [new file with mode: 0644]

diff --git a/patches/0020-use_openat_ifndef_SYS_open.patch b/patches/0020-use_openat_ifndef_SYS_open.patch
new file mode 100644 (file)
index 0000000..fb35f76
--- /dev/null
@@ -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