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 under the terms of the BSD
5 .\" Copyright as found in /usr/src/COPYRIGHT in the FreeBSD source tree.
14 .Nd return swap summary statistics for the system
18 .Fn kvm_getswapinfo "kvm_t *kd" "struct kvm_swap *" "int maxswap" "int flags"
22 function fills an array of kvm_swap structures with swap summary
23 information for each swap device, for up to maxswap - 1 devices.
24 The number of devices, up to maxswap - 1, is returned. A grand
25 total of all swap devices ( including any devices that go beyond
26 maxswap - 1 ) is returned in one additional array entry. This
27 entry is not counted in the return value. Thus, if you specify
28 a maxswap value of 1, the function will typically return the
29 value 0 and the single kvm_swap structure will be filled with
30 the grand total over all swap devices. The grand total is calculated
31 from all available swap devices whether or not you made room
32 for them all in the array.
33 the grant total is returned.
35 The flags argument is currently unused and must be passed as 0.
37 If an error occurs, -1 is returned.
39 Each swap partition and the grand total is summarized in the kvm_swap
40 structure. This structure contains the following fields:
41 .Bl -inset -width indent
42 .It char ksw_devname[];
48 Values are in PAGE_SIZE'd chunks ( see getpagesize() ). ksw_flags contains
49 a copy of the swap device flags.
52 This function caches the nlist values for various kernel variables which
53 it reuses in successive calls. You may call the function with kd == NULL
56 If the load average was unobtainable, \-1 is returned; otherwise,
57 the number of swap devices actually retrieved is returned.
59 If the name of the swap device does not fit in the static char buffer
60 in the structure, it is truncated. The buffer is always zero terminated.