summaryrefslogtreecommitdiffstats
path: root/usr.bin/systat/iostat.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2000-11-25 03:47:36 +0000
committerrwatson <rwatson@FreeBSD.org>2000-11-25 03:47:36 +0000
commit9e4c4b43a58f03a2ad88b212861b6ff974f7e02d (patch)
tree2d60e3318c76d6c67455b64204637d7e8a262848 /usr.bin/systat/iostat.c
parentdd9a2cc4457fe62fd7ec0e6133201a18fe298f65 (diff)
downloadFreeBSD-src-9e4c4b43a58f03a2ad88b212861b6ff974f7e02d.zip
FreeBSD-src-9e4c4b43a58f03a2ad88b212861b6ff974f7e02d.tar.gz
o Make systat/iostat.c use sysctl() to retrieve cp_time instead of
kmem.
Diffstat (limited to 'usr.bin/systat/iostat.c')
-rw-r--r--usr.bin/systat/iostat.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/usr.bin/systat/iostat.c b/usr.bin/systat/iostat.c
index ac2fe0b..20d90d0 100644
--- a/usr.bin/systat/iostat.c
+++ b/usr.bin/systat/iostat.c
@@ -77,22 +77,6 @@ static char sccsid[] = "@(#)iostat.c 8.1 (Berkeley) 6/6/93";
#include "extern.h"
#include "devs.h"
-static struct nlist namelist[] = {
-#define X_CP_TIME 0
- { "_cp_time" },
-#ifdef vax
-#define X_MBDINIT (X_CP_TIME+1)
- { "_mbdinit" },
-#define X_UBDINIT (X_CP_TIME+2)
- { "_ubdinit" },
-#endif
-#ifdef tahoe
-#define X_VBDINIT (X_CP_TIME+1)
- { "_vbdinit" },
-#endif
- { "" },
-};
-
struct statinfo cur, last;
static int linesperregion;
@@ -141,11 +125,6 @@ initiostat()
if (dsinit(100, &cur, &last, NULL) != 1)
return(0);
- if (kvm_nlist(kd, namelist)) {
- nlisterr(namelist);
- return(0);
- }
-
return(1);
}
@@ -153,8 +132,15 @@ void
fetchiostat()
{
struct devinfo *tmp_dinfo;
-
- NREAD(X_CP_TIME, cur.cp_time, sizeof(cur.cp_time));
+ size_t len;
+ int err;
+
+ len = sizeof(cur.cp_time);
+ err = sysctlbyname("kern.cp_time", &cur.cp_time, &len, NULL, 0);
+ if (err || len != sizeof(cur.cp_time)) {
+ perror("kern.cp_time");
+ exit (1);
+ }
tmp_dinfo = last.dinfo;
last.dinfo = cur.dinfo;
cur.dinfo = tmp_dinfo;
OpenPOWER on IntegriCloud