summaryrefslogtreecommitdiffstats
path: root/sys/compat/linprocfs
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-07-18 10:26:09 +0000
committerphk <phk@FreeBSD.org>2003-07-18 10:26:09 +0000
commit5fa40a32657fa0c3bd8a986099bb65516d11e97b (patch)
treef65e135aef6b67bb4e1d27be159856b438db243f /sys/compat/linprocfs
parent84f9cb2fa862e169a92c4dc14584dda3a33c2a89 (diff)
downloadFreeBSD-src-5fa40a32657fa0c3bd8a986099bb65516d11e97b.zip
FreeBSD-src-5fa40a32657fa0c3bd8a986099bb65516d11e97b.tar.gz
Add a new function swap_pager_status() which reports the total size of the
paging space and how much of it is in use (in pages). Use this interface from the Linuxolator instead of groping around in the internals of the swap_pager.
Diffstat (limited to 'sys/compat/linprocfs')
-rw-r--r--sys/compat/linprocfs/linprocfs.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
index fe789be..da3530b 100644
--- a/sys/compat/linprocfs/linprocfs.c
+++ b/sys/compat/linprocfs/linprocfs.c
@@ -121,6 +121,7 @@ linprocfs_domeminfo(PFS_FILL_ARGS)
unsigned long long swapused; /* used swap space in bytes */
unsigned long long swapfree; /* free swap space in bytes */
vm_object_t object;
+ int i, j;
memtotal = physmem * PAGE_SIZE;
/*
@@ -135,14 +136,10 @@ linprocfs_domeminfo(PFS_FILL_ARGS)
*/
memused = cnt.v_wire_count * PAGE_SIZE;
memfree = memtotal - memused;
- if (swapblist == NULL) {
- swaptotal = 0;
- swapfree = 0;
- } else {
- swaptotal = (u_quad_t)swapblist->bl_blocks * 1024; /* XXX why 1024? */
- swapfree = (u_quad_t)swapblist->bl_root->u.bmu_avail * PAGE_SIZE;
- }
- swapused = swaptotal - swapfree;
+ swap_pager_status(&i, &j);
+ swaptotal = i * PAGE_SIZE;
+ swapused = j * PAGE_SIZE;
+ swapfree = swaptotal - swapused;
memshared = 0;
TAILQ_FOREACH(object, &vm_object_list, object_list)
if (object->shadow_count > 1)
OpenPOWER on IntegriCloud