From 6dc56e664bfd9d71951842cf006b7a76eb35cc34 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 28 Jan 2016 15:44:11 -0500 Subject: [svn-r29011] LFS changes in the autotools and library. * We assume that fseeko and ftello exist. * The *64 IO functions and types are no longer explicitly used. We now rely on a mapping provided by _FILE_OFFSET_BITS (or its equivalent). * _LARGEFILE(64)_SOURCE is no longer exposed via AM_CPPFLAGS. The CMake files have not yet been updated but CMake is still functional. The CMake configure files will just run a few unecessary tests and create unneeded #defines until they are updated in a few days. Tested on: Linux, OS X, Solaris, z/OS --- configure.ac | 22 ------------------- src/H5FDstdio.c | 21 +++++------------- src/H5private.h | 68 +++++++++++++++------------------------------------------ 3 files changed, 23 insertions(+), 88 deletions(-) diff --git a/configure.ac b/configure.ac index 2f81607..4ab4245 100644 --- a/configure.ac +++ b/configure.ac @@ -1045,10 +1045,6 @@ fi ## case "$host_cpu-$host_vendor-$host_os" in *linux*) - ## Make available various LFS-related routines using the following - ## _LARGEFILE*_SOURCE macros. - AM_CPPFLAGS="-D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE $AM_CPPFLAGS" - ## Add POSIX support on Linux systems, so defines ## __USE_POSIX, which is required to get the prototype for fdopen ## defined correctly in . @@ -1083,23 +1079,6 @@ esac CPPFLAGS="$H5_CPPFLAGS $AM_CPPFLAGS $CPPFLAGS" CFLAGS="$H5_CFLAGS $AM_CFLAGS $CFLAGS" -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -]], - [[off64_t n = 0;]])], - [AC_CHECK_FUNCS([lseek64 fseeko64 ftello64 ftruncate64])], - [AC_MSG_RESULT([skipping test for lseek64, fseeko64 , ftello64, ftruncate64 because off64_t is not defined])]) - -AC_CHECK_FUNCS([fseeko ftello]) - -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -]], -[[struct stat64 sb;]])], -[AC_CHECK_FUNCS([stat64 fstat64])], -[AC_MSG_RESULT([skipping test for stat64 and fstat64])]) - ## Checkpoint the cache AC_CACHE_SAVE @@ -1150,7 +1129,6 @@ cat >>confdefs.h <<\EOF #include /*for off_t definition*/ EOF AC_CHECK_SIZEOF([off_t]) -AC_CHECK_SIZEOF([off64_t]) if test "X$C9x" = "Xyes"; then cat >>confdefs.h <<\EOF diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index d5b3d40..bc85c74 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -126,23 +126,14 @@ typedef struct H5FD_stdio_t { #endif /* H5_HAVE_MINGW */ #endif /* H5_HAVE_WIN32_API */ -/* Use file_xxx to indicate these are local macros, avoiding confusing - * with the global HD_xxx macros. - * Assume fseeko, which is POSIX standard, is always supported; - * but prefer to use fseeko64 if supported. +/* If these functions weren't re-defined for Windows, give them + * more platform-independent names. */ #ifndef file_fseek - #ifdef H5_HAVE_FSEEKO64 - #define file_fseek fseeko64 - #define file_offset_t off64_t - #define file_ftruncate ftruncate64 - #define file_ftell ftello64 - #else - #define file_fseek fseeko - #define file_offset_t off_t - #define file_ftruncate ftruncate - #define file_ftell ftello - #endif /* H5_HAVE_FSEEKO64 */ + #define file_fseek fseeko + #define file_offset_t off_t + #define file_ftruncate ftruncate + #define file_ftell ftello #endif /* file_fseek */ /* These macros check for overflow of various quantities. These macros diff --git a/src/H5private.h b/src/H5private.h index 6a71dc4..4ce6431 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -870,58 +870,31 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #endif /* HDfrexpl */ /* fscanf() variable arguments */ #ifndef HDfseek - #ifdef H5_HAVE_FSEEKO - #define HDfseek(F,O,W) fseeko(F,O,W) - #else /* H5_HAVE_FSEEKO */ - #define HDfseek(F,O,W) fseek(F,O,W) - #endif /* H5_HAVE_FSEEKO */ + #define HDfseek(F,O,W) fseeko(F,O,W) #endif /* HDfseek */ #ifndef HDfsetpos #define HDfsetpos(F,P) fsetpos(F,P) #endif /* HDfsetpos */ -/* definitions related to the file stat utilities. - * For Unix, if off_t is not 64bit big, try use the pseudo-standard - * xxx64 versions if available. - */ -#if !defined(HDfstat) || !defined(HDstat) || !defined(HDlstat) - #if H5_SIZEOF_OFF_T!=8 && H5_SIZEOF_OFF64_T==8 && defined(H5_HAVE_STAT64) - #ifndef HDfstat - #define HDfstat(F,B) fstat64(F,B) - #endif /* HDfstat */ - #ifndef HDlstat - #define HDlstat(S,B) lstat64(S,B) - #endif /* HDlstat */ - #ifndef HDstat - #define HDstat(S,B) stat64(S,B) - #endif /* HDstat */ - typedef struct stat64 h5_stat_t; - typedef off64_t h5_stat_size_t; - #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF64_T - #else /* H5_SIZEOF_OFF_T!=8 && ... */ - #ifndef HDfstat - #define HDfstat(F,B) fstat(F,B) - #endif /* HDfstat */ - #ifndef HDlstat - #define HDlstat(S,B) lstat(S,B) - #endif /* HDlstat */ - #ifndef HDstat - #define HDstat(S,B) stat(S,B) - #endif /* HDstat */ - typedef struct stat h5_stat_t; - typedef off_t h5_stat_size_t; - #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T - #endif /* H5_SIZEOF_OFF_T!=8 && ... */ -#endif /* !defined(HDfstat) || !defined(HDstat) */ +#ifndef HDfstat + #define HDfstat(F,B) fstat(F,B) +#endif /* HDfstat */ +#ifndef HDlstat + #define HDlstat(S,B) lstat(S,B) +#endif /* HDlstat */ +#ifndef HDstat + #define HDstat(S,B) stat(S,B) +#endif /* HDstat */ + +typedef struct stat h5_stat_t; +typedef off_t h5_stat_size_t; +#define HDoff_t off_t +#define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T #ifndef HDftell - #define HDftell(F) ftell(F) + #define HDftell(F) ftello(F) #endif /* HDftell */ #ifndef HDftruncate - #ifdef H5_HAVE_FTRUNCATE64 - #define HDftruncate(F,L) ftruncate64(F,L) - #else #define HDftruncate(F,L) ftruncate(F,L) - #endif #endif /* HDftruncate */ #ifndef HDfwrite #define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F) @@ -1064,15 +1037,8 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #ifndef HDlongjmp #define HDlongjmp(J,N) longjmp(J,N) #endif /* HDlongjmp */ -/* HDlseek and HDoff_t must be defined together for consistency. */ #ifndef HDlseek - #ifdef H5_HAVE_LSEEK64 - #define HDlseek(F,O,W) lseek64(F,O,W) - #define HDoff_t off64_t - #else - #define HDlseek(F,O,W) lseek(F,O,W) - #define HDoff_t off_t - #endif + #define HDlseek(F,O,W) lseek(F,O,W) #endif /* HDlseek */ #ifndef HDmalloc #define HDmalloc(Z) malloc(Z) -- cgit v0.12