| manpages.info - online man pages | ![]() |
|||
|
fstat (1) Table of Contents
Namefstat - file status
Synopsisfstat [-fnv] [-M core] [-N system] [-p pid] [-u user] [filename...]
DescriptionFstat identifies open files. A file is considered open by a process if it was explicitly opened, is the working directory, root directory, active pure text, or kernel trace file for that process. If no options are specified, fstat reports on all open files in the system.
Options:
filename ...
The following fields are printed:
If the file number is followed by an asterisk (``*''), the file is not an inode, but rather a socket, FIFO, 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.
MODE The mode of the file. If the -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.
SZ|DV If the file is not a character or block special, prints the size of the file in bytes. Otherwise, if the -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.
MOUNT If the -n flag wasn't specified, this header is present and is the pathname that the filesystem the file resides in is mounted on.
SocketsThe formating of open sockets depends on the protocol domain. In all cases the first field is the domain name, the second field is the socket type (stream, dgram, etc), and the third is the socket flags field (in hex). The remaining fields are protocol dependent. For tcp, it is the address of the tcpcb, and for udp, the inpcb (socket pcb). For unix domain sockets, its the address of the socket pcb and the address of the connected pcb (if connected). Otherwise the protocol number and address of the socket itself are printed. The attempt is to make enough information available to permit further analysis without duplicating netstat(1) .
For example, the addresses mentioned above are the addresses which the ``netstat -A'' command would print for tcp, udp, and unixdomain. Note that since pipes are implemented using sockets, a pipe appears as a connected unix domain stream socket. A unidirectional unix domain socket indicates the direction of flow with an arrow (``<-'' or ``->''), and a full duplex socket shows a double arrow (``<->'').
BugsSince fstat takes a snapshot of the system, it is only correct for a very short period of time.
See Alsonetstat(1) , nfsstat(1) , ps(1) , systat(1) , vmstat(1) , iostat(8) , pstat(8)
HistoryThe fstat command appeared in 4.3BSD-Tahoe.
|