summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/compat/linprocfs/linprocfs.c9
-rw-r--r--sys/compat/linprocfs/linprocfs_misc.c9
-rw-r--r--sys/i386/linux/linprocfs/linprocfs_misc.c9
3 files changed, 21 insertions, 6 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
index 4babe74..5d78083 100644
--- a/sys/compat/linprocfs/linprocfs.c
+++ b/sys/compat/linprocfs/linprocfs.c
@@ -99,8 +99,13 @@ linprocfs_domeminfo(curp, p, pfs, uio)
*/
memused = cnt.v_wire_count * PAGE_SIZE;
memfree = memtotal - memused;
- swaptotal = swapblist->bl_blocks * 1024; /* XXX why 1024? */
- swapfree = swapblist->bl_root->u.bmu_avail * PAGE_SIZE;
+ if (swapblist == NULL) {
+ swaptotal = 0;
+ swapfree = 0;
+ } else {
+ swaptotal = swapblist->bl_blocks * 1024; /* XXX why 1024? */
+ swapfree = swapblist->bl_root->u.bmu_avail * PAGE_SIZE;
+ }
swapused = swaptotal - swapfree;
memshared = 0;
for (object = TAILQ_FIRST(&vm_object_list); object != NULL;
diff --git a/sys/compat/linprocfs/linprocfs_misc.c b/sys/compat/linprocfs/linprocfs_misc.c
index 4babe74..5d78083 100644
--- a/sys/compat/linprocfs/linprocfs_misc.c
+++ b/sys/compat/linprocfs/linprocfs_misc.c
@@ -99,8 +99,13 @@ linprocfs_domeminfo(curp, p, pfs, uio)
*/
memused = cnt.v_wire_count * PAGE_SIZE;
memfree = memtotal - memused;
- swaptotal = swapblist->bl_blocks * 1024; /* XXX why 1024? */
- swapfree = swapblist->bl_root->u.bmu_avail * PAGE_SIZE;
+ if (swapblist == NULL) {
+ swaptotal = 0;
+ swapfree = 0;
+ } else {
+ swaptotal = swapblist->bl_blocks * 1024; /* XXX why 1024? */
+ swapfree = swapblist->bl_root->u.bmu_avail * PAGE_SIZE;
+ }
swapused = swaptotal - swapfree;
memshared = 0;
for (object = TAILQ_FIRST(&vm_object_list); object != NULL;
diff --git a/sys/i386/linux/linprocfs/linprocfs_misc.c b/sys/i386/linux/linprocfs/linprocfs_misc.c
index 4babe74..5d78083 100644
--- a/sys/i386/linux/linprocfs/linprocfs_misc.c
+++ b/sys/i386/linux/linprocfs/linprocfs_misc.c
@@ -99,8 +99,13 @@ linprocfs_domeminfo(curp, p, pfs, uio)
*/
memused = cnt.v_wire_count * PAGE_SIZE;
memfree = memtotal - memused;
- swaptotal = swapblist->bl_blocks * 1024; /* XXX why 1024? */
- swapfree = swapblist->bl_root->u.bmu_avail * PAGE_SIZE;
+ if (swapblist == NULL) {
+ swaptotal = 0;
+ swapfree = 0;
+ } else {
+ swaptotal = swapblist->bl_blocks * 1024; /* XXX why 1024? */
+ swapfree = swapblist->bl_root->u.bmu_avail * PAGE_SIZE;
+ }
swapused = swaptotal - swapfree;
memshared = 0;
for (object = TAILQ_FIRST(&vm_object_list); object != NULL;
OpenPOWER on IntegriCloud