| 1 |
.\" Copyright 1995, Thomas K. Dyas <[email protected]> |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH ustat 2 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
ustat \- get filesystem statistics |
| 9 |
.SH LIBRARY |
| 10 |
Standard C library |
| 11 |
.RI ( libc ,\~ \-lc ) |
| 12 |
.SH SYNOPSIS |
| 13 |
.nf |
| 14 |
.B #include <sys/types.h> |
| 15 |
.BR "#include <unistd.h>" " /* libc[45] */" |
| 16 |
.BR "#include <ustat.h>" " /* glibc2 */" |
| 17 |
.P |
| 18 |
.BI "[[deprecated]] int ustat(dev_t " dev ", struct ustat *" ubuf ); |
| 19 |
.fi |
| 20 |
.SH DESCRIPTION |
| 21 |
.BR ustat () |
| 22 |
returns information about a mounted filesystem. |
| 23 |
.I dev |
| 24 |
is a device number identifying a device containing |
| 25 |
a mounted filesystem. |
| 26 |
.I ubuf |
| 27 |
is a pointer to a |
| 28 |
.I ustat |
| 29 |
structure that contains the following |
| 30 |
members: |
| 31 |
.P |
| 32 |
.in +4n |
| 33 |
.EX |
| 34 |
daddr_t f_tfree; /* Total free blocks */ |
| 35 |
ino_t f_tinode; /* Number of free inodes */ |
| 36 |
char f_fname[6]; /* Filsys name */ |
| 37 |
char f_fpack[6]; /* Filsys pack name */ |
| 38 |
.EE |
| 39 |
.in |
| 40 |
.P |
| 41 |
The last two fields, |
| 42 |
.I f_fname |
| 43 |
and |
| 44 |
.IR f_fpack , |
| 45 |
are not implemented and will |
| 46 |
always be filled with null bytes (\[aq]\[rs]0\[aq]). |
| 47 |
.SH RETURN VALUE |
| 48 |
On success, zero is returned and the |
| 49 |
.I ustat |
| 50 |
structure pointed to by |
| 51 |
.I ubuf |
| 52 |
will be filled in. |
| 53 |
On error, \-1 is returned, and |
| 54 |
.I errno |
| 55 |
is set to indicate the error. |
| 56 |
.SH ERRORS |
| 57 |
.TP |
| 58 |
.B EFAULT |
| 59 |
.I ubuf |
| 60 |
points outside of your accessible address space. |
| 61 |
.TP |
| 62 |
.B EINVAL |
| 63 |
.I dev |
| 64 |
does not refer to a device containing a mounted filesystem. |
| 65 |
.TP |
| 66 |
.B ENOSYS |
| 67 |
The mounted filesystem referenced by |
| 68 |
.I dev |
| 69 |
does not support this operation, |
| 70 |
or any version of Linux before Linux 1.3.16. |
| 71 |
.SH STANDARDS |
| 72 |
None. |
| 73 |
.SH HISTORY |
| 74 |
SVr4. |
| 75 |
Removed in glibc 2.28. |
| 76 |
.\" SVr4 documents additional error conditions ENOLINK, ECOMM, and EINTR |
| 77 |
.\" but has no ENOSYS condition. |
| 78 |
.P |
| 79 |
.BR ustat () |
| 80 |
is deprecated and has been provided only for compatibility. |
| 81 |
All new programs should use |
| 82 |
.BR statfs (2) |
| 83 |
instead. |
| 84 |
.SS HP-UX notes |
| 85 |
The HP-UX version of the |
| 86 |
.I ustat |
| 87 |
structure has an additional field, |
| 88 |
.IR f_blksize , |
| 89 |
that is unknown elsewhere. |
| 90 |
HP-UX warns: |
| 91 |
For some filesystems, the number of free inodes does not change. |
| 92 |
Such filesystems will return \-1 in the field |
| 93 |
.IR f_tinode . |
| 94 |
.\" Some software tries to use this in order to test whether the |
| 95 |
.\" underlying filesystem is NFS. |
| 96 |
For some filesystems, inodes are dynamically allocated. |
| 97 |
Such filesystems will return the current number of free inodes. |
| 98 |
.SH SEE ALSO |
| 99 |
.BR stat (2), |
| 100 |
.BR statfs (2) |