From 447e6dc34bf998d4b64dffd624e4baa3299789b6 Mon Sep 17 00:00:00 2001 From: rmacklem Date: Wed, 18 May 2011 01:26:08 +0000 Subject: [PATCH] MFC: r221440 Fix nfsstat.c so that the "-z" option works for the new NFS subsystem. git-svn-id: svn://svn.freebsd.org/base/stable/8@222045 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- usr.bin/nfsstat/nfsstat.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/usr.bin/nfsstat/nfsstat.c b/usr.bin/nfsstat/nfsstat.c index a1b162b7f..7f5224ef9 100644 --- a/usr.bin/nfsstat/nfsstat.c +++ b/usr.bin/nfsstat/nfsstat.c @@ -164,10 +164,7 @@ main(int argc, char **argv) if (run_v4 != 0 && modfind("nfscommon") < 0) errx(1, "experimental client/server not loaded"); - if (run_v4 != 0) { - if (nfssvc(NFSSVC_GETSTATS, &ext_nfsstats) < 0) - err(1, "Can't get stats"); - } else if (nlistf != NULL || memf != NULL) { + if (run_v4 == 0 && (nlistf != NULL || memf != NULL)) { deadkernel = 1; if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, @@ -549,7 +546,17 @@ sperc2(int ttl, int misses) void exp_intpr(int clientOnly, int serverOnly) { - + int nfssvc_flag; + + nfssvc_flag = NFSSVC_GETSTATS; + if (zflag != 0) { + if (clientOnly != 0) + nfssvc_flag |= NFSSVC_ZEROCLTSTATS; + if (serverOnly != 0) + nfssvc_flag |= NFSSVC_ZEROSRVSTATS; + } + if (nfssvc(nfssvc_flag, &ext_nfsstats) < 0) + err(1, "Can't get stats"); if (clientOnly != 0) { if (printtitle) { printf("Client Info:\n"); -- 2.45.0