1333 High kernel cpu usage & dtrace hang on idle system
[illumos-gate.git] / usr / src / man / man2 / statvfs.2
blobd7b178156696958c7688d9c1190d4f77ab9ecf09
1 '\" te
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"
7 .SH NAME
8 statvfs, fstatvfs \- get file system information
9 .SH SYNOPSIS
10 .LP
11 .nf
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);
16 .fi
18 .LP
19 .nf
20 \fBint\fR \fBfstatvfs\fR(\fBint\fR \fIfildes\fR, \fBstruct statvfs *\fR\fIbuf\fR);
21 .fi
23 .SH DESCRIPTION
24 .sp
25 .LP
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
29 by the function.
30 .sp
31 .LP
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.
36 .sp
37 .LP
38 The \fBstatvfs\fR structure pointed to by \fIbuf\fR includes the following
39 members:
40 .sp
41 .in +2
42 .nf
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
54                                     non-privileged user*/
55 u_long      f_fsid;              /* file system id (dev for now) */
56 char        f_basetype[FSTYPSZ]; /* target fs type name,
57                                     null-terminated */
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 */
62 .fi
63 .in -2
65 .sp
66 .LP
67 The \fBf_basetype\fR member contains a null-terminated FSType name of the
68 mounted target.
69 .sp
70 .LP
71 The following values can be returned in the \fBf_flag\fR field:
72 .sp
73 .in +2
74 .nf
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
78                         NAME_MAX */
79 .fi
80 .in -2
82 .sp
83 .LP
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.
88 .SH RETURN VALUES
89 .sp
90 .LP
91 Upon successful completion, \fB0\fR is returned. Otherwise, \fB\(mi1\fR is
92 returned and \fBerrno\fR is set to indicate the error.
93 .SH ERRORS
94 .sp
95 .LP
96 The \fBstatvfs()\fR and \fBfstatvfs()\fR functions will fail if:
97 .sp
98 .ne 2
99 .na
100 \fB\fBEOVERFLOW\fR\fR
102 .RS 13n
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:
111 .ne 2
113 \fB\fBEACCES\fR\fR
115 .RS 16n
116 Search permission is denied on a component of the path prefix.
120 .ne 2
122 \fB\fBEFAULT\fR\fR
124 .RS 16n
125 The \fIpath\fR or \fIbuf\fR argument points to an illegal address.
129 .ne 2
131 \fB\fBEINTR\fR\fR
133 .RS 16n
134 A signal was caught during the execution of the \fBstatvfs()\fR function.
138 .ne 2
140 \fB\fBEIO\fR\fR
142 .RS 16n
143 An I/O error occurred while reading the file system.
147 .ne 2
149 \fB\fBELOOP\fR\fR
151 .RS 16n
152 Too many symbolic links were encountered in translating \fIpath\fR.
156 .ne 2
158 \fB\fBENAMETOOLONG\fR\fR
160 .RS 16n
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.
166 .ne 2
168 \fB\fBENOENT\fR\fR
170 .RS 16n
171 Either a component of the path prefix or the file referred to by \fIpath\fR
172 does not exist.
176 .ne 2
178 \fB\fBENOLINK\fR\fR
180 .RS 16n
181 The \fIpath\fR argument points to a remote machine and the link to that machine
182 is no longer active.
186 .ne 2
188 \fB\fBENOTDIR\fR\fR
190 .RS 16n
191 A component of the path prefix of \fIpath\fR is not a directory.
196 The \fBfstatvfs()\fR function will fail if:
198 .ne 2
200 \fB\fBEBADF\fR\fR
202 .RS 10n
203 The \fIfildes\fR argument is not an open file descriptor.
207 .ne 2
209 \fB\fBEFAULT\fR\fR
211 .RS 10n
212 The \fIbuf\fR argument points to an illegal address.
216 .ne 2
218 \fB\fBEINTR\fR\fR
220 .RS 10n
221 A signal was caught during the execution of the \fBfstatvfs()\fR function.
225 .ne 2
227 \fB\fBEIO\fR\fR
229 .RS 10n
230 An I/O error occurred while reading the file system.
233 .SH USAGE
236 The \fBstatvfs()\fR and \fBfstatvfs()\fR functions have transitional interfaces
237 for 64-bit file offsets.  See \fBlf64\fR(5).
238 .SH ATTRIBUTES
241 See \fBattributes\fR(5) for descriptions of the following attributes:
246 box;
247 c | c
248 l | l .
249 ATTRIBUTE TYPE  ATTRIBUTE VALUE
251 Interface Stability     Standard
254 .SH SEE ALSO
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)
261 .SH BUGS
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.