1 .\" Copyright (c) 1987, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)fstat.1 8.3 (Berkeley) 2/25/94
33 .\" $FreeBSD: src/usr.bin/fstat/fstat.1,v 1.9.2.7 2002/06/21 15:26:59 charnier Exp $
52 utility identifies open files.
53 A file is considered open by a process if it was explicitly opened,
54 is the working directory, root directory, active executable text, or kernel
55 trace file for that process.
56 If no options are specified,
58 reports on all open files in the system.
63 Restrict examination to files open in the same filesystems as
64 the named file arguments, or to the filesystem containing the
65 current directory if there are no additional filename arguments.
66 For example, to find all files open in the filesystem where the
70 .Dq Li fstat -f /usr/src .
72 Extract values associated with the name list from the specified core
73 instead of the default
76 Extract the name list from the specified system instead of the default
79 Include memory-mapped files in the listing; normally these are excluded
80 due to the extra processing required.
82 Numerical format. Print the device number (maj,min) of the filesystem
83 the file resides in rather than the mount point name; for special
85 device number that the special device refers to rather than the filename
88 and print the mode of the file in octal instead of symbolic form.
90 Report all files open by the specified process.
92 Report all files open by the specified user.
94 Verbose mode. Print error messages upon failures to locate particular
95 system data structures rather than silently ignoring them. Most of
96 these data structures are dynamically created or deleted and it is
97 possible for them to disappear while
100 is normal and unavoidable since the rest of the system is running while
104 Restrict reports to the specified files.
107 The following fields are printed:
108 .Bl -tag -width MOUNT
110 The username of the owner of the process (effective uid).
112 The command name of the process.
116 The file number in the per-process open file table or one of the following
119 .Bd -literal -offset indent -compact
120 text - executable text inode
121 wd - current working directory
123 tr - kernel trace file
124 mmap - memory-mapped file
127 If the file number is followed by an asterisk (``*''), the file is
128 not an inode, but rather a socket,
130 or there is an error.
131 In this case the remainder of the line doesn't
132 correspond to the remaining headers -- the format of the line
133 is described later under
138 flag wasn't specified, this header is present and is the
139 pathname that the filesystem the file resides in is mounted on.
143 flag is specified, this header is present and is the
144 major/minor number of the device that this file resides in.
146 The inode number of the file.
148 The mode of the file. If the
150 flag isn't specified, the mode is printed
151 using a symbolic format (see
153 otherwise, the mode is printed
156 If the file is not a character or block special, prints the size of
157 the file in bytes. Otherwise, if the
159 flag is not specified, prints
160 the name of the special file as located in
165 flag is specified, prints the major/minor device
166 number that the special device refers to.
168 This column describes the access mode that the file allows.
169 The letter ``r'' indicates open for reading;
170 the letter ``w'' indicates open for writing.
171 This field is useful when trying to find the processes that are
172 preventing a filesystem from being down graded to read-only.
174 If filename arguments are specified and the
177 this field is present and is the name associated with the given file.
178 Normally the name cannot be determined since there is no mapping
179 from an open file back to the directory entry that was used to open
180 that file. Also, since different directory entries may reference
183 the name printed may not be the actual
184 name that the process originally used to open that file.
187 The formating of open sockets depends on the protocol domain.
188 In all cases the first field is the domain name, the second field
189 is the socket type (stream, dgram, etc), and the third is the socket
190 flags field (in hex).
191 The remaining fields are protocol dependent.
192 For tcp, it is the address of the tcpcb, and for udp, the inpcb (socket pcb).
193 For unix domain sockets, its the address of the socket pcb and the address
194 of the connected pcb (if connected).
195 Otherwise the protocol number and address of the socket itself are printed.
196 The attempt is to make enough information available to
197 permit further analysis without duplicating
200 For example, the addresses mentioned above are the addresses which the
202 command would print for tcp, udp, and unixdomain.
203 Note that since pipes are implemented using sockets, a pipe appears as a
204 connected unix domain stream socket.
205 A unidirectional unix domain socket indicates the direction of flow with
206 an arrow (``<-'' or ``->''), and a full duplex socket shows a double arrow
211 takes a snapshot of the system, it is only correct for a very short period