Documentation Archive Developer
ADC Home > Reference Library > Reference > Mac OS X > Mac OS X Man Pages


This document is a Mac OS X manual page. Manual pages are a command-line technology for providing documentation. You can view these manual pages locally using the man(1) command. These manual pages come from many different sources, and thus, have a variety of writing styles.

For more information about the manual page format, see the manual page for manpages(5).

STATVFS(3)               BSD Library Functions Manual               STATVFS(3)

     fstatvfs, statvfs -- retrieve file system information

     Standard C Library (libc, -lc)

     #include <sys/statvfs.h>

     fstatvfs(int fildes, struct statvfs *buf);

     statvfs(const char *restrict path, struct statvfs *restrict buf);

     The statvfs() and fstatvfs() functions attempt to fill the structure
     pointed to by buf with file system statistics, but portable applications
     must not depend on this.  Applications must pass a pathname or file
     descriptor which refers to a file on the file system in which they are

     The statvfs structure contains the following members:

           f_namemax  The maximum length in bytes of a file name on this file
                      system.  Applications should use pathconf(2) instead.

           f_fsid     Not meaningful in this implementation.

           f_frsize   The size in bytes of the minimum unit of allocation on
                      this file system.  (This corresponds to the f_bsize mem-ber member
                      ber of struct statfs.)

           f_bsize    The preferred length of I/O requests for files on this
                      file system.  (Corresponds to the f_iosize member of
                      struct statfs.)

           f_flag     Flags describing mount options for this file system; see

     In addition, there are three members of type fsfilcnt_t, which represent
     counts of file serial numbers (i.e., inodes); these are named f_files,
     f_favail, and f_ffree, and represent the number of file serial numbers
     which exist in total, are available to unprivileged processes, and are
     available to privileged processes, respectively.  Likewise, the members
     f_blocks, f_bavail, and f_bfree (all of type fsblkcnt_t) represent the
     respective allocation-block counts.

     There are two flags defined for the f_flag member:

           ST_RDONLY  The file system is mounted read-only.

           ST_NOSUID  The semantics of the S_ISUID and S_ISGID file mode bits
                      are not supported by, or are disabled on, this file sys-tem. system.

     The statvfs() and fstatvfs() functions are implemented as wrappers around
     the statfs() and fstatfs() functions, respectively.  Not all the informa-tion information
     tion provided by those functions is made available through this inter-face. interface.

     The statvfs() and fstatvfs() functions return the value 0 if successful;
     otherwise the value -1 is returned and the global variable errno is set
     to indicate the error.

     The statvfs() function fails if one or more of the following are true:

     [EACCES]           Search permission is denied for a component of the
                        path prefix of path.

     [EFAULT]           Buf or path points to an invalid address.

     [EIO]              An I/O error occurred while reading from or writing to
                        the file system.

     [ELOOP]            Too many symbolic links were encountered in translat-ing translating
                        ing path.

     [ENAMETOOLONG]     The length of a component of path exceeds {NAME_MAX}
                        characters, or the length of path exceeds {PATH_MAX}

     [ENOENT]           The file referred to by path does not exist.

     [ENOTDIR]          A component of the path prefix of Path is not a direc-tory. directory.

     The fstatvfs() functions fails if one or more of the following are true:

     [EBADF]            fildes is not a valid open file descriptor.

     [EFAULT]           Buf points to an invalid address.

     [EIO]              An I/O error occurred while reading from or writing to
                        the file system.


     The statvfs() and fstatvfs() functions conform to IEEE Std 1003.1-2001
     (``POSIX.1'').  As standardized, portable applications cannot depend on
     these functions returning any valid information at all.  This implementa-tion implementation
     tion attempts to provide as much useful information as is provided by the
     underlying file system, subject to the limitations of the specified data

     The statvfs() and fstatvfs() manual page was originally written by
     Garrett Wollman <>.

BSD                              July 13, 2002                             BSD