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

NAME

6       fstatvfs, statvfs - get file system information
7

SYNOPSIS

9       #include <sys/statvfs.h>
10
11       int fstatvfs(int fildes, struct statvfs *buf);
12       int statvfs(const char *restrict path, struct statvfs *restrict buf);
13
14

DESCRIPTION

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

RETURN VALUE

39       Upon successful completion, statvfs() shall  return  0.  Otherwise,  it
40       shall return -1 and set errno to indicate the error.
41

ERRORS

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

EXAMPLES

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

APPLICATION USAGE

123       None.
124

RATIONALE

126       None.
127

FUTURE DIRECTIONS

129       None.
130

SEE ALSO

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