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 November 28, 2011 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 ... 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. 50.Pp 51By default, basic process statistics are printed; one of the following 52options may be specified in order to select more detailed process information 53for printing: 54.Bl -tag -width indent 55.It Fl b 56Display binary information for the process. 57.It Fl c 58Display command line arguments for the process. 59.It Fl e 60Display environment variables for the process. 61.It Fl f 62Display file descriptor information for the process. 63.It Fl i 64Display signal pending and disposition information for the process. 65.It Fl j 66Display signal pending and blocked information for the process threads. 67.It Fl k 68Display the stacks of kernel threads in the process, excluding stacks of 69threads currently running on a CPU and threads with stacks swapped to disk. 70If the flag is repeated, function offsets as well as function names are 71printed. 72.It Fl l 73Display resource limits for the process. 74.It Fl s 75Display security credential information for the process. 76.It Fl t 77Display thread information for the process. 78.It Fl v 79Display virtual memory mappings for the process. 80.It Fl x 81Display ELF auxiliary vector for the process. 82.El 83.Pp 84All options generate output in the format of a table, the first field of 85which is the process ID to which the row of information corresponds. 86The 87.Fl h 88flag may be used to suppress table headers. 89.Pp 90The 91.Fl w 92flag may be used to specify a wait interval at which to repeat the printing 93of the requested process information. 94If the 95.Fl w 96flag is not specified, the output will not repeat. 97.Pp 98The 99.Fl C 100flag requests the printing of additional capability information in the file 101descriptor view. 102.Pp 103Some information, such as VM and file descriptor information, is available 104only to the owner of a process or the superuser. 105.Ss Binary Information 106Display the process ID, command, and path to the process binary: 107.Pp 108.Bl -tag -width indent -compact 109.It PID 110process ID 111.It COMM 112command 113.It PATH 114path to process binary (if available) 115.El 116.Ss Command Line Arguments 117Display the process ID, command, and command line arguments: 118.Pp 119.Bl -tag -width indent -compact 120.It PID 121process ID 122.It COMM 123command 124.It ARGS 125command line arguments (if available) 126.El 127.Ss File Descriptors 128Display detailed information about each file descriptor referenced by a 129process, including the process ID, command, file descriptor number, and 130per-file descriptor object information, such as object type and file system 131path. 132By default, the following information will be printed: 133.Pp 134.Bl -tag -width indent -compact 135.It PID 136process ID 137.It COMM 138command 139.It FD 140file descriptor number or cwd/root/jail 141.It T 142file descriptor type 143.It V 144vnode type 145.It FLAGS 146file descriptor flags 147.It REF 148file descriptor reference count 149.It OFFSET 150file descriptor offset 151.It PRO 152network protocol 153.It NAME 154file path or socket addresses (if available) 155.El 156.Pp 157The following file descriptor types may be displayed: 158.Pp 159.Bl -tag -width X -compact 160.It c 161crypto 162.It e 163POSIX semaphore 164.It f 165fifo 166.It h 167shared memory 168.It k 169kqueue 170.It m 171message queue 172.It p 173pipe 174.It s 175socket 176.It t 177pseudo-terminal master 178.It v 179vnode 180.El 181.Pp 182The following vnode types may be displayed: 183.Pp 184.Bl -tag -width X -compact 185.It - 186not a vnode 187.It b 188block device 189.It c 190character device 191.It d 192directory 193.It f 194fifo 195.It l 196symbolic link 197.It r 198regular file 199.It s 200socket 201.It x 202revoked device 203.El 204.Pp 205The following file descriptor flags may be displayed: 206.Pp 207.Bl -tag -width X -compact 208.It r 209read 210.It w 211write 212.It a 213append 214.It s 215async 216.It f 217fsync 218.It n 219non-blocking 220.It d 221direct I/O 222.It l 223lock held 224.It c 225descriptor is a capability 226.El 227.Pp 228If the 229.Fl C 230flag is specified, the vnode type, reference count, and offset fields will be 231omitted, and a new capabilities field will be included listing capabilities, 232as described in 233.Xr cap_new 2 , 234present for each capability descriptor. 235.Ss Signal Disposition Information 236Display signal pending and disposition for a process: 237.Pp 238.Bl -tag -width ident -compact 239.It PID 240process ID 241.It COMM 242command 243.It SIG 244signal name 245.It FLAGS 246process signal disposition details, three symbols 247.Bl -tag -width X -compact 248.It P 249if signal is pending in the global process queue, - otherwise 250.It I 251if signal delivery disposition is SIGIGN, - otherwise 252.It C 253if signal delivery is to catch it, - otherwise 254.El 255.El 256.Pp 257If 258.Fl n 259switch is given, the signal numbers are shown instead of signal names. 260.Ss Thread Signal Information 261Display signal pending and blocked for a process threads: 262.Pp 263.Bl -tag -width ident -compact 264.It PID 265process ID 266.It COMM 267command 268.It TID 269thread ID 270.It SIG 271signal name 272.It FLAGS 273thread signal delivery status, two symbols 274.Bl -tag -width X -compact 275.It P 276if signal is pending for the thread, - otherwise 277.It B 278if signal is blocked in the thread signal mask, - if not blocked 279.El 280.El 281.Pp 282The 283.Fl n 284switch has the same effect as for the 285.Fl i 286switch, the signals numbers are shown instead of signal names. 287.Ss Kernel Thread Stacks 288Display kernel thread stacks for a process, allowing further interpretation 289of thread wait channels. 290If the 291.Fl k 292flag is repeated, function offsets, not just function names, are printed. 293.Pp 294This feature requires 295.Cd "options STACK" 296or 297.Cd "options DDB" 298to be compiled into the kernel. 299.Pp 300.Bl -tag -width indent -compact 301.It PID 302process ID 303.It TID 304thread ID 305.It COMM 306command 307.It TDNAME 308thread name 309.It KSTACK 310kernel thread call stack 311.El 312.Ss Security Credentials 313Display process credential information: 314.Pp 315.Bl -tag -width indent -compact 316.It PID 317process ID 318.It COMM 319command 320.It EUID 321effective user ID 322.It RUID 323real user ID 324.It SVUID 325saved user ID 326.It EGID 327effective group ID 328.It RGID 329real group ID 330.It SVGID 331saved group ID 332.It FLAGS 333credential flags 334.It GROUPS 335group set 336.El 337.Pp 338The following credential flags may be displayed: 339.Pp 340.Bl -tag -width X -compact 341.It C 342capability mode 343.El 344.Ss Thread Information 345Display per-thread information, including process ID, per-thread ID, name, 346CPU, and execution state: 347.Pp 348.Bl -tag -width indent -compact 349.It PID 350process ID 351.It TID 352thread ID 353.It COMM 354command 355.It TDNAME 356thread name 357.It CPU 358current or most recent CPU run on 359.It PRI 360thread priority 361.It STATE 362thread state 363.It WCHAN 364thread wait channel 365.El 366.Ss Virtual Memory Mappings 367Display process virtual memory mappings, including addresses, mapping 368meta-data, and mapped object information: 369.Pp 370.Bl -tag -width indent -compact 371.It PID 372process ID 373.It START 374starting address of mapping 375.It END 376ending address of mapping 377.It PRT 378protection flags 379.It RES 380resident pages 381.It PRES 382private resident pages 383.It REF 384reference count 385.It SHD 386shadow page count 387.It FL 388mapping flags 389.It TP 390VM object type 391.El 392.Pp 393The following protection flags may be displayed: 394.Pp 395.Bl -tag -width X -compact 396.It r 397read 398.It w 399write 400.It x 401execute 402.El 403.Pp 404The following VM object types may be displayed: 405.Pp 406.Bl -tag -width XX -compact 407.It -- 408none 409.It dd 410dead 411.It df 412default 413.It dv 414device 415.It ph 416physical 417.It sw 418swap 419.It vn 420vnode 421.El 422.Pp 423The following mapping flags may be displayed: 424.Pp 425.Bl -tag -width X -compact 426.It C 427copy-on-write 428.It N 429needs copy 430.It S 431one or more superpage mappings are used 432.El 433.Sh EXIT STATUS 434.Ex -std 435.Sh SEE ALSO 436.Xr fstat 1 , 437.Xr ps 1 , 438.Xr sockstat 1 , 439.Xr cap_enter 2 , 440.Xr cap_new 2 , 441.Xr ddb 4 , 442.Xr stack 9 443.Sh AUTHORS 444.An Robert N M Watson 445.Sh BUGS 446Some field values may include spaces, which limits the extent to which the 447output of 448.Nm 449may be mechanically parsed. 450.Pp 451The display of open file or memory mapping pathnames is implemented using the 452kernel's name cache. 453If a file system does not use the name cache, or the path to a file is not in 454the cache, a path will not be displayed. 455.Pp 456.Nm 457currently supports extracting data only from a live kernel, and not from 458kernel crash dumps. 459