1 .\" Copyright (C) 1999 Matthew Dillon. All rights reserved.
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\" notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\" notice, this list of conditions and the following disclaimer in the
10 .\" documentation and/or other materials provided with the distribution.
12 .\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15 .\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
16 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .Nd return swap summary statistics for the system
37 .Fn kvm_getswapinfo "kvm_t *kd" "struct kvm_swap *" "int maxswap" "int flags"
41 function fills an array of
43 structures with swap summary
44 information for each swap device, for up to
47 The number of devices, up to
51 total of all swap devices (including any devices that go beyond
53 \- 1) is returned in one additional array entry.
55 entry is not counted in the return value.
56 Thus, if you specify a
58 value of 1, the function will typically return the
59 value 0 and the single
61 structure will be filled with
62 the grand total over all swap devices.
63 The grand total is calculated
64 from all available swap devices whether or not you made room
65 for them all in the array.
66 The grand total is returned.
68 The flags argument is currently unused and must be passed as 0.
70 If an error occurs, -1 is returned.
72 Each swap partition and the grand total is summarized in the
75 This structure contains the following fields:
77 .Bl -item -offset indent -compact
79 .Va char ksw_devname[] ;
94 a copy of the swap device flags.
96 This function caches the nlist values for various kernel variables which
97 it reuses in successive calls.
98 You may call the function with
104 If the load average was unobtainable, \-1 is returned; otherwise,
105 the number of swap devices actually retrieved is returned.
107 If the name of the swap device does not fit in the static char buffer
108 in the structure, it is truncated.
109 The buffer is always zero terminated.