summaryrefslogtreecommitdiff
path: root/lib/intercept/intercept.h
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2017-06-18 18:56:08 +0000
committerChris Wilson <chris+github@qwirx.com>2017-06-22 20:28:06 +0100
commit6a04b0abd728da5211e6702b1d42aef95c02d8da (patch)
treebc8ec9cb1f7aa1783b73096f6e4a54c96133cb90 /lib/intercept/intercept.h
parentd8422a8b053b62c67e5fe2e861a09d2c792b657a (diff)
Fix intercept of SYS_open on platforms that only have SYS_openat (e.g. arm64)
Diffstat (limited to 'lib/intercept/intercept.h')
-rw-r--r--lib/intercept/intercept.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/intercept/intercept.h b/lib/intercept/intercept.h
index c0d61638..4de5f9f2 100644
--- a/lib/intercept/intercept.h
+++ b/lib/intercept/intercept.h
@@ -62,5 +62,14 @@ void intercept_setup_stat_post_hook (lstat_post_hook_t hookfn);
void intercept_clear_setup();
+// Some newer architectures don't have an open() syscall, but use openat() instead.
+// In these cases we define SYS_open (which is otherwise undefined) to equal SYS_openat
+// (which is defined) so that everywhere else we can call intercept_setup_error(SYS_open)
+// without caring about the difference.
+// https://chromium.googlesource.com/linux-syscall-support/
+#if !HAVE_DECL_SYS_OPEN && HAVE_DECL_SYS_OPENAT
+# define SYS_open SYS_openat
+#endif
+
#endif // !PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
#endif // !INTERCEPT_H