OSDN Git Service

(split) LDP: Update original to LDP v3.51.
[linuxjm/LDP_man-pages.git] / original / 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 2003-08-04 "Linux" "Linux Programmer's Manual"
31 .SH NAME
32 ustat \- get file system statistics
33 .SH SYNOPSIS
34 .nf
35 .B #include <sys/types.h>
36 .br
37 .BR "#include <unistd.h>" "    /* libc[45] */"
38 .br
39 .BR "#include <ustat.h>" "     /* glibc2 */"
40 .sp
41 .BI "int ustat(dev_t " dev ", struct ustat *" ubuf );
42 .fi
43 .SH DESCRIPTION
44 .BR ustat ()
45 returns information about a mounted file system.
46 .I dev
47 is a device number identifying a device containing
48 a mounted file system.
49 .I ubuf
50 is a pointer to a \fIustat\fP structure that contains the following
51 members:
52 .in +4n
53 .nf
54
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 .fi
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 file system.
86 .TP
87 .B ENOSYS
88 The mounted file system 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 file systems, the number of free inodes does not change.
110 Such file systems 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 file system is NFS.
114 For some file systems, inodes are dynamically allocated.
115 Such file systems will return the current number of free inodes.
116 .SH SEE ALSO
117 .BR stat (2),
118 .BR statfs (2)