Skip to content

Instantly share code, notes, and snippets.

@tuxillo
Created June 18, 2014 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuxillo/b16e5e75ef67bbfa47e9 to your computer and use it in GitHub Desktop.
Save tuxillo/b16e5e75ef67bbfa47e9 to your computer and use it in GitHub Desktop.
diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c
index 147d743..e6eb301 100644
--- a/usr.bin/systat/vmstat.c
+++ b/usr.bin/systat/vmstat.c
@@ -144,8 +144,6 @@ static struct nlist namelist[] = {
{ .n_name = "_inactivevnodes" },
#define X_ACTIVEVNODES 5
{ .n_name = "_activevnodes" },
-#define X_NUMDIRTYBUFFERS 6
- { .n_name = "_dirtybufspace" },
{ .n_name = "" },
};
@@ -828,12 +826,17 @@ getinfo(struct Info *ls)
NREAD(X_INACTIVEVNODES, &ls->inactivevnodes,
sizeof(ls->inactivevnodes));
NREAD(X_ACTIVEVNODES, &ls->activevnodes, sizeof(ls->activevnodes));
- NREAD(X_NUMDIRTYBUFFERS, &ls->dirtybufspace, sizeof(ls->dirtybufspace));
if (nintr) {
size = nintr * sizeof(ls->intrcnt[0]);
sysctlbyname("hw.intrcnt_all", ls->intrcnt, &size, NULL, 0);
}
+ size = sizeof(ls->dirtybufspace);
+ if (sysctlbyname("vfs.dirtybufspace", &ls->dirtybufspace, &size,
+ NULL, 0) < 0) {
+ error("Can't get kernel info: %s\n", strerror(errno));
+ bzero(&ls->dirtybufspace, sizeof(ls->dirtybufspace));
+ }
size = sizeof(ls->Total);
if (sysctlbyname("vm.vmtotal", &ls->Total, &size, NULL, 0) < 0) {
error("Can't get kernel info: %s\n", strerror(errno));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment