[Midnightbsd-cvs] src [8485] trunk/usr.bin/nfsstat/nfsstat.c: add a -m option to nfsstat
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Sep 18 18:35:04 EDT 2016
Revision: 8485
http://svnweb.midnightbsd.org/src/?rev=8485
Author: laffer1
Date: 2016-09-18 18:35:04 -0400 (Sun, 18 Sep 2016)
Log Message:
-----------
add a -m option to nfsstat
Modified Paths:
--------------
trunk/usr.bin/nfsstat/nfsstat.c
Modified: trunk/usr.bin/nfsstat/nfsstat.c
===================================================================
--- trunk/usr.bin/nfsstat/nfsstat.c 2016-09-18 22:34:10 UTC (rev 8484)
+++ trunk/usr.bin/nfsstat/nfsstat.c 2016-09-18 22:35:04 UTC (rev 8485)
@@ -107,14 +107,36 @@
int ch;
char *memf, *nlistf;
char errbuf[_POSIX2_LINE_MAX];
+ int mntlen, i;
+ char buf[1024];
+ struct statfs *mntbuf;
+ struct nfscl_dumpmntopts dumpmntopts;
interval = 0;
memf = nlistf = NULL;
- while ((ch = getopt(argc, argv, "cesWM:N:ow:z")) != -1)
+ while ((ch = getopt(argc, argv, "cesWM:mN:ow:z")) != -1)
switch(ch) {
case 'M':
memf = optarg;
break;
+ case 'm':
+ /* Display mount options for NFS mount points. */
+ mntlen = getmntinfo(&mntbuf, MNT_NOWAIT);
+ for (i = 0; i < mntlen; i++) {
+ if (strcmp(mntbuf->f_fstypename, "nfs") == 0) {
+ dumpmntopts.ndmnt_fname =
+ mntbuf->f_mntonname;
+ dumpmntopts.ndmnt_buf = buf;
+ dumpmntopts.ndmnt_blen = sizeof(buf);
+ if (nfssvc(NFSSVC_DUMPMNTOPTS,
+ &dumpmntopts) >= 0)
+ printf("%s on %s\n%s\n",
+ mntbuf->f_mntfromname,
+ mntbuf->f_mntonname, buf);
+ }
+ mntbuf++;
+ }
+ exit(0);
case 'N':
nlistf = optarg;
break;
@@ -646,7 +668,7 @@
usage(void)
{
(void)fprintf(stderr,
- "usage: nfsstat [-ceoszW] [-M core] [-N system] [-w wait]\n");
+ "usage: nfsstat [-cemoszW] [-M core] [-N system] [-w wait]\n");
exit(1);
}
More information about the Midnightbsd-cvs
mailing list