1.\" $NetBSD: pstat.8,v 1.44 2019/12/12 05:00:33 wiz Exp $ 2.\" 3.\" Copyright (c) 1980, 1991, 1993, 1994 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" from: @(#)pstat.8 8.5 (Berkeley) 5/13/94 31.\" 32.Dd December 11, 2019 33.Dt PSTAT 8 34.Os 35.Sh NAME 36.Nm pstat 37.Nd display system data structures 38.Sh SYNOPSIS 39.Nm 40.Oo 41.Fl T | Fl f | Fl s | 42.Fl t | Fl v 43.Oc 44.Op Fl ghkmn 45.Op Fl M Ar core 46.Op Fl N Ar system 47.Sh DESCRIPTION 48.Nm 49displays open file entry, swap space utilization, 50terminal state, and vnode data structures. 51If 52.Ar corefile 53is given, the information is sought there, otherwise 54in 55.Pa /dev/kmem . 56The required namelist is taken from 57.Pa /netbsd 58unless 59.Ar system 60is specified. 61.Pp 62The following options are available: 63.Bl -tag -width Ds 64.It Fl T 65Prints the number of used and free slots for open files, used vnodes, and swap 66space. 67This option is useful for checking to see how large system tables 68become if the system is under heavy load. 69.It Fl f 70Print the open file table with these headings: 71.Bl -tag -width indent 72.It LOC 73The core location of this table entry. 74.It TYPE 75The type of object the file table entry points to. 76.It FLG 77Miscellaneous state variables encoded thus: 78.Pp 79.Bl -tag -width indent -compact 80.It R 81open for reading 82.It W 83open for writing 84.It A 85open for appending 86.It S 87shared lock present 88.It X 89exclusive lock present 90.It I 91signal pgrp when data ready 92.El 93.It CNT 94Number of processes that know this open file. 95.It MSG 96Number of messages outstanding for this file. 97.It DATA 98The location of the vnode table entry or socket structure for this file. 99.It USE 100Number of active users of this open file. 101.It IFLG 102Value of internal flags. 103.It OFFSET 104The file offset (see 105.Xr lseek 2 ) . 106.El 107.It Fl g 108The 109.Fl g 110option uses (1024 * 1024 * 1024) byte blocks instead of the default 512 byte. 111.It Fl h 112Use 113.Xr humanize_number 3 114to display (swap) sizes. 115.It Fl k 116Use 1K-byte blocks. 117.It Fl m 118The 119.Fl m 120option uses (1024 * 1024) byte blocks instead of the default 512 byte. 121.It Fl n 122Print devices by major/minor number rather than by name. 123.It Fl s 124Print information about swap space usage on all the 125swap areas compiled into the kernel. 126The first column is the device name of the partition. 127The next column is the total space available in the partition. 128The 129.Ar Used 130column indicates the total blocks used so far; the 131.Ar Available 132column indicates how much space is remaining on each partition. 133The 134.Ar Capacity 135reports the percentage of space used. 136.Pp 137If more than one partition is configured into the system, totals for all 138of the statistics will be reported in the final line of the report. 139.It Fl t 140Print table for terminals 141with these headings: 142.Bl -tag -width indent 143.It LINE 144Physical device name. 145.It RAW 146Number of characters in raw input queue. 147.It CAN 148Number of characters in canonicalized input queue. 149.It OUT 150Number of characters in output queue. 151.It HWT 152High water mark for output. 153.It LWT 154Low water mark for output. 155.It COL 156Calculated column position of terminal. 157.It STATE 158Miscellaneous state variables encoded thus: 159.Pp 160.Bl -tag -width indent -compact 161.It T 162delay timeout in progress 163.\" .It W 164.\" waiting for open to complete 165.It O 166open 167.It F 168outq has been flushed during DMA 169.It C 170carrier is on 171.It B 172busy doing output 173.It A 174process is awaiting output 175.It X 176open for exclusive use 177.It S 178output stopped 179.It K 180further input blocked 181.It Y 182tty in async I/O mode 183.It D 184state for lowercase 185.Ql \e 186work 187.It E 188within a 189.Ql \e.../ 190for PRTRUB 191.It L 192next character is literal 193.It P 194retyping suspended input 195.Pq PENDIN 196.It N 197counting tab width, ignore FLUSHO 198.It \&> 199tty used for dialout 200.El 201.It SESS 202Session for which this is controlling terminal. 203.It PGID 204Current foreground process group associated with this terminal. 205.It DISC 206Line discipline; 207.Ql term 208for 209TTYDISC (see 210.Xr termios 4 ) , 211.Ql tab 212for TABLDISC , 213.\" (see 214.\".Xr tb 4 ) , 215.Ql slip 216for SLIPDISC (see 217.Xr sl 4 ) , 218.Ql ppp 219for PPPDISC (see 220.Xr ppp 4 ) , 221.Ql strip 222for STRIPDISC (see 223.Xr strip 4 ) , 224.Ql hdlc 225for HDLCDISC. 226.El 227.It Fl v 228Print the active vnodes. 229Each group of vnodes corresponding to a particular filesystem is preceded 230by a two line header. 231The first line consists of the following: 232.Pp 233.No *** MOUNT Em fstype from Li on Em on fsflags 234.Pp 235where 236.Em fstype 237is one of 238.Em adosfs , afs , cd9660 , fdesc , 239.Em ffs , ext2fs , kernfs , lfs , lofs , 240.Em mfs , msdos , nfs , null , 241.Em procfs , umap , union ; 242.Em from 243is the filesystem 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 265VV_ROOT root of its file system. 266.It T 267VI_TEXT pure text prototype. 268.It S 269VV_SYSTEM vnode being used by kernel. 270.It I 271VV_ISTTY vnode is a tty. 272.It E 273VI_EXECMAP vnode has PROT_EXEC mappings. 274.It D 275VU_DIROP lfs vnode involved in directory op. 276.It O 277VI_ONWORKLST vnode is on syncer work-list. 278.It M 279VV_MPSAFE file system is multithreaded 280.El 281.It USE 282The number of references to this vnode. 283.It HOLD 284The number of I/O buffers held by this vnode. 285.It TAG 286The type of underlying data. 287.It NPAGE 288The number of pages in this vnode. 289.It FILEID 290The vnode fileid. 291In the case of 292.Em ffs 293or 294.Em ext2fs 295this is the inode number. 296.It IFLAG 297Miscellaneous filesystem specific state variables encoded thus: 298.Bl -tag -width indent 299.It "For ffs, lfs or ext2fs:" 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 306update time 307.Pq Xr fs 5 308must be corrected 309.It M 310contains modifications 311.It a 312has been accessed 313.It R 314has a rename in progress 315.It S 316shared lock applied 317.It E 318exclusive lock applied 319.It c 320is being cleaned (LFS) 321.It D 322directory operation in progress (LFS) 323.It s 324blocks to be freed in free count 325.El 326.It "For nfs:" 327.Bl -tag -width indent -compact 328.It W 329waiting for I/O buffer flush to complete 330.It P 331I/O buffers being flushed 332.It M 333locally modified data exists 334.It E 335an earlier write failed 336.It A 337special file accessed 338.It U 339special file updated 340.It C 341special file times changed 342.El 343.El 344.It SIZ/RDEV 345Number of bytes in an ordinary file, or 346major and minor device of special file. 347.El 348.El 349.Sh ENVIRONMENT 350.Bl -tag -width BLOCKSIZE 351.It Ev BLOCKSIZE 352If the environment variable 353.Ev BLOCKSIZE 354is set, and the 355.Fl k 356option is not specified, the block counts will be displayed in units of that 357size block. 358.El 359.Sh FILES 360.Bl -tag -width /dev/kmemxxx -compact 361.It Pa /netbsd 362namelist 363.It Pa /dev/kmem 364default source of tables 365.El 366.Sh SEE ALSO 367.Xr ps 1 , 368.Xr systat 1 , 369.Xr vmstat 1 , 370.Xr stat 2 , 371.Xr fs 5 , 372.Xr iostat 8 373.Rs 374.%T Tn UNIX Implementation 375.%A K. Thompson 376.Re 377.Sh HISTORY 378The 379.Nm 380command appeared in 381.Bx 4.0 . 382.Sh BUGS 383Swap statistics are reported for all swap partitions compiled into the kernel, 384regardless of whether those partitions are being used. 385.Pp 386Does not understand NFS swap servers. 387