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.
7 .\" $FreeBSD: src/lib/libkvm/kvm_getswapinfo.3,v 1.5.2.6 2001/12/17 10:08:30 ru Exp $
8 .\" $DragonFly: src/lib/libkvm/kvm_getswapinfo.3,v 1.3 2004/06/28 02:57:10 drhodus Exp $
15 .Nd return swap summary statistics for the system
22 .Fn kvm_getswapinfo "kvm_t *kd" "struct kvm_swap *" "int maxswap" "int flags"
26 function fills an array of
28 structures with swap summary
29 information for each swap device, for up to
32 The number of devices, up to
34 \- 1, is returned. A grand
35 total of all swap devices (including any devices that go beyond
37 \- 1) is returned in one additional array entry. This
38 entry is not counted in the return value.
39 Thus, if you specify a
41 value of 1, the function will typically return the
42 value 0 and the single
44 structure will be filled with
45 the grand total over all swap devices. The grand total is calculated
46 from all available swap devices whether or not you made room
47 for them all in the array.
48 The grand total is returned.
50 The flags argument is currently unused and must be passed as 0.
52 If an error occurs, -1 is returned.
54 Each swap partition and the grand total is summarized in the
56 structure. This structure contains the following fields:
58 .Bl -item -offset indent -compact
60 .Va char ksw_devname[] ;
75 a copy of the swap device flags.
77 This function caches the nlist values for various kernel variables which
78 it reuses in successive calls.
79 You may call the function with
85 If the load average was unobtainable, \-1 is returned; otherwise,
86 the number of swap devices actually retrieved is returned.
88 If the name of the swap device does not fit in the static char buffer
89 in the structure, it is truncated. The buffer is always zero terminated.