Fixed null pointer panic for accessing "meminfo" when there is no swap.

This commit is contained in:
Bruce Evans 2000-08-12 21:08:42 +00:00
parent b10fc2ddef
commit c6e4d7c5ba
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=64560
3 changed files with 21 additions and 6 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;