The kvm_getswapinfo function fills an array of
.Vt kvm_swap structures with swap summary information for each swap device, for up to maxswap - 1 devices. The number of devices, up to maxswap - 1, is returned. A grand total of all swap devices (including any devices that go beyond maxswap - 1) is returned in one additional array entry. This entry is not counted in the return value. Thus, if you specify a maxswap value of 1, the function will typically return the value 0 and the single
.Vt kvm_swap structure will be filled with the grand total over all swap devices. The grand total is calculated from all available swap devices whether or not you made room for them all in the array. The grand total is returned.
The flags argument is currently unused and must be passed as 0.
If an error occurs, -1 is returned.
Each swap partition and the grand total is summarized in the
.Vt kvm_swap structure. This structure contains the following fields: