libport: Remove the statvfs() function replacements.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c4e4540053
commit
d9a58b6013
|
@ -17757,7 +17757,6 @@ for ac_func in \
|
|||
fnmatch \
|
||||
fork \
|
||||
fstatfs \
|
||||
fstatvfs \
|
||||
futimens \
|
||||
futimes \
|
||||
futimesat \
|
||||
|
@ -17784,8 +17783,6 @@ for ac_func in \
|
|||
setprogname \
|
||||
settimeofday \
|
||||
sigprocmask \
|
||||
statfs \
|
||||
statvfs \
|
||||
strnlen \
|
||||
strtold \
|
||||
symlink \
|
||||
|
@ -18457,25 +18454,6 @@ _ACEOF
|
|||
;;
|
||||
esac
|
||||
|
||||
ac_fn_c_check_type "$LINENO" "fsblkcnt_t" "ac_cv_type_fsblkcnt_t" "$ac_includes_default"
|
||||
if test "x$ac_cv_type_fsblkcnt_t" = xyes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_FSBLKCNT_T 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
ac_fn_c_check_type "$LINENO" "fsfilcnt_t" "ac_cv_type_fsfilcnt_t" "$ac_includes_default"
|
||||
if test "x$ac_cv_type_fsfilcnt_t" = xyes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_FSFILCNT_T 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_type "$LINENO" "sigset_t" "ac_cv_type_sigset_t" "#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
"
|
||||
|
@ -18714,155 +18692,6 @@ $as_echo "#define HAVE_LINUX_22_JOYSTICK_API 1" >>confdefs.h
|
|||
fi
|
||||
fi
|
||||
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct statfs" "f_bfree" "ac_cv_member_struct_statfs_f_bfree" "#include <sys/types.h>
|
||||
#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
|
||||
#ifdef HAVE_SYS_STATFS_H
|
||||
# include <sys/statfs.h>
|
||||
#endif
|
||||
"
|
||||
if test "x$ac_cv_member_struct_statfs_f_bfree" = xyes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_STRUCT_STATFS_F_BFREE 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
ac_fn_c_check_member "$LINENO" "struct statfs" "f_bavail" "ac_cv_member_struct_statfs_f_bavail" "#include <sys/types.h>
|
||||
#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
|
||||
#ifdef HAVE_SYS_STATFS_H
|
||||
# include <sys/statfs.h>
|
||||
#endif
|
||||
"
|
||||
if test "x$ac_cv_member_struct_statfs_f_bavail" = xyes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_STRUCT_STATFS_F_BAVAIL 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
ac_fn_c_check_member "$LINENO" "struct statfs" "f_frsize" "ac_cv_member_struct_statfs_f_frsize" "#include <sys/types.h>
|
||||
#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
|
||||
#ifdef HAVE_SYS_STATFS_H
|
||||
# include <sys/statfs.h>
|
||||
#endif
|
||||
"
|
||||
if test "x$ac_cv_member_struct_statfs_f_frsize" = xyes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_STRUCT_STATFS_F_FRSIZE 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
ac_fn_c_check_member "$LINENO" "struct statfs" "f_ffree" "ac_cv_member_struct_statfs_f_ffree" "#include <sys/types.h>
|
||||
#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
|
||||
#ifdef HAVE_SYS_STATFS_H
|
||||
# include <sys/statfs.h>
|
||||
#endif
|
||||
"
|
||||
if test "x$ac_cv_member_struct_statfs_f_ffree" = xyes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_STRUCT_STATFS_F_FFREE 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
ac_fn_c_check_member "$LINENO" "struct statfs" "f_favail" "ac_cv_member_struct_statfs_f_favail" "#include <sys/types.h>
|
||||
#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
|
||||
#ifdef HAVE_SYS_STATFS_H
|
||||
# include <sys/statfs.h>
|
||||
#endif
|
||||
"
|
||||
if test "x$ac_cv_member_struct_statfs_f_favail" = xyes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_STRUCT_STATFS_F_FAVAIL 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
ac_fn_c_check_member "$LINENO" "struct statfs" "f_namelen" "ac_cv_member_struct_statfs_f_namelen" "#include <sys/types.h>
|
||||
#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
|
||||
#ifdef HAVE_SYS_STATFS_H
|
||||
# include <sys/statfs.h>
|
||||
#endif
|
||||
"
|
||||
if test "x$ac_cv_member_struct_statfs_f_namelen" = xyes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_STRUCT_STATFS_F_NAMELEN 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct statvfs" "f_blocks" "ac_cv_member_struct_statvfs_f_blocks" "#ifdef HAVE_SYS_STATVFS_H
|
||||
#include <sys/statvfs.h>
|
||||
#endif
|
||||
"
|
||||
if test "x$ac_cv_member_struct_statvfs_f_blocks" = xyes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_STRUCT_STATVFS_F_BLOCKS 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct dirent" "d_reclen" "ac_cv_member_struct_dirent_d_reclen" "#ifdef HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
|
27
configure.ac
27
configure.ac
|
@ -2166,7 +2166,6 @@ AC_CHECK_FUNCS(\
|
|||
fnmatch \
|
||||
fork \
|
||||
fstatfs \
|
||||
fstatvfs \
|
||||
futimens \
|
||||
futimes \
|
||||
futimesat \
|
||||
|
@ -2193,8 +2192,6 @@ AC_CHECK_FUNCS(\
|
|||
setprogname \
|
||||
settimeofday \
|
||||
sigprocmask \
|
||||
statfs \
|
||||
statvfs \
|
||||
strnlen \
|
||||
strtold \
|
||||
symlink \
|
||||
|
@ -2299,7 +2296,6 @@ fi
|
|||
dnl **** Check for types ****
|
||||
|
||||
AC_C_INLINE
|
||||
AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t])
|
||||
AC_CHECK_TYPES([sigset_t],,,[#include <sys/types.h>
|
||||
#include <signal.h>])
|
||||
AC_CHECK_TYPES([request_sense],,,[#include <linux/cdrom.h>])
|
||||
|
@ -2402,29 +2398,6 @@ then
|
|||
fi
|
||||
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, struct statfs.f_frsize, struct statfs.f_ffree, struct statfs.f_favail, struct statfs.f_namelen],,,
|
||||
[#include <sys/types.h>
|
||||
#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
|
||||
#ifdef HAVE_SYS_STATFS_H
|
||||
# include <sys/statfs.h>
|
||||
#endif])
|
||||
|
||||
AC_CHECK_MEMBERS([struct statvfs.f_blocks],,,
|
||||
[#ifdef HAVE_SYS_STATVFS_H
|
||||
#include <sys/statvfs.h>
|
||||
#endif])
|
||||
|
||||
dnl Check for dirent.d_reclen
|
||||
AC_CHECK_MEMBERS([struct dirent.d_reclen],,,
|
||||
[#ifdef HAVE_DIRENT_H
|
||||
|
|
|
@ -186,18 +186,9 @@
|
|||
/* Define if FreeType 2 is installed */
|
||||
#undef HAVE_FREETYPE
|
||||
|
||||
/* 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 `fstatfs' function. */
|
||||
#undef HAVE_FSTATFS
|
||||
|
||||
/* Define to 1 if you have the `fstatvfs' function. */
|
||||
#undef HAVE_FSTATVFS
|
||||
|
||||
/* Define to 1 if you have the <ft2build.h> header file. */
|
||||
#undef HAVE_FT2BUILD_H
|
||||
|
||||
|
@ -801,12 +792,6 @@
|
|||
/* Define to 1 if you have the `SSLCopyPeerCertificates' function. */
|
||||
#undef HAVE_SSLCOPYPEERCERTIFICATES
|
||||
|
||||
/* 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 <stdbool.h> header file. */
|
||||
#undef HAVE_STDBOOL_H
|
||||
|
||||
|
@ -876,27 +861,6 @@
|
|||
/* Define to 1 if `sun_len' is a member of `struct sockaddr_un'. */
|
||||
#undef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
|
||||
|
||||
/* Define to 1 if `f_bavail' is a member of `struct statfs'. */
|
||||
#undef HAVE_STRUCT_STATFS_F_BAVAIL
|
||||
|
||||
/* Define to 1 if `f_bfree' is a member of `struct statfs'. */
|
||||
#undef HAVE_STRUCT_STATFS_F_BFREE
|
||||
|
||||
/* Define to 1 if `f_favail' is a member of `struct statfs'. */
|
||||
#undef HAVE_STRUCT_STATFS_F_FAVAIL
|
||||
|
||||
/* Define to 1 if `f_ffree' is a member of `struct statfs'. */
|
||||
#undef HAVE_STRUCT_STATFS_F_FFREE
|
||||
|
||||
/* Define to 1 if `f_frsize' is a member of `struct statfs'. */
|
||||
#undef HAVE_STRUCT_STATFS_F_FRSIZE
|
||||
|
||||
/* Define to 1 if `f_namelen' is a member of `struct statfs'. */
|
||||
#undef HAVE_STRUCT_STATFS_F_NAMELEN
|
||||
|
||||
/* Define to 1 if `f_blocks' is a member of `struct statvfs'. */
|
||||
#undef HAVE_STRUCT_STATVFS_F_BLOCKS
|
||||
|
||||
/* Define to 1 if `st_atim' is a member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_ATIM
|
||||
|
||||
|
|
|
@ -129,35 +129,6 @@ extern int _spawnvp(int mode, const char *cmdname, const char * const argv[]);
|
|||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/****************************************************************
|
||||
* Type definitions
|
||||
*/
|
||||
|
||||
#ifndef HAVE_FSBLKCNT_T
|
||||
typedef unsigned long fsblkcnt_t;
|
||||
#endif
|
||||
#ifndef HAVE_FSFILCNT_T
|
||||
typedef unsigned long fsfilcnt_t;
|
||||
#endif
|
||||
|
||||
#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;
|
||||
};
|
||||
#endif /* HAVE_STRUCT_STATVFS_F_BLOCKS */
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* Macro definitions
|
||||
*/
|
||||
|
@ -245,10 +216,6 @@ static inline float __port_nan(void)
|
|||
|
||||
#ifndef NO_LIBWINE_PORT
|
||||
|
||||
#ifndef HAVE_FSTATVFS
|
||||
int fstatvfs( int fd, struct statvfs *buf );
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETOPT_LONG_ONLY
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
|
@ -306,10 +273,6 @@ ssize_t pwrite( int fd, const void *buf, size_t count, off_t offset );
|
|||
int readlink( const char *path, char *buf, size_t size );
|
||||
#endif /* HAVE_READLINK */
|
||||
|
||||
#ifndef HAVE_STATVFS
|
||||
int statvfs( const char *path, struct statvfs *buf );
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRNLEN
|
||||
size_t strnlen( const char *str, size_t maxlen );
|
||||
#endif /* !defined(HAVE_STRNLEN) */
|
||||
|
@ -328,13 +291,11 @@ extern int mkstemps(char *template, int suffix_len);
|
|||
|
||||
#define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable
|
||||
|
||||
#define fstatvfs __WINE_NOT_PORTABLE(fstatvfs)
|
||||
#define getopt_long __WINE_NOT_PORTABLE(getopt_long)
|
||||
#define getopt_long_only __WINE_NOT_PORTABLE(getopt_long_only)
|
||||
#define lstat __WINE_NOT_PORTABLE(lstat)
|
||||
#define pread __WINE_NOT_PORTABLE(pread)
|
||||
#define pwrite __WINE_NOT_PORTABLE(pwrite)
|
||||
#define statvfs __WINE_NOT_PORTABLE(statvfs)
|
||||
#define strnlen __WINE_NOT_PORTABLE(strnlen)
|
||||
#define usleep __WINE_NOT_PORTABLE(usleep)
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
STATICLIB = libwine_port.a
|
||||
|
||||
C_SRCS = \
|
||||
fstatvfs.c \
|
||||
getopt.c \
|
||||
isfinite.c \
|
||||
isinf.c \
|
||||
|
@ -13,7 +12,6 @@ C_SRCS = \
|
|||
pwrite.c \
|
||||
readlink.c \
|
||||
spawn.c \
|
||||
statvfs.c \
|
||||
strnlen.c \
|
||||
symlink.c \
|
||||
usleep.c
|
||||
|
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
* fstatvfs 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#ifndef HAVE_FSTATVFS
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_VFS_H
|
||||
# include <sys/vfs.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_MOUNT_H
|
||||
# include <sys/mount.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STATFS_H
|
||||
# include <sys/statfs.h>
|
||||
#endif
|
||||
|
||||
int fstatvfs( int fd, struct statvfs *buf )
|
||||
{
|
||||
int ret;
|
||||
#ifdef HAVE_FSTATFS
|
||||
struct statfs info;
|
||||
|
||||
/* FIXME: add autoconf check for this */
|
||||
#if defined(__svr4__) || defined(_SCO_DS) || defined(__sun)
|
||||
ret = fstatfs( fd, &info, 0, 0 );
|
||||
#else
|
||||
ret = fstatfs( fd, &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;
|
||||
#ifdef HAVE_STRUCT_STATFS_F_NAMELEN
|
||||
buf->f_namemax = info.f_namelen;
|
||||
#endif
|
||||
#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
|
||||
}
|
||||
#else /* HAVE_FSTATFS */
|
||||
ret = -1;
|
||||
errno = ENOSYS;
|
||||
#endif /* HAVE_FSTATFS */
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* HAVE_FSTATVFS */
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#ifndef HAVE_STATVFS
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_VFS_H
|
||||
# include <sys/vfs.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_MOUNT_H
|
||||
# include <sys/mount.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STATFS_H
|
||||
# include <sys/statfs.h>
|
||||
#endif
|
||||
|
||||
int statvfs( const char *path, struct statvfs *buf )
|
||||
{
|
||||
int ret;
|
||||
#ifdef HAVE_STATFS
|
||||
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;
|
||||
#ifdef HAVE_STRUCT_STATFS_F_NAMELEN
|
||||
buf->f_namemax = info.f_namelen;
|
||||
#endif
|
||||
#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
|
||||
}
|
||||
#else /* HAVE_STATFS */
|
||||
ret = -1;
|
||||
errno = ENOSYS;
|
||||
#endif /* HAVE_STATFS */
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* HAVE_STATVFS */
|
Loading…
Reference in New Issue