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