From b698093da430bb25ee2cdf6346472aac91559b25 Mon Sep 17 00:00:00 2001 From: Yan-Hao Wang Date: Sat, 12 Oct 2024 23:17:23 +0800 Subject: [PATCH] nfsstat(1): Complete libxo transition Reviewed by: des MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D41428 --- usr.bin/nfsstat/nfsstat.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/usr.bin/nfsstat/nfsstat.c b/usr.bin/nfsstat/nfsstat.c index 55f5573662c7..20472cf4a129 100644 --- a/usr.bin/nfsstat/nfsstat.c +++ b/usr.bin/nfsstat/nfsstat.c @@ -83,7 +83,6 @@ #include #include #include -#include #include @@ -168,7 +167,7 @@ main(int argc, char **argv) mntbuf->f_mntfromname, mntbuf->f_mntonname, buf); else if (errno == EPERM) - errx(1, "Only privileged users" + xo_errx(1, "Only privileged users" " can use the -m option"); } mntbuf++; @@ -241,7 +240,8 @@ main(int argc, char **argv) xo_close_container("nfsstat"); } - xo_finish(); + if (xo_finish() < 0) + xo_err(1, "stdout"); exit(0); } @@ -505,8 +505,7 @@ printhdr(int clientOnly, int serverOnly, int newStats) static void usage(void) { - (void)fprintf(stderr, - "usage: nfsstat [-cdEemqszW] [-w wait]\n"); + xo_error("usage: nfsstat [-cdEemqszW] [-w wait]\n"); exit(1); } @@ -1131,7 +1130,7 @@ exp_sidewaysintpr(u_int interval, int clientOnly, int serverOnly, ext_nfsstatsp = &lastst; ext_nfsstatsp->vers = NFSSTATS_V1; if (nfssvc(NFSSVC_GETSTATS | NFSSVC_NEWSTRUCT, ext_nfsstatsp) < 0) - err(1, "Can't get stats"); + xo_err(1, "Can't get stats"); clock_gettime(CLOCK_MONOTONIC, &lastts); compute_totals(&lasttotal, ext_nfsstatsp); sleep(interval); @@ -1141,7 +1140,7 @@ exp_sidewaysintpr(u_int interval, int clientOnly, int serverOnly, ext_nfsstatsp->vers = NFSSTATS_V1; if (nfssvc(NFSSVC_GETSTATS | NFSSVC_NEWSTRUCT, ext_nfsstatsp) < 0) - err(1, "Can't get stats"); + xo_err(1, "Can't get stats"); clock_gettime(CLOCK_MONOTONIC, &ts); if (--hdrcnt == 0) {