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
333 pseudo-terminal master
338 The following vnode types may be displayed:
340 .Bl -tag -width X -compact
361 The following file descriptor flags may be displayed:
363 .Bl -tag -width X -compact
384 flag is specified, the vnode type, reference count, and offset fields will be
385 omitted, and a new capabilities field will be included listing capabilities,
387 .Xr cap_rights_limit 2 ,
388 present for each capability descriptor.
390 The following network protocols may be displayed (grouped by address family):
395 .Bl -tag -width indent -compact
426 .Bl -tag -width indent -compact
439 .Bl -tag -width indent -compact
441 unknown address family.
443 .Ss Signal Disposition Information
444 Display signal pending and disposition for a process:
446 .Bl -tag -width indent -compact
454 process signal disposition details, three symbols
455 .Bl -tag -width X -compact
457 if signal is pending in the global process queue; - otherwise.
459 if signal delivery disposition is
463 if the signal will be caught; - otherwise.
469 switch is given, the signal numbers are shown instead of signal names.
470 .Ss Thread Signal Information
471 Display signal pending and blocked for a process's threads:
473 .Bl -tag -width indent -compact
483 thread signal delivery status, two symbols
484 .Bl -tag -width X -compact
486 if signal is pending for the thread, - otherwise
488 if signal is blocked in the thread signal mask, - if not blocked
494 switch has the same effect as for the
496 switch: the signal numbers are shown instead of signal names.
497 .Ss Kernel Thread Stacks
498 Display kernel thread stacks for a process, allowing further interpretation
499 of thread wait channels.
502 flag is repeated, function offsets, not just function names, are printed.
504 This feature requires
508 to be compiled into the kernel.
510 .Bl -tag -width indent -compact
520 kernel thread call stack
523 Display resource limits for a process:
525 .Bl -tag -width indent -compact
538 Display resource usage for a process.
542 resource usage for individual threads is displayed instead.
544 .Bl -tag -width "RESOURCE" -compact
561 .Ss Security Credentials
562 Display process credential information:
564 .Bl -tag -width indent -compact
582 file creation mode mask
589 The following credential flags may be displayed:
591 .Bl -tag -width X -compact
595 .Ss Thread Information
596 Display per-thread information, including process ID, per-thread ID, name,
597 CPU, and execution state:
599 .Bl -tag -width indent -compact
609 current or most recent CPU run on
617 .Ss Virtual Memory Mappings
618 Display process virtual memory mappings, including addresses, mapping
619 meta-data, and mapped object information:
621 .Bl -tag -width indent -compact
625 starting address of mapping
627 ending address of mapping
633 private resident pages
644 The following protection flags may be displayed:
646 .Bl -tag -width X -compact
655 The following VM object types may be displayed:
657 .Bl -tag -width XX -compact
667 device with managed pages
679 The following mapping flags may be displayed:
681 .Bl -tag -width X -compact
687 one or more superpage mappings are used
689 grows down (top-down stack)
691 grows up (bottom-up stack)
693 pages in this range are locked by
698 .Ss ELF Auxiliary Vector
699 Display ELF auxiliary vector values:
701 .Bl -tag -width indent -compact
707 auxiliary vector name
709 auxiliary vector value
714 Show binary information about the current shell:
715 .Bd -literal -offset indent
718 46620 bash 1201000 /usr/local/bin/bash
721 Same as above but showing information about open file descriptors:
722 .Bd -literal -offset indent
724 PID COMM FD T V FLAGS REF OFFSET PRO NAME
725 46620 bash text v r r------- - - - /usr/local/bin/bash
726 46620 bash ctty v c rw------ - - - /dev/pts/12
727 46620 bash cwd v d r------- - - - /tmp
728 46620 bash root v d r------- - - - /
729 46620 bash 0 v c rw------ 7 372071 - /dev/pts/12
730 46620 bash 1 v c rw------ 7 372071 - /dev/pts/12
731 46620 bash 2 v c rw------ 7 372071 - /dev/pts/12
732 46620 bash 255 v c rw------ 7 372071 - /dev/pts/12
735 Show the arguments used to launch
737 .Bd -literal -offset indent
738 $ procstat arguments 1
743 Extract binary information from a core dump:
744 .Bd -literal -offset indent
745 $ procstat binary core.36642
747 36642 top 1201000 /usr/bin/top
750 Trying to extract information from a core file generated in a different major
752 version might show an error like this:
753 .Bd -literal -offset indent
754 $ procstat mplayer.core
755 procstat: kinfo_proc structure size mismatch
756 procstat: procstat_getprocs()
763 .Xr cap_rights_limit 2 ,
769 .Xr xo_parse_args 3 ,
779 .An Robert N M Watson Aq Mt rwatson@FreeBSD.org .
785 .Aq Mt allanjude@FreeBSD.org .
788 .Aq Mt juraj@lutter.sk
789 added the pargs, penv and pwdx functionality.
791 The display of open file or memory mapping pathnames is implemented using the
793 If a file system does not use the name cache, or the path to a file is not in
794 the cache, a path will not be displayed.
797 currently supports extracting data only from a live kernel, and not from