|
|
1.1 root 1: .\" Copyright (c) 1989 The Regents of the University of California.
2: .\" All rights reserved.
3: .\"
4: .\" Redistribution and use in source and binary forms are permitted provided
5: .\" that: (1) source distributions retain this entire copyright notice and
6: .\" comment, and (2) distributions including binaries display the following
7: .\" acknowledgement: ``This product includes software developed by the
8: .\" University of California, Berkeley and its contributors'' in the
9: .\" documentation or other materials provided with the distribution and in
10: .\" all advertising materials mentioning features or use of this software.
11: .\" Neither the name of the University nor the names of its contributors may
12: .\" be used to endorse or promote products derived from this software without
13: .\" specific prior written permission.
14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17: .\"
18: .\" @(#)statfs.2 6.3 (Berkeley) 6/23/90
19: .\"
20: .TH STATFS 2 "June 23, 1990"
21: .UC 7
22: .SH NAME
23: statfs \- get file system statistics
24: .SH SYNOPSIS
25: .nf
26: .ft B
27: #include <sys/types.h>
28: #include <sys/mount.h>
29: .LP
30: .ft B
31: statfs(path, buf)
32: char *path;
33: struct statfs *buf;
34: .LP
35: .ft B
36: fstatfs(fd, buf)
37: int fd;
38: struct statfs *buf;
39: .fi
40: .ft R
41: .SH DESCRIPTION
42: .I Statfs
43: returns information about a mounted file system.
44: .I path
45: is the path name of any file within the mounted filesystem.
46: .I Buf
47: is a pointer to a
48: .I statfs
49: structure defined as follows:
50: .IP
51: .ta \w'#define\0\0'u +\w'fsid_t\0\0'u +\w'f_mntfromname[MNAMELEN]\0\0'u
52: .nf
53: typedef quad fsid_t;
54: .sp 1
55: #define MNAMELEN 32 /* length of buffer for returned name */
56: .sp 1
57: struct statfs {
58: short f_type; /* type of filesystem (see below) */
59: short f_flags; /* copy of mount flags */
60: long f_fsize; /* fundamental file system block size */
61: long f_bsize; /* optimal transfer block size */
62: long f_blocks; /* total data blocks in file system */
63: long f_bfree; /* free blocks in fs */
64: long f_bavail; /* free blocks avail to non-superuser */
65: long f_files; /* total file nodes in file system */
66: long f_ffree; /* free file nodes in fs */
67: fsid_t f_fsid; /* file system id */
68: long f_spare[6]; /* spare for later */
69: char f_mntonname[MNAMELEN]; /* directory on which mounted */
70: char f_mntfromname[MNAMELEN]; /* mounted filesystem */
71: };
72: /*
73: * File system types.
74: */
75: #define MOUNT_UFS 1
76: #define MOUNT_NFS 2
77: #define MOUNT_MFS 3
78: #define MOUNT_PC 4
79: .fi
80: .PP
81: Fields that are undefined for a particular file system are set to \-1.
82: .I Fstatfs
83: returns the same information about an open file referenced by descriptor
84: .IR fd .
85: .SH RETURN VALUE
86: Upon successful completion, a value of 0 is returned.
87: Otherwise, \-1 is returned and the global variable
88: .I errno
89: is set to indicate the error.
90: .SH ERRORS
91: .I Statfs
92: fails if one or more of the following are true:
93: .TP 15
94: ENOTDIR
95: A component of the path prefix of
96: .I path
97: is not a directory.
98: .TP 15
99: EINVAL
100: .I path
101: contains a character with the high-order bit set.
102: .TP 15
103: ENAMETOOLONG
104: The length of a component of
105: .I path
106: exceeds 255 characters,
107: or the length of
108: .I path
109: exceeds 1023 characters.
110: .TP 15
111: ENOENT
112: The file referred to by
113: .I path
114: does not exist.
115: .TP 15
116: EACCES
117: Search permission is denied for a component of the path prefix of
118: .IR path .
119: .TP 15
120: ELOOP
121: Too many symbolic links were encountered in translating
122: .IR path .
123: .TP 15
124: EFAULT
125: .I Buf
126: or
127: .I path
128: points to an invalid address.
129: .TP 15
130: EIO
131: An I/O error occurred while reading from or writing to the file system.
132: .PP
133: .I Fstatfs
134: fails if one or both of the following are true:
135: .TP 15
136: EBADF
137: .I fd
138: is not a valid open file descriptor.
139: .TP 15
140: EFAULT
141: .I buf
142: points to an invalid address.
143: .TP 15
144: EIO
145: An I/O error occurred while reading from or writing to the file system.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.