| STATVFS(5) | File Formats Manual | STATVFS(5) | 
statvfs —
#include <sys/types.h>
#include <sys/statvfs.h>
<sys/statvfs.h> header
  defines the structures and functions that return information about a mounted
  file system. The statvfs structure is defined as
  follows:
typedef struct { int32_t val[2]; } fsid_t;	/* file system id type */
#define VFS_NAMELEN  32 	/* length of fs type name, including nul */
#define VFS_MNAMELEN 1024	/* length of buffer for returned name */
struct statvfs {
	unsigned long	f_flag;	  /* copy of mount exported flags */
	unsigned long	f_bsize;  /* system block size */
	unsigned long	f_frsize; /* system fragment size */
	unsigned long	f_iosize; /* optimal file system block size */
	/* The following are in units of f_frsize */
	fsblkcnt_t	f_blocks; /* number of blocks in file system */
	fsblkcnt_t	f_bfree;  /* free blocks avail in file system */
	fsblkcnt_t	f_bavail; /* free blocks avail to non-root */
	fsblkcnt_t	f_bresvd; /* blocks reserved for root */
	fsfilcnt_t	f_files;  /* total file nodes in file system */
	fsfilcnt_t	f_ffree;  /* free file nodes in file system */
	fsfilcnt_t	f_favail; /* free file nodes avail to non-root */
	fsfilcnt_t	f_fresvd; /* file nodes reserved for root */
	uint64_t  f_syncreads;	  /* count of sync reads since mount */
	uint64_t  f_syncwrites;	  /* count of sync writes since mount */
	uint64_t  f_asyncreads;	  /* count of async reads since mount */
	uint64_t  f_asyncwrites;  /* count of async writes since mount */
	unsigned long	f_fsid;   /* POSIX compliant file system id */
	fsid_t          f_fsidx;  /* NetBSD compatible file system id */
	unsigned long	f_namemax;/* maximum filename length */
	uid_t		f_owner; /* user that mounted the file system */
	uint32_t	f_spare[4]; /* spare space */
	char	f_fstypename[VFS_NAMELEN]; /* fs type name */
	char	f_mntonname[VFS_MNAMELEN]; /* directory on which mounted */
	char	f_mntfromname[VFS_MNAMELEN]; /* mounted file system */
};
The f_flag argument can have the following bits set:
ST_RDONLYST_NOEXECST_NOSUIDST_NODEVST_UNIONST_SYNCHRONOUSST_ASYNCST_NOCOREDUMPST_NOATIMEST_SYMPERMST_NODEVMTIMEST_LOGST_LOCALST_QUOTAST_ROOTFSST_EXRDONLYST_EXPORTEDST_DEFEXPORTEDST_EXPORTANONST_EXKERBST_EXNORESPORTST_EXPUBLICFields that are undefined for a particular file system are set to -1.
statfs system call.statfs
      system call) when the used space has exceeded the non-superuser free
      space. In order to comply with the X/Open standard, we have to define
      fsblkcnt_t as an unsigned type, so in all cases
      where f_bavail would have been negative, we set it
      to 0. In addition we provide f_bresvd which contains
      the amount of reserved blocks for the superuser, so the old value of
      f_bavail can be easily computed as:
    
	old_bavail = f_bfree - f_bresvd;
    
    <sys/statvfs.h> header first
  appeared in NetBSD 3.0.
| June 2, 2016 | NetBSD 9.3 |