xref: /freebsd/usr.bin/procstat/procstat.1 (revision f05cddf9)
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 April 20, 2013
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.It c
229descriptor is a capability
230.El
231.Pp
232If the
233.Fl C
234flag is specified, the vnode type, reference count, and offset fields will be
235omitted, and a new capabilities field will be included listing capabilities,
236as described in
237.Xr cap_new 2 ,
238present for each capability descriptor.
239.Ss Signal Disposition Information
240Display signal pending and disposition for a process:
241.Pp
242.Bl -tag -width ident -compact
243.It PID
244process ID
245.It COMM
246command
247.It SIG
248signal name
249.It FLAGS
250process signal disposition details, three symbols
251.Bl -tag -width X -compact
252.It P
253if signal is pending in the global process queue, - otherwise
254.It I
255if signal delivery disposition is SIGIGN, - otherwise
256.It C
257if signal delivery is to catch it, - otherwise
258.El
259.El
260.Pp
261If
262.Fl n
263switch is given, the signal numbers are shown instead of signal names.
264.Ss Thread Signal Information
265Display signal pending and blocked for a process threads:
266.Pp
267.Bl -tag -width ident -compact
268.It PID
269process ID
270.It COMM
271command
272.It TID
273thread ID
274.It SIG
275signal name
276.It FLAGS
277thread signal delivery status, two symbols
278.Bl -tag -width X -compact
279.It P
280if signal is pending for the thread, - otherwise
281.It B
282if signal is blocked in the thread signal mask, - if not blocked
283.El
284.El
285.Pp
286The
287.Fl n
288switch has the same effect as for the
289.Fl i
290switch, the signals numbers are shown instead of signal names.
291.Ss Kernel Thread Stacks
292Display kernel thread stacks for a process, allowing further interpretation
293of thread wait channels.
294If the
295.Fl k
296flag is repeated, function offsets, not just function names, are printed.
297.Pp
298This feature requires
299.Cd "options STACK"
300or
301.Cd "options DDB"
302to be compiled into the kernel.
303.Pp
304.Bl -tag -width indent -compact
305.It PID
306process ID
307.It TID
308thread ID
309.It COMM
310command
311.It TDNAME
312thread name
313.It KSTACK
314kernel thread call stack
315.El
316.Ss Security Credentials
317Display process credential information:
318.Pp
319.Bl -tag -width indent -compact
320.It PID
321process ID
322.It COMM
323command
324.It EUID
325effective user ID
326.It RUID
327real user ID
328.It SVUID
329saved user ID
330.It EGID
331effective group ID
332.It RGID
333real group ID
334.It SVGID
335saved group ID
336.It UMASK
337file creation mode mask
338.It FLAGS
339credential flags
340.It GROUPS
341group set
342.El
343.Pp
344The following credential flags may be displayed:
345.Pp
346.Bl -tag -width X -compact
347.It C
348capability mode
349.El
350.Ss Thread Information
351Display per-thread information, including process ID, per-thread ID, name,
352CPU, and execution state:
353.Pp
354.Bl -tag -width indent -compact
355.It PID
356process ID
357.It TID
358thread ID
359.It COMM
360command
361.It TDNAME
362thread name
363.It CPU
364current or most recent CPU run on
365.It PRI
366thread priority
367.It STATE
368thread state
369.It WCHAN
370thread wait channel
371.El
372.Ss Virtual Memory Mappings
373Display process virtual memory mappings, including addresses, mapping
374meta-data, and mapped object information:
375.Pp
376.Bl -tag -width indent -compact
377.It PID
378process ID
379.It START
380starting address of mapping
381.It END
382ending address of mapping
383.It PRT
384protection flags
385.It RES
386resident pages
387.It PRES
388private resident pages
389.It REF
390reference count
391.It SHD
392shadow page count
393.It FL
394mapping flags
395.It TP
396VM object type
397.El
398.Pp
399The following protection flags may be displayed:
400.Pp
401.Bl -tag -width X -compact
402.It r
403read
404.It w
405write
406.It x
407execute
408.El
409.Pp
410The following VM object types may be displayed:
411.Pp
412.Bl -tag -width XX -compact
413.It --
414none
415.It dd
416dead
417.It df
418default
419.It dv
420device
421.It ph
422physical
423.It sg
424scatter/gather
425.It sw
426swap
427.It vn
428vnode
429.El
430.Pp
431The following mapping flags may be displayed:
432.Pp
433.Bl -tag -width X -compact
434.It C
435copy-on-write
436.It N
437needs copy
438.It S
439one or more superpage mappings are used
440.It D
441grows down (top-down stack)
442.It U
443grows up (bottom-up stack)
444.El
445.Sh EXIT STATUS
446.Ex -std
447.Sh SEE ALSO
448.Xr fstat 1 ,
449.Xr ps 1 ,
450.Xr sockstat 1 ,
451.Xr cap_enter 2 ,
452.Xr cap_new 2 ,
453.Xr ddb 4 ,
454.Xr stack 9
455.Sh AUTHORS
456.An Robert N M Watson
457.Sh BUGS
458Some field values may include spaces, which limits the extent to which the
459output of
460.Nm
461may be mechanically parsed.
462.Pp
463The display of open file or memory mapping pathnames is implemented using the
464kernel's name cache.
465If a file system does not use the name cache, or the path to a file is not in
466the cache, a path will not be displayed.
467.Pp
468.Nm
469currently supports extracting data only from a live kernel, and not from
470kernel crash dumps.
471