]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/ustat.2
44f30271f3f687a9f84669d7fa159db420a9a4a8
[thirdparty/man-pages.git] / man2 / ustat.2
1 .\" Copyright (C) 1995, Thomas K. Dyas <tdyas@eden.rutgers.edu>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" Created 1995-08-09 Thomas K. Dyas <tdyas@eden.rutgers.edu>
26 .\" Modified 1997-01-31 by Eric S. Raymond <esr@thyrsus.com>
27 .\" Modified 2001-03-22 by aeb
28 .\" Modified 2003-08-04 by aeb
29 .\"
30 .TH USTAT 2 2017-09-15 "Linux" "Linux Programmer's Manual"
31 .SH NAME
32 ustat \- get filesystem statistics
33 .SH SYNOPSIS
34 .nf
35 .B #include <sys/types.h>
36 .BR "#include <unistd.h>" " /* libc[45] */"
37 .BR "#include <ustat.h>" " /* glibc2 */"
38 .PP
39 .BI "int ustat(dev_t " dev ", struct ustat *" ubuf );
40 .fi
41 .SH DESCRIPTION
42 .BR ustat ()
43 returns information about a mounted filesystem.
44 .I dev
45 is a device number identifying a device containing
46 a mounted filesystem.
47 .I ubuf
48 is a pointer to a
49 .I ustat
50 structure that contains the following
51 members:
52 .PP
53 .in +4n
54 .EX
55 daddr_t f_tfree; /* Total free blocks */
56 ino_t f_tinode; /* Number of free inodes */
57 char f_fname[6]; /* Filsys name */
58 char f_fpack[6]; /* Filsys pack name */
59 .EE
60 .in
61 .PP
62 The last two fields,
63 .I f_fname
64 and
65 .IR f_fpack ,
66 are not implemented and will
67 always be filled with null bytes (\(aq\\0\(aq).
68 .SH RETURN VALUE
69 On success, zero is returned and the
70 .I ustat
71 structure pointed to by
72 .I ubuf
73 will be filled in.
74 On error, \-1 is returned, and
75 .I errno
76 is set appropriately.
77 .SH ERRORS
78 .TP
79 .B EFAULT
80 .I ubuf
81 points outside of your accessible address space.
82 .TP
83 .B EINVAL
84 .I dev
85 does not refer to a device containing a mounted filesystem.
86 .TP
87 .B ENOSYS
88 The mounted filesystem referenced by
89 .I dev
90 does not support this operation, or any version of Linux before
91 1.3.16.
92 .SH CONFORMING TO
93 SVr4.
94 .\" SVr4 documents additional error conditions ENOLINK, ECOMM, and EINTR
95 .\" but has no ENOSYS condition.
96 .SH NOTES
97 .BR ustat ()
98 is deprecated and has been provided only for compatibility.
99 All new programs should use
100 .BR statfs (2)
101 instead.
102 .SS HP-UX notes
103 The HP-UX version of the
104 .I ustat
105 structure has an additional field,
106 .IR f_blksize ,
107 that is unknown elsewhere.
108 HP-UX warns:
109 For some filesystems, the number of free inodes does not change.
110 Such filesystems will return \-1 in the field
111 .IR f_tinode .
112 .\" Some software tries to use this in order to test whether the
113 .\" underlying filesystem is NFS.
114 For some filesystems, inodes are dynamically allocated.
115 Such filesystems will return the current number of free inodes.
116 .SH SEE ALSO
117 .BR stat (2),
118 .BR statfs (2)