date and time created 88/12/14 16:21:47 by marc
[unix-history] / usr / src / usr.bin / fstat / fstat.1
CommitLineData
d613fe68
MT
1.\" Copyright (c) 1987 Regents of the University of California.
2.\" All rights reserved.
3c3ea40f 3.\"
d613fe68 4.\" Redistribution and use in source and binary forms are permitted
57a981eb
KB
5.\" provided that the above copyright notice and this paragraph are
6.\" duplicated in all such forms and that any documentation,
7.\" advertising materials, and other materials related to such
8.\" distribution and use acknowledge that the software was developed
9.\" by the University of California, Berkeley. The name of the
10.\" University may not be used to endorse or promote products derived
11.\" from this software without specific prior written permission.
12.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14.\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
d613fe68 15.\"
57a981eb 16.\" @(#)fstat.1 5.4 (Berkeley) %G%
3c3ea40f
MT
17.\"
18.TH FSTAT 8 ""
19.UC 4
20.SH NAME
21fstat \- file status
22.SH SYNOPSIS
23.B fstat
24[
25.B \-u
26user ] [
27.B \-p
28pid ] [
d613fe68
MT
29.B filename...
30]
3c3ea40f
MT
31.SH DESCRIPTION
32.I Fstat
33identifies open files.
34A file is considered open if a process has it open,
35if it is the working directory for a process,
36or if it is an active pure text file.
37If no options are specified,
38.I fstat
39reports on all open files.
40.PP
41Options:
42.TP 6
43.B \-u
44Report all files open by a specified user.
45.TP 6
46.B \-p
47Report all files open by a specified process id.
48.TP 6
d613fe68
MT
49.B filename...
50Restrict reports to the specified files.
3c3ea40f
MT
51If the file is a block special file,
52.I fstat
53additionally reports on any open files on that device,
54treating it as a mounted file system.
55.PP
3c3ea40f
MT
56The following fields are printed
57.TP 6
58.B USER
59The username of the owner of the process.
60.TP 6
61.B CMD
62The command name of the process.
63.TP 6
64.B PID
65The process id.
66.TP 6
67.B FD
68The file number in the per-process open file table. The special
69names "text" and "wd" mean that the file is the pure text inode
70or the working directory for the process. If the file number is
71followed by an asterick (*), then the file is not an inode, but
72either a socket, fifo, or has an error of some kind. In this case
73the rest of the entry is variable format, doesn't correspond
74to the rest of the
75headings, and is
76enclosed in parenthesis.
77The following paragraph describing sockets will explain the
78variable format.
79.TP 6
80.B DEVICE
81Major minor number of the device this file exists on.
82.TP 6
83.B INODE
84The inode number of the file.
85.TP 6
86.B SIZE
87The size in bytes of the file.
88.TP 6
89.B TYPE
90The type of the file. (see stat(2))
91.PP
92Sockets
93.sp1 6
d613fe68
MT
94The formating of open sockets depends on the protocol domain. In
95all cases the first field is the domain name, the second field
3c3ea40f 96is the socket type (stream, dgram, etc), and the third is the socket
d613fe68
MT
97flags field (in hex). The remaining fields are protocol dependent. For tcp,
98it is the address of the tcpcb, and for udp,
99the inpcb (socket pcb). For unix domain sockets, its the address of the socket
3c3ea40f
MT
100pcb and the address of the connected pcb (if connected). Otherwise
101the protocol number and address of the socket itself are printed. The
102idea is not to duplicate netstat, but to make available enough
103information for further analysis. For example, the addresses mentioned
104above are the addresses which the "netstat -A" command would print for
105tcp, udp, and unixdomain. Note that since pipe(2) is implemented
d613fe68
MT
106with sockets, a pipe appears as a connected unix domain stream socket.
107A unidirectional unix domain socket indicates the direction of
108flow with an arrow ("<-" or "->"), and a full duplex socket shows
109a double arrow ("<->").
3c3ea40f 110.dt
d613fe68
MT
111.SH BUGS
112Socket information clutters the output.
113.PP
114Since \fIfstat\fP takes a snapshot of the system, it is only correct for
115a very short period of time.
3c3ea40f
MT
116.SH "SEE ALSO"
117ps(1), stat(2), pstat(8)