xref: /freebsd/usr.bin/procstat/procstat.1 (revision 5ae59dec60e3815b621ae87f74a377cf3449ca55)
1.\"-
2.\" Copyright (c) 2007-2009 Robert N. M. Watson
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.\" $FreeBSD$
27.\"
28.Dd February 11, 2014
29.Dt PROCSTAT 1
30.Os
31.Sh NAME
32.Nm procstat
33.Nd get detailed process information
34.Sh SYNOPSIS
35.Nm
36.Op Fl h
37.Op Fl n
38.Op Fl C
39.Op Fl w Ar interval
40.Op Fl b | c | e | f | i | j | k | l | s | t | v | x
41.Op Fl a | Ar pid | Ar core ...
42.Sh DESCRIPTION
43The
44.Nm
45utility displays detailed information about the processes identified by the
46.Ar pid
47arguments, or if the
48.Fl a
49flag is used, all processes.
50It can also display information extracted from a process core file, if
51the core file is specified as the argument.
52.Pp
53By default, basic process statistics are printed; one of the following
54options may be specified in order to select more detailed process information
55for printing:
56.Bl -tag -width indent
57.It Fl b
58Display binary information for the process.
59.It Fl c
60Display command line arguments for the process.
61.It Fl e
62Display environment variables for the process.
63.It Fl f
64Display file descriptor information for the process.
65.It Fl i
66Display signal pending and disposition information for the process.
67.It Fl j
68Display signal pending and blocked information for the process threads.
69.It Fl k
70Display the stacks of kernel threads in the process, excluding stacks of
71threads currently running on a CPU and threads with stacks swapped to disk.
72If the flag is repeated, function offsets as well as function names are
73printed.
74.It Fl l
75Display resource limits for the process.
76.It Fl s
77Display security credential information for the process.
78.It Fl t
79Display thread information for the process.
80.It Fl v
81Display virtual memory mappings for the process.
82.It Fl x
83Display ELF auxiliary vector for the process.
84.El
85.Pp
86All options generate output in the format of a table, the first field of
87which is the process ID to which the row of information corresponds.
88The
89.Fl h
90flag may be used to suppress table headers.
91.Pp
92The
93.Fl w
94flag may be used to specify a wait interval at which to repeat the printing
95of the requested process information.
96If the
97.Fl w
98flag is not specified, the output will not repeat.
99.Pp
100The
101.Fl C
102flag requests the printing of additional capability information in the file
103descriptor view.
104.Pp
105Some information, such as VM and file descriptor information, is available
106only to the owner of a process or the superuser.
107.Ss Binary Information
108Display the process ID, command, and path to the process binary:
109.Pp
110.Bl -tag -width indent -compact
111.It PID
112process ID
113.It COMM
114command
115.It OSREL
116osreldate for process binary
117.It PATH
118path to process binary (if available)
119.El
120.Ss Command Line Arguments
121Display the process ID, command, and command line arguments:
122.Pp
123.Bl -tag -width indent -compact
124.It PID
125process ID
126.It COMM
127command
128.It ARGS
129command line arguments (if available)
130.El
131.Ss File Descriptors
132Display detailed information about each file descriptor referenced by a
133process, including the process ID, command, file descriptor number, and
134per-file descriptor object information, such as object type and file system
135path.
136By default, the following information will be printed:
137.Pp
138.Bl -tag -width indent -compact
139.It PID
140process ID
141.It COMM
142command
143.It FD
144file descriptor number or cwd/root/jail
145.It T
146file descriptor type
147.It V
148vnode type
149.It FLAGS
150file descriptor flags
151.It REF
152file descriptor reference count
153.It OFFSET
154file descriptor offset
155.It PRO
156network protocol
157.It NAME
158file path or socket addresses (if available)
159.El
160.Pp
161The following file descriptor types may be displayed:
162.Pp
163.Bl -tag -width X -compact
164.It c
165crypto
166.It e
167POSIX semaphore
168.It f
169fifo
170.It h
171shared memory
172.It k
173kqueue
174.It m
175message queue
176.It p
177pipe
178.It s
179socket
180.It t
181pseudo-terminal master
182.It v
183vnode
184.El
185.Pp
186The following vnode types may be displayed:
187.Pp
188.Bl -tag -width X -compact
189.It -
190not a vnode
191.It b
192block device
193.It c
194character device
195.It d
196directory
197.It f
198fifo
199.It l
200symbolic link
201.It r
202regular file
203.It s
204socket
205.It x
206revoked device
207.El
208.Pp
209The following file descriptor flags may be displayed:
210.Pp
211.Bl -tag -width X -compact
212.It r
213read
214.It w
215write
216.It a
217append
218.It s
219async
220.It f
221fsync
222.It n
223non-blocking
224.It d
225direct I/O
226.It l
227lock held
228.El
229.Pp
230If the
231.Fl C
232flag is specified, the vnode type, reference count, and offset fields will be
233omitted, and a new capabilities field will be included listing capabilities,
234as described in
235.Xr cap_rights_limit 2 ,
236present for each capability descriptor.
237.Ss Signal Disposition Information
238Display signal pending and disposition for a process:
239.Pp
240.Bl -tag -width ident -compact
241.It PID
242process ID
243.It COMM
244command
245.It SIG
246signal name
247.It FLAGS
248process signal disposition details, three symbols
249.Bl -tag -width X -compact
250.It P
251if signal is pending in the global process queue, - otherwise
252.It I
253if signal delivery disposition is SIGIGN, - otherwise
254.It C
255if signal delivery is to catch it, - otherwise
256.El
257.El
258.Pp
259If
260.Fl n
261switch is given, the signal numbers are shown instead of signal names.
262.Ss Thread Signal Information
263Display signal pending and blocked for a process threads:
264.Pp
265.Bl -tag -width ident -compact
266.It PID
267process ID
268.It COMM
269command
270.It TID
271thread ID
272.It SIG
273signal name
274.It FLAGS
275thread signal delivery status, two symbols
276.Bl -tag -width X -compact
277.It P
278if signal is pending for the thread, - otherwise
279.It B
280if signal is blocked in the thread signal mask, - if not blocked
281.El
282.El
283.Pp
284The
285.Fl n
286switch has the same effect as for the
287.Fl i
288switch, the signals numbers are shown instead of signal names.
289.Ss Kernel Thread Stacks
290Display kernel thread stacks for a process, allowing further interpretation
291of thread wait channels.
292If the
293.Fl k
294flag is repeated, function offsets, not just function names, are printed.
295.Pp
296This feature requires
297.Cd "options STACK"
298or
299.Cd "options DDB"
300to be compiled into the kernel.
301.Pp
302.Bl -tag -width indent -compact
303.It PID
304process ID
305.It TID
306thread ID
307.It COMM
308command
309.It TDNAME
310thread name
311.It KSTACK
312kernel thread call stack
313.El
314.Ss Security Credentials
315Display process credential information:
316.Pp
317.Bl -tag -width indent -compact
318.It PID
319process ID
320.It COMM
321command
322.It EUID
323effective user ID
324.It RUID
325real user ID
326.It SVUID
327saved user ID
328.It EGID
329effective group ID
330.It RGID
331real group ID
332.It SVGID
333saved group ID
334.It UMASK
335file creation mode mask
336.It FLAGS
337credential flags
338.It GROUPS
339group set
340.El
341.Pp
342The following credential flags may be displayed:
343.Pp
344.Bl -tag -width X -compact
345.It C
346capability mode
347.El
348.Ss Thread Information
349Display per-thread information, including process ID, per-thread ID, name,
350CPU, and execution state:
351.Pp
352.Bl -tag -width indent -compact
353.It PID
354process ID
355.It TID
356thread ID
357.It COMM
358command
359.It TDNAME
360thread name
361.It CPU
362current or most recent CPU run on
363.It PRI
364thread priority
365.It STATE
366thread state
367.It WCHAN
368thread wait channel
369.El
370.Ss Virtual Memory Mappings
371Display process virtual memory mappings, including addresses, mapping
372meta-data, and mapped object information:
373.Pp
374.Bl -tag -width indent -compact
375.It PID
376process ID
377.It START
378starting address of mapping
379.It END
380ending address of mapping
381.It PRT
382protection flags
383.It RES
384resident pages
385.It PRES
386private resident pages
387.It REF
388reference count
389.It SHD
390shadow page count
391.It FL
392mapping flags
393.It TP
394VM object type
395.El
396.Pp
397The following protection flags may be displayed:
398.Pp
399.Bl -tag -width X -compact
400.It r
401read
402.It w
403write
404.It x
405execute
406.El
407.Pp
408The following VM object types may be displayed:
409.Pp
410.Bl -tag -width XX -compact
411.It --
412none
413.It dd
414dead
415.It df
416default
417.It dv
418device
419.It md
420device with managed pages
421.Pq GEM/TTM
422.It ph
423physical
424.It sg
425scatter/gather
426.It sw
427swap
428.It vn
429vnode
430.El
431.Pp
432The following mapping flags may be displayed:
433.Pp
434.Bl -tag -width X -compact
435.It C
436copy-on-write
437.It N
438needs copy
439.It S
440one or more superpage mappings are used
441.It D
442grows down (top-down stack)
443.It U
444grows up (bottom-up stack)
445.El
446.Sh EXIT STATUS
447.Ex -std
448.Sh SEE ALSO
449.Xr fstat 1 ,
450.Xr ps 1 ,
451.Xr sockstat 1 ,
452.Xr cap_enter 2 ,
453.Xr cap_rights_limit 2 ,
454.Xr ddb 4 ,
455.Xr stack 9
456.Sh AUTHORS
457.An Robert N M Watson
458.Sh BUGS
459Some field values may include spaces, which limits the extent to which the
460output of
461.Nm
462may be mechanically parsed.
463.Pp
464The display of open file or memory mapping pathnames is implemented using the
465kernel's name cache.
466If a file system does not use the name cache, or the path to a file is not in
467the cache, a path will not be displayed.
468.Pp
469.Nm
470currently supports extracting data only from a live kernel, and not from
471kernel crash dumps.
472