git: b698093da430 - main - nfsstat(1): Complete libxo transition
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 12 Oct 2024 18:30:21 UTC
The branch main has been updated by lwhsu:
URL: https://cgit.FreeBSD.org/src/commit/?id=b698093da430bb25ee2cdf6346472aac91559b25
commit b698093da430bb25ee2cdf6346472aac91559b25
Author: Yan-Hao Wang <yanhaowang@FreeBSD.org>
AuthorDate: 2024-10-12 15:17:23 +0000
Commit: Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2024-10-12 18:21:47 +0000
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 <string.h>
#include <paths.h>
#include <devstat.h>
-#include <err.h>
#include <libxo/xo.h>
@@ -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) {