diff mbox series

[pseudo,1/2] ports/linux: Ensure SYS_openat2 is defined

Message ID 20260213110624.1659480-1-richard.purdie@linuxfoundation.org
State New
Headers show
Series [pseudo,1/2] ports/linux: Ensure SYS_openat2 is defined | expand

Commit Message

Richard Purdie Feb. 13, 2026, 11:06 a.m. UTC
Some systems such as Debian 11 and OpenSUSE 15.5 don't define SYS_openat2
which means the syscall intercept doesn't work if pseudo compiled on those
systems and then used on others which do use that syscall.

Add a define to catch this situation and resolve it. Also add a error
if the value is undefined to prevent us getting into this situation again.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 ports/linux/portdefs.h        | 5 +++++
 ports/linux/pseudo_wrappers.c | 2 ++
 2 files changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/ports/linux/portdefs.h b/ports/linux/portdefs.h
index 1b4ce74..a8b2be6 100644
--- a/ports/linux/portdefs.h
+++ b/ports/linux/portdefs.h
@@ -53,3 +53,8 @@  GLIBC_COMPAT_SYMBOL(memcpy,2.0);
 #define _MKNOD_VER 1
 #endif
 #endif
+
+/* Debian 11 and Opensuse 15.5 need this */
+#ifndef SYS_openat2
+#define SYS_openat2 __NR_openat2
+#endif
diff --git a/ports/linux/pseudo_wrappers.c b/ports/linux/pseudo_wrappers.c
index df7de09..300b5a5 100644
--- a/ports/linux/pseudo_wrappers.c
+++ b/ports/linux/pseudo_wrappers.c
@@ -96,6 +96,8 @@  syscall(long number, ...) {
 
 		return wrap_openat2(dirfd, path, how, size);
 	}
+#else
+#error SYS_openat2 not defined
 #endif
 
 #ifdef SYS_renameat2