summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2018-02-25 11:22:57 +1100
committerDarren Tucker <dtucker@dtucker.net>2018-02-26 00:09:04 +1100
commit11057564eb6ab8fd987de50c3d7f394c6f6632b7 (patch)
tree0702d5182bb32de607b84110e36e3a2f167b13a7
parente9dede06e5bc582a4aeb5b1cd5a7a640d7de3609 (diff)
bsd-statvfs: include sys/vfs.h, check for f_flags.
-rw-r--r--configure.ac18
-rw-r--r--openbsd-compat/bsd-statvfs.c8
-rw-r--r--openbsd-compat/bsd-statvfs.h3
3 files changed, 29 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 605844ba2..e9762ba68 100644
--- a/configure.ac
+++ b/configure.ac
@@ -409,6 +409,7 @@ AC_CHECK_HEADERS([ \
409 sys/sysmacros.h \ 409 sys/sysmacros.h \
410 sys/time.h \ 410 sys/time.h \
411 sys/timers.h \ 411 sys/timers.h \
412 sys/vfs.h \
412 time.h \ 413 time.h \
413 tmpdir.h \ 414 tmpdir.h \
414 ttyent.h \ 415 ttyent.h \
@@ -3659,6 +3660,23 @@ AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
3659#endif 3660#endif
3660]) 3661])
3661 3662
3663AC_CHECK_MEMBERS([struct statfs.f_flags], [], [], [[
3664#include <sys/types.h>
3665#ifdef HAVE_SYS_BITYPES_H
3666#include <sys/bitypes.h>
3667#endif
3668#ifdef HAVE_SYS_STATFS_H
3669#include <sys/statfs.h>
3670#endif
3671#ifdef HAVE_SYS_STATVFS_H
3672#include <sys/statvfs.h>
3673#endif
3674#ifdef HAVE_SYS_VFS_H
3675#include <sys/vfs.h>
3676#endif
3677]])
3678
3679
3662AC_CHECK_TYPES([in_addr_t, in_port_t], , , 3680AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
3663[#include <sys/types.h> 3681[#include <sys/types.h>
3664#include <netinet/in.h>]) 3682#include <netinet/in.h>])
diff --git a/openbsd-compat/bsd-statvfs.c b/openbsd-compat/bsd-statvfs.c
index 458dbe89c..e3bd87d98 100644
--- a/openbsd-compat/bsd-statvfs.c
+++ b/openbsd-compat/bsd-statvfs.c
@@ -25,6 +25,10 @@
25 25
26#include <errno.h> 26#include <errno.h>
27 27
28#ifndef MNAMELEN
29# define MNAMELEN 32
30#endif
31
28static void 32static void
29copy_statfs_to_statvfs(struct statvfs *to, struct statfs *from) 33copy_statfs_to_statvfs(struct statvfs *to, struct statfs *from)
30{ 34{
@@ -37,7 +41,11 @@ copy_statfs_to_statvfs(struct statvfs *to, struct statfs *from)
37 to->f_ffree = from->f_ffree; 41 to->f_ffree = from->f_ffree;
38 to->f_favail = from->f_ffree; /* no exact equivalent */ 42 to->f_favail = from->f_ffree; /* no exact equivalent */
39 to->f_fsid = 0; /* XXX fix me */ 43 to->f_fsid = 0; /* XXX fix me */
44#ifdef HAVE_STRUCT_STATFS_F_FLAGS
40 to->f_flag = from->f_flags; 45 to->f_flag = from->f_flags;
46#else
47 to->f_flag = 0;
48#endif
41 to->f_namemax = MNAMELEN; 49 to->f_namemax = MNAMELEN;
42} 50}
43 51
diff --git a/openbsd-compat/bsd-statvfs.h b/openbsd-compat/bsd-statvfs.h
index 815ec03b2..e2a4c15f7 100644
--- a/openbsd-compat/bsd-statvfs.h
+++ b/openbsd-compat/bsd-statvfs.h
@@ -26,6 +26,9 @@
26#ifdef HAVE_SYS_STATFS_H 26#ifdef HAVE_SYS_STATFS_H
27#include <sys/statfs.h> 27#include <sys/statfs.h>
28#endif 28#endif
29#ifdef HAVE_SYS_VFS_H
30#include <sys/vfs.h>
31#endif
29 32
30#ifndef HAVE_FSBLKCNT_T 33#ifndef HAVE_FSBLKCNT_T
31typedef unsigned long fsblkcnt_t; 34typedef unsigned long fsblkcnt_t;