From 625d588938d638ce72457305203e61e9f9ebc3b8 Mon Sep 17 00:00:00 2001 From: Martin Ebourne Date: Sat, 7 Jan 2006 23:35:52 +0000 Subject: Fix raidfile intercept tests on 32 bit Linux with large file support. Now intercept tests are never disabled. --- configure.ac | 6 +----- lib/common/BoxPlatform.h | 5 ----- test/raidfile/intercept.cpp | 13 +++++++++++++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 8cb0d945..3322cf91 100644 --- a/configure.ac +++ b/configure.ac @@ -132,17 +132,13 @@ AC_CHECK_DECLS([XATTR_NOFOLLOW],,, [[#include ]]) ### Miscellaneous complicated feature checks ## Check for large file support active. AC_SYS_LARGEFILE has already worked -## out how to enable it if necessary, we need to know if we've got it so we -## can disable the raidfile intercepts +## out how to enable it if necessary, we just use this to report to the user AC_CACHE_CHECK([if we have large file support enabled], [have_large_file_support], [AC_RUN_IFELSE([AC_LANG_PROGRAM([[$ac_includes_default]], [[ return sizeof(off_t)==4; ]])], [have_large_file_support=yes], [have_large_file_support=no] )]) -if test "x$have_large_file_support" = "xyes"; then - AC_DEFINE([HAVE_LARGE_FILE_SUPPORT], 1, [Define to 1 large file support is in use]) -fi ## Find out how to do file locking AC_CHECK_FUNCS([flock]) diff --git a/lib/common/BoxPlatform.h b/lib/common/BoxPlatform.h index 42eb13e8..774776cb 100644 --- a/lib/common/BoxPlatform.h +++ b/lib/common/BoxPlatform.h @@ -47,11 +47,6 @@ #endif #endif -// Cannot do the intercepts in test/raidfile if large file support is enabled -#ifdef HAVE_LARGE_FILE_SUPPORT - #define PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE -#endif - #ifdef HAVE_DEFINE_PRAGMA // set packing to one bytes (can't use push/pop on gcc) #define BEGIN_STRUCTURE_PACKING_FOR_WIRE #pragma pack(1) diff --git a/test/raidfile/intercept.cpp b/test/raidfile/intercept.cpp index 11cd06e9..6df344e1 100644 --- a/test/raidfile/intercept.cpp +++ b/test/raidfile/intercept.cpp @@ -161,6 +161,15 @@ open(const char *path, int flags, mode_t mode) return r; } +extern "C" int +open64(const char *path, int flags, mode_t mode) +{ + // With _FILE_OFFSET_BITS set to 64 this should really use (flags | + // O_LARGEFILE) here, but not actually necessary for the tests and not + // worth the trouble finding O_LARGEFILE + return open(path, flags, mode); +} + extern "C" int close(int d) { @@ -245,6 +254,10 @@ 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) + // 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 -- cgit v1.2.3