diff options
| -rw-r--r-- | usr.bin/systat/fetch.c | 4 | ||||
| -rw-r--r-- | usr.bin/systat/systat.h | 1 | ||||
| -rw-r--r-- | usr.bin/systat/vmstat.c | 12 |
3 files changed, 11 insertions, 6 deletions
diff --git a/usr.bin/systat/fetch.c b/usr.bin/systat/fetch.c index 94ef6190476d..e5839116e74e 100644 --- a/usr.bin/systat/fetch.c +++ b/usr.bin/systat/fetch.c @@ -74,8 +74,8 @@ void getsysctl(name, ptr, len) strerror(errno)); } if (nlen != len) { - error("sysctl(%s...) expected %d, got %d", name, - len, nlen); + error("sysctl(%s...) expected %lu, got %lu", name, + (unsigned long)len, (unsigned long)nlen); } } diff --git a/usr.bin/systat/systat.h b/usr.bin/systat/systat.h index d4ea835df94e..187c6ba649c9 100644 --- a/usr.bin/systat/systat.h +++ b/usr.bin/systat/systat.h @@ -67,4 +67,3 @@ extern int use_kvm; #define NVAL(indx) namelist[(indx)].n_value #define NPTR(indx) (void *)NVAL((indx)) #define NREAD(indx, buf, len) kvm_ckread(NPTR((indx)), (buf), (len)) -#define LONG (sizeof (long)) diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c index 5da93c383e0d..9a3fc027e628 100644 --- a/usr.bin/systat/vmstat.c +++ b/usr.bin/systat/vmstat.c @@ -209,6 +209,7 @@ initkre() { char *intrnamebuf, *cp; int i; + size_t sz; if ((num_devices = getnumdevs()) < 0) { warnx("%s", devstat_errbuf); @@ -226,9 +227,14 @@ initkre() return(0); if (nintr == 0) { - GETSYSCTL("hw.nintr", nintr); + if (sysctlbyname("hw.intrcnt", NULL, &sz, NULL, 0) == -1) { + error("sysctl(hw.intrcnt...) failed: %s", + strerror(errno)); + return (0); + } + nintr = sz / sizeof(u_long); intrloc = calloc(nintr, sizeof (long)); - intrname = calloc(nintr, sizeof (long)); + intrname = calloc(nintr, sizeof (char *)); intrnamebuf = sysctl_dynread("hw.intrnames", NULL); if (intrnamebuf == NULL || intrname == NULL || intrloc == NULL) { @@ -767,7 +773,7 @@ getinfo(s, st) GETSYSCTL("debug.freevnodes", s->freevnodes); GETSYSCTL("vfs.cache.nchstats", s->nchstats); GETSYSCTL("vfs.numdirtybuffers", s->numdirtybuffers); - getsysctl("hw.intrcnt", s->intrcnt, nintr * LONG); + getsysctl("hw.intrcnt", s->intrcnt, nintr * sizeof(u_long)); size = sizeof(s->Total); mib[0] = CTL_VM; |
