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