summaryrefslogtreecommitdiffstats
path: root/bin/df/df.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1999-11-01 04:57:43 +0000
committerjulian <julian@FreeBSD.org>1999-11-01 04:57:43 +0000
commit88e6664e72dd70106a567d5644fe4590706802da (patch)
tree59d58b9cf9f4963300c5cddeda44d525a49bdc94 /bin/df/df.c
parent5b57e9c591261e0fbaa6abc2d4926227d2c2b322 (diff)
downloadFreeBSD-src-88e6664e72dd70106a567d5644fe4590706802da.zip
FreeBSD-src-88e6664e72dd70106a567d5644fe4590706802da.tar.gz
Most modern OSs have the ability to flag certain mounts as ones to
be ignored by default by the df(1) program. This is used mostly to avoid stat()-ing entries that do not represent "real" disk mount points (such as those made by an automounter such as amd.) It is also useful not to have to stat() these entries because it takes longer to report them that for other file systems, being that these mount points are served by a user-level file server and resulting in several context switches. Worse, if the automounter is down unexpectedly, a causal df(1) will hang in an interruptible way. PR: kern/9764 Submitted by: Erez Zadok <ezk@cs.columbia.edu>
Diffstat (limited to 'bin/df/df.c')
-rw-r--r--bin/df/df.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/bin/df/df.c b/bin/df/df.c
index b402efd..ebe9d84 100644
--- a/bin/df/df.c
+++ b/bin/df/df.c
@@ -73,7 +73,7 @@ void prtstat __P((struct statfs *, int));
int ufs_df __P((char *, int));
void usage __P((void));
-int iflag, nflag;
+int aflag = 0, iflag, nflag;
struct ufs_args mdev;
int
@@ -88,8 +88,11 @@ main(argc, argv)
char *mntpt, *mntpath, **vfslist;
vfslist = NULL;
- while ((ch = getopt(argc, argv, "iknt:")) != -1)
+ while ((ch = getopt(argc, argv, "aiknt:")) != -1)
switch (ch) {
+ case 'a':
+ aflag = 1;
+ break;
case 'i':
iflag = 1;
break;
@@ -130,8 +133,10 @@ main(argc, argv)
maxwidth = width;
}
}
- for (i = 0; i < mntsize; i++)
- prtstat(&mntbuf[i], maxwidth);
+ for (i = 0; i < mntsize; i++) {
+ if (aflag || (mntbuf[i].f_flags & MNT_IGNORE) == 0)
+ prtstat(&mntbuf[i], maxwidth);
+ }
exit(rv);
}
@@ -377,6 +382,6 @@ void
usage()
{
(void)fprintf(stderr,
- "usage: df [-ikn] [-t type] [file | filesystem ...]\n");
+ "usage: df [-aikn] [-t type] [file | filesystem ...]\n");
exit(1);
}
OpenPOWER on IntegriCloud