summaryrefslogtreecommitdiff
path: root/lib/intercept/intercept.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/intercept/intercept.cpp')
-rw-r--r--lib/intercept/intercept.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/intercept/intercept.cpp b/lib/intercept/intercept.cpp
index 88ea0d6e..72bd8d4e 100644
--- a/lib/intercept/intercept.cpp
+++ b/lib/intercept/intercept.cpp
@@ -242,6 +242,10 @@ extern "C" int
open(const char *path, int flags, ...)
#endif // DEFINE_ONLY_OPEN64
{
+ // Some newer architectures don't have an open() syscall, but use openat() instead.
+ // In these cases we will need to call sys_openat() instead of sys_open().
+ // https://chromium.googlesource.com/linux-syscall-support/
+
if(intercept_count > 0)
{
if(intercept_filename != NULL &&
@@ -264,6 +268,8 @@ extern "C" int
#ifdef PLATFORM_NO_SYSCALL
int r = TEST_open(path, flags, mode);
+#elif HAVE_DECL_SYS_OPENAT && !HAVE_DECL_SYS_OPEN
+ int r = syscall(SYS_openat, AT_FDCWD, path, flags, mode);
#else
int r = syscall(SYS_open, path, flags, mode);
#endif
@@ -389,7 +395,7 @@ lseek(int fildes, off_t offset, int whence)
#else
#ifdef HAVE_LSEEK_DUMMY_PARAM
off_t r = syscall(SYS_lseek, fildes, 0 /* extra 0 required here! */, offset, whence);
- #elif defined(_FILE_OFFSET_BITS)
+ #elif defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 32
// Don't bother trying to call SYS__llseek on 32 bit since it is
// fiddly and not needed for the tests
off_t r = syscall(SYS_lseek, fildes, (uint32_t)offset, whence);