1STATVFS(2)                 Linux Programmer's Manual                STATVFS(2)
2
3
4

NAME

6       statvfs, fstatvfs - get file system statistics
7

SYNOPSIS

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

DESCRIPTION

15       The function statvfs() returns information about a mounted file system.
16       path is the pathname of any file within the mounted filesystem.  buf is
17       a pointer to a statvfs structure defined approximately as follows:
18
19         struct statvfs {
20           unsigned long  f_bsize;    /* file system block size */
21           unsigned long  f_frsize;   /* fragment size */
22           fsblkcnt_t     f_blocks;   /* size of fs in f_frsize units */
23           fsblkcnt_t     f_bfree;    /* # free blocks */
24           fsblkcnt_t     f_bavail;   /* # free blocks for non-root */
25           fsfilcnt_t     f_files;    /* # inodes */
26           fsfilcnt_t     f_ffree;    /* # free inodes */
27           fsfilcnt_t     f_favail;   /* # free inodes for non-root */
28           unsigned long  f_fsid;     /* file system ID */
29           unsigned long  f_flag;     /* mount flags */
30           unsigned long  f_namemax;  /* maximum filename length */
31         };
32
33       Here  the types fsblkcnt_t and fsfilcnt_t are defined in <sys/types.h>.
34       Both used to be unsigned long.
35
36       The field f_flag is a bit mask (of mount flags,  see  mount(8)).   Bits
37       defined by POSIX are
38
39       ST_RDONLY
40              Read-only file system.
41
42       ST_NOSUID
43              Set-user-ID/set-group-ID bits are ignored by exec(2).
44
45       It is unspecified whether all members of the returned struct have mean‐
46       ingful values on all filesystems.
47
48       fstatvfs() returns the same information about an open  file  referenced
49       by descriptor fd.
50

RETURN VALUE

52       On  success,  zero is returned.  On error, -1 is returned, and errno is
53       set appropriately.
54

ERRORS

56       EACCES (statvfs()) Search permission is denied for a component  of  the
57              path prefix of path.  (See also path_resolution(2).)
58
59       EBADF  (fstatvfs()) fd is not a valid open file descriptor.
60
61       EFAULT Buf or path points to an invalid address.
62
63       EINTR  This call was interrupted by a signal.
64
65       EIO    An I/O error occurred while reading from the file system.
66
67       ELOOP  (statvfs())  Too  many symbolic links were encountered in trans‐
68              lating path.
69
70       ENAMETOOLONG
71              (statvfs()) path is too long.
72
73       ENOENT (statvfs()) The file referred to by path does not exist.
74
75       ENOMEM Insufficient kernel memory was available.
76
77       ENOSYS The file system does not support this call.
78
79       ENOTDIR
80              (statvfs()) A component of the path prefix  of  path  is  not  a
81              directory.
82
83       EOVERFLOW
84              Some  values  were  too  large to be represented in the returned
85              struct.
86

CONFORMING TO

88       POSIX.1-2001
89

NOTES

91       The Linux kernel has system calls statfs()  and  fstatfs()  to  support
92       this library call.
93
94       The current glibc implementations of
95
96          pathconf(path, _PC_REC_XFER_ALIGN);
97          pathconf(path, _PC_ALLOC_SIZE_MIN);
98          pathconf(path, _PC_REC_MIN_XFER_SIZE);
99
100       respectively  use  the  f_frsize,  f_frsize,  and f_bsize fields of the
101       return value of statvfs(path,buf).
102

SEE ALSO

104       statfs(2)
105
106
107
108Linux 2.6.0                       2003-08-22                        STATVFS(2)
Impressum