BSD 4_3_Net_2 release
[unix-history] / usr / src / usr.bin / fstat / fstat.1
index 0e1876a..bd1277f 100644 (file)
-.\" Copyright (c) 1987 Regents of the University of California.
+.\" Copyright (c) 1987, 1991 Regents of the University of California.
 .\" All rights reserved.
 .\"
 .\" All rights reserved.
 .\"
-.\" Redistribution and use in source and binary forms are permitted
-.\" provided that the above copyright notice and this paragraph are
-.\" duplicated in all such forms and that any documentation,
-.\" advertising materials, and other materials related to such
-.\" distribution and use acknowledge that the software was developed
-.\" by the University of California, Berkeley.  The name of the
-.\" University may not be used to endorse or promote products derived
-.\" from this software without specific prior written permission.
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-.\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"    This product includes software developed by the University of
+.\"    California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
 .\"
 .\"
-.\"    @(#)fstat.1     5.7 (Berkeley) 6/22/90
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
 .\"
 .\"
-.TH FSTAT 1 "June 22, 1990"
-.UC 4
-.SH NAME
-fstat \- file status
-.SH SYNOPSIS
-.B fstat
-[
-.B \-u
-user ] [
-.B \-p
-pid ] [
-.B filename... 
-]
-.SH DESCRIPTION
-.I Fstat
+.\"     @(#)fstat.1    5.12 (Berkeley) 7/22/91
+.\"
+.Dd July 22, 1991
+.Dt FSTAT 1
+.Os BSD 4
+.Sh NAME
+.Nm fstat
+.Nd file status
+.Sh SYNOPSIS
+.Nm fstat
+.Op Fl fnv
+.Op Fl M Ar core
+.Op Fl N Ar system
+.Op Fl u Ar user
+.Op Ar filename...
+.Sh DESCRIPTION
+.Nm Fstat
 identifies open files.
 identifies open files.
-A file is considered open if a process has it open,
-if it is the working directory for a process,
-or if it is an active pure text file.
+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,
 If no options are specified,
-.I fstat
-reports on all open files.
-.PP
+.Nm fstat
+reports on all open files in the system.
+.Pp
 Options:
 Options:
-.TP 6
-.B  \-u
-Report all files open by the specified user.
-.TP 6
-.B  \-p
+.Bl -tag -width Ds
+.It Fl f
+If additional filename arguments are present, restrict examination to files
+open in the same filesystem as the named file arguments.
+For example, to find all files open in the filesystem where the
+directory
+.Pa /usr/src
+resides, type
+.Dq Li fstat -f /usr/src .
+.It Fl M
+Extract values associated with the name list from the specified core
+instead of the default
+.Pa /dev/kmem .
+.It Fl N
+Extract the name list from the specified system instead of the default
+.Pa /vmunix .
+.It Fl n
+Numerical format.  Print the device number (maj,min) of the filesystem
+the file resides in rather than the mount point name; for special
+files, print the
+device number that the special device refers to rather than the filename
+in
+.Pa /dev ;
+and print the mode of the file in octal instead of symbolic form.
+.It Fl p
 Report all files open by the specified process.
 Report all files open by the specified process.
-.TP 6
-.B filename...
+.It Fl u
+Report all files open by the specified user.
+.It Fl v
+Verbose mode.  Print error messages upon failures to locate particular
+system data structures rather than silently ignoring them.  Most of
+these data structures are dynamically created or deleted and it is
+possible for them to disappear while
+.Nm fstat
+is running.  This
+is normal and  unavoidable since the rest of the system is running while
+.Nm fstat
+itself is running.
+.It Ar filename ...
 Restrict reports to the specified files.
 Restrict reports to the specified files.
-If the file is a block special file,
-.I fstat
-additionally reports on any open files on that device,
-treating it as a mounted file system.  
-.PP
+.El
+.Pp
 The following fields are printed:
 The following fields are printed:
