.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved .TH "FSTATVFS" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual" .\" fstatvfs .SH PROLOG This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. .SH NAME fstatvfs, statvfs \- get file system information .SH SYNOPSIS .LP \fB#include .br .sp int fstatvfs(int\fP \fIfildes\fP\fB, struct statvfs *\fP\fIbuf\fP\fB); .br int statvfs(const char *restrict\fP \fIpath\fP\fB, struct statvfs *restrict\fP \fIbuf\fP\fB); \fP \fB .br \fP .SH DESCRIPTION .LP The \fIfstatvfs\fP() function shall obtain information about the file system containing the file referenced by \fIfildes\fP. .LP The \fIstatvfs\fP() function shall obtain information about the file system containing the file named by \fIpath\fP. .LP For both functions, the \fIbuf\fP argument is a pointer to a \fBstatvfs\fP structure that shall be filled. Read, write, or execute permission of the named file is not required. .LP The following flags can be returned in the \fIf_flag\fP member: .TP 7 ST_RDONLY Read-only file system. .TP 7 ST_NOSUID Setuid/setgid bits ignored by \fIexec\fP. .sp .LP It is unspecified whether all members of the \fBstatvfs\fP structure have meaningful values on all file systems. .SH RETURN VALUE .LP Upon successful completion, \fIstatvfs\fP() shall return 0. Otherwise, it shall return -1 and set \fIerrno\fP to indicate the error. .SH ERRORS .LP The \fIfstatvfs\fP() and \fIstatvfs\fP() functions shall fail if: .TP 7 .B EIO An I/O error occurred while reading the file system. .TP 7 .B EINTR A signal was caught during execution of the function. .TP 7 .B EOVERFLOW One of the values to be returned cannot be represented correctly in the structure pointed to by \fIbuf\fP. .sp .LP The \fIfstatvfs\fP() function shall fail if: .TP 7 .B EBADF The \fIfildes\fP argument is not an open file descriptor. .sp .LP The \fIstatvfs\fP() function shall fail if: .TP 7 .B EACCES Search permission is denied on a component of the path prefix. .TP 7 .B ELOOP A loop exists in symbolic links encountered during resolution of the \fIpath\fP argument. .TP 7 .B ENAMETOOLONG The length of a pathname exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}. .TP 7 .B ENOENT A component of \fIpath\fP does not name an existing file or \fIpath\fP is an empty string. .TP 7 .B ENOTDIR A component of the path prefix of \fIpath\fP is not a directory. .sp .LP The \fIstatvfs\fP() function may fail if: .TP 7 .B ELOOP More than {SYMLOOP_MAX} symbolic links were encountered during resolution of the \fIpath\fP argument. .TP 7 .B ENAMETOOLONG Pathname resolution of a symbolic link produced an intermediate result whose length exceeds {PATH_MAX}. .sp .LP \fIThe following sections are informative.\fP .SH EXAMPLES .SS Obtaining File System Information Using fstatvfs() .LP The following example shows how to obtain file system information for the file system upon which the file named \fB/home/cnd/mod1\fP resides, using the \fIfstatvfs\fP() function. The \fB/home/cnd/mod1\fP file is opened with read/write privileges and the open file descriptor is passed to the \fIfstatvfs\fP() function. .sp .RS .nf \fB#include #include .sp struct statvfs buffer; int status; \&... fildes = open("/home/cnd/mod1", O_RDWR); status = fstatvfs(fildes, &buffer); \fP .fi .RE .SS Obtaining File System Information Using statvfs() .LP The following example shows how to obtain file system information for the file system upon which the file named \fB/home/cnd/mod1\fP resides, using the \fIstatvfs\fP() function. .sp .RS .nf \fB#include .sp struct statvfs buffer; int status; \&... status = statvfs("/home/cnd/mod1", &buffer); \fP .fi .RE .SH APPLICATION USAGE .LP None. .SH RATIONALE .LP None. .SH FUTURE DIRECTIONS .LP None. .SH SEE ALSO .LP \fIchmod\fP(), \fIchown\fP(), \fIcreat\fP(), \fIdup\fP(), \fIexec\fP(), \fIfcntl\fP(), \fIlink\fP(), \fImknod\fP(), \fIopen\fP(), \fIpipe\fP(), \fIread\fP(), \fItime\fP(), \fIunlink\fP(), \fIutime\fP(), \fIwrite\fP(), the Base Definitions volume of IEEE\ Std\ 1003.1-2001, \fI\fP .SH COPYRIGHT Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .