Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/swap_pager.c
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* @(#)swap_pager.c 8.9 (Berkeley) 3/21/94 | * @(#)swap_pager.c 8.9 (Berkeley) 3/21/94 | ||||
* @(#)vm_swap.c 8.5 (Berkeley) 2/17/94 | * @(#)vm_swap.c 8.5 (Berkeley) 2/17/94 | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include "opt_compat.h" | |||||
#include "opt_swap.h" | #include "opt_swap.h" | ||||
#include "opt_vm.h" | #include "opt_vm.h" | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/conf.h> | #include <sys/conf.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/priv.h> | #include <sys/priv.h> | ||||
▲ Show 20 Lines • Show All 2,332 Lines • ▼ Show 20 Lines | TAILQ_FOREACH(sp, &swtailq, sw_list) { | ||||
} | } | ||||
error = 0; | error = 0; | ||||
break; | break; | ||||
} | } | ||||
mtx_unlock(&sw_dev_mtx); | mtx_unlock(&sw_dev_mtx); | ||||
return (error); | return (error); | ||||
} | } | ||||
#if defined(COMPAT_FREEBSD11) | |||||
#define XSWDEV_VERSION_11 1 | |||||
struct xswdev11 { | |||||
u_int xsw_version; | |||||
uint32_t xsw_dev; | |||||
int xsw_flags; | |||||
int xsw_nblks; | |||||
int xsw_used; | |||||
}; | |||||
#endif | |||||
static int | static int | ||||
sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS) | sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct xswdev xs; | struct xswdev xs; | ||||
#if defined(COMPAT_FREEBSD11) | |||||
struct xswdev11 xs11; | |||||
#endif | |||||
int error; | int error; | ||||
if (arg2 != 1) /* name length */ | if (arg2 != 1) /* name length */ | ||||
return (EINVAL); | return (EINVAL); | ||||
error = swap_dev_info(*(int *)arg1, &xs, NULL, 0); | error = swap_dev_info(*(int *)arg1, &xs, NULL, 0); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
#if defined(COMPAT_FREEBSD11) | |||||
if (req->oldlen == sizeof(xs11)) { | |||||
xs11.xsw_version = XSWDEV_VERSION_11; | |||||
xs11.xsw_dev = xs.xsw_dev; /* truncation */ | |||||
xs11.xsw_flags = xs.xsw_flags; | |||||
xs11.xsw_nblks = xs.xsw_nblks; | |||||
xs11.xsw_used = xs.xsw_used; | |||||
error = SYSCTL_OUT(req, &xs11, sizeof(xs11)); | |||||
} else | |||||
#endif | |||||
error = SYSCTL_OUT(req, &xs, sizeof(xs)); | error = SYSCTL_OUT(req, &xs, sizeof(xs)); | ||||
return (error); | return (error); | ||||
} | } | ||||
SYSCTL_INT(_vm, OID_AUTO, nswapdev, CTLFLAG_RD, &nswapdev, 0, | SYSCTL_INT(_vm, OID_AUTO, nswapdev, CTLFLAG_RD, &nswapdev, 0, | ||||
"Number of swap devices"); | "Number of swap devices"); | ||||
SYSCTL_NODE(_vm, OID_AUTO, swap_info, CTLFLAG_RD | CTLFLAG_MPSAFE, | SYSCTL_NODE(_vm, OID_AUTO, swap_info, CTLFLAG_RD | CTLFLAG_MPSAFE, | ||||
sysctl_vm_swap_info, | sysctl_vm_swap_info, | ||||
"Swap statistics by device"); | "Swap statistics by device"); | ||||
▲ Show 20 Lines • Show All 386 Lines • Show Last 20 Lines |