FSTAT(1) | General Commands Manual | FSTAT(1) |
fstat
—
fstat |
[-fnosv ] [-M
core] [-N
system] [-p
pid] [-u
user] [file ...] |
fstat
identifies open files. A file is considered open
by a process if it was explicitly opened, is the working directory, root
directory, active executable text, or kernel trace file for that process. If
no options are specified, fstat
reports on all open
files in the system.
The options are as follows:
-f
# fstat -f /usr/src
-M
core-N
system-n
-o
-p
pid-s
-u
user-v
fstat
is running. This is
normal and unavoidable since the rest of the system is running while
fstat
itself is running.The following fields are printed:
USER
CMD
PID
FD
text - executable text inode wd - current working directory root - root inode tr - kernel trace file
If the file number is followed by an asterisk
(‘*
’), the file is not an inode,
but rather a socket, or there is an error. In this case the remainder of
the line doesn't correspond to the remaining headers -- the format of
the line is described later under
SOCKETS.
MOUNT
-n
flag wasn't specified, this header is
present and is the pathname that the file system the file resides in is
mounted on.DEV
-n
flag is specified, this header is
present and is the major/minor number of the device that this file resides
in.INUM
MODE
-n
flag isn't
specified, the mode is printed using a symbolic format (see
strmode(3)); otherwise,
the mode is printed as an octal number.R/W
SZ
|
DV
-n
flag is
not specified, prints the name of the special file as located in
/dev. If that cannot be located, or the
-n
flag is specified, prints the major/minor
device number that the special device refers to.NAME
-f
flag is not, then this field is present and is the name associated with
the given file. Normally the name cannot be determined since there is no
mapping from an open file back to the directory entry that was used to
open that file. Also, since different directory entries may reference the
same file (via ln(1)), the name
printed may not be the actual name that the process originally used to
open that file.XFERS
KBYTES
For example, the addresses mentioned above are the addresses which
the netstat -A
command would print for TCP, UDP, and
UNIX-domain. A unidirectional
UNIX-domain socket indicates the direction of flow
with an arrow (“<-” or “->”), and a full
duplex socket shows a double arrow (“<->”).
For AF_INET
and
AF_INET6
sockets, fstat
also
attempts to print the internet address and port for the local end of a
connection. If the socket is connected, it also prints the remote internet
address and port. A ‘*
’ is used to
indicate an INADDR_ANY
binding. In this case, the
use of the arrow (“<--” or “-->”)
indicates the direction the socket connection was created.
If the socket has been spliced to or from another socket (c.f.
setsockopt(2) and
SO_SPLICE
) then fstat
prints
a thick arrow (“<==>”, “<==”, or
“==>”), followed by the address and endpoint information of
the other socket in the splice, if available.
fstat
command appeared in
4.3BSD-Tahoe.
fstat
, even though they appear in
netstat(1).
fstat
takes a snapshot of the system, it is only
correct for a very short period of time.
Moreover, because DNS resolution and YP lookups cause many file
descriptor changes, fstat
does not attempt to
translate the internet address and port numbers into symbolic names.
January 7, 2012 | OpenBSD-5.6 |