From 426a506afd1ffb3bd67e61b4693ee9bb968097a1 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 4 Sep 2014 01:36:08 +0000 Subject: Simplify code with macros, update comments and fix whitespace. Hopefully all of these changes are inconsequential. Merged back changes from the test refactor branch to reduce diffs. --- lib/intercept/intercept.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/intercept/intercept.cpp') diff --git a/lib/intercept/intercept.cpp b/lib/intercept/intercept.cpp index 7a33b610..ee79fe00 100644 --- a/lib/intercept/intercept.cpp +++ b/lib/intercept/intercept.cpp @@ -132,7 +132,7 @@ void intercept_setup_error(const char *filename, unsigned int errorafter, int er intercept_delay_ms = 0; } -void intercept_setup_delay(const char *filename, unsigned int delay_after, +void intercept_setup_delay(const char *filename, unsigned int delay_after, int delay_ms, int syscall_to_delay, int num_delays) { BOX_TRACE("Setup for delay: " << filename << -- cgit v1.2.3 From 5475701ecfb8334092b36fd1258c19096da7c1f6 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 10 Dec 2014 23:27:59 +0000 Subject: Fix intercept tests on NetBSD. Thanks to Jose Luis Rodriguez Garcia for the patch! --- lib/intercept/intercept.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/intercept/intercept.cpp') diff --git a/lib/intercept/intercept.cpp b/lib/intercept/intercept.cpp index ee79fe00..41a7333b 100644 --- a/lib/intercept/intercept.cpp +++ b/lib/intercept/intercept.cpp @@ -514,7 +514,7 @@ DIR *opendir(const char *dirname) { if (opendir_real == NULL) { - opendir_real = (opendir_t*)find_function("opendir"); + opendir_real = (opendir_t*)find_function(FUNC_OPENDIR); } if (opendir_real == NULL) @@ -547,7 +547,7 @@ struct dirent *readdir(DIR *dir) if (readdir_real == NULL) { - readdir_real = (readdir_t*)find_function("readdir"); + readdir_real = (readdir_t*)find_function(FUNC_READDIR); } if (readdir_real == NULL) -- cgit v1.2.3 From e2e1fcd3ef141aefa4c458c5e811365ee02aaa35 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 9 Dec 2015 22:32:37 +0000 Subject: Remove unused headers not present on Windows. Add missing header. --- lib/intercept/intercept.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/intercept/intercept.cpp') diff --git a/lib/intercept/intercept.cpp b/lib/intercept/intercept.cpp index 41a7333b..88ea0d6e 100644 --- a/lib/intercept/intercept.cpp +++ b/lib/intercept/intercept.cpp @@ -15,7 +15,6 @@ #include #endif #include -#include #ifdef HAVE_SYS_UIO_H #include -- cgit v1.2.3 From 81e9aa6545f7f19124c9f5e88982b867d8732965 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 26 Jan 2017 07:26:34 +0000 Subject: Hopefully fix test/raidfile on Solaris. 64-bit Solaris has _FILE_OFFSET_BITS defined (to 64), which was wrongly causing the substitute lseek in lib/intercept to enter the 32-bit branch. --- lib/intercept/intercept.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/intercept/intercept.cpp') diff --git a/lib/intercept/intercept.cpp b/lib/intercept/intercept.cpp index 88ea0d6e..ac8c4431 100644 --- a/lib/intercept/intercept.cpp +++ b/lib/intercept/intercept.cpp @@ -389,7 +389,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); -- cgit v1.2.3 From 6a04b0abd728da5211e6702b1d42aef95c02d8da Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 18 Jun 2017 18:56:08 +0000 Subject: Fix intercept of SYS_open on platforms that only have SYS_openat (e.g. arm64) --- lib/intercept/intercept.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/intercept/intercept.cpp') diff --git a/lib/intercept/intercept.cpp b/lib/intercept/intercept.cpp index ac8c4431..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 -- cgit v1.2.3