1.\"- 2.\" Copyright (c) 2007-2008 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 April 19, 2008 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 w Ar interval 38.Op Fl b | c | f | k | s | t | v 39.Op Fl a | Ar pid ... 40.Sh DESCRIPTION 41The 42.Nm 43utility displays detailed information about the processes identified by the 44.Ar pid 45arguments, or if the 46.Fl a 47flag is used, all processes. 48.Pp 49By default, basic process statistics are printed; one of the following 50options may be specified in order to select more detailed process information 51for printing: 52.Bl -tag -width indent 53.It Fl b 54Display binary information for the process. 55.It Fl c 56Display command line arguments for the process. 57.It Fl f 58Display file descriptor information for the process. 59.It Fl k 60Display the stacks of kernel threads in the process, excluding stacks of 61threads currently running on a CPU and threads with stacks swapped to disk. 62If the flag is repeated, function offsets as well as function names are 63printed. 64.It Fl s 65Display security credential information for the process. 66.It Fl t 67Display thread information for the process. 68.It Fl v 69Display virtual memory mappings for the process. 70.El 71.Pp 72All options generate output in the format of a table, the first field of 73which is the process ID to which the row of information corresponds. 74The 75.Fl h 76flag may be used to suppress table headers. 77.Pp 78The 79.Fl w 80flag may be used to specify a wait interval at which to repeat the printing 81of the requested process information. 82If the 83.Fl w 84flag is not specified, the output will not repeat. 85.Pp 86Some information, such as VM and file descriptor information, is available 87only to the owner of a process or the superuser. 88.Ss Binary Information 89Display the process ID, command, and path to the process binary: 90.Pp 91.Bl -tag -width indent -compact 92.It PID 93process ID 94.It COMM 95command 96.It PATH 97path to process binary (if available) 98.El 99.Ss Command Line Arguments 100Display the process ID, command, and command line arguments: 101.Pp 102.Bl -tag -width indent -compact 103.It PID 104process ID 105.It COMM 106command 107.It ARGS 108command line arguments (if available) 109.El 110.Ss File Descriptors 111Display detailed information about each file descriptor referenced by a 112process, including the process ID, command, file descriptor number, and 113per-file descriptor object information, such as object type and file system 114path: 115.Pp 116.Bl -tag -width indent -compact 117.It PID 118process ID 119.It COMM 120command 121.It FD 122file descriptor number or cwd/root/jail 123.It T 124file descriptor type 125.It V 126vnode type 127.It FLAGS 128file descriptor flags 129.It REF 130file descriptor reference count 131.It OFFSET 132file descriptor offset 133.It PRO 134network protocol 135.It NAME 136file path or socket addresses (if available) 137.El 138.Pp 139The following file descriptor types may be displayed: 140.Pp 141.Bl -tag -width X -compact 142.It c 143crypto 144.It f 145fifo 146.It h 147shared memory 148.It k 149kqueue 150.It m 151messsage queue 152.It p 153pipe 154.It s 155socket 156.It v 157vnode 158.El 159.Pp 160The following vnode types may be displayed: 161.Pp 162.Bl -tag -width X -compact 163.It - 164not a vnode 165.It b 166block device 167.It c 168character device 169.It f 170fifo 171.It l 172symbolic link 173.It s 174socket 175.It x 176revoked device 177.El 178.Pp 179The following file descriptor flags may be displayed: 180.Pp 181.Bl -tag -width X -compact 182.It r 183read 184.It w 185write 186.It a 187append 188.It s 189async 190.It f 191fsync 192.It n 193non-blocking 194.It d 195direct I/O 196.It l 197lock held 198.El 199.Ss Kernel Thread Stacks 200Display kernel thread stacks for a process, allowing further interpretation 201of thread wait channels. 202If the 203.Fl k 204flag is reeated, function offsets, not just function names, are printed. 205.Pp 206This feature requires 207.Cd "options STACK" 208or 209.Cd "options DDB" 210to be compiled into the kernel. 211.Pp 212.Bl -tag -width indent -compact 213.It PID 214process ID 215.It TID 216thread ID 217.It COMM 218command 219.It TDNAME 220thread name 221.It KSTACK 222kernel thread call stack 223.El 224.Ss Security Credentials 225Display process credential information: 226.Pp 227.Bl -tag -width indent -compact 228.It PID 229process ID 230.It COMM 231command 232.It EUID 233effective user ID 234.It RUID 235real user ID 236.It SVUID 237saved user ID 238.It EGID 239effective group ID 240.It RGID 241real group ID 242.It SVGID 243saved group ID 244.It GROUPS 245group set 246.El 247.Ss Thread Information 248Display per-thread information, including process ID, per-thread ID, name, 249CPU, and execution state: 250.Pp 251.Bl -tag -width indent -compact 252.It PID 253process ID 254.It TID 255thread ID 256.It COMM 257command 258.It TDNAME 259thread name 260.It CPU 261current or most recent CPU run on 262.It PRI 263thread priority 264.It STATE 265thread state 266.It WCHAN 267thread wait channel 268.El 269.Ss Virtual Memory Mappings 270Display process virtual memory mappings, including addresses, mapping 271meta-data, and mapped object information: 272.Pp 273.Bl -tag -width indent -compact 274.It PID 275process ID 276.It START 277starting address of mapping 278.It END 279ending address of mapping 280.It PRT 281protection flags 282.It RES 283resident pages 284.It PRES 285private resident pages 286.It REF 287reference count 288.It SHD 289shadow page count 290.It FL 291mapping flags 292.It TP 293VM object type 294.El 295.Pp 296The following protection flags may be displayed: 297.Pp 298.Bl -tag -width X -compact 299.It r 300read 301.It w 302write 303.It x 304execute 305.El 306.Pp 307The following VM object types may be displayed: 308.Pp 309.Bl -tag -width XX -compact 310.It -- 311none 312.It dd 313dead 314.It df 315default 316.It dv 317device 318.It ph 319physical 320.It sw 321swap 322.It vn 323vnode 324.El 325.Pp 326The following mapping flags may be displayed: 327.Pp 328.Bl -tag -width X -compact 329.It C 330copy-on-write 331.It N 332needs copy 333.El 334.Sh EXIT STATUS 335.Ex -std 336.Sh SEE ALSO 337.Xr fstat 1 , 338.Xr ps 1 , 339.Xr sockstat 1 , 340.Xr ddb 4 , 341.Xr stack 9 342.Sh AUTHORS 343.An Robert N M Watson 344.Sh BUGS 345Some field values may include spaces, which limits the extent to which the 346output of 347.Nm 348may be mechanically parsed. 349.Pp 350The display of open file or memory mapping pathnames is implemented using the 351kernel's name cache. 352It therefore does not work for file systems 353that do not use the name cache, such as 354.Xr devfs 4 , 355or if the name is not present in the cache due to removal. 356.Pp 357.Nm 358currently supports extracting data only from a live kernel, and not from 359kernel crash dumps. 360