From c08932c6e5e1609835219e9f42efe46bb6624a7d Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 24 Feb 2018 08:47:40 +0000 Subject: Fix raidfile tests on 32-bit Linux A recent fix for Solaris (commit 81e9aa6545f7f19124c9f5e88982b867d8732965) broke support for 32-bit Linux (which wasn't spotted because we didn't have any 32-bit builders). Try a different approach: detect whether the lseek syscall takes a 64-bit integer offset, and use that if possible. CMake: reimplement autoconf tests for 64-bit lseek (cherry picked from commit 138ea5d174f146f14d91a16bf5d1ce8e479d2024) --- lib/intercept/intercept.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/intercept/intercept.cpp') diff --git a/lib/intercept/intercept.cpp b/lib/intercept/intercept.cpp index 72bd8d4e..f46e6982 100644 --- a/lib/intercept/intercept.cpp +++ b/lib/intercept/intercept.cpp @@ -390,23 +390,23 @@ lseek(int fildes, off_t offset, int whence) { // random magic for lseek syscall, see /usr/src/lib/libc/sys/lseek.c CHECK_FOR_FAKE_ERROR_COND(fildes, 0, SYS_lseek, -1); + #ifdef PLATFORM_NO_SYSCALL int r = TEST_lseek(fildes, offset, whence); +#elif defined HAVE_LSEEK_DUMMY_PARAM + off_t r = syscall(SYS_lseek, fildes, 0 /* extra 0 required here! */, (int32_t)offset, + whence); +#elif defined HAVE_LSEEK_64_BIT + off_t r = syscall(SYS_lseek, fildes, (int64_t)offset, 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) && _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); - #else - off_t r = syscall(SYS_lseek, fildes, offset, whence); - #endif + off_t r = syscall(SYS_lseek, fildes, (int32_t)offset, whence); #endif + if(r != -1) { intercept_filepos = r; } + return r; } -- cgit v1.2.3