diff options
author | mjacob <mjacob@FreeBSD.org> | 2001-01-23 00:09:30 +0000 |
---|---|---|
committer | mjacob <mjacob@FreeBSD.org> | 2001-01-23 00:09:30 +0000 |
commit | 16f8aaa40931ee553642e7309e95513393276953 (patch) | |
tree | 9d634cb2511170f4cffae7cf7f3412b68774b7a5 /usr.bin/vmstat | |
parent | c98acd5ed74e4e3fa81fea4e41cfc433bb72c580 (diff) | |
download | FreeBSD-src-16f8aaa40931ee553642e7309e95513393276953.zip FreeBSD-src-16f8aaa40931ee553642e7309e95513393276953.tar.gz |
Update vm zone list traversal for changes made to kernel. Note that this
is ultimately silly because no locks are held in user space while traversing
the list via kvm_reads... really, this should use the sysctl interface
which *is* protected by a lock in the kernel.
Diffstat (limited to 'usr.bin/vmstat')
-rw-r--r-- | usr.bin/vmstat/vmstat.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c index 2e5814f..9c5f151 100644 --- a/usr.bin/vmstat/vmstat.c +++ b/usr.bin/vmstat/vmstat.c @@ -866,6 +866,7 @@ domem() void dozmem() { + static SLIST_HEAD(vm_zone_list, vm_zone) zlist; vm_zone_t zonep; int nmax = 512; int zused_bytes = 0; @@ -880,7 +881,10 @@ dozmem() "mem-use" ); - kread(X_ZLIST, &zonep, sizeof(zonep)); + SLIST_INIT(&zlist); + kread(X_ZLIST, &zlist, sizeof(zlist)); + zonep = SLIST_FIRST(&zlist); + while (zonep != NULL && nmax) { struct vm_zone zone; char buf[32]; @@ -904,7 +908,7 @@ dozmem() zused_bytes += (zone.ztotal - zone.zfreecnt) * zone.zsize; ztotal_bytes += zone.ztotal * zone.zsize; --nmax; - zonep = zone.znext; + zonep = SLIST_NEXT(&zone, zent); } printf( "------------------------------------------\n" |