2 .\" Copyright (c) 2007-2009 Robert N. M. Watson
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
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.
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
33 .Nd get detailed process information
42 .Op Ar pid ... | Ar core ...
73 .Op Ar pid ... | Ar core ...
116 utility displays detailed information about the processes identified by the
120 flag is used, all processes.
121 It can also display information extracted from a process core file, if
122 the core file is specified as the argument.
129 utilities display the arguments, environment, and current working directory,
130 respectively of the process specified by
133 They mimic the behavior of Solaris utilities of the same names.
137 flag is specified the output is generated via
139 in a selection of different human and machine readable formats.
142 for details on command line arguments.
144 The following commands are available for
146 .Bl -tag -width indent
148 Print basic process statistics (this is the default).
150 Display binary information for the process.
152 Substring commands are accepted.
153 .It Ar argument(s) | Fl c
154 Display command line arguments for the process.
156 Substring commands are accepted.
157 .It Ar environment | Fl e
158 Display environment variables for the process.
160 Substring commands are accepted.
161 .It Ar file(s) | Ar fd(s) | Fl f
162 Display file descriptor information for the process.
166 subcommand flag is used then additional capability information is printed.
167 .It Ar signal(s) | Fl i
168 Display signal pending and disposition information for the process.
172 subcommand option is used, the signal numbers are shown instead of signal
175 Substring commands are accepted.
176 .It Ar tsignal(s) | Fl j
177 Display signal pending and blocked information for the process's threads.
181 subcommand option is used, the signal numbers are shown instead of signal
184 Substring commands are accepted.
186 Display the stacks of kernel threads in the process, excluding stacks of
187 threads currently running on a CPU and threads with stacks swapped to disk.
191 subcommand option is used (or the command flag is repeated), function
192 offsets as well as function names are printed.
194 Display resource limits for the process.
195 .It Ar ptlwpinfo | Fl L
196 Display LWP info for the process pertaining to its signal driven exit.
198 Display resource usage information for the process.
204 is used then per-thread statistics are printed, rather than per-process
206 The second field in the table will list the thread ID to which the row of
207 information corresponds.
208 .It Ar credential(s) | Fl s
209 Display security credential information for the process.
211 Substring commands are accepted.
212 .It Ar cpuset | Ar cs | Fl S
213 Display the cpuset information for the thread.
214 .It Ar thread(s) | Fl t
215 Display thread information for the process.
217 Display virtual memory mappings for the process.
219 Display ELF auxiliary vector for the process.
221 Display arguments for the process.
223 Display environment variables for the process.
225 Display current working directory for the process.
228 All options generate output in the format of a table, the first field of
229 which is the process ID to which the row of information corresponds.
232 flag may be used to suppress table headers.
236 flag may be used to specify a wait interval at which to repeat the printing
237 of the requested process information.
240 flag is not specified, the output will not repeat.
242 Information for VM, file descriptor, and cpuset options is available
243 only to the owner of a process or the superuser.
244 A cpuset value displayed as -1 means that the information is either invalid
246 .Ss Binary Information
247 Display the process ID, command, and path to the process binary:
249 .Bl -tag -width indent -compact
255 osreldate for process binary
257 path to process binary (if available)
259 .Ss Command Line Arguments
260 Display the process ID, command, and command line arguments:
262 .Bl -tag -width indent -compact
268 command line arguments (if available)
270 .Ss Environment Variables
271 Display the process ID, command, and environment variables:
273 .Bl -tag -width "ENVIRONMENT" -compact
279 environment variables (if available)
282 Display detailed information about each file descriptor referenced by a
283 process, including the process ID, command, file descriptor number, and
284 per-file descriptor object information, such as object type and file system
286 By default, the following information will be printed:
288 .Bl -tag -width indent -compact
294 file descriptor number or cwd/root/jail
300 file descriptor flags
302 file descriptor reference count
304 file descriptor offset
308 file path or socket addresses (if available)
311 The following file descriptor types may be displayed:
313 .Bl -tag -width X -compact
331 pseudo-terminal master
336 The following vnode types may be displayed:
338 .Bl -tag -width X -compact
359 The following file descriptor flags may be displayed:
361 .Bl -tag -width X -compact
382 flag is specified, the vnode type, reference count, and offset fields will be
383 omitted, and a new capabilities field will be included listing capabilities,
385 .Xr cap_rights_limit 2 ,
386 present for each capability descriptor.
388 The following network protocols may be displayed (grouped by address family):
393 .Bl -tag -width indent -compact
424 .Bl -tag -width indent -compact
437 .Bl -tag -width indent -compact
439 unknown address family.
441 .Ss Signal Disposition Information
442 Display signal pending and disposition for a process:
444 .Bl -tag -width indent -compact
452 process signal disposition details, three symbols
453 .Bl -tag -width X -compact
455 if signal is pending in the global process queue; - otherwise.
457 if signal delivery disposition is
461 if the signal will be caught; - otherwise.
467 switch is given, the signal numbers are shown instead of signal names.
468 .Ss Thread Signal Information
469 Display signal pending and blocked for a process's threads:
471 .Bl -tag -width indent -compact
481 thread signal delivery status, two symbols
482 .Bl -tag -width X -compact
484 if signal is pending for the thread, - otherwise
486 if signal is blocked in the thread signal mask, - if not blocked
492 switch has the same effect as for the
494 switch: the signal numbers are shown instead of signal names.
495 .Ss Kernel Thread Stacks
496 Display kernel thread stacks for a process, allowing further interpretation
497 of thread wait channels.
500 flag is repeated, function offsets, not just function names, are printed.
502 This feature requires
506 to be compiled into the kernel.
508 .Bl -tag -width indent -compact
518 kernel thread call stack
521 Display resource limits for a process:
523 .Bl -tag -width indent -compact
536 Display resource usage for a process.
540 resource usage for individual threads is displayed instead.
542 .Bl -tag -width "RESOURCE" -compact
559 .Ss Security Credentials
560 Display process credential information:
562 .Bl -tag -width indent -compact
580 file creation mode mask
587 The following credential flags may be displayed:
589 .Bl -tag -width X -compact
593 .Ss Thread Information
594 Display per-thread information, including process ID, per-thread ID, name,
595 CPU, and execution state:
597 .Bl -tag -width indent -compact
607 current or most recent CPU run on
615 .Ss Virtual Memory Mappings
616 Display process virtual memory mappings, including addresses, mapping
617 meta-data, and mapped object information:
619 .Bl -tag -width indent -compact
623 starting address of mapping
625 ending address of mapping
631 private resident pages
642 The following protection flags may be displayed:
644 .Bl -tag -width X -compact
653 The following VM object types may be displayed:
655 .Bl -tag -width XX -compact
665 device with managed pages
677 The following mapping flags may be displayed:
679 .Bl -tag -width X -compact
685 one or more superpage mappings are used
687 grows down (top-down stack)
689 grows up (bottom-up stack)
691 pages in this range are locked by
696 .Ss ELF Auxiliary Vector
697 Display ELF auxiliary vector values:
699 .Bl -tag -width indent -compact
705 auxiliary vector name
707 auxiliary vector value
712 Show binary information about the current shell:
713 .Bd -literal -offset indent
716 46620 bash 1201000 /usr/local/bin/bash
719 Same as above but showing information about open file descriptors:
720 .Bd -literal -offset indent
722 PID COMM FD T V FLAGS REF OFFSET PRO NAME
723 46620 bash text v r r------- - - - /usr/local/bin/bash
724 46620 bash ctty v c rw------ - - - /dev/pts/12
725 46620 bash cwd v d r------- - - - /tmp
726 46620 bash root v d r------- - - - /
727 46620 bash 0 v c rw------ 7 372071 - /dev/pts/12
728 46620 bash 1 v c rw------ 7 372071 - /dev/pts/12
729 46620 bash 2 v c rw------ 7 372071 - /dev/pts/12
730 46620 bash 255 v c rw------ 7 372071 - /dev/pts/12
733 Show the arguments used to launch
735 .Bd -literal -offset indent
736 $ procstat arguments 1
741 Extract binary information from a core dump:
742 .Bd -literal -offset indent
743 $ procstat binary core.36642
745 36642 top 1201000 /usr/bin/top
748 Trying to extract information from a core file generated in a different major
750 version might show an error like this:
751 .Bd -literal -offset indent
752 $ procstat mplayer.core
753 procstat: kinfo_proc structure size mismatch
754 procstat: procstat_getprocs()
761 .Xr cap_rights_limit 2 ,
767 .Xr xo_parse_args 3 ,
777 .An Robert N M Watson Aq Mt rwatson@FreeBSD.org .
783 .Aq Mt allanjude@FreeBSD.org .
786 .Aq Mt juraj@lutter.sk
787 added the pargs, penv and pwdx functionality.
789 The display of open file or memory mapping pathnames is implemented using the
791 If a file system does not use the name cache, or the path to a file is not in
792 the cache, a path will not be displayed.
795 currently supports extracting data only from a live kernel, and not from