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 information about advisory locks on files.
149 All three types of locks are listed, BSD-style
158 Note that neither the
162 list can be used to limit the display of the locks, mostly because
163 some types of locks do not have local (or any) owning processes.
165 Print basic process statistics (this is the default).
167 Display binary information for the process.
169 Substring commands are accepted.
170 .It Ar argument(s) | Fl c
171 Display command line arguments for the process.
173 Substring commands are accepted.
174 .It Ar environment | Fl e
175 Display environment variables for the process.
177 Substring commands are accepted.
178 .It Ar file(s) | Ar fd(s) | Fl f
179 Display file descriptor information for the process.
183 subcommand flag is used then additional capability information is printed.
184 .It Ar signal(s) | Fl i
185 Display signal pending and disposition information for the process.
189 subcommand option is used, the signal numbers are shown instead of signal
192 Substring commands are accepted.
193 .It Ar tsignal(s) | Fl j
194 Display signal pending and blocked information for the process's threads.
198 subcommand option is used, the signal numbers are shown instead of signal
201 Substring commands are accepted.
203 Display the stacks of kernel threads in the process, excluding stacks of
204 threads currently running on a CPU and threads with stacks swapped to disk.
208 subcommand option is used (or the command flag is repeated), function
209 offsets as well as function names are printed.
211 Display resource limits for the process.
212 .It Ar ptlwpinfo | Fl L
213 Display LWP info for the process pertaining to its signal driven exit.
215 Display resource usage information for the process.
221 is used then per-thread statistics are printed, rather than per-process
223 The second field in the table will list the thread ID to which the row of
224 information corresponds.
225 .It Ar credential(s) | Fl s
226 Display security credential information for the process.
228 Substring commands are accepted.
229 .It Ar cpuset | Ar cs | Fl S
230 Display the cpuset information for the thread.
231 .It Ar thread(s) | Fl t
232 Display thread information for the process.
234 Display virtual memory mappings for the process.
236 Display ELF auxiliary vector for the process.
238 Display arguments for the process.
240 Display environment variables for the process.
242 Display current working directory for the process.
245 All options generate output in the format of a table, the first field of
246 which is the process ID to which the row of information corresponds.
249 flag may be used to suppress table headers.
253 flag may be used to specify a wait interval at which to repeat the printing
254 of the requested process information.
257 flag is not specified, the output will not repeat.
259 Information for VM, file descriptor, and cpuset options is available
260 only to the owner of a process or the superuser.
261 A cpuset value displayed as -1 means that the information is either invalid
263 .Ss Binary Information
264 Display the process ID, command, and path to the process binary:
266 .Bl -tag -width indent -compact
272 osreldate for process binary
274 path to process binary (if available)
276 .Ss Command Line Arguments
277 Display the process ID, command, and command line arguments:
279 .Bl -tag -width indent -compact
285 command line arguments (if available)
287 .Ss Environment Variables
288 Display the process ID, command, and environment variables:
290 .Bl -tag -width "ENVIRONMENT" -compact
296 environment variables (if available)
299 Display detailed information about each file descriptor referenced by a
300 process, including the process ID, command, file descriptor number, and
301 per-file descriptor object information, such as object type and file system
303 By default, the following information will be printed:
305 .Bl -tag -width indent -compact
311 file descriptor number or cwd/root/jail
317 file descriptor flags
319 file descriptor reference count
321 file descriptor offset
325 file path or socket addresses (if available)
328 The following file descriptor types may be displayed:
330 .Bl -tag -width X -compact
350 pseudo-terminal master
355 The following vnode types may be displayed:
357 .Bl -tag -width X -compact
378 The following file descriptor flags may be displayed:
380 .Bl -tag -width X -compact
401 flag is specified, the vnode type, reference count, and offset fields will be
402 omitted, and a new capabilities field will be included listing capabilities,
404 .Xr cap_rights_limit 2 ,
405 present for each capability descriptor.
407 The following network protocols may be displayed (grouped by address family):
412 .Bl -tag -width indent -compact
439 .Bl -tag -width indent -compact
454 .Bl -tag -width indent -compact
456 .Dv Divert socket; see
460 .Bl -tag -width indent -compact
462 unknown address family.
464 .Ss Signal Disposition Information
465 Display signal pending and disposition for a process:
467 .Bl -tag -width indent -compact
475 process signal disposition details, three symbols
476 .Bl -tag -width X -compact
478 if signal is pending in the global process queue; - otherwise.
480 if signal delivery disposition is
484 if the signal will be caught; - otherwise.
490 switch is given, the signal numbers are shown instead of signal names.
491 .Ss Thread Signal Information
492 Display signal pending and blocked for a process's threads:
494 .Bl -tag -width indent -compact
504 thread signal delivery status, two symbols
505 .Bl -tag -width X -compact
507 if signal is pending for the thread, - otherwise
509 if signal is blocked in the thread signal mask, - if not blocked
515 switch has the same effect as for the
517 switch: the signal numbers are shown instead of signal names.
518 .Ss Kernel Thread Stacks
519 Display kernel thread stacks for a process, allowing further interpretation
520 of thread wait channels.
523 flag is repeated, function offsets, not just function names, are printed.
525 This feature requires
529 to be compiled into the kernel.
531 .Bl -tag -width indent -compact
541 kernel thread call stack
544 Display resource limits for a process:
546 .Bl -tag -width indent -compact
559 Display resource usage for a process.
563 resource usage for individual threads is displayed instead.
565 .Bl -tag -width "RESOURCE" -compact
582 .Ss Security Credentials
583 Display process credential information:
585 .Bl -tag -width indent -compact
603 file creation mode mask
610 The following credential flags may be displayed:
612 .Bl -tag -width X -compact
616 .Ss Thread Information
617 Display per-thread information, including process ID, per-thread ID, name,
618 CPU, and execution state:
620 .Bl -tag -width indent -compact
630 current or most recent CPU run on
638 .Ss Virtual Memory Mappings
639 Display process virtual memory mappings, including addresses, mapping
640 meta-data, and mapped object information:
642 .Bl -tag -width indent -compact
646 starting address of mapping
648 ending address of mapping
654 private resident pages
665 The following protection flags may be displayed:
667 .Bl -tag -width X -compact
676 The following VM object types may be displayed:
678 .Bl -tag -width XX -compact
688 device with managed pages
702 The following mapping flags may be displayed:
704 .Bl -tag -width X -compact
710 one or more superpage mappings are used
712 grows down (top-down stack)
714 grows up (bottom-up stack)
716 pages in this range are locked by
721 .Ss ELF Auxiliary Vector
722 Display ELF auxiliary vector values:
724 .Bl -tag -width indent -compact
730 auxiliary vector name
732 auxiliary vector value
734 .Ss Advisory Lock Information
735 .Bl -tag -width indent -compact
743 Type of the lock, one of
753 Process id of the owner, for
757 Remote system id if applicable
759 File system id where the locked file resize
761 rdev for the file system
763 Unique file identifier (inode number) of the locked file
766 Start offset of the locked range
768 Length of the locked range.
771 If available, the path of the locked file
776 Show binary information about the current shell:
777 .Bd -literal -offset indent
780 46620 bash 1201000 /usr/local/bin/bash
783 Same as above but showing information about open file descriptors:
784 .Bd -literal -offset indent
786 PID COMM FD T V FLAGS REF OFFSET PRO NAME
787 46620 bash text v r r------- - - - /usr/local/bin/bash
788 46620 bash ctty v c rw------ - - - /dev/pts/12
789 46620 bash cwd v d r------- - - - /tmp
790 46620 bash root v d r------- - - - /
791 46620 bash 0 v c rw------ 7 372071 - /dev/pts/12
792 46620 bash 1 v c rw------ 7 372071 - /dev/pts/12
793 46620 bash 2 v c rw------ 7 372071 - /dev/pts/12
794 46620 bash 255 v c rw------ 7 372071 - /dev/pts/12
797 Show the arguments used to launch
799 .Bd -literal -offset indent
800 $ procstat arguments 1
805 Extract binary information from a core dump:
806 .Bd -literal -offset indent
807 $ procstat binary core.36642
809 36642 top 1201000 /usr/bin/top
812 Trying to extract information from a core file generated in a different major
814 version might show an error like this:
815 .Bd -literal -offset indent
816 $ procstat mplayer.core
817 procstat: kinfo_proc structure size mismatch
818 procstat: procstat_getprocs()
825 .Xr cap_rights_limit 2 ,
831 .Xr xo_parse_args 3 ,
841 .An Robert N M Watson Aq Mt rwatson@FreeBSD.org .
847 .Aq Mt allanjude@FreeBSD.org .
850 .Aq Mt juraj@lutter.sk
851 added the pargs, penv and pwdx functionality.
853 The display of open file or memory mapping pathnames is implemented using the
855 If a file system does not use the name cache, or the path to a file is not in
856 the cache, a path will not be displayed.
859 currently supports extracting data only from a live kernel, and not from