2 .\" Copyright 1989 AT&T. Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH STATVFS 2 "Mar 22, 2004"
8 statvfs, fstatvfs \- get file system information
12 #include <sys/types.h>
13 #include <sys/statvfs.h>
15 \fBint\fR \fBstatvfs\fR(\fBconst char *restrict\fR \fIpath\fR, \fBstruct statvfs *restrict\fR \fIbuf\fR);
20 \fBint\fR \fBfstatvfs\fR(\fBint\fR \fIfildes\fR, \fBstruct statvfs *\fR\fIbuf\fR);
26 The \fBstatvfs()\fR function returns a "generic superblock" describing a file
27 system; it can be used to acquire information about mounted file systems. The
28 \fIbuf\fR argument is a pointer to a structure (described below) that is filled
32 The \fIpath\fR argument should name a file that resides on that file system.
33 The file system type is known to the operating system. Read, write, or execute
34 permission for the named file is not required, but all directories listed in
35 the path name leading to the file must be searchable.
38 The \fBstatvfs\fR structure pointed to by \fIbuf\fR includes the following
43 u_long f_bsize; /* preferred file system block size */
44 u_long f_frsize; /* fundamental filesystem block
45 (size if supported) */
46 fsblkcnt_t f_blocks; /* total # of blocks on file system
47 in units of f_frsize */
48 fsblkcnt_t f_bfree; /* total # of free blocks */
49 fsblkcnt_t f_bavail; /* # of free blocks avail to
50 non-privileged user */
51 fsfilcnt_t f_files; /* total # of file nodes (inodes) */
52 fsfilcnt_t f_ffree; /* total # of free file nodes */
53 fsfilcnt_t f_favail; /* # of inodes avail to
55 u_long f_fsid; /* file system id (dev for now) */
56 char f_basetype[FSTYPSZ]; /* target fs type name,
58 u_long f_flag; /* bit mask of flags */
59 u_long f_namemax; /* maximum file name length */
60 char f_fstr[32]; /* file system specific string */
61 u_long f_filler[16]; /* reserved for future expansion */
67 The \fBf_basetype\fR member contains a null-terminated FSType name of the
71 The following values can be returned in the \fBf_flag\fR field:
75 ST_RDONLY 0x01 /* read-only file system */
76 ST_NOSUID 0x02 /* does not support setuid/setgid semantics */
77 ST_NOTRUNC 0x04 /* does not truncate file names longer than
84 The \fBfstatvfs()\fR function is similar to \fBstatvfs()\fR, except that the
85 file named by \fIpath\fR in \fBstatvfs()\fR is instead identified by an open
86 file descriptor \fIfildes\fR obtained from a successful \fBopen\fR(2),
87 \fBcreat\fR(2), \fBdup\fR(2), \fBfcntl\fR(2), or \fBpipe\fR(2) function call.
91 Upon successful completion, \fB0\fR is returned. Otherwise, \fB\(mi1\fR is
92 returned and \fBerrno\fR is set to indicate the error.
96 The \fBstatvfs()\fR and \fBfstatvfs()\fR functions will fail if:
100 \fB\fBEOVERFLOW\fR\fR
103 One of the values to be returned cannot be represented correctly in the
104 structure pointed to by \fIbuf\fR.
109 The \fBstatvfs()\fR function will fail if:
116 Search permission is denied on a component of the path prefix.
125 The \fIpath\fR or \fIbuf\fR argument points to an illegal address.
134 A signal was caught during the execution of the \fBstatvfs()\fR function.
143 An I/O error occurred while reading the file system.
152 Too many symbolic links were encountered in translating \fIpath\fR.
158 \fB\fBENAMETOOLONG\fR\fR
161 The length of a \fIpath\fR component exceeds \fBNAME_MAX\fR characters, or the
162 length of \fIpath\fR The exceeds \fBPATH_MAX\fR characters.
171 Either a component of the path prefix or the file referred to by \fIpath\fR
181 The \fIpath\fR argument points to a remote machine and the link to that machine
191 A component of the path prefix of \fIpath\fR is not a directory.
196 The \fBfstatvfs()\fR function will fail if:
203 The \fIfildes\fR argument is not an open file descriptor.
212 The \fIbuf\fR argument points to an illegal address.
221 A signal was caught during the execution of the \fBfstatvfs()\fR function.
230 An I/O error occurred while reading the file system.
236 The \fBstatvfs()\fR and \fBfstatvfs()\fR functions have transitional interfaces
237 for 64-bit file offsets. See \fBlf64\fR(5).
241 See \fBattributes\fR(5) for descriptions of the following attributes:
249 ATTRIBUTE TYPE ATTRIBUTE VALUE
251 Interface Stability Standard
257 \fBchmod\fR(2), \fBchown\fR(2), \fBcreat\fR(2), \fBdup\fR(2), \fBfcntl\fR(2),
258 \fBlink\fR(2), \fBmknod\fR(2), \fBopen\fR(2), \fBpipe\fR(2), \fBread\fR(2),
259 \fBtime\fR(2), \fBunlink\fR(2), \fButime\fR(2), \fBwrite\fR(2),
260 \fBattributes\fR(5), \fBlf64\fR(5), \fBstandards\fR(5)
264 The values returned for \fBf_files\fR, \fBf_ffree\fR, and \fBf_favail\fR may
265 not be valid for \fBNFS\fR mounted file systems.