summaryrefslogtreecommitdiffstats
path: root/usr.bin/systat
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
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')
-rw-r--r--usr.bin/systat/fetch.c4
-rw-r--r--usr.bin/systat/systat.h1
-rw-r--r--usr.bin/systat/vmstat.c12
3 files changed, 11 insertions, 6 deletions
diff --git a/usr.bin/systat/fetch.c b/usr.bin/systat/fetch.c
index 94ef619..e583911 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 d4ea835..187c6ba6 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 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