Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

statvfs(3) [freebsd man page]

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

NAME
statvfs, fstatvfs -- retrieve file system information LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/statvfs.h> int statvfs(const char * restrict path, struct statvfs * restrict buf); int fstatvfs(int fd, struct statvfs *buf); DESCRIPTION
The statvfs() and fstatvfs() functions fill the structure pointed to by buf with garbage. This garbage will occasionally bear resemblance to 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 interested. 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 member 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 below. 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 pro- cesses, 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 system. IMPLEMENTATION NOTES
The statvfs() and fstatvfs() functions are implemented as wrappers around the statfs() and fstatfs() functions, respectively. Not all the information provided by those functions is made available through this interface. RETURN VALUES
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. ERRORS
The statvfs() and fstatvfs() functions may fail for any of the reasons documented for statfs(2) or fstatfs(2) and pathconf(2) or fpathconf(2), respectively. In addition, statvfs() and fstatvfs() functions may also fail for the following reason: [EOVERFLOW] One or more of the file system statistics has a value which cannot be represented by the data types used in struct statvfs. SEE ALSO
pathconf(2), statfs(2) STANDARDS
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 implementation attempts to provide as much useful information as is provided by the underlying file system, subject to the limitations of the specified data types. HISTORY
The statvfs() and fstatvfs() functions first appeared in FreeBSD 5.0. AUTHORS
The statvfs() and fstatvfs() functions and this manual page were written by Garrett Wollman <wollman@FreeBSD.org>. BSD
July 13, 2002 BSD

Check Out this Related Man Page

STATVFS(3)						     Linux Programmer's Manual							STATVFS(3)

NAME
statvfs, fstatvfs - get file system statistics SYNOPSIS
#include <sys/statvfs.h> int statvfs(const char *path, struct statvfs *buf); int fstatvfs(int fd, struct statvfs *buf); DESCRIPTION
The function statvfs() returns information about a mounted file system. path is the pathname of any file within the mounted file system. buf is a pointer to a statvfs structure defined approximately as follows: struct statvfs { unsigned long f_bsize; /* file system block size */ unsigned long f_frsize; /* fragment size */ fsblkcnt_t f_blocks; /* size of fs in f_frsize units */ fsblkcnt_t f_bfree; /* # free blocks */ fsblkcnt_t f_bavail; /* # free blocks for unprivileged users */ fsfilcnt_t f_files; /* # inodes */ fsfilcnt_t f_ffree; /* # free inodes */ fsfilcnt_t f_favail; /* # free inodes for unprivileged users */ unsigned long f_fsid; /* file system ID */ unsigned long f_flag; /* mount flags */ unsigned long f_namemax; /* maximum filename length */ }; Here the types fsblkcnt_t and fsfilcnt_t are defined in <sys/types.h>. Both used to be unsigned long. The field f_flag is a bit mask (of mount flags, see mount(8)). Bits defined by POSIX are ST_RDONLY Read-only file system. ST_NOSUID Set-user-ID/set-group-ID bits are ignored by exec(3). It is unspecified whether all members of the returned struct have meaningful values on all file systems. fstatvfs() returns the same information about an open file referenced by descriptor fd. RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS
EACCES (statvfs()) Search permission is denied for a component of the path prefix of path. (See also path_resolution(7).) EBADF (fstatvfs()) fd is not a valid open file descriptor. EFAULT Buf or path points to an invalid address. EINTR This call was interrupted by a signal. EIO An I/O error occurred while reading from the file system. ELOOP (statvfs()) Too many symbolic links were encountered in translating path. ENAMETOOLONG (statvfs()) path is too long. ENOENT (statvfs()) The file referred to by path does not exist. ENOMEM Insufficient kernel memory was available. ENOSYS The file system does not support this call. ENOTDIR (statvfs()) A component of the path prefix of path is not a directory. EOVERFLOW Some values were too large to be represented in the returned struct. CONFORMING TO
POSIX.1-2001. NOTES
The Linux kernel has system calls statfs(2) and fstatfs(2) to support this library call. The current glibc implementations of pathconf(path, _PC_REC_XFER_ALIGN); pathconf(path, _PC_ALLOC_SIZE_MIN); pathconf(path, _PC_REC_MIN_XFER_SIZE); respectively use the f_frsize, f_frsize, and f_bsize fields of the return value of statvfs(path,buf). SEE ALSO
statfs(2) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2003-08-22 STATVFS(3)
Man Page