Add sysctl to query amount of swap space free
PR: kern/166780 Submitted by: Radim Kolar <hsn@sendmail.cz> Approved by: cperciva MFC after: 1 week
This commit is contained in:
parent
9463606153
commit
01b578179f
@ -2692,3 +2692,18 @@ swaponvp(struct thread *td, struct vnode *vp, u_long nblks)
|
||||
NODEV);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_vm_swap_free(SYSCTL_HANDLER_ARGS) {
|
||||
int swap_free, used;
|
||||
int total;
|
||||
|
||||
swap_pager_status(&total, &used);
|
||||
|
||||
swap_free = (total - used) * PAGE_SIZE;
|
||||
return SYSCTL_OUT(req, &swap_free, sizeof(swap_free));
|
||||
}
|
||||
|
||||
SYSCTL_OID(_vm, OID_AUTO, swap_free, CTLTYPE_INT|CTLFLAG_RD|CTLFLAG_MPSAFE,
|
||||
NULL, 0, sysctl_vm_swap_free, "Q",
|
||||
"Blocks of free swap storage.");
|
||||
|
Loading…
Reference in New Issue
Block a user