[issue1805] sysctl needed for taking swap statistics

Matthew Dillon dillon at apollo.backplane.com
Tue Aug 17 09:45:06 PDT 2010


:New submission from Carlos Olmedo Escobar <carlos.olmedo.e at gmail.com>:
:
:I'm developing a library and I need to take the total/free swap space from a
:sysctl() call (i can use kvm but in this case my lib will need the suid bit).
:This kind of call already exists on FreeBSD (vm.swap_info plus struct xswdev).
:Also in Open/NetBSD.

    We currently have (in HEAD):

    vm.swap_anon_use	# of pages of anonymous memory swapped out to swap.

    vm.swap_cache_use	# of pages of clean data swapped out by swapcache
			  (for people with SSDs).

    There is no total swap sysctl but I will add one right now.  I will
    call it 'vm.swap_size'.  You will then be able to calculate the
    amount of free swap with (vm.swap_size - vm.anon_use - vm.cache_use).

    Currently the list of individual swap devices is not exported.

					-Matt
					Matthew Dillon 
					<dillon at backplane.com>





More information about the Bugs mailing list