summaryrefslogtreecommitdiffstats
path: root/usr.bin/systat/vmstat.c
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2001-06-01 13:29:19 +0000
committertmm <tmm@FreeBSD.org>2001-06-01 13:29:19 +0000
commitcacf0242b20a64a310c2ba6aad06fdfb349c5588 (patch)
tree2c7aac8d8bb17e273425c3336f2642a6b5beb3b3 /usr.bin/systat/vmstat.c
parent9ce8a6234736b0446ecc22b1092f693c658a25be (diff)
downloadFreeBSD-src-cacf0242b20a64a310c2ba6aad06fdfb349c5588.zip
FreeBSD-src-cacf0242b20a64a310c2ba6aad06fdfb349c5588.tar.gz
Replace a use of the hw.nintr sysctl as it has just gone away, cast
size_t variables when passing them to a printf-like function, and some minor cleanups.
Diffstat (limited to 'usr.bin/systat/vmstat.c')
-rw-r--r--usr.bin/systat/vmstat.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c
index 5da93c3..9a3fc02 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;
OpenPOWER on IntegriCloud