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