Use statvfs instead of statfs, and provide a default implementation in
libwine_port if necessary.

diff --git a/configure b/configure
index 8674f3e..73b55be 100755
--- a/configure
+++ b/configure
@@ -16084,6 +16084,7 @@
 
 
 
+
 for ac_func in \
 	_lwp_create \
 	_lwp_self \
@@ -16128,6 +16129,7 @@
 	snprintf \
 	spawnvp \
 	statfs \
+	statvfs \
 	strcasecmp \
 	strerror \
 	strncasecmp \
@@ -16323,6 +16325,7 @@
 
 
 
+
 for ac_header in \
 	arpa/inet.h \
 	arpa/nameser.h \
@@ -16390,6 +16393,7 @@
 	sys/socket.h \
 	sys/sockio.h \
 	sys/statfs.h \
+	sys/statvfs.h \
 	sys/strtio.h \
 	sys/syscall.h \
 	sys/sysctl.h \
@@ -17638,6 +17642,132 @@
 
 
 fi
+echo "$as_me:$LINENO: checking for fsblkcnt_t" >&5
+echo $ECHO_N "checking for fsblkcnt_t... $ECHO_C" >&6
+if test "${ac_cv_type_fsblkcnt_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if ((fsblkcnt_t *) 0)
+  return 0;
+if (sizeof (fsblkcnt_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_fsblkcnt_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_fsblkcnt_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_fsblkcnt_t" >&5
+echo "${ECHO_T}$ac_cv_type_fsblkcnt_t" >&6
+if test $ac_cv_type_fsblkcnt_t = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_FSBLKCNT_T 1
+_ACEOF
+
+
+fi
+echo "$as_me:$LINENO: checking for fsfilcnt_t" >&5
+echo $ECHO_N "checking for fsfilcnt_t... $ECHO_C" >&6
+if test "${ac_cv_type_fsfilcnt_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if ((fsfilcnt_t *) 0)
+  return 0;
+if (sizeof (fsfilcnt_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_fsfilcnt_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_fsfilcnt_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_fsfilcnt_t" >&5
+echo "${ECHO_T}$ac_cv_type_fsfilcnt_t" >&6
+if test $ac_cv_type_fsfilcnt_t = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_FSFILCNT_T 1
+_ACEOF
+
+
+fi
 
 
 echo "$as_me:$LINENO: checking whether linux/input.h is for real" >&5
@@ -18360,6 +18490,532 @@
 
 
 fi
+echo "$as_me:$LINENO: checking for struct statfs.f_frsize" >&5
+echo $ECHO_N "checking for struct statfs.f_frsize... $ECHO_C" >&6
+if test "${ac_cv_member_struct_statfs_f_frsize+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#ifdef STATFS_DEFINED_BY_SYS_MOUNT
+# include <sys/mount.h>
+#else
+# ifdef STATFS_DEFINED_BY_SYS_VFS
+#  include <sys/vfs.h>
+# else
+#  ifdef STATFS_DEFINED_BY_SYS_STATFS
+#   include <sys/statfs.h>
+#  endif
+# endif
+#endif
+
+int
+main ()
+{
+static struct statfs ac_aggr;
+if (ac_aggr.f_frsize)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_statfs_f_frsize=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#ifdef STATFS_DEFINED_BY_SYS_MOUNT
+# include <sys/mount.h>
+#else
+# ifdef STATFS_DEFINED_BY_SYS_VFS
+#  include <sys/vfs.h>
+# else
+#  ifdef STATFS_DEFINED_BY_SYS_STATFS
+#   include <sys/statfs.h>
+#  endif
+# endif
+#endif
+
+int
+main ()
+{
+static struct statfs ac_aggr;
+if (sizeof ac_aggr.f_frsize)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_statfs_f_frsize=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_member_struct_statfs_f_frsize=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_member_struct_statfs_f_frsize" >&5
+echo "${ECHO_T}$ac_cv_member_struct_statfs_f_frsize" >&6
+if test $ac_cv_member_struct_statfs_f_frsize = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STATFS_F_FRSIZE 1
+_ACEOF
+
+
+fi
+echo "$as_me:$LINENO: checking for struct statfs.f_ffree" >&5
+echo $ECHO_N "checking for struct statfs.f_ffree... $ECHO_C" >&6
+if test "${ac_cv_member_struct_statfs_f_ffree+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#ifdef STATFS_DEFINED_BY_SYS_MOUNT
+# include <sys/mount.h>
+#else
+# ifdef STATFS_DEFINED_BY_SYS_VFS
+#  include <sys/vfs.h>
+# else
+#  ifdef STATFS_DEFINED_BY_SYS_STATFS
+#   include <sys/statfs.h>
+#  endif
+# endif
+#endif
+
+int
+main ()
+{
+static struct statfs ac_aggr;
+if (ac_aggr.f_ffree)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_statfs_f_ffree=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#ifdef STATFS_DEFINED_BY_SYS_MOUNT
+# include <sys/mount.h>
+#else
+# ifdef STATFS_DEFINED_BY_SYS_VFS
+#  include <sys/vfs.h>
+# else
+#  ifdef STATFS_DEFINED_BY_SYS_STATFS
+#   include <sys/statfs.h>
+#  endif
+# endif
+#endif
+
+int
+main ()
+{
+static struct statfs ac_aggr;
+if (sizeof ac_aggr.f_ffree)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_statfs_f_ffree=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_member_struct_statfs_f_ffree=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_member_struct_statfs_f_ffree" >&5
+echo "${ECHO_T}$ac_cv_member_struct_statfs_f_ffree" >&6
+if test $ac_cv_member_struct_statfs_f_ffree = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STATFS_F_FFREE 1
+_ACEOF
+
+
+fi
+echo "$as_me:$LINENO: checking for struct statfs.f_favail" >&5
+echo $ECHO_N "checking for struct statfs.f_favail... $ECHO_C" >&6
+if test "${ac_cv_member_struct_statfs_f_favail+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#ifdef STATFS_DEFINED_BY_SYS_MOUNT
+# include <sys/mount.h>
+#else
+# ifdef STATFS_DEFINED_BY_SYS_VFS
+#  include <sys/vfs.h>
+# else
+#  ifdef STATFS_DEFINED_BY_SYS_STATFS
+#   include <sys/statfs.h>
+#  endif
+# endif
+#endif
+
+int
+main ()
+{
+static struct statfs ac_aggr;
+if (ac_aggr.f_favail)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_statfs_f_favail=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#ifdef STATFS_DEFINED_BY_SYS_MOUNT
+# include <sys/mount.h>
+#else
+# ifdef STATFS_DEFINED_BY_SYS_VFS
+#  include <sys/vfs.h>
+# else
+#  ifdef STATFS_DEFINED_BY_SYS_STATFS
+#   include <sys/statfs.h>
+#  endif
+# endif
+#endif
+
+int
+main ()
+{
+static struct statfs ac_aggr;
+if (sizeof ac_aggr.f_favail)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_statfs_f_favail=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_member_struct_statfs_f_favail=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_member_struct_statfs_f_favail" >&5
+echo "${ECHO_T}$ac_cv_member_struct_statfs_f_favail" >&6
+if test $ac_cv_member_struct_statfs_f_favail = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STATFS_F_FAVAIL 1
+_ACEOF
+
+
+fi
+
+
+echo "$as_me:$LINENO: checking for struct statvfs.f_blocks" >&5
+echo $ECHO_N "checking for struct statvfs.f_blocks... $ECHO_C" >&6
+if test "${ac_cv_member_struct_statvfs_f_blocks+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+
+int
+main ()
+{
+static struct statvfs ac_aggr;
+if (ac_aggr.f_blocks)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_statvfs_f_blocks=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+
+int
+main ()
+{
+static struct statvfs ac_aggr;
+if (sizeof ac_aggr.f_blocks)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_statvfs_f_blocks=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_member_struct_statvfs_f_blocks=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_member_struct_statvfs_f_blocks" >&5
+echo "${ECHO_T}$ac_cv_member_struct_statvfs_f_blocks" >&6
+if test $ac_cv_member_struct_statvfs_f_blocks = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STATVFS_F_BLOCKS 1
+_ACEOF
+
+
+fi
 
 
 echo "$as_me:$LINENO: checking for struct msghdr.msg_accrights" >&5
diff --git a/configure.ac b/configure.ac
index b1161fe..94ce8b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1056,6 +1056,7 @@
 	snprintf \
 	spawnvp \
 	statfs \
+	statvfs \
 	strcasecmp \
 	strerror \
 	strncasecmp \
@@ -1137,6 +1138,7 @@
 	sys/socket.h \
 	sys/sockio.h \
 	sys/statfs.h \
+	sys/statvfs.h \
 	sys/strtio.h \
 	sys/syscall.h \
 	sys/sysctl.h \
@@ -1236,7 +1238,7 @@
 
 AC_C_CONST
 AC_C_INLINE
-AC_CHECK_TYPES([mode_t, off_t, pid_t, size_t, ssize_t, long long])
+AC_CHECK_TYPES([mode_t, off_t, pid_t, size_t, ssize_t, long long, fsblkcnt_t, fsfilcnt_t])
 
 AC_CACHE_CHECK([whether linux/input.h is for real],
 	wine_cv_linux_input_h,
@@ -1384,7 +1386,7 @@
 dnl **** FIXME: what about mixed cases, where we need two of them? ***
 
 dnl Check for statfs members
-AC_CHECK_MEMBERS([struct statfs.f_bfree, struct statfs.f_bavail],,,
+AC_CHECK_MEMBERS([struct statfs.f_bfree, struct statfs.f_bavail, struct statfs.f_frsize, struct statfs.f_ffree, struct statfs.f_favail],,,
 [#include <sys/types.h>
 #ifdef HAVE_SYS_PARAM_H
 # include <sys/param.h>
@@ -1401,6 +1403,11 @@
 # endif
 #endif])
 
+AC_CHECK_MEMBERS([struct statvfs.f_blocks],,,
+[#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif])
+
 dnl Check for socket structure members
 AC_CHECK_MEMBERS([struct msghdr.msg_accrights, struct sockaddr.sa_len, struct sockaddr_un.sun_len],,,
 [#include <sys/types.h>
diff --git a/files/drive.c b/files/drive.c
index 96eeade..af8f70c 100644
--- a/files/drive.c
+++ b/files/drive.c
@@ -43,6 +43,9 @@
 #ifdef HAVE_SYS_PARAM_H
 # include <sys/param.h>
 #endif
+#ifdef HAVE_SYS_STATVFS_H
+# include <sys/statvfs.h>
+#endif
 #ifdef STATFS_DEFINED_BY_SYS_VFS
 # include <sys/vfs.h>
 #else
@@ -1370,7 +1373,7 @@
 static int DRIVE_GetFreeSpace( int drive, PULARGE_INTEGER size,
 			       PULARGE_INTEGER available )
 {
-    struct statfs info;
+    struct statvfs info;
 
     if (!DRIVE_IsValid(drive))
     {
@@ -1378,32 +1381,18 @@
         return 0;
     }
 
-/* FIXME: add autoconf check for this */
-#if defined(__svr4__) || defined(_SCO_DS) || defined(__sun)
-    if (statfs( DOSDrives[drive].root, &info, 0, 0) < 0)
-#else
-    if (statfs( DOSDrives[drive].root, &info) < 0)
-#endif
+    if (statvfs( DOSDrives[drive].root, &info ) < 0)
     {
         FILE_SetDosError();
-        WARN("cannot do statfs(%s)\n", DOSDrives[drive].root);
+        WARN("cannot do statvfs(%s)\n", DOSDrives[drive].root);
         return 0;
     }
-
-    size->QuadPart = RtlEnlargedUnsignedMultiply( info.f_bsize, info.f_blocks );
-#ifdef HAVE_STRUCT_STATFS_F_BAVAIL
-    available->QuadPart = RtlEnlargedUnsignedMultiply( info.f_bavail, info.f_bsize );
-#else
-# ifdef HAVE_STRUCT_STATFS_F_BFREE
-    available->QuadPart = RtlEnlargedUnsignedMultiply( info.f_bfree, info.f_bsize );
-# else
-#  error "statfs has no bfree/bavail member!"
-# endif
-#endif
+    size->QuadPart = RtlEnlargedUnsignedMultiply( info.f_frsize, info.f_blocks );
     if (DOSDrives[drive].type == DRIVE_CDROM)
-    { /* ALWAYS 0, even if no real CD-ROM mounted there !! */
-        available->QuadPart = 0;
-    }
+        available->QuadPart = 0; /* ALWAYS 0, even if no real CD-ROM mounted there !! */
+    else
+        available->QuadPart = RtlEnlargedUnsignedMultiply( info.f_frsize, info.f_bavail );
+
     return 1;
 }
 
diff --git a/include/config.h.in b/include/config.h.in
index 25747b0..37633ed 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -119,6 +119,12 @@
 /* Define to 1 if you have the <freetype/tttables.h> header file. */
 #undef HAVE_FREETYPE_TTTABLES_H
 
+/* Define to 1 if the system has the type `fsblkcnt_t'. */
+#undef HAVE_FSBLKCNT_T
+
+/* Define to 1 if the system has the type `fsfilcnt_t'. */
+#undef HAVE_FSFILCNT_T
+
 /* Define to 1 if you have the <ft2build.h> header file. */
 #undef HAVE_FT2BUILD_H
 
@@ -515,6 +521,9 @@
 /* Define to 1 if you have the `statfs' function. */
 #undef HAVE_STATFS
 
+/* Define to 1 if you have the `statvfs' function. */
+#undef HAVE_STATVFS
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
@@ -554,6 +563,18 @@
 /* Define to 1 if `f_bfree' is member of `struct statfs'. */
 #undef HAVE_STRUCT_STATFS_F_BFREE
 
+/* Define to 1 if `f_favail' is member of `struct statfs'. */
+#undef HAVE_STRUCT_STATFS_F_FAVAIL
+
+/* Define to 1 if `f_ffree' is member of `struct statfs'. */
+#undef HAVE_STRUCT_STATFS_F_FFREE
+
+/* Define to 1 if `f_frsize' is member of `struct statfs'. */
+#undef HAVE_STRUCT_STATFS_F_FRSIZE
+
+/* Define to 1 if `f_blocks' is member of `struct statvfs'. */
+#undef HAVE_STRUCT_STATVFS_F_BLOCKS
+
 /* Define to 1 if `st_blocks' is member of `struct stat'. */
 #undef HAVE_STRUCT_STAT_ST_BLOCKS
 
@@ -641,6 +662,9 @@
 /* Define to 1 if you have the <sys/statfs.h> header file. */
 #undef HAVE_SYS_STATFS_H
 
+/* Define to 1 if you have the <sys/statvfs.h> header file. */
+#undef HAVE_SYS_STATVFS_H
+
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
diff --git a/include/wine/port.h b/include/wine/port.h
index e7424f9..00d1748 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -64,19 +64,29 @@
 #ifndef HAVE_SSIZE_T
 typedef int ssize_t;
 #endif
+#ifndef HAVE_FSBLKCNT_T
+typedef unsigned long fsblkcnt_t;
+#endif
+#ifndef HAVE_FSFILCNT_T
+typedef unsigned long fsfilcnt_t;
+#endif
 
-#ifndef HAVE_STATFS
-# ifdef __BEOS__
-#  define HAVE_STRUCT_STATFS_F_BFREE
-struct statfs {
-  long   f_bsize;  /* block_size */
-  long   f_blocks; /* total_blocks */
-  long   f_bfree;  /* free_blocks */
+#ifndef HAVE_STRUCT_STATVFS_F_BLOCKS
+struct statvfs
+{
+    unsigned long f_bsize;
+    unsigned long f_frsize;
+    fsblkcnt_t    f_blocks;
+    fsblkcnt_t    f_bfree;
+    fsblkcnt_t    f_bavail;
+    fsfilcnt_t    f_files;
+    fsfilcnt_t    f_ffree;
+    fsfilcnt_t    f_favail;
+    unsigned long f_fsid;
+    unsigned long f_flag;
+    unsigned long f_namemax;
 };
-# else /* defined(__BEOS__) */
-struct statfs;
-# endif /* defined(__BEOS__) */
-#endif /* !defined(HAVE_STATFS) */
+#endif /* HAVE_STRUCT_STATVFS_F_BLOCKS */
 
 
 /****************************************************************
@@ -262,10 +272,6 @@
 void siglongjmp( sigjmp_buf buf, int val );
 #endif /* HAVE_SIGSETJMP */
 
-#ifndef HAVE_STATFS
-int statfs(const char *name, struct statfs *info);
-#endif /* !defined(HAVE_STATFS) */
-
 #ifndef HAVE_STRNCASECMP
 # ifndef HAVE__STRNICMP
 int strncasecmp(const char *str1, const char *str2, size_t n);
diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in
index 73530d9..6241205 100644
--- a/libs/port/Makefile.in
+++ b/libs/port/Makefile.in
@@ -21,7 +21,7 @@
 	readlink.c \
 	sigsetjmp.c \
 	spawn.c \
-	statfs.c \
+	statvfs.c \
 	strcasecmp.c \
 	strerror.c \
 	strncasecmp.c \
diff --git a/libs/port/statfs.c b/libs/port/statfs.c
deleted file mode 100644
index 0b2bb33..0000000
--- a/libs/port/statfs.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * statfs function
- *
- * Copyright 1996 Alexandre Julliard
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "config.h"
-#include "wine/port.h"
-
-#ifdef __BEOS__
-#include <be/kernel/fs_info.h>
-#include <be/kernel/OS.h>
-#endif
-
-#include <errno.h>
-#ifdef HAVE_SYS_PARAM_H
-# include <sys/param.h>
-#endif
-#ifdef STATFS_DEFINED_BY_SYS_VFS
-# include <sys/vfs.h>
-#else
-# ifdef STATFS_DEFINED_BY_SYS_MOUNT
-#  include <sys/mount.h>
-# else
-#  ifdef STATFS_DEFINED_BY_SYS_STATFS
-#   include <sys/statfs.h>
-#  endif
-# endif
-#endif
-
-#ifndef HAVE_STATFS
-int statfs(const char *name, struct statfs *info)
-{
-#ifdef __BEOS__
-    dev_t mydev;
-    fs_info fsinfo;
-
-    if(!info) {
-        errno = ENOSYS;
-        return -1;
-    }
-
-    if ((mydev = dev_for_path(name)) < 0) {
-        errno = ENOSYS;
-        return -1;
-    }
-
-    if (fs_stat_dev(mydev,&fsinfo) < 0) {
-        errno = ENOSYS;
-        return -1;
-    }
-
-    info->f_bsize = fsinfo.block_size;
-    info->f_blocks = fsinfo.total_blocks;
-    info->f_bfree = fsinfo.free_blocks;
-    return 0;
-#else /* defined(__BEOS__) */
-    errno = ENOSYS;
-    return -1;
-#endif /* defined(__BEOS__) */
-}
-#endif /* !defined(HAVE_STATFS) */
diff --git a/libs/port/statvfs.c b/libs/port/statvfs.c
new file mode 100644
index 0000000..fc1f10b
--- /dev/null
+++ b/libs/port/statvfs.c
@@ -0,0 +1,90 @@
+/*
+ * statvfs function
+ *
+ * Copyright 2004 Alexandre Julliard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#ifndef HAVE_STATVFS
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#ifdef STATFS_DEFINED_BY_SYS_VFS
+# include <sys/vfs.h>
+#else
+# ifdef STATFS_DEFINED_BY_SYS_MOUNT
+#  include <sys/mount.h>
+# else
+#  ifdef STATFS_DEFINED_BY_SYS_STATFS
+#   include <sys/statfs.h>
+#  endif
+# endif
+#endif
+
+int statvfs( const char *path, struct statvfs *buf )
+{
+    int ret;
+    struct statfs info;
+
+/* FIXME: add autoconf check for this */
+#if defined(__svr4__) || defined(_SCO_DS) || defined(__sun)
+    ret = statfs( path, &info, 0, 0 );
+#else
+    ret = statfs( path, &info );
+#endif
+    if (ret >= 0)
+    {
+        memset( buf, 0, sizeof(*buf) );
+        buf->f_bsize   = info.f_bsize;
+        buf->f_blocks  = info.f_blocks;
+        buf->f_files   = info.f_files;
+        buf->f_namemax = info.f_namelen;
+#ifdef HAVE_STRUCT_STATFS_F_FRSIZE
+        buf->f_frsize  = info.f_frsize;
+#else
+        buf->f_frsize  = info.f_bsize;
+#endif
+#ifdef HAVE_STRUCT_STATFS_F_BFREE
+        buf->f_bfree   = info.f_bfree;
+#else
+        buf->f_bfree   = info.f_bavail;
+#endif
+#ifdef HAVE_STRUCT_STATFS_F_BAVAIL
+        buf->f_bavail  = info.f_bavail;
+#else
+        buf->f_bavail  = info.f_bfree;
+#endif
+#ifdef HAVE_STRUCT_STATFS_F_FFREE
+        buf->f_ffree   = info.f_ffree;
+#else
+        buf->f_ffree   = info.f_favail;
+#endif
+#ifdef HAVE_STRUCT_STATFS_F_FAVAIL
+        buf->f_favail  = info.f_favail;
+#else
+        buf->f_favail  = info.f_ffree;
+#endif
+    }
+    return ret;
+}
+
+#endif /* HAVE_STATVFS */