Use statvfs instead of statfs, and provide a default implementation in
authorAlexandre Julliard <julliard@winehq.org>
Fri, 5 Mar 2004 21:03:46 +0000 (21:03 +0000)
committerAlexandre Julliard <julliard@winehq.org>
Fri, 5 Mar 2004 21:03:46 +0000 (21:03 +0000)
libwine_port if necessary.

configure
configure.ac
files/drive.c
include/config.h.in
include/wine/port.h
libs/port/Makefile.in
libs/port/statfs.c [deleted file]
libs/port/statvfs.c [new file with mode: 0644]

index 8674f3ef51b6c2e7a6cc70f666f6ccaa8bd1d85a..73b55be8ea875129d5f273db70ec3d0ca8453f8f 100755 (executable)
--- a/configure
+++ b/configure
@@ -16082,6 +16082,7 @@ fi
 
 
 
+
 
 
 for ac_func in \
@@ -16128,6 +16129,7 @@ for ac_func in \
        snprintf \
        spawnvp \
        statfs \
+       statvfs \
        strcasecmp \
        strerror \
        strncasecmp \
@@ -16321,6 +16323,7 @@ done
 
 
 
+
 
 
 for ac_header in \
@@ -16390,6 +16393,7 @@ for ac_header in \
        sys/socket.h \
        sys/sockio.h \
        sys/statfs.h \
+       sys/statvfs.h \
        sys/strtio.h \
        sys/syscall.h \
        sys/sysctl.h \
@@ -17637,6 +17641,132 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+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
 
 
@@ -18359,6 +18489,532 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+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
 
 
index b1161febb141d11ad40906ecb491ed5062aefc04..94ce8b3af32d3aa74ae353c55779735a0a34be80 100644 (file)
@@ -1056,6 +1056,7 @@ AC_CHECK_FUNCS(\
        snprintf \
        spawnvp \
        statfs \
+       statvfs \
        strcasecmp \
        strerror \
        strncasecmp \
@@ -1137,6 +1138,7 @@ AC_CHECK_HEADERS(\
        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 @@ dnl **** Check for types ****
 
 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 @@ fi
 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 @@ AC_CHECK_MEMBERS([struct statfs.f_bfree, struct statfs.f_bavail],,,
 # 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>
index 96eeade060cbe62c05ba872cd1fd5dae0a44a02b..af8f70c4e716ea86aa3680eb07b899c89c5785f1 100644 (file)
@@ -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 @@ BOOL WINAPI DefineDosDeviceW(DWORD flags,LPCWSTR devname,LPCWSTR targetpath)
 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 @@ static int DRIVE_GetFreeSpace( int drive, PULARGE_INTEGER size,
         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;
 }
 
index 25747b0d99ccee12db8fe5632298189355faf698..37633ed0fe3ce3d95f8862c578dc568abc93a610 100644 (file)
 /* 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
 
 /* 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
 
 /* 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
 
 /* 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
 
index e7424f92e0a17b92dda8c5ef9018fa74ce6710bd..00d1748dbe90e887cfa6930a23791e7d7b75536e 100644 (file)
@@ -64,19 +64,29 @@ typedef unsigned int size_t;
 #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 @@ int sigsetjmp( sigjmp_buf buf, int savesigs );
 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);
index 73530d9fa3837f6c71d2b86626616d089af69937..6241205773c926e4743f01bebb5cd9ef74428c31 100644 (file)
@@ -21,7 +21,7 @@ C_SRCS = \
        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 (file)
index 0b2bb33..0000000
+++ /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 (file)
index 0000000..fc1f10b
--- /dev/null
@@ -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 */