NetBSD/usr.sbin/swapinfo
cgd 7b6f2f49df fixes from Thomas Eberhardt to get it to grok BLOCKSIZE, etc. 1994-03-23 04:50:36 +00:00
..
Makefile needs -lkvm, not -lutil 1994-01-28 01:00:24 +00:00
README added swapinfo from Kevin Lahey <kml@rokkaku.atl.ga.us> 1993-04-10 12:16:52 +00:00
devname.c Add RCS identifiers. 1993-08-01 17:54:45 +00:00
swapinfo.1 fixes from Thomas Eberhardt to get it to grok BLOCKSIZE, etc. 1994-03-23 04:50:36 +00:00
swapinfo.c fixes from Thomas Eberhardt to get it to grok BLOCKSIZE, etc. 1994-03-23 04:50:36 +00:00

README

swapinfo
========

Swapinfo is designed to provide some information to the user about the
state of the swap space on the system.  I've written it based on a 
brief (!) perusal of the VM code in 386BSD.  I could be pretty confused
about how it all fits together, and perhaps this is totally bogus.
It seems to work for me, though.

How it works:

During startup, the system traverses the list of configured swap partitions,
and determines the size of the various partitions.  As each new partition
is added for swapping (via swapon), the free space on that disk is added
to a linked list of free space.  Adjacent areas are coalesced to form
larger areas.  The swapping algorithm seems to take the first free section
that it finds [?].

Swapinfo reads in the list of configured swap partitions from the /dev/kmem,
to determine the size of the partitions.  It then traverses the list
of free space, figuring up how much is still available and how much
has therefore been used.  Things get a little hairy in that the swap space
is divided amongst the configured swap partitions so that the first
4096 blocks of swap go on the first swap partition, the second 4096 on
the second swap partition, and so on.  This works out to be a fairly
simple bit of code, though.

More caveats:

This works on my system.  Your milage may vary.  Since I'm reading /dev/kmem
to follow a linked list, the program could easily get lost looking for
some free space if anything got changed between reads of /dev/kmem.
If you get occasional inconsistant results, ignore 'em.

Feel free to send bug reports, flames, etc., to:

Kevin Lahey
kml@rokkaku.atl.ga.us