OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man3 / statvfs.3
1 .\" Copyright (C) 2003 Andries Brouwer (aeb@cwi.nl)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" The pathconf note is from Walter Harms
26 .\" This is not a system call on Linux
27 .\"
28 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
29 .\"
30 .TH STATVFS 3 2013-09-26 "Linux" "Linux Programmer's Manual"
31 .SH NAME
32 statvfs, fstatvfs \- get filesystem statistics
33 .SH SYNOPSIS
34 .B #include <sys/statvfs.h>
35 .sp
36 .BI "int statvfs(const char *" path ", struct statvfs *" buf );
37 .br
38 .BI "int fstatvfs(int " fd ", struct statvfs *" buf );
39 .SH DESCRIPTION
40 The function
41 .BR statvfs ()
42 returns information about a mounted filesystem.
43 .I path
44 is the pathname of any file within the mounted filesystem.
45 .I buf
46 is a pointer to a
47 .I statvfs
48 structure defined approximately as follows:
49
50 .in +4n
51 .nf
52 struct statvfs {
53     unsigned long  f_bsize;    /* filesystem block size */
54     unsigned long  f_frsize;   /* fragment size */
55     fsblkcnt_t     f_blocks;   /* size of fs in f_frsize units */
56     fsblkcnt_t     f_bfree;    /* # free blocks */
57     fsblkcnt_t     f_bavail;   /* # free blocks for unprivileged users */
58     fsfilcnt_t     f_files;    /* # inodes */
59     fsfilcnt_t     f_ffree;    /* # free inodes */
60     fsfilcnt_t     f_favail;   /* # free inodes for unprivileged users */
61     unsigned long  f_fsid;     /* filesystem ID */
62     unsigned long  f_flag;     /* mount flags */
63     unsigned long  f_namemax;  /* maximum filename length */
64 };
65 .fi
66 .in
67
68 Here the types
69 .I fsblkcnt_t
70 and
71 .I fsfilcnt_t
72 are defined in
73 .IR <sys/types.h> .
74 Both used to be
75 .IR "unsigned long" .
76
77 The field
78 .I f_flag
79 is a bit mask (of mount flags, see
80 .BR mount (8)).
81 Bits defined by POSIX are
82 .TP
83 .B ST_RDONLY
84 Read-only filesystem.
85 .TP
86 .B ST_NOSUID
87 Set-user-ID/set-group-ID bits are ignored by
88 .BR exec (3).
89 .LP
90 It is unspecified whether all members of the returned struct
91 have meaningful values on all filesystems.
92
93 .BR fstatvfs ()
94 returns the same information about an open file referenced by descriptor
95 .IR fd .
96 .SH RETURN VALUE
97 On success, zero is returned.
98 On error, \-1 is returned, and
99 .I errno
100 is set appropriately.
101 .SH ERRORS
102 .TP
103 .B EACCES
104 .RB ( statvfs ())
105 Search permission is denied for a component of the path prefix of
106 .IR path .
107 (See also
108 .BR path_resolution (7).)
109 .TP
110 .B EBADF
111 .RB ( fstatvfs ())
112 .I fd
113 is not a valid open file descriptor.
114 .TP
115 .B EFAULT
116 .I Buf
117 or
118 .I path
119 points to an invalid address.
120 .TP
121 .B EINTR
122 This call was interrupted by a signal.
123 .TP
124 .B EIO
125 An I/O error occurred while reading from the filesystem.
126 .TP
127 .B ELOOP
128 .RB ( statvfs ())
129 Too many symbolic links were encountered in translating
130 .IR path .
131 .TP
132 .B ENAMETOOLONG
133 .RB ( statvfs ())
134 .I path
135 is too long.
136 .TP
137 .B ENOENT
138 .RB ( statvfs ())
139 The file referred to by
140 .I path
141 does not exist.
142 .TP
143 .B ENOMEM
144 Insufficient kernel memory was available.
145 .TP
146 .B ENOSYS
147 The filesystem does not support this call.
148 .TP
149 .B ENOTDIR
150 .RB ( statvfs ())
151 A component of the path prefix of
152 .I path
153 is not a directory.
154 .TP
155 .B EOVERFLOW
156 Some values were too large to be represented in the returned struct.
157 .SH ATTRIBUTES
158 .SS Multithreading (see pthreads(7))
159 The
160 .BR statvfs ()
161 and
162 .BR fstatvfs ()
163 functions are thread-safe.
164 .SH CONFORMING TO
165 POSIX.1-2001.
166 .SH NOTES
167 The Linux kernel has system calls
168 .BR statfs (2)
169 and
170 .BR fstatfs (2)
171 to support this library call.
172
173 The current glibc implementations of
174 .sp
175 .nf
176    pathconf(path, _PC_REC_XFER_ALIGN);
177    pathconf(path, _PC_ALLOC_SIZE_MIN);
178    pathconf(path, _PC_REC_MIN_XFER_SIZE);
179 .fi
180 .sp
181 respectively use the
182 .IR f_frsize ,
183 .IR f_frsize ,
184 and
185 .I f_bsize
186 fields of the return value of
187 .IR "statvfs(path,buf)" .
188 .SH SEE ALSO
189 .BR statfs (2)
190 .SH COLOPHON
191 This page is part of release 3.79 of the Linux
192 .I man-pages
193 project.
194 A description of the project,
195 information about reporting bugs,
196 and the latest version of this page,
197 can be found at
198 \%http://www.kernel.org/doc/man\-pages/.