2 * Copyright (c) 2008,2014 Darren Tucker <dtucker@zip.com.au>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
14 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 #if !defined(HAVE_STATVFS) || !defined(HAVE_FSTATVFS)
21 #include <sys/types.h>
23 #ifdef HAVE_SYS_MOUNT_H
24 #include <sys/mount.h>
26 #ifdef HAVE_SYS_STATFS_H
27 #include <sys/statfs.h>
30 #ifndef HAVE_FSBLKCNT_T
31 typedef unsigned long fsblkcnt_t;
33 #ifndef HAVE_FSFILCNT_T
34 typedef unsigned long fsfilcnt_t;
44 /* as defined in IEEE Std 1003.1, 2004 Edition */
46 unsigned long f_bsize; /* File system block size. */
47 unsigned long f_frsize; /* Fundamental file system block size. */
48 fsblkcnt_t f_blocks; /* Total number of blocks on file system in */
49 /* units of f_frsize. */
50 fsblkcnt_t f_bfree; /* Total number of free blocks. */
51 fsblkcnt_t f_bavail; /* Number of free blocks available to */
52 /* non-privileged process. */
53 fsfilcnt_t f_files; /* Total number of file serial numbers. */
54 fsfilcnt_t f_ffree; /* Total number of free file serial numbers. */
55 fsfilcnt_t f_favail; /* Number of file serial numbers available to */
56 /* non-privileged process. */
57 unsigned long f_fsid; /* File system ID. */
58 unsigned long f_flag; /* BBit mask of f_flag values. */
59 unsigned long f_namemax;/* Maximum filename length. */
64 int statvfs(const char *, struct statvfs *);
68 int fstatvfs(int, struct statvfs *);