OSDN Git Service

(split) LDP man-pages の original/ を v3.29 に更新。
[linuxjm/LDP_man-pages.git] / original / man3 / statvfs.3
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.
11 .\"
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.
19 .\"
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 .\"
26 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
27 .\"
28 .TH STATVFS 3 2003-08-22 "Linux" "Linux Programmer's Manual"
29 .SH NAME
30 statvfs, 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
38 The function
39 .BR statvfs ()
40 returns information about a mounted file system.
41 .I path
42 is the pathname of any file within the mounted file system.
43 .I buf
44 is a pointer to a
45 .I statvfs
46 structure defined approximately as follows:
47
48 .in +4n
49 .nf
50 struct statvfs {
51     unsigned long  f_bsize;    /* file system block size */
52     unsigned long  f_frsize;   /* fragment size */
53     fsblkcnt_t     f_blocks;   /* size of fs in f_frsize units */
54     fsblkcnt_t     f_bfree;    /* # free blocks */
55     fsblkcnt_t     f_bavail;   /* # free blocks for unprivileged users */
56     fsfilcnt_t     f_files;    /* # inodes */
57     fsfilcnt_t     f_ffree;    /* # free inodes */
58     fsfilcnt_t     f_favail;   /* # free inodes for unprivileged users */
59     unsigned long  f_fsid;     /* file system ID */
60     unsigned long  f_flag;     /* mount flags */
61     unsigned long  f_namemax;  /* maximum filename length */
62 };
63 .fi
64 .in
65
66 Here the types
67 .I fsblkcnt_t
68 and
69 .I fsfilcnt_t
70 are defined in
71 .IR <sys/types.h> .
72 Both used to be
73 .IR "unsigned long" .
74
75 The field
76 .I f_flag
77 is a bit mask (of mount flags, see
78 .BR mount (8)).
79 Bits defined by POSIX are
80 .TP
81 .B ST_RDONLY
82 Read-only file system.
83 .TP
84 .B ST_NOSUID
85 Set-user-ID/set-group-ID bits are ignored by
86 .BR exec (3).
87 .LP
88 It is unspecified whether all members of the returned struct
89 have meaningful values on all file systems.
90
91 .BR fstatvfs ()
92 returns the same information about an open file referenced by descriptor
93 .IR fd .
94 .SH "RETURN VALUE"
95 On success, zero is returned.
96 On error, \-1 is returned, and
97 .I errno
98 is set appropriately.
99 .SH ERRORS
100 .TP
101 .B EACCES
102 .RB ( statvfs ())
103 Search permission is denied for a component of the path prefix of
104 .IR path .
105 (See also
106 .BR path_resolution (7).)
107 .TP
108 .B EBADF
109 .RB ( fstatvfs ())
110 .I fd
111 is not a valid open file descriptor.
112 .TP
113 .B EFAULT
114 .I Buf
115 or
116 .I path
117 points to an invalid address.
118 .TP
119 .B EINTR
120 This call was interrupted by a signal.
121 .TP
122 .B EIO
123 An I/O error occurred while reading from the file system.
124 .TP
125 .B ELOOP
126 .RB ( statvfs ())
127 Too many symbolic links were encountered in translating
128 .IR path .
129 .TP
130 .B ENAMETOOLONG
131 .RB ( statvfs ())
132 .I path
133 is too long.
134 .TP
135 .B ENOENT
136 .RB ( statvfs ())
137 The file referred to by
138 .I path
139 does not exist.
140 .TP
141 .B ENOMEM
142 Insufficient kernel memory was available.
143 .TP
144 .B ENOSYS
145 The file system does not support this call.
146 .TP
147 .B ENOTDIR
148 .RB ( statvfs ())
149 A component of the path prefix of
150 .I path
151 is not a directory.
152 .TP
153 .B EOVERFLOW
154 Some values were too large to be represented in the returned struct.
155 .SH "CONFORMING TO"
156 POSIX.1-2001.
157 .SH NOTES
158 The Linux kernel has system calls
159 .BR statfs (2)
160 and
161 .BR fstatfs (2)
162 to support this library call.
163
164 The current glibc implementations of
165 .sp
166 .nf
167    pathconf(path, _PC_REC_XFER_ALIGN);
168    pathconf(path, _PC_ALLOC_SIZE_MIN);
169    pathconf(path, _PC_REC_MIN_XFER_SIZE);
170 .fi
171 .sp
172 respectively use the
173 .IR f_frsize ,
174 .IR f_frsize ,
175 and
176 .I f_bsize
177 fields of the return value of
178 .IR "statvfs(path,buf)" .
179 .SH "SEE ALSO"
180 .BR statfs (2)