bsd-statvfs: include sys/vfs.h, check for f_flags.

This commit is contained in:
Darren Tucker 2018-02-25 11:22:57 +11:00
parent e9dede06e5
commit 11057564eb
3 changed files with 29 additions and 0 deletions

View File

@ -409,6 +409,7 @@ AC_CHECK_HEADERS([ \
sys/sysmacros.h \
sys/time.h \
sys/timers.h \
sys/vfs.h \
time.h \
tmpdir.h \
ttyent.h \
@ -3659,6 +3660,23 @@ AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
#endif
])
AC_CHECK_MEMBERS([struct statfs.f_flags], [], [], [[
#include <sys/types.h>
#ifdef HAVE_SYS_BITYPES_H
#include <sys/bitypes.h>
#endif
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
#ifdef HAVE_SYS_STATVFS_H
#include <sys/statvfs.h>
#endif
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif
]])
AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
[#include <sys/types.h>
#include <netinet/in.h>])

View File

@ -25,6 +25,10 @@
#include <errno.h>
#ifndef MNAMELEN
# define MNAMELEN 32
#endif
static void
copy_statfs_to_statvfs(struct statvfs *to, struct statfs *from)
{
@ -37,7 +41,11 @@ copy_statfs_to_statvfs(struct statvfs *to, struct statfs *from)
to->f_ffree = from->f_ffree;
to->f_favail = from->f_ffree; /* no exact equivalent */
to->f_fsid = 0; /* XXX fix me */
#ifdef HAVE_STRUCT_STATFS_F_FLAGS
to->f_flag = from->f_flags;
#else
to->f_flag = 0;
#endif
to->f_namemax = MNAMELEN;
}

View File

@ -26,6 +26,9 @@
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif
#ifndef HAVE_FSBLKCNT_T
typedef unsigned long fsblkcnt_t;