1USTAT(2) Linux Programmer's Manual USTAT(2)
2
3
4
6 ustat - get filesystem statistics
7
9 #include <sys/types.h>
10 #include <unistd.h> /* libc[45] */
11 #include <ustat.h> /* glibc2 */
12
13 int ustat(dev_t dev, struct ustat *ubuf);
14
16 ustat() returns information about a mounted filesystem. dev is a de‐
17 vice number identifying a device containing a mounted filesystem. ubuf
18 is a pointer to a ustat structure that contains the following members:
19
20 daddr_t f_tfree; /* Total free blocks */
21 ino_t f_tinode; /* Number of free inodes */
22 char f_fname[6]; /* Filsys name */
23 char f_fpack[6]; /* Filsys pack name */
24
25 The last two fields, f_fname and f_fpack, are not implemented and will
26 always be filled with null bytes ('\0').
27
29 On success, zero is returned and the ustat structure pointed to by ubuf
30 will be filled in. On error, -1 is returned, and errno is set to indi‐
31 cate the error.
32
34 EFAULT ubuf points outside of your accessible address space.
35
36 EINVAL dev does not refer to a device containing a mounted filesystem.
37
38 ENOSYS The mounted filesystem referenced by dev does not support this
39 operation, or any version of Linux before 1.3.16.
40
42 Since version 2.28, glibc no longer provides a wrapper for this system
43 call.
44
46 SVr4.
47
49 ustat() is deprecated and has been provided only for compatibility.
50 All new programs should use statfs(2) instead.
51
52 HP-UX notes
53 The HP-UX version of the ustat structure has an additional field,
54 f_blksize, that is unknown elsewhere. HP-UX warns: For some filesys‐
55 tems, the number of free inodes does not change. Such filesystems will
56 return -1 in the field f_tinode. For some filesystems, inodes are dy‐
57 namically allocated. Such filesystems will return the current number
58 of free inodes.
59
61 stat(2), statfs(2)
62
64 This page is part of release 5.12 of the Linux man-pages project. A
65 description of the project, information about reporting bugs, and the
66 latest version of this page, can be found at
67 https://www.kernel.org/doc/man-pages/.
68
69
70
71Linux 2021-03-22 USTAT(2)