fsusage: Restore previous behaviour on AIX, Cygwin, Interix.
authorBruno Haible <bruno@clisp.org>
Sun, 24 Jul 2011 10:17:59 +0000 (12:17 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 24 Jul 2011 10:17:59 +0000 (12:17 +0200)
* m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE): Enforce a 64-bit struct statvfs
f_blocks field only on MacOS X.

ChangeLog
m4/fsusage.m4

index aba4b49..37dd892 100644 (file)
--- 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.
index d595c9b..c0a6256 100644 (file)
@@ -62,14 +62,19 @@ a system call.
 "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],