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
31 .Nd get detailed process information
40 .Op Ar pid ... | Ar core ...
71 .Op Ar pid ... | Ar core ...
114 utility displays detailed information about the processes identified by the
118 flag is used, all processes.
119 It can also display information extracted from a process core file, if
120 the core file is specified as the argument.
127 utilities display the arguments, environment, and current working directory,
128 respectively of the process specified by
131 They mimic the behavior of Solaris utilities of the same names.
135 flag is specified the output is generated via
137 in a selection of different human and machine readable formats.
140 for details on command line arguments.
142 The following commands are available for
144 .Bl -tag -width indent
146 Print information about advisory locks on files.
147 All three types of locks are listed, BSD-style
156 Note that neither the
160 list can be used to limit the display of the locks, mostly because
161 some types of locks do not have local (or any) owning processes.
163 Print basic process statistics (this is the default).
165 Display binary information for the process.
167 Substring commands are accepted.
168 .It Ar argument(s) | Fl c
169 Display command line arguments for the process.
171 Substring commands are accepted.
172 .It Ar environment | Fl e
173 Display environment variables for the process.
175 Substring commands are accepted.
176 .It Ar file(s) | Ar fd(s) | Fl f
177 Display file descriptor information for the process.
181 subcommand flag is used then additional capability information is printed.
182 .It Ar signal(s) | Fl i
183 Display signal pending and disposition information for the process.
187 subcommand option is used, the signal numbers are shown instead of signal
190 Substring commands are accepted.
191 .It Ar tsignal(s) | Fl j
192 Display signal pending and blocked information for the process's threads.
196 subcommand option is used, the signal numbers are shown instead of signal
199 Substring commands are accepted.
201 Display the stacks of kernel threads in the process, excluding stacks of
202 threads currently running on a CPU and threads with stacks swapped to disk.
206 subcommand option is used (or the command flag is repeated), function
207 offsets as well as function names are printed.
209 Display resource limits for the process.
210 .It Ar ptlwpinfo | Fl L
211 Display LWP info for the process pertaining to its signal driven exit.
213 Display resource usage information for the process.
219 is used then per-thread statistics are printed, rather than per-process
221 The second field in the table will list the thread ID to which the row of
222 information corresponds.
223 .It Ar credential(s) | Fl s
224 Display security credential information for the process.
226 Substring commands are accepted.
227 .It Ar cpuset | Ar cs | Fl S
228 Display the cpuset information for the thread.
229 .It Ar thread(s) | Fl t
230 Display thread information for the process.
232 Display virtual memory mappings for the process.
234 Display ELF auxiliary vector for the process.
236 Display arguments for the process.
238 Display environment variables for the process.
240 Display current working directory for the process.
243 All options generate output in the format of a table, the first field of
244 which is the process ID to which the row of information corresponds.
247 flag may be used to suppress table headers.
251 flag may be used to specify a wait interval at which to repeat the printing
252 of the requested process information.
255 flag is not specified, the output will not repeat.
257 Information for VM, file descriptor, and cpuset options is available
258 only to the owner of a process or the superuser.
259 A cpuset value displayed as -1 means that the information is either invalid
261 .Ss Binary Information
262 Display the process ID, command, and path to the process binary:
264 .Bl -tag -width indent -compact
270 osreldate for process binary
272 path to process binary (if available)
274 .Ss Command Line Arguments
275 Display the process ID, command, and command line arguments:
277 .Bl -tag -width indent -compact
283 command line arguments (if available)
285 .Ss Environment Variables
286 Display the process ID, command, and environment variables:
288 .Bl -tag -width "ENVIRONMENT" -compact
294 environment variables (if available)
297 Display detailed information about each file descriptor referenced by a
298 process, including the process ID, command, file descriptor number, and
299 per-file descriptor object information, such as object type and file system
301 By default, the following information will be printed:
303 .Bl -tag -width indent -compact
309 file descriptor number or cwd/root/jail
315 file descriptor flags
317 file descriptor reference count
319 file descriptor offset
323 file path or socket addresses (if available)
326 The following file descriptor types may be displayed:
328 .Bl -tag -width X -compact
348 pseudo-terminal master
353 The following vnode types may be displayed:
355 .Bl -tag -width X -compact
376 The following file descriptor flags may be displayed:
378 .Bl -tag -width X -compact
399 flag is specified, the vnode type, reference count, and offset fields will be
400 omitted, and a new capabilities field will be included listing capabilities,
402 .Xr cap_rights_limit 2 ,
403 present for each capability descriptor.
405 The following network protocols may be displayed (grouped by address family):
410 .Bl -tag -width indent -compact
437 .Bl -tag -width indent -compact
452 .Bl -tag -width indent -compact
454 .Dv Divert socket; see
458 .Bl -tag -width indent -compact
460 unknown address family.
462 .Ss Signal Disposition Information
463 Display signal pending and disposition for a process:
465 .Bl -tag -width indent -compact
473 process signal disposition details, three symbols
474 .Bl -tag -width X -compact
476 if signal is pending in the global process queue; - otherwise.
478 if signal delivery disposition is
482 if the signal will be caught; - otherwise.
488 switch is given, the signal numbers are shown instead of signal names.
489 .Ss Thread Signal Information
490 Display signal pending and blocked for a process's threads:
492 .Bl -tag -width indent -compact
502 thread signal delivery status, two symbols
503 .Bl -tag -width X -compact
505 if signal is pending for the thread, - otherwise
507 if signal is blocked in the thread signal mask, - if not blocked
513 switch has the same effect as for the
515 switch: the signal numbers are shown instead of signal names.
516 .Ss Kernel Thread Stacks
517 Display kernel thread stacks for a process, allowing further interpretation
518 of thread wait channels.
521 flag is repeated, function offsets, not just function names, are printed.
523 This feature requires
527 to be compiled into the kernel.
529 .Bl -tag -width indent -compact
539 kernel thread call stack
542 Display resource limits for a process:
544 .Bl -tag -width indent -compact
557 Display resource usage for a process.
561 resource usage for individual threads is displayed instead.
563 .Bl -tag -width "RESOURCE" -compact
580 .Ss Security Credentials
581 Display process credential information:
583 .Bl -tag -width indent -compact
601 file creation mode mask
608 The following credential flags may be displayed:
610 .Bl -tag -width X -compact
614 .Ss Thread Information
615 Display per-thread information, including process ID, per-thread ID, name,
616 CPU, and execution state:
618 .Bl -tag -width indent -compact
628 current or most recent CPU run on
636 .Ss Virtual Memory Mappings
637 Display process virtual memory mappings, including addresses, mapping
638 meta-data, and mapped object information:
640 .Bl -tag -width indent -compact
644 starting address of mapping
646 ending address of mapping
652 private resident pages
663 The following protection flags may be displayed:
665 .Bl -tag -width X -compact
674 The following VM object types may be displayed:
676 .Bl -tag -width XX -compact
686 device with managed pages
700 The following mapping flags may be displayed:
702 .Bl -tag -width X -compact
708 one or more superpage mappings are used
710 grows down (top-down stack)
712 grows up (bottom-up stack)
714 pages in this range are locked by
719 .Ss ELF Auxiliary Vector
720 Display ELF auxiliary vector values:
722 .Bl -tag -width indent -compact
728 auxiliary vector name
730 auxiliary vector value
732 .Ss Advisory Lock Information
733 .Bl -tag -width indent -compact
741 Type of the lock, one of
751 Process id of the owner, for
755 Remote system id if applicable
757 File system id where the locked file resize
759 rdev for the file system
761 Unique file identifier (inode number) of the locked file
764 Start offset of the locked range
766 Length of the locked range.
769 If available, the path of the locked file
774 Show binary information about the current shell:
775 .Bd -literal -offset indent
778 46620 bash 1201000 /usr/local/bin/bash
781 Same as above but showing information about open file descriptors:
782 .Bd -literal -offset indent
784 PID COMM FD T V FLAGS REF OFFSET PRO NAME
785 46620 bash text v r r------- - - - /usr/local/bin/bash
786 46620 bash ctty v c rw------ - - - /dev/pts/12
787 46620 bash cwd v d r------- - - - /tmp
788 46620 bash root v d r------- - - - /
789 46620 bash 0 v c rw------ 7 372071 - /dev/pts/12
790 46620 bash 1 v c rw------ 7 372071 - /dev/pts/12
791 46620 bash 2 v c rw------ 7 372071 - /dev/pts/12
792 46620 bash 255 v c rw------ 7 372071 - /dev/pts/12
795 Show the arguments used to launch
797 .Bd -literal -offset indent
798 $ procstat arguments 1
803 Extract binary information from a core dump:
804 .Bd -literal -offset indent
805 $ procstat binary core.36642
807 36642 top 1201000 /usr/bin/top
810 Trying to extract information from a core file generated in a different major
812 version might show an error like this:
813 .Bd -literal -offset indent
814 $ procstat mplayer.core
815 procstat: kinfo_proc structure size mismatch
816 procstat: procstat_getprocs()
823 .Xr cap_rights_limit 2 ,
829 .Xr xo_parse_args 3 ,
839 .An Robert N M Watson Aq Mt rwatson@FreeBSD.org .
845 .Aq Mt allanjude@FreeBSD.org .
848 .Aq Mt juraj@lutter.sk
849 added the pargs, penv and pwdx functionality.
851 The display of open file or memory mapping pathnames is implemented using the
853 If a file system does not use the name cache, or the path to a file is not in
854 the cache, a path will not be displayed.
857 currently supports extracting data only from a live kernel, and not from