1FSTATVFS(3P)               POSIX Programmer's Manual              FSTATVFS(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       fstatvfs, statvfs - get file system information
13

SYNOPSIS

15       #include <sys/statvfs.h>
16
17       int fstatvfs(int fildes, struct statvfs *buf);
18       int statvfs(const char *restrict path, struct statvfs *restrict buf);
19
20

DESCRIPTION

22       The fstatvfs() function shall obtain information about the file  system
23       containing the file referenced by fildes.
24
25       The  statvfs()  function shall obtain information about the file system
26       containing the file named by path.
27
28       For both functions, the buf argument is a pointer to a  statvfs  struc‐
29       ture  that  shall  be filled. Read, write, or execute permission of the
30       named file is not required.
31
32       The following flags can be returned in the f_flag member:
33
34       ST_RDONLY
35              Read-only file system.
36
37       ST_NOSUID
38              Setuid/setgid bits ignored by exec.
39
40
41       It is unspecified whether all members of  the  statvfs  structure  have
42       meaningful values on all file systems.
43

RETURN VALUE

45       Upon  successful  completion,  statvfs()  shall return 0. Otherwise, it
46       shall return -1 and set errno to indicate the error.
47

ERRORS

49       The fstatvfs() and statvfs() functions shall fail if:
50
51       EIO    An I/O error occurred while reading the file system.
52
53       EINTR  A signal was caught during execution of the function.
54
55       EOVERFLOW
56              One of the values to be returned cannot be represented correctly
57              in the structure pointed to by buf.
58
59
60       The fstatvfs() function shall fail if:
61
62       EBADF  The fildes argument is not an open file descriptor.
63
64
65       The statvfs() function shall fail if:
66
67       EACCES Search permission is denied on a component of the path prefix.
68
69       ELOOP  A loop exists in symbolic links encountered during resolution of
70              the path argument.
71
72       ENAMETOOLONG
73              The length of a pathname exceeds {PATH_MAX} or a pathname compo‐
74              nent is longer than {NAME_MAX}.
75
76       ENOENT A component of path does not name an existing file or path is an
77              empty string.
78
79       ENOTDIR
80              A component of the path prefix of path is not a directory.
81
82
83       The statvfs() function may fail if:
84
85       ELOOP  More than {SYMLOOP_MAX} symbolic links were  encountered  during
86              resolution of the path argument.
87
88       ENAMETOOLONG
89              Pathname  resolution of a symbolic link produced an intermediate
90              result whose length exceeds {PATH_MAX}.
91
92
93       The following sections are informative.
94

EXAMPLES

96   Obtaining File System Information Using fstatvfs()
97       The following example shows how to obtain file system  information  for
98       the file system upon which the file named /home/cnd/mod1 resides, using
99       the fstatvfs()  function.   The  /home/cnd/mod1  file  is  opened  with
100       read/write  privileges  and  the  open file descriptor is passed to the
101       fstatvfs() function.
102
103
104              #include <statvfs.h>
105              #include <fcntl.h>
106
107
108              struct statvfs buffer;
109              int            status;
110              ...
111              fildes = open("/home/cnd/mod1", O_RDWR);
112              status  = fstatvfs(fildes, &buffer);
113
114   Obtaining File System Information Using statvfs()
115       The following example shows how to obtain file system  information  for
116       the file system upon which the file named /home/cnd/mod1 resides, using
117       the statvfs() function.
118
119
120              #include <statvfs.h>
121
122
123              struct statvfs buffer;
124              int            status;
125              ...
126              status = statvfs("/home/cnd/mod1", &buffer);
127

APPLICATION USAGE

129       None.
130

RATIONALE

132       None.
133

FUTURE DIRECTIONS

135       None.
136

SEE ALSO

138       chmod(), chown(), creat(), dup(),  exec(),  fcntl(),  link(),  mknod(),
139       open(),  pipe(),  read(),  time(), unlink(), utime(), write(), the Base
140       Definitions volume of IEEE Std 1003.1-2001, <sys/statvfs.h>
141
143       Portions of this text are reprinted and reproduced in  electronic  form
144       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
145       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
146       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
147       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
148       event of any discrepancy between this version and the original IEEE and
149       The Open Group Standard, the original IEEE and The Open Group  Standard
150       is  the  referee document. The original Standard can be obtained online
151       at http://www.opengroup.org/unix/online.html .
152
153
154
155IEEE/The Open Group                  2003                         FSTATVFS(3P)
Impressum