Module Name: src
Committed By: christos
Date: Fri Nov 23 03:37:27 UTC 2012
Modified Files:
src/usr.bin/systat: bufcache.c
Log Message:
use more sysctl
To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/systat/bufcache.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/systat/bufcache.c
diff -u src/usr.bin/systat/bufcache.c:1.22 src/usr.bin/systat/bufcache.c:1.23
--- src/usr.bin/systat/bufcache.c:1.22 Mon Apr 28 16:24:15 2008
+++ src/usr.bin/systat/bufcache.c Thu Nov 22 22:37:27 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: bufcache.c,v 1.22 2008/04/28 20:24:15 martin Exp $ */
+/* $NetBSD: bufcache.c,v 1.23 2012/11/23 03:37:27 christos Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: bufcache.c,v 1.22 2008/04/28 20:24:15 martin Exp $");
+__RCSID("$NetBSD: bufcache.c,v 1.23 2012/11/23 03:37:27 christos Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -74,16 +74,10 @@ struct ml_entry {
struct mount ml_mount;
};
-static struct nlist namelist[] = {
-#define X_BUFMEM 0
- { .n_name = "_bufmem" },
- { .n_name = NULL },
-};
-
static struct vcache vcache[VCACHE_SIZE];
static LIST_HEAD(mount_list, ml_entry) mount_list;
-static u_long bufmem;
+static uint64_t bufmem;
static u_int nbuf, pgwidth, kbwidth;
static struct uvmexp_sysctl uvmexp;
@@ -133,8 +127,11 @@ showbufcache(void)
int tbuf, i, lastrow;
double tvalid, tsize;
struct ml_entry *ml;
+ size_t len;
- NREAD(X_BUFMEM, &bufmem, sizeof(bufmem));
+ len = sizeof(bufmem);
+ if (sysctlbyname("vm.bufmem", &bufmem, &len, NULL, 0))
+ error("can't get \"vm.bufmmem\": %s", strerror(errno));
mvwprintw(wnd, 0, 0,
" %*d metadata buffers using %*ld kBytes of "
@@ -218,13 +215,6 @@ showbufcache(void)
int
initbufcache(void)
{
- if (namelist[0].n_type == 0) {
- if (kvm_nlist(kd, namelist)) {
- nlisterr(namelist);
- return(0);
- }
- }
-
fetchuvmexp();
pgwidth = (int)(floor(log10((double)uvmexp.npages)) + 1);
kbwidth = (int)(floor(log10(uvmexp.npages * getpagesize() / 1024.0)) +