1.\" $OpenBSD: pstat.8,v 1.51 2016/09/25 15:23:37 deraadt Exp $ 2.\" $NetBSD: pstat.8,v 1.9.4.1 1996/06/02 09:08:17 mrg Exp $ 3.\" 4.\" Copyright (c) 1980, 1991, 1993, 1994 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. Neither the name of the University nor the names of its contributors 16.\" may be used to endorse or promote products derived from this software 17.\" without specific prior written permission. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" from: @(#)pstat.8 8.4 (Berkeley) 4/19/94 32.\" 33.Dd $Mdocdate: September 25 2016 $ 34.Dt PSTAT 8 35.Os 36.Sh NAME 37.Nm pstat 38.Nd display system data structures 39.Sh SYNOPSIS 40.Nm pstat 41.Op Fl fknsTtv 42.Op Fl M Ar core 43.Op Fl N Ar system 44.Op Fl d Ar format Ar symbol ... 45.Sh DESCRIPTION 46.Nm 47displays open file entry, swap space utilization, 48terminal state, and vnode data structure information. 49If 50.Ar core 51is given, the information is sought there, otherwise 52in the running kernel via 53.Pa /dev/kmem . 54The required namelist is taken from the running kernel unless 55.Ar system 56is specified. 57.Pp 58The options are as follows: 59.Bl -tag -width Ds 60.It Fl d Ar format Ar symbol ... 61Print the values of 62.Ar symbol 63using the specified format. 64.Ar format 65is a 66.Xr printf 3 Ns -style 67format, without the leading percent or precision specifiers, 68such as 69.Ar s , 70.Ar p , 71or 72.Ar llx . 73Symbol names are read from the remaining command line arguments. 74Addresses may also be specified in hex. 75.Pp 76The 77.Fl d 78option requires the ability to open 79.Pa /dev/kmem 80which may be restricted based upon the value of the 81.Ar kern.allowkmem 82.Xr sysctl 8 . 83.It Fl f 84Print the open file table with these headings: 85.Bl -tag -width indent 86.It LOC 87The core location of this table entry. 88.It TYPE 89The type of object the file table entry points to. 90.It FLG 91Miscellaneous state variables encoded thus: 92.Pp 93.Bl -tag -width indent -compact 94.It R 95open for reading 96.It W 97open for writing 98.It A 99open for appending 100.It L 101exclusive or shared lock present 102.It I 103signal pgrp when data ready 104.It l 105file descriptor slot is larval 106.El 107.It CNT 108Number of processes that know this open file. 109.It MSG 110Number of messages outstanding for this file. 111.It DATA 112The location of the vnode table entry or socket structure for this file. 113.It OFFSET 114The file offset (see 115.Xr lseek 2 ) . 116This information is only visible to the user or superuser. 117.El 118.It Fl k 119Use 1K-byte blocks. 120.It Fl M Ar core 121Extract values associated with the name list from the specified core 122instead of the running kernel. 123.It Fl N Ar system 124Extract the name list from the specified system 125instead of the running kernel. 126.It Fl n 127Print devices by major/minor number rather than by name. 128.It Fl s 129Print information about swap space usage on all the 130swap areas compiled into the kernel. 131The first column is the device name of the partition. 132The next column is the total space available in the partition. 133The 134.Ar Used 135column indicates the total blocks used so far; 136the 137.Ar Available 138column indicates how much space is remaining on each partition. 139The 140.Ar Capacity 141reports the percentage of space used. 142.Pp 143If more than one partition is configured into the system, totals for all 144of the statistics will be reported in the final line of the report. 145.It Fl T 146Prints the number of used and free slots for open files, used vnodes, and swap 147space. 148It is useful for checking to see how large system tables become 149if the system is under heavy load. 150.It Fl t 151Print table for terminals 152with these headings: 153.Bl -tag -width indent 154.It LINE 155Physical device name. 156.It RAW 157Number of characters in raw input queue. 158.It CAN 159Number of characters in canonicalized input queue. 160.It OUT 161Number of characters in output queue. 162.It HWT 163High water mark for output. 164.It LWT 165Low water mark for output. 166.It COL 167Calculated column position of terminal. 168.It STATE 169Miscellaneous state variables encoded thus: 170.Pp 171.Bl -tag -width indent -compact 172.It W 173waiting for open to complete 174.It O 175open 176.It C 177carrier is on 178.It T 179delay timeout in progress 180.It F 181outq has been flushed during DMA 182.It B 183busy doing output 184.It A 185process is awaiting output 186.It X 187open for exclusive use 188.It S 189output stopped 190.It K 191further input blocked 192.It Y 193tty in async I/O mode 194.It D 195next character is escaped lowercase special 196.It E 197printing erase sequence 198.It L 199next character is literal 200.It P 201retyping suspended input 202.It N 203counting tab width, ignoring output flush 204.El 205.It SESS 206Enclosing session. 207.It PGID 208Process group for which this is controlling terminal. 209.It DISC 210Line discipline: 211.Ql term 212for 213TTYDISC (see 214.Xr termios 4 ) , 215.Ql slip 216for SLIPDISC , 217.Ql ppp 218for PPPDISC (see 219.Xr ppp 4 ) , 220.Ql strip 221for STRIPDISC, 222.\" (see 223.\" .Xr strip 4 ) . 224and 225.Ql nmea 226for NMEADISC (see 227.Xr nmea 4 ) . 228.El 229.It Fl v 230Print the active vnodes. 231Each group of vnodes corresponding 232to a particular filesystem is preceded by a two line header. 233The first line consists of the following: 234.Pp 235.No *** MOUNT Em fstype from 236on 237.Em on fsflags 238.Pp 239where 240.Em fstype 241is one of the file systems supported by the kernel; 242.Em from 243is the partition the filesystem is mounted from; 244.Em on 245is the directory 246the filesystem is mounted on; and 247.Em fsflags 248is a list 249of optional flags applied to the mount (see 250.Xr mount 8 ) . 251The second line is a header for the individual fields, 252the first part of which are fixed, and the second part are filesystem 253type specific. 254The headers common to all vnodes are: 255.Bl -tag -width indent 256.It ADDR 257Location of this vnode. 258.It TYP 259File type. 260.It VFLAG 261A list of letters representing vnode flags: 262.Pp 263.Bl -tag -width indent -compact 264.It R 265VROOT root of its file system. 266.It T 267VTEXT pure text prototype. 268.It S 269VSYSTEM vnode being used by kernel. 270.It I 271VISTTY vnode represents a tty. 272.It L 273VXLOCK locked to change underlying type. 274.It W 275VXWANT process is waiting for vnode. 276.It B 277VBWAIT waiting for output to complete. 278.It A 279VALIASED vnode has an alias. 280.It F 281VONFREELIST vnode is on a free list. 282.It l 283VLOCKSWORK FS supports locking discipline. 284.It s 285VONSYNCLIST vnode is on syncer worklist. 286.El 287.It USE 288The number of references to this vnode. 289.It HOLD 290The number of I/O buffers held by this vnode. 291.It FILEID 292The vnode fileid. 293In the case of 294.Em ffs 295this is the inode number. 296.It IFLAG 297Miscellaneous filesystem specific state variables encoded thus: 298.Bl -tag -width indent 299.It "For ffs:" 300.Bl -tag -width indent -compact 301.It A 302access time must be corrected 303.It C 304changed time must be corrected 305.It U 306modification time must be corrected 307.It R 308has a rename in progress 309.It M 310contains modifications 311.It m 312contains lazy modifications 313.It S 314shared lock applied 315.It E 316exclusive lock applied 317.El 318.It "For nfs:" 319.Bl -tag -width indent -compact 320.It W 321waiting for I/O buffer flush to complete 322.It P 323I/O buffers being flushed 324.It M 325locally modified data exists 326.It E 327an earlier write failed 328.It X 329non-cacheable lease (nqnfs) 330.It O 331write lease (nqnfs) 332.It G 333lease was evicted (nqnfs) 334.It A 335special file accessed 336.It U 337special file updated 338.It C 339special file times changed 340.El 341.El 342.It SIZ/RDEV 343Number of bytes in an ordinary file, or 344major and minor device of special file. 345.El 346.Pp 347The 348.Fl v 349option requires the ability to open 350.Pa /dev/kmem 351which may be restricted based upon the value of the 352.Ar kern.allowkmem 353.Xr sysctl 8 . 354.El 355.Sh ENVIRONMENT 356.Bl -tag -width BLOCKSIZE 357.It Ev BLOCKSIZE 358If the environment variable 359.Ev BLOCKSIZE 360is set, and the 361.Fl k 362option is not specified, the block counts will be displayed in units of that 363size block. 364.El 365.Sh SEE ALSO 366.Xr fstat 1 , 367.Xr netstat 1 , 368.Xr procmap 1 , 369.Xr ps 1 , 370.Xr systat 1 , 371.Xr tcpbench 1 , 372.Xr top 1 , 373.Xr stat 2 , 374.Xr printf 3 , 375.Xr fs 5 , 376.Xr iostat 8 , 377.Xr vmstat 8 378.Rs 379.%T UNIX Implementation 380.%A Ken Thompson 381.%J Bell System Technical Journal 382.%V Volume 57 383.%N Number 6 384.%D 1978 385.%P 1931\(en1946 386.Re 387.Sh HISTORY 388The 389.Nm 390command appeared in 391.Bx 4.0 . 392.Sh BUGS 393Swap statistics are reported for all swap partitions compiled into the kernel, 394regardless of whether those partitions are being used. 395.Pp 396Does not understand NFS swap servers. 397