summaryrefslogtreecommitdiff
path: root/m4/fsusage.m4
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2012-05-15 12:52:36 +0100
committerPádraig Brady <P@draigBrady.com>2012-05-16 00:45:20 +0100
commitb1fac377605c0eef8844fc8d3818d360f37d6fa4 (patch)
tree86222f3596e42fb26ab5f8b49b2b009890ec54ef /m4/fsusage.m4
parent4b43b0c056870b819bfa114bc62889c3e0ed8f2e (diff)
downloadgnulib-b1fac377605c0eef8844fc8d3818d360f37d6fa4.tar.gz
fsusage: fix block size returned on older Linux 2.6
* lib/fsusage.c: Fall back to (struct statfs).f_frsize which is available since Linux 2.6. * m4/fsusage.m4 (STAT_STATFS2_FRSIZE): Always define when the member is available so it can be used as a fallback. * doc/posix-functions/statvfs.texi: Mention the hang issue on Linux < 2.6.36.
Diffstat (limited to 'm4/fsusage.m4')
-rw-r--r--m4/fsusage.m431
1 files changed, 31 insertions, 0 deletions
diff --git a/m4/fsusage.m4 b/m4/fsusage.m4
index f87834eeb4..90b41dfb9c 100644
--- a/m4/fsusage.m4
+++ b/m4/fsusage.m4
@@ -128,6 +128,37 @@ if test $ac_fsusage_space = no; then
fi
fi
+# Check for this unconditionally so we have a
+# good fallback on glibc/Linux > 2.6 < 2.6.36
+AC_MSG_CHECKING([for two-argument statfs with statfs.f_frsize member])
+AC_CACHE_VAL([fu_cv_sys_stat_statfs2_frsize],
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+ int
+ main ()
+ {
+ struct statfs fsd;
+ fsd.f_frsize = 0;
+ return statfs (".", &fsd) != 0;
+ }]])],
+ [fu_cv_sys_stat_statfs2_frsize=yes],
+ [fu_cv_sys_stat_statfs2_frsize=no],
+ [fu_cv_sys_stat_statfs2_frsize=no])])
+AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_frsize])
+if test $fu_cv_sys_stat_statfs2_frsize = yes; then
+ AC_DEFINE([STAT_STATFS2_FRSIZE], [1],
+[ Define if statfs takes 2 args and struct statfs has a field named f_frsize.
+ (glibc/Linux > 2.6)])
+fi
+
if test $ac_fsusage_space = no; then
# glibc/Linux, MacOS X, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4.
# (glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0,