shithub: riscv

ref: 41be41b4936b4d58312cc99993511f0f09d6161d
dir: /sys/man/3/swap/

View raw version
.TH SWAP 3
.SH NAME
swap \- memory usage statistics and swap file control
.SH SYNOPSIS
.nf
.B bind -a #¶ /dev

.B /dev/swap
.fi
.SH DESCRIPTION
The
.B swap
device holds a text block giving memory usage statistics:
.IP
.EX
\fIn\fP memory
\fIn\fP pagesize
\fIn\fP kernel
\fIn\fP/\fIm\fP user
\fIn\fP/\fIm\fP swap
\fIa\fP/\fIn\fP/\fIm\fP kernel malloc
\fIa\fP/\fIn\fP/\fIm\fP kernel draw
\fIa\fP/\fIn\fP/\fIm\fP kernel secret
.EE
.PP
These are total memory (bytes), system page size (bytes),
kernel memory (pages), user memory (pages), swap space (pages),
kernel malloced data (bytes), kernel graphics data (bytes)
and kernel secret data (bytes).
The expression
.IR n / m
indicates
.I n
used out of
.I m
available.
For kernel malloc and kernel draw,
.IR a
indicates the current allocation in bytes.
These numbers are not blank padded.
.PP
To turn on swapping, write to
.B swap
the textual file descriptor number of a file or device on which to swap.
.PP
Only the hostowner is allowed to enable swapping. The pages written to
the swap file are transparently encrypted by the kernel using a random key.
.SH SEE ALSO
.IR memory (8),
.IR swap (8).
.SH SOURCE
.B /sys/src/9/port/devswap.c