changeset 15448:80fc7c769d16

fsusage: Restore previous behaviour on AIX, Cygwin, Interix. * m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE): Enforce a 64-bit struct statvfs f_blocks field only on MacOS X.
author Bruno Haible <bruno@clisp.org>
date Sun, 24 Jul 2011 12:17:59 +0200
parents 103270df56db
children 411d56b204ad
files ChangeLog m4/fsusage.m4
diffstat 2 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2011-07-24  Bruno Haible  <bruno@clisp.org>
 
+	fsusage: Restore previous behaviour on AIX, Cygwin, Interix.
+	* m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE): Enforce a 64-bit struct statvfs
+	f_blocks field only on MacOS X.
+
 	fsusage: Support large volumes on glibc/Hurd, HP-UX, Solaris, MacOS X.
 	* m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE): Require AC_SYS_LARGEFILE.
 	* modules/fsusage (Depends-on): Add largefile.
--- a/m4/fsusage.m4
+++ b/m4/fsusage.m4
@@ -62,14 +62,19 @@
 "Do not use Tru64's statvfs implementation"
 #endif
 
-#include <limits.h>
 #include <sys/statvfs.h>
 
-/* Reject implementations, such as MacOS X 10.7, where f_blocks is a
-   32-bit quantity; that commonly limits file systems to 4 TiB, a
-   ridiculously small limit these days.  */
 struct statvfs fsd;
+
+#if defined __APPLE__ && defined __MACH__
+#include <limits.h>
+/* On MacOS X >= 10.5, f_blocks in 'struct statvfs' is a 32-bit quantity;
+   that commonly limits file systems to 4 TiB.  Whereas f_blocks in
+   'struct statfs' is a 64-bit type, thanks to the large-file support
+   that was enabled above.  In this case, don't use statvfs(); use statfs()
+   instead.  */
 int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1];
+#endif
 ]],
                                     [[statvfs (0, &fsd);]])],
                                  [fu_cv_sys_stat_statvfs=yes],