1.\" $OpenBSD: pstat.8,v 1.60 2021/10/20 06:35:40 semarie 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: October 20 2021 $ 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 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 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.El 105.It CNT 106Number of processes that know this open file. 107.It MSG 108Number of messages outstanding for this file. 109.It DATA 110The location of the vnode table entry or socket structure for this file. 111.It OFFSET 112The file offset (see 113.Xr lseek 2 ) . 114This information is only visible to the user or superuser. 115.El 116.It Fl k 117Use 1K-byte blocks. 118.It Fl M Ar core 119Extract values associated with the name list from the specified core 120instead of the running kernel. 121.It Fl N Ar system 122Extract the name list from the specified system 123instead of the running kernel. 124.It Fl n 125Print devices by major/minor number rather than by name. 126.It Fl s 127Print information about swap space usage on all the 128swap areas compiled into the kernel. 129The first column is the device name of the partition. 130The next column is the total space available in the partition. 131The 132.Ar Used 133column indicates the total blocks used so far; 134the 135.Ar Available 136column indicates how much space is remaining on each partition. 137The 138.Ar Capacity 139reports the percentage of space used. 140.Pp 141If more than one partition is configured into the system, totals for all 142of the statistics will be reported in the final line of the report. 143.It Fl T 144Prints the number of used and free slots for open files, used vnodes, and swap 145space. 146It is useful for checking to see how large system tables become 147if the system is under heavy load. 148.It Fl t 149Print table for terminals 150with these headings: 151.Bl -tag -width indent 152.It LINE 153Physical device name. 154.It RAW 155Number of characters in raw input queue. 156.It CAN 157Number of characters in canonicalized input queue. 158.It OUT 159Number of characters in output queue. 160.It HWT 161High water mark for output. 162.It LWT 163Low water mark for output. 164.It COL 165Calculated column position of terminal. 166.It STATE 167Miscellaneous state variables encoded thus: 168.Pp 169.Bl -tag -width indent -compact 170.It W 171waiting for open to complete 172.It O 173open 174.It C 175carrier is on 176.It T 177delay timeout in progress 178.It F 179outq has been flushed during DMA 180.It B 181busy doing output 182.It A 183process is awaiting output 184.It X 185open for exclusive use 186.It S 187output stopped 188.It K 189further input blocked 190.It Y 191tty in async I/O mode 192.It D 193next character is escaped lowercase special 194.It E 195printing erase sequence 196.It L 197next character is literal 198.It P 199retyping suspended input 200.It N 201counting tab width, ignoring output flush 202.El 203.It SESS 204Enclosing session. 205.It PGID 206Process group for which this is controlling terminal. 207.It DISC 208Line discipline: 209.Ql term 210for 211TTYDISC (see 212.Xr termios 4 ) , 213.Ql ppp 214for PPPDISC (see 215.Xr ppp 4 ) 216and 217.Ql nmea 218for NMEADISC (see 219.Xr nmea 4 ) . 220.El 221.It Fl v 222Print the active vnodes. 223Each group of vnodes corresponding 224to a particular filesystem is preceded by a two line header. 225The first line consists of the following: 226.Pp 227.No *** MOUNT Em fstype from 228on 229.Em on fsflags 230.Pp 231where 232.Em fstype 233is one of the file systems supported by the kernel; 234.Em from 235is the partition the filesystem is mounted from; 236.Em on 237is the directory 238the filesystem is mounted on; and 239.Em fsflags 240is a list 241of optional flags applied to the mount (see 242.Xr mount 8 ) . 243The second line is a header for the individual fields, 244the first part of which are fixed, and the second part are filesystem 245type specific. 246The headers common to all vnodes are: 247.Bl -tag -width indent 248.It ADDR 249Location of this vnode. 250.It TYP 251File type. 252.It VFLAG 253A list of letters representing vnode flags: 254.Pp 255.Bl -tag -width indent -compact 256.It R 257VROOT root of its file system. 258.It T 259VTEXT pure text prototype. 260.It S 261VSYSTEM vnode being used by kernel. 262.It I 263VISTTY vnode represents a tty. 264.It L 265VXLOCK locked to change underlying type. 266.It W 267VXWANT process is waiting for vnode. 268.It B 269VBWAIT waiting for output to complete. 270.It A 271VALIASED vnode has an alias. 272.It F 273VONFREELIST vnode is on a free list. 274.It l 275VLOCKSWORK FS supports locking discipline. 276.It s 277VONSYNCLIST vnode is on syncer worklist. 278.El 279.It USE 280The number of references to this vnode. 281.It HOLD 282The number of I/O buffers held by this vnode. 283.It FILEID 284The vnode fileid. 285In the case of 286.Em ffs 287this is the inode number. 288.It IFLAG 289Miscellaneous filesystem specific state variables encoded thus: 290.Bl -tag -width indent 291.It "For ffs:" 292.Bl -tag -width indent -compact 293.It A 294access time must be corrected 295.It C 296changed time must be corrected 297.It U 298modification time must be corrected 299.It R 300has a rename in progress 301.It M 302contains modifications 303.It m 304contains lazy modifications 305.It S 306shared lock applied 307.It E 308exclusive lock applied 309.El 310.It "For nfs:" 311.Bl -tag -width indent -compact 312.It W 313waiting for I/O buffer flush to complete 314.It P 315I/O buffers being flushed 316.It M 317locally modified data exists 318.It E 319an earlier write failed 320.It X 321non-cacheable lease (nqnfs) 322.It O 323write lease (nqnfs) 324.It G 325lease was evicted (nqnfs) 326.It A 327special file accessed 328.It U 329special file updated 330.It C 331special file times changed 332.El 333.El 334.It SIZ/RDEV 335Number of bytes in an ordinary file, or 336major and minor device of special file. 337.El 338.Pp 339The 340.Fl v 341option requires the ability to open 342.Pa /dev/kmem 343which may be restricted based upon the value of the 344.Ar kern.allowkmem 345.Xr sysctl 8 . 346.El 347.Sh ENVIRONMENT 348.Bl -tag -width BLOCKSIZE 349.It Ev BLOCKSIZE 350If the environment variable 351.Ev BLOCKSIZE 352is set, and the 353.Fl k 354option is not specified, the block counts will be displayed in units of that 355size block. 356.El 357.Sh SEE ALSO 358.Xr fstat 1 , 359.Xr netstat 1 , 360.Xr procmap 1 , 361.Xr ps 1 , 362.Xr systat 1 , 363.Xr tcpbench 1 , 364.Xr top 1 , 365.Xr stat 2 , 366.Xr printf 3 , 367.Xr fs 5 , 368.Xr iostat 8 , 369.Xr vmstat 8 370.Rs 371.%T UNIX Implementation 372.%A Ken Thompson 373.%J Bell System Technical Journal 374.%V Volume 57 375.%N Number 6 376.%D 1978 377.%P pp. 1931\(en1946 378.Re 379.Sh HISTORY 380The 381.Nm 382command appeared in 383.At v7 . 384.Sh BUGS 385Swap statistics are reported for all swap partitions compiled into the kernel, 386regardless of whether those partitions are being used. 387.Pp 388Does not understand NFS swap servers. 389