diff options
| author | Robert Watson <rwatson@FreeBSD.org> | 2005-08-01 21:33:17 +0000 |
|---|---|---|
| committer | Robert Watson <rwatson@FreeBSD.org> | 2005-08-01 21:33:17 +0000 |
| commit | c753d56b39b82cd8787a3c6620f1637976e40594 (patch) | |
| tree | d2cdbcd5c9ddf81091c1c2db48cd1dff32819321 /usr.bin/vmstat | |
| parent | dcb5fef5dbd4ca8488deff7a9074850d851bdc08 (diff) | |
Notes
Diffstat (limited to 'usr.bin/vmstat')
| -rw-r--r-- | usr.bin/vmstat/vmstat.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c index 6e3aaaae605f..c466000c9922 100644 --- a/usr.bin/vmstat/vmstat.c +++ b/usr.bin/vmstat/vmstat.c @@ -155,7 +155,7 @@ static void domem(void); static void dointr(void); static void dosum(void); static void dovmstat(unsigned int, int); -static void dozmem(void); +static void domemstat_zone(void); static void kread(int, void *, size_t); static void kreado(int, void *, size_t, size_t); static char *kgetstr(const char *); @@ -302,7 +302,7 @@ main(int argc, char *argv[]) if (todo & MEMSTAT) domem(); if (todo & ZMEMSTAT) - dozmem(); + domemstat_zone(); if (todo & SUMSTAT) dosum(); #ifdef notyet @@ -945,16 +945,29 @@ domemstat_zone(void) struct memory_type_list *mtlp; struct memory_type *mtp; char name[MEMTYPE_MAXNAME + 1]; + int error; mtlp = memstat_mtl_alloc(); if (mtlp == NULL) { warn("memstat_mtl_alloc"); return; } - if (memstat_sysctl_uma(mtlp, 0) < 0) { - warnx("memstat_sysctl_uma: %s", - memstat_strerror(memstat_mtl_geterror(mtlp))); - return; + if (kd == NULL) { + if (memstat_sysctl_uma(mtlp, 0) < 0) { + warnx("memstat_sysctl_uma: %s", + memstat_strerror(memstat_mtl_geterror(mtlp))); + return; + } + } else { + if (memstat_kvm_uma(mtlp, kd) < 0) { + error = memstat_mtl_geterror(mtlp); + if (error == MEMSTAT_ERROR_KVM) + warnx("memstat_kvm_uma: %s", + kvm_geterr(kd)); + else + warnx("memstat_kvm_uma: %s", + memstat_strerror(error)); + } } printf("%-15s %-8s %-9s %-7s %-5s %-8s\n\n", "ITEM", "SIZE", "LIMIT", "USED", "FREE", "REQUESTS"); @@ -1060,14 +1073,6 @@ domem(void) } while (type.ks_next != NULL); } -static void -dozmem(void) -{ - if (kd != NULL) - errx(1, "not implemented"); - domemstat_zone(); -} - /* * kread reads something from the kernel, given its nlist index. */ |
