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