pstat
—
display system data structures
pstat |
[-T | -f |
-s | -t |
-v ] [-ghkmn ]
[-M core]
[-N system] |
pstat
displays open file entry, swap space utilization,
terminal state, and vnode data structures. If corefile
is given, the information is sought there, otherwise in
/dev/kmem. The required namelist is taken from
/netbsd unless system is
specified.
The following options are available:
-T
- Prints the number of used and free slots for open files, used vnodes, and
swap space. This option is useful for checking to see how large system
tables become if the system is under heavy load.
-f
- Print the open file table with these headings:
- LOC
- The core location of this table entry.
- TYPE
- The type of object the file table entry points to.
- FLG
- Miscellaneous state variables encoded thus:
- R
- open for reading
- W
- open for writing
- A
- open for appending
- S
- shared lock present
- X
- exclusive lock present
- I
- signal pgrp when data ready
- CNT
- Number of processes that know this open file.
- MSG
- Number of messages outstanding for this file.
- DATA
- The location of the vnode table entry or socket structure for this
file.
- USE
- Number of active users of this open file.
- IFLG
- Value of internal flags.
- OFFSET
- The file offset (see
lseek(2)).
-g
- The
-g
option uses (1024 * 1024 * 1024) byte
blocks instead of the default 512 byte.
-h
- Use
humanize_number(3)
to display (swap) sizes.
-k
- Use 1K-byte blocks.
-m
- The
-m
option uses (1024 * 1024) byte blocks
instead of the default 512 byte.
-n
- Print devices by major/minor number rather than by name.
-s
- Print information about swap space usage on all the swap areas compiled
into the kernel. The first column is the device name of the partition. The
next column is the total space available in the partition. The
Used column indicates the total blocks used so far;
the Available column indicates how much space is
remaining on each partition. The Capacity reports
the percentage of space used.
If more than one partition is configured into the system,
totals for all of the statistics will be reported in the final line of
the report.
-t
- Print table for terminals with these headings:
- LINE
- Physical device name.
- RAW
- Number of characters in raw input queue.
- CAN
- Number of characters in canonicalized input queue.
- OUT
- Number of characters in output queue.
- HWT
- High water mark for output.
- LWT
- Low water mark for output.
- COL
- Calculated column position of terminal.
- STATE
- Miscellaneous state variables encoded thus:
- T
- delay timeout in progress
- O
- open
- F
- outq has been flushed during DMA
- C
- carrier is on
- B
- busy doing output
- A
- process is awaiting output
- X
- open for exclusive use
- S
- output stopped
- K
- further input blocked
- Y
- tty in async I/O mode
- D
- state for lowercase ‘
\
’
work
- E
- within a ‘
\.../
’ for
PRTRUB
- L
- next character is literal
- P
- retyping suspended input (PENDIN)
- N
- counting tab width, ignore FLUSHO
- >
- tty used for dialout
- SESS
- Session for which this is controlling terminal.
- PGID
- Current foreground process group associated with this terminal.
- DISC
- Line discipline; ‘
term
’ for
TTYDISC (see
termios(4)),
‘tab
’ for TABLDISC (see
tb(4)),
‘slip
’ for SLIPDISC (see
sl(4)),
‘ppp
’ for PPPDISC (see
ppp(4)),
‘strip
’ for STRIPDISC (see
strip(4)),
‘hdlc
’ for HDLCDISC.
-v
- Print the active vnodes. Each group of vnodes corresponding to a
particular filesystem is preceded by a two line header. The first line
consists of the following:
*** MOUNT fstype
from on
on fsflags
where fstype is one of
adosfs, afs,
cd9660, fdesc,
ffs, ext2fs,
kernfs, lfs, lofs,
mfs, msdos, nfs,
null, procfs,
umap, union; from
is the filesystem mounted from; on is the directory
the filesystem is mounted on; and fsflags is a list of
optional flags applied to the mount (see
mount(8)). The second line
is a header for the individual fields, the first part of which are
fixed, and the second part are filesystem type specific. The headers
common to all vnodes are:
- ADDR
- Location of this vnode.
- TYP
- File type.
- VFLAG
- A list of letters representing vnode flags:
- R
- VROOT root of its file system.
- T
- VTEXT pure text prototype.
- S
- VSYSTEM vnode being used by kernel.
- I
- VISTTY vnode is a tty.
- E
- VEXECMAP vnode has PROT_EXEC mappings.
- D
- VDIROP lfs vnode involved in directory op.
- O
- VONWORKLST vnode is on syncer work-list.
- USE
- The number of references to this vnode.
- HOLD
- The number of I/O buffers held by this vnode.
- TAG
- The type of underlying data.
- NPAGE
- The number of pages in this vnode.
- FILEID
- The vnode fileid. In the case of ffs or
ext2fs this is the inode number.
- IFLAG
- Miscellaneous filesystem specific state variables encoded thus:
- For ffs, lfs or ext2fs:
-
- A
- access time must be corrected
- C
- changed time must be corrected
- U
- update time (fs(5))
must be corrected
- M
- contains modifications
- a
- has been accessed
- R
- has a rename in progress
- S
- shared lock applied
- E
- exclusive lock applied
- c
- is being cleaned (LFS)
- D
- directory operation in progress (LFS)
- s
- blocks to be freed in free count
- For nfs:
-
- W
- waiting for I/O buffer flush to complete
- P
- I/O buffers being flushed
- M
- locally modified data exists
- E
- an earlier write failed
- A
- special file accessed
- U
- special file updated
- C
- special file times changed
- SIZ/RDEV
- Number of bytes in an ordinary file, or major and minor device of
special file.
BLOCKSIZE
- If the environment variable
BLOCKSIZE
is set, and
the -k
option is not specified, the block counts
will be displayed in units of that size block.
- /netbsd
- namelist
- /dev/kmem
- default source of tables
The pstat
command appeared in
4.0BSD.
Swap statistics are reported for all swap partitions compiled into the kernel,
regardless of whether those partitions are being used.
Does not understand NFS swap servers.