xref: /freebsd/usr.bin/fstat/fstat.1 (revision ca7e3117d443779a9e74b01072157cff8be0f5a2)
19b50d902SRodney W. Grimes.\" Copyright (c) 1987, 1991, 1993
29b50d902SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
39b50d902SRodney W. Grimes.\"
49b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
59b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions
69b50d902SRodney W. Grimes.\" are met:
79b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
89b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
99b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
109b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
119b50d902SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
129b50d902SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
139b50d902SRodney W. Grimes.\"    must display the following acknowledgement:
149b50d902SRodney W. Grimes.\"	This product includes software developed by the University of
159b50d902SRodney W. Grimes.\"	California, Berkeley and its contributors.
169b50d902SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
179b50d902SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
189b50d902SRodney W. Grimes.\"    without specific prior written permission.
199b50d902SRodney W. Grimes.\"
209b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
219b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
229b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
239b50d902SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
249b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
259b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
269b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
279b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
289b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
299b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
309b50d902SRodney W. Grimes.\" SUCH DAMAGE.
319b50d902SRodney W. Grimes.\"
329b50d902SRodney W. Grimes.\"     @(#)fstat.1	8.3 (Berkeley) 2/25/94
339b50d902SRodney W. Grimes.\"
349b50d902SRodney W. Grimes.Dd February 25, 1994
359b50d902SRodney W. Grimes.Dt FSTAT 1
369b50d902SRodney W. Grimes.Os BSD 4
379b50d902SRodney W. Grimes.Sh NAME
389b50d902SRodney W. Grimes.Nm fstat
399b50d902SRodney W. Grimes.Nd file status
409b50d902SRodney W. Grimes.Sh SYNOPSIS
419b50d902SRodney W. Grimes.Nm fstat
429b50d902SRodney W. Grimes.Op Fl fnv
439b50d902SRodney W. Grimes.Op Fl M Ar core
449b50d902SRodney W. Grimes.Op Fl N Ar system
459b50d902SRodney W. Grimes.Op Fl p Ar pid
469b50d902SRodney W. Grimes.Op Fl u Ar user
479b50d902SRodney W. Grimes.Op Ar filename...
489b50d902SRodney W. Grimes.Sh DESCRIPTION
499b50d902SRodney W. Grimes.Nm Fstat
509b50d902SRodney W. Grimesidentifies open files.
519b50d902SRodney W. GrimesA file is considered open by a process if it was explicitly opened,
52ca7e3117SPeter Wemmis the working directory, root directory, active executable text, or kernel
539b50d902SRodney W. Grimestrace file for that process.
549b50d902SRodney W. GrimesIf no options are specified,
559b50d902SRodney W. Grimes.Nm fstat
569b50d902SRodney W. Grimesreports on all open files in the system.
579b50d902SRodney W. Grimes.Pp
589b50d902SRodney W. GrimesOptions:
599b50d902SRodney W. Grimes.Bl -tag -width Ds
609b50d902SRodney W. Grimes.It Fl f
619b50d902SRodney W. GrimesRestrict examination to files open in the same filesystems as
629b50d902SRodney W. Grimesthe named file arguments, or to the filesystem containing the
639b50d902SRodney W. Grimescurrent directory if there are no additional filename arguments.
649b50d902SRodney W. GrimesFor example, to find all files open in the filesystem where the
659b50d902SRodney W. Grimesdirectory
669b50d902SRodney W. Grimes.Pa /usr/src
679b50d902SRodney W. Grimesresides, type
689b50d902SRodney W. Grimes.Dq Li fstat -f /usr/src .
699b50d902SRodney W. Grimes.It Fl M
709b50d902SRodney W. GrimesExtract values associated with the name list from the specified core
719b50d902SRodney W. Grimesinstead of the default
729b50d902SRodney W. Grimes.Pa /dev/kmem .
739b50d902SRodney W. Grimes.It Fl N
749b50d902SRodney W. GrimesExtract the name list from the specified system instead of the default
75b3bfc719SDavid Greenman.Pa /kernel .
769b50d902SRodney W. Grimes.It Fl n
779b50d902SRodney W. GrimesNumerical format.  Print the device number (maj,min) of the filesystem
789b50d902SRodney W. Grimesthe file resides in rather than the mount point name; for special
799b50d902SRodney W. Grimesfiles, print the
809b50d902SRodney W. Grimesdevice number that the special device refers to rather than the filename
819b50d902SRodney W. Grimesin
829b50d902SRodney W. Grimes.Pa /dev ;
839b50d902SRodney W. Grimesand print the mode of the file in octal instead of symbolic form.
849b50d902SRodney W. Grimes.It Fl p
859b50d902SRodney W. GrimesReport all files open by the specified process.
869b50d902SRodney W. Grimes.It Fl u
879b50d902SRodney W. GrimesReport all files open by the specified user.
889b50d902SRodney W. Grimes.It Fl v
899b50d902SRodney W. GrimesVerbose mode.  Print error messages upon failures to locate particular
909b50d902SRodney W. Grimessystem data structures rather than silently ignoring them.  Most of
919b50d902SRodney W. Grimesthese data structures are dynamically created or deleted and it is
929b50d902SRodney W. Grimespossible for them to disappear while
939b50d902SRodney W. Grimes.Nm fstat
949b50d902SRodney W. Grimesis running.  This
959b50d902SRodney W. Grimesis normal and  unavoidable since the rest of the system is running while
969b50d902SRodney W. Grimes.Nm fstat
979b50d902SRodney W. Grimesitself is running.
989b50d902SRodney W. Grimes.It Ar filename ...
999b50d902SRodney W. GrimesRestrict reports to the specified files.
1009b50d902SRodney W. Grimes.El
1019b50d902SRodney W. Grimes.Pp
1029b50d902SRodney W. GrimesThe following fields are printed:
1039b50d902SRodney W. Grimes.Bl -tag -width MOUNT
1049b50d902SRodney W. Grimes.It Li USER
1059b50d902SRodney W. GrimesThe username of the owner of the process (effective uid).
1069b50d902SRodney W. Grimes.It Li CMD
1079b50d902SRodney W. GrimesThe command name of the process.
1089b50d902SRodney W. Grimes.It Li PID
1099b50d902SRodney W. GrimesThe process id.
1109b50d902SRodney W. Grimes.It Li FD
1119b50d902SRodney W. GrimesThe file number in the per-process open file table or one of the following
1129b50d902SRodney W. Grimesspecial names:
1139b50d902SRodney W. Grimes.Pp
1149b50d902SRodney W. Grimes.Bd -ragged -offset indent -compact
115ca7e3117SPeter Wemmtext	- executable text inode
1169b50d902SRodney W. Grimeswd 	- current working directory
1179b50d902SRodney W. Grimesroot	- root inode
1189b50d902SRodney W. Grimestr	- kernel trace file
1199b50d902SRodney W. Grimes.Ed
1209b50d902SRodney W. Grimes.Pp
1219b50d902SRodney W. GrimesIf the file number is followed by an asterisk (``*''), the file is
1229b50d902SRodney W. Grimesnot an inode, but rather a socket,
1239b50d902SRodney W. Grimes.Tn FIFO ,
1249b50d902SRodney W. Grimesor there is an error.
1259b50d902SRodney W. GrimesIn this case the remainder of the line doesn't
1269b50d902SRodney W. Grimescorrespond to the remaining headers -- the format of the line
1279b50d902SRodney W. Grimesis described later under
1289b50d902SRodney W. Grimes.Sx Sockets .
1299b50d902SRodney W. Grimes.It Li MOUNT
1309b50d902SRodney W. GrimesIf the
1319b50d902SRodney W. Grimes.Fl n
1329b50d902SRodney W. Grimesflag wasn't specified, this header is present and is the
1339b50d902SRodney W. Grimespathname that the filesystem the file resides in is mounted on.
1349b50d902SRodney W. Grimes.It Li DEV
1359b50d902SRodney W. GrimesIf the
1369b50d902SRodney W. Grimes.Fl n
1379b50d902SRodney W. Grimesflag is specified, this header is present and is the
1389b50d902SRodney W. Grimesmajor/minor number of the device that this file resides in.
1399b50d902SRodney W. Grimes.It Li INUM
1409b50d902SRodney W. GrimesThe inode number of the file.
1419b50d902SRodney W. Grimes.It Li MODE
1429b50d902SRodney W. GrimesThe mode of the file.  If the
1439b50d902SRodney W. Grimes.Fl n
1449b50d902SRodney W. Grimesflag isn't specified, the mode is printed
1459b50d902SRodney W. Grimesusing a symbolic format (see
1469b50d902SRodney W. Grimes.Xr strmode 3 ) ;
1479b50d902SRodney W. Grimesotherwise, the mode is printed
1489b50d902SRodney W. Grimesas an octal number.
1499b50d902SRodney W. Grimes.It Li SZ\&|DV
1509b50d902SRodney W. GrimesIf the file is not a character or block special, prints the size of
1519b50d902SRodney W. Grimesthe file in bytes.  Otherwise, if the
1529b50d902SRodney W. Grimes.Fl n
1539b50d902SRodney W. Grimesflag is not specified, prints
1549b50d902SRodney W. Grimesthe name of the special file as located in
1559b50d902SRodney W. Grimes.Pa /dev .
1569b50d902SRodney W. GrimesIf that cannot be
1579b50d902SRodney W. Grimeslocated, or the
1589b50d902SRodney W. Grimes.Fl n
1599b50d902SRodney W. Grimesflag is specified, prints the major/minor device
1609b50d902SRodney W. Grimesnumber that the special device refers to.
1619b50d902SRodney W. Grimes.It Li R/W
1629b50d902SRodney W. GrimesThis column describes the access mode that the file allows.
1639b50d902SRodney W. GrimesThe letter ``r'' indicates open for reading;
1649b50d902SRodney W. Grimesthe letter ``w'' indicates open for writing.
1659b50d902SRodney W. GrimesThis field is useful when trying to find the processes that are
1669b50d902SRodney W. Grimespreventing a filesystem from being down graded to read-only.
1679b50d902SRodney W. Grimes.It Li NAME
1689b50d902SRodney W. GrimesIf filename arguments are specified and the
1699b50d902SRodney W. Grimes.Fl f
1709b50d902SRodney W. Grimesflag is not, then
1719b50d902SRodney W. Grimesthis field is present and is the name associated with the given file.
1729b50d902SRodney W. GrimesNormally the name cannot be determined since there is no mapping
1739b50d902SRodney W. Grimesfrom an open file back to the directory entry that was used to open
1749b50d902SRodney W. Grimesthat file.  Also, since different directory entries may reference
1759b50d902SRodney W. Grimesthe same file (via
176906c1e27SMike Pritchard.Xr ln 1 ) ,
1779b50d902SRodney W. Grimesthe name printed may not be the actual
1789b50d902SRodney W. Grimesname that the process originally used to open that file.
1799b50d902SRodney W. Grimes.El
1809b50d902SRodney W. Grimes.Sh SOCKETS
1819b50d902SRodney W. GrimesThe formating of open sockets depends on the protocol domain.
1829b50d902SRodney W. GrimesIn all cases the first field is the domain name, the second field
1839b50d902SRodney W. Grimesis the socket type (stream, dgram, etc), and the third is the socket
1849b50d902SRodney W. Grimesflags field (in hex).
1859b50d902SRodney W. GrimesThe remaining fields are protocol dependent.
1869b50d902SRodney W. GrimesFor tcp, it is the address of the tcpcb, and for udp, the inpcb (socket pcb).
1879b50d902SRodney W. GrimesFor unix domain sockets, its the address of the socket pcb and the address
1889b50d902SRodney W. Grimesof the connected pcb (if connected).
1899b50d902SRodney W. GrimesOtherwise the protocol number and address of the socket itself are printed.
1909b50d902SRodney W. GrimesThe attempt is to make enough information available to
1919b50d902SRodney W. Grimespermit further analysis without duplicating
1929b50d902SRodney W. Grimes.Xr netstat 1 .
1939b50d902SRodney W. Grimes.Pp
1949b50d902SRodney W. GrimesFor example, the addresses mentioned above are the addresses which the
1959b50d902SRodney W. Grimes.Dq Li netstat -A
1969b50d902SRodney W. Grimescommand would print for tcp, udp, and unixdomain.
1979b50d902SRodney W. GrimesNote that since pipes are implemented using sockets, a pipe appears as a
1989b50d902SRodney W. Grimesconnected unix domain stream socket.
1999b50d902SRodney W. GrimesA unidirectional unix domain socket indicates the direction of flow with
2009b50d902SRodney W. Grimesan arrow (``<-'' or ``->''), and a full duplex socket shows a double arrow
2019b50d902SRodney W. Grimes(``<->'').
2029b50d902SRodney W. Grimes.Sh BUGS
2039b50d902SRodney W. GrimesSince
2049b50d902SRodney W. Grimes.Nm fstat
2059b50d902SRodney W. Grimestakes a snapshot of the system, it is only correct for a very short period
2069b50d902SRodney W. Grimesof time.
2079b50d902SRodney W. Grimes.Sh SEE ALSO
2089b50d902SRodney W. Grimes.Xr netstat 1 ,
2099b50d902SRodney W. Grimes.Xr nfsstat 1 ,
2109b50d902SRodney W. Grimes.Xr ps 1 ,
2119b50d902SRodney W. Grimes.Xr systat 1 ,
2129b50d902SRodney W. Grimes.Xr iostat 8 ,
213270d3d75SMike Pritchard.Xr pstat 8 ,
214270d3d75SMike Pritchard.Xr vmstat 8
2159b50d902SRodney W. Grimes.Sh HISTORY
2169b50d902SRodney W. GrimesThe
2179b50d902SRodney W. Grimes.Nm
2189b50d902SRodney W. Grimescommand appeared in
2199b50d902SRodney W. Grimes.Bx 4.3 tahoe .
220