-.TP 6
-.B  USER
-The username of the owner of the process.
-.TP 6
-.B CMD
+.Bl -tag -width MOUNT
+.It Li USER
+The username of the owner of the process (effective uid).
+.It Li CMD
 The command name of the process.
 The command name of the process.
-.TP 6
-.B PID
+.It Li PID
 The process id.
 The process id.
-.TP 6
-.B FD
-The file number in the per-process open file table.  The special
-names ``text'' and ``wd'' mean that the file is the pure text inode
-or the working directory for the process.
-If the file number is followed by an asterisk (``*''), then the file is
-not an inode, but is a socket or a FIFO or has an error of some kind.
-In this case the rest of the entry is in variable format, doesn't
-correspond to the rest of the headings, and is enclosed in parentheses.
-If the file resides on a remote filesystem, the device, inode,
-and size fields are replaced by the text ``from remote filesystem''.
-.TP 6
-.B DEVICE
-Major/minor number of the device this file exists on.
-.TP 6
-.B INODE
+.It Li FD
+The file number in the per-process open file table or one of the following
+special names:
+.Pp
+.Bd -ragged -offset indent -compact
+text   - pure text inode
+wd     - current working directory
+root   - root inode
+tr     - kernel trace file
+.Ed
+.Pp
+If the file number is followed by an asterisk (``*''), the file is
+not an inode, but rather a socket,
+.Tn 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
+.Sx Sockets .
+.It Li MOUNT
+If the
+.Fl n
+flag wasn't specified, this header is present and is the
+pathname that the filesystem the file resides in is mounted on.
+.It Li DEV
+If the
+.Fl n
+flag is specified, this header is present and is the
+major/minor number of the device that this file resides in.
+.It Li INUM
 The inode number of the file.
 The inode number of the file.
-.TP 6
-.B SIZE
-The size, in bytes, of the file.
-.TP 6
-.B TYPE
-The type of the file (see
-.IR stat (2)).
-.SH Sockets
+.It Li MODE
+The mode of the file.  If the
+.Fl n
+flag isn't specified, the mode is printed
+using a symbolic format (see
+.Xr strmode 3 ) ;
+otherwise, the mode is printed
+as an octal number.
+.It Li SZ\&|DV
+If the file is not a character or block special, prints the size of
+the file in bytes.  Otherwise, if the
+.Fl n
+flag is not specified, prints
+the name of the special file as located in
+.Pa /dev .
+If that cannot be
+located, or the
+.Fl n
+flag is specified, prints the major/minor device
+number that the special device refers to.
+.It Li NAME
+If filename arguments are specified and the
+.Fl 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
+.Xr ln 2 ) ,
+the name printed may not be the actual
+name that the process originally used to open that file.
+.El
+.Sh SOCKETS
 The 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
 The 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
@@ -97,21 +179,33 @@ 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.
 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 not duplicate
-.IR netstat (1),
-but rather to make enough information available to permit further analysis.
-.PP
+The attempt is to make enough information available to 
+permit further analysis without duplicating
+.Xr netstat 1 .
+.Pp
 For example, the addresses mentioned above are the addresses which the
 For example, the addresses mentioned above are the addresses which the
-``netstat -A'' command would print for tcp, udp, and unixdomain.
+.Dq Li 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
 (``<->'').
 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
 (``<->'').
-.SH BUGS
+.Sh BUGS
 Since
 Since
-.I fstat
+.Nm fstat
 takes a snapshot of the system, it is only correct for a very short period
 of time.
 takes a snapshot of the system, it is only correct for a very short period
 of time.
-.SH "SEE ALSO"
-netstat(1), ps(1), systat(1), stat(2), pstat(8)
+.Sh SEE ALSO
+.Xr netstat 1 ,
+.Xr nfsstat 1 ,
+.Xr ps 1 ,
+.Xr systat 1 ,
+.Xr vmstat 1 ,
+.Xr iostat 8 ,
+.Xr pstat 8
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.3 tahoe .