1.\" $NetBSD: statvfs.5,v 1.12 2010/03/22 18:58:32 joerg Exp $ 2.\" 3.\" Copyright (c) 1989, 1991, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" @(#)statfs.2 8.5 (Berkeley) 5/24/95 31.\" 32.Dd April 10, 2009 33.Dt STATVFS 5 34.Os 35.Sh NAME 36.Nm statvfs 37.Nd file system statistics 38.Sh SYNOPSIS 39.In sys/types.h 40.In sys/statvfs.h 41.Sh DESCRIPTION 42The 43.In sys/statvfs.h 44header defines the structures and functions that 45return information about a mounted file system. 46The 47.Nm statvfs 48structure is defined as follows: 49.Bd -literal 50typedef struct { int32_t val[2]; } fsid_t; /* file system id type */ 51 52#define VFS_NAMELEN 32 /* length of fs type name, including nul */ 53#define VFS_MNAMELEN 1024 /* length of buffer for returned name */ 54 55struct statvfs { 56 unsigned long f_flag; /* copy of mount exported flags */ 57 unsigned long f_bsize; /* system block size */ 58 unsigned long f_frsize; /* system fragment size */ 59 unsigned long f_iosize; /* optimal file system block size */ 60 61 fsblkcnt_t f_blocks; /* number of blocks in file system */ 62 fsblkcnt_t f_bfree; /* free blocks avail in file system */ 63 fsblkcnt_t f_bavail; /* free blocks avail to non-root */ 64 fsblkcnt_t f_bresvd; /* blocks reserved for root */ 65 66 fsfilcnt_t f_files; /* total file nodes in file system */ 67 fsfilcnt_t f_ffree; /* free file nodes in file system */ 68 fsfilcnt_t f_favail; /* free file nodes avail to non-root */ 69 fsfilcnt_t f_fresvd; /* file nodes reserved for root */ 70 71 uint64_t f_syncreads; /* count of sync reads since mount */ 72 uint64_t f_syncwrites; /* count of sync writes since mount */ 73 74 uint64_t f_asyncreads; /* count of async reads since mount */ 75 uint64_t f_asyncwrites; /* count of async writes since mount */ 76 77 unsigned long f_fsid; /* POSIX compliant file system id */ 78 fsid_t f_fsidx; /* NetBSD compatible file system id */ 79 80 unsigned long f_namemax;/* maximum filename length */ 81 uid_t f_owner; /* user that mounted the file system */ 82 83 uint32_t f_spare[4]; /* spare space */ 84 85 char f_fstypename[VFS_NAMELEN]; /* fs type name */ 86 char f_mntonname[VFS_MNAMELEN]; /* directory on which mounted */ 87 char f_mntfromname[VFS_MNAMELEN]; /* mounted file system */ 88}; 89.Ed 90.Pp 91The 92.Fa f_flag 93argument can have the following bits set: 94.Bl -tag -width ST_SYNCHRONOUS 95.It Dv ST_RDONLY 96The filesystem is mounted read-only; 97Even the super-user may not write on it. 98.It Dv ST_NOEXEC 99Files may not be executed from the filesystem. 100.It Dv ST_NOSUID 101Setuid and setgid bits on files are not honored when they are executed. 102.It Dv ST_NODEV 103Special files in the filesystem may not be opened. 104.It Dv ST_UNION 105Union with underlying filesystem instead of obscuring it. 106.It Dv ST_SYNCHRONOUS 107All I/O to the filesystem is done synchronously. 108.It Dv ST_ASYNC 109No filesystem I/O is done synchronously. 110.It Dv ST_NOCOREDUMP 111Don't write core dumps to this file system. 112.It Dv ST_NOATIME 113Never update access times. 114.It Dv ST_SYMPERM 115Recognize symbolic link permission. 116.It Dv ST_NODEVMTIME 117Never update modification times for device files. 118.It Dv ST_LOG 119Use logging (journalling). 120.It Dv ST_LOCAL 121The filesystem resides locally. 122.It Dv ST_QUOTA 123The filesystem has quotas enabled on it. 124.It Dv ST_ROOTFS 125Identifies the root filesystem. 126.It Dv ST_EXRDONLY 127The filesystem is exported read-only. 128.It Dv ST_EXPORTED 129The filesystem is exported for both reading and writing. 130.It Dv ST_DEFEXPORTED 131The filesystem is exported for both reading and writing to any Internet host. 132.It Dv ST_EXPORTANON 133The filesystem maps all remote accesses to the anonymous user. 134.It Dv ST_EXKERB 135The filesystem is exported with Kerberos uid mapping. 136.It Dv ST_EXNORESPORT 137Don't enforce reserved ports (NFS). 138.It Dv ST_EXPUBLIC 139Public export (WebNFS). 140.El 141.Pp 142Fields that are undefined for a particular file system are set to \-1. 143.Sh NOTES 144.Bl -tag -width f_bavail 145.It f_flag 146The 147.Fa f_flag 148field is the same as the 149.Fa f_flags 150field in the 151.Bx 4.3 152.Xr statfs 2 153system call. 154.It f_fsid 155Is defined to be 156.Ft unsigned long 157by the X/Open standard. 158Unfortunately this is not enough space to store our 159.Ft fsid_t , 160so we define an additional 161.Fa f_fsidx 162field. 163.It f_bavail 164Could historically be negative (in the 165.Xr statfs 2 166system call) when the used space has exceeded 167the non-superuser free space. 168In order to comply with the X/Open standard, we have to define 169.Ft fsblkcnt_t 170as an unsigned type, so in all cases where 171.Fa f_bavail 172would have been negative, we set it to 0. 173In addition we provide 174.Fa f_bresvd 175which contains the amount of reserved blocks for the superuser, so 176the old value of 177.Fa f_bavail 178can be easily computed as: 179.Bd -literal 180 old_bavail = f_bfree - f_bresvd; 181.Ed 182.El 183.Sh SEE ALSO 184.Xr statvfs 2 185.Sh HISTORY 186The 187.In sys/statvfs.h 188header first appeared in 189.Nx 3.0 . 190