[Midnightbsd-cvs] src [11342] trunk/bin/df/df.c: sync with freebsd
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Thu Jul 5 15:05:30 EDT 2018
Revision: 11342
http://svnweb.midnightbsd.org/src/?rev=11342
Author: laffer1
Date: 2018-07-05 15:05:29 -0400 (Thu, 05 Jul 2018)
Log Message:
-----------
sync with freebsd
Modified Paths:
--------------
trunk/bin/df/Makefile
trunk/bin/df/df.1
trunk/bin/df/df.c
Property Changed:
----------------
trunk/bin/df/df.1
Modified: trunk/bin/df/Makefile
===================================================================
--- trunk/bin/df/Makefile 2018-07-05 19:04:52 UTC (rev 11341)
+++ trunk/bin/df/Makefile 2018-07-05 19:05:29 UTC (rev 11342)
@@ -1,6 +1,6 @@
+# $MidnightBSD$
# @(#)Makefile 8.3 (Berkeley) 5/8/95
-# $FreeBSD: src/bin/df/Makefile,v 1.18 2004/05/24 22:21:49 pjd Exp $
-# $MidnightBSD$
+# $FreeBSD: stable/10/bin/df/Makefile 310380 2016-12-21 23:59:58Z brooks $
MOUNT= ${.CURDIR}/../../sbin/mount
.PATH: ${MOUNT}
@@ -10,6 +10,9 @@
CFLAGS+= -I${MOUNT}
+CFLAGS+= -DMOUNT_CHAR_DEVS
+SRCS+= getmntopts.c
+
DPADD= ${LIBUTIL}
LDADD= -lutil
Modified: trunk/bin/df/df.1
===================================================================
--- trunk/bin/df/df.1 2018-07-05 19:04:52 UTC (rev 11341)
+++ trunk/bin/df/df.1 2018-07-05 19:05:29 UTC (rev 11342)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\"-
.\" Copyright (c) 1989, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -27,10 +28,9 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)df.1 8.3 (Berkeley) 5/8/95
-.\" $FreeBSD: src/bin/df/df.1,v 1.42.2.1 2009/08/03 08:13:06 kensmith Exp $
-.\" $MidnightBSD: src/bin/df/df.1,v 1.4 2010/03/27 21:46:55 laffer1 Exp $
+.\" $FreeBSD: stable/10/bin/df/df.1 260947 2014-01-20 23:23:29Z wblock $
.\"
-.Dd January 24, 2013
+.Dd January 16, 2014
.Dt DF 1
.Os
.Sh NAME
@@ -84,13 +84,13 @@
This overrides any
.Ev BLOCKSIZE
specification from the environment.
-.It Fl H
+.It Fl h
.Dq Human-readable
output.
Use unit suffixes: Byte, Kibibyte, Mebibyte, Gibibyte, Tebibyte and
Pebibyte (based on powers of 1024) in order to reduce the number of
digits to four or fewer.
-.It Fl h
+.It Fl H
.Dq Human-readable
output.
Use unit suffixes: Byte, Kilobyte, Megabyte,
@@ -188,9 +188,7 @@
.El
.Sh SEE ALSO
.Xr lsvfs 1 ,
-.Xr pstat 1 ,
.Xr quota 1 ,
-.Xr swapinfo 1 ,
.Xr fstatfs 2 ,
.Xr getfsstat 2 ,
.Xr statfs 2 ,
@@ -199,7 +197,9 @@
.Xr localeconv 3 ,
.Xr fstab 5 ,
.Xr mount 8 ,
-.Xr quot 8 .
+.Xr pstat 8 ,
+.Xr quot 8 ,
+.Xr swapinfo 8
.Sh STANDARDS
With the exception of most options,
the
Property changes on: trunk/bin/df/df.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/bin/df/df.c
===================================================================
--- trunk/bin/df/df.c 2018-07-05 19:04:52 UTC (rev 11341)
+++ trunk/bin/df/df.c 2018-07-05 19:05:29 UTC (rev 11342)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1980, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -44,17 +45,21 @@
#endif /* not lint */
#endif
#include <sys/cdefs.h>
-/* $FreeBSD: src/bin/df/df.c,v 1.74.2.1 2009/08/03 08:13:06 kensmith Exp $ */
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/bin/df/df.c 310380 2016-12-21 23:59:58Z brooks $");
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <sys/sysctl.h>
+#ifdef MOUNT_CHAR_DEVS
#include <ufs/ufs/ufsmount.h>
+#endif
#include <err.h>
#include <libutil.h>
#include <locale.h>
+#ifdef MOUNT_CHAR_DEVS
+#include <mntopts.h>
+#endif
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -98,7 +103,9 @@
static int aflag = 0, cflag, hflag, iflag, kflag, lflag = 0, nflag, Tflag;
static int thousands;
+#ifdef MOUNT_CHAR_DEVS
static struct ufs_args mdev;
+#endif
int
main(int argc, char *argv[])
@@ -107,11 +114,21 @@
struct statfs statfsbuf, totalbuf;
struct maxwidths maxwidths;
struct statfs *mntbuf;
+#ifdef MOUNT_CHAR_DEVS
+ struct iovec *iov = NULL;
+#endif
const char *fstype;
- char *mntpath, *mntpt;
+#ifdef MOUNT_CHAR_DEVS
+ char *mntpath;
+ char errmsg[255] = {0};
+#endif
+ char *mntpt;
const char **vfslist;
int i, mntsize;
int ch, rv;
+#ifdef MOUNT_CHAR_DEVS
+ int iovlen = 0;
+#endif
fstype = "ufs";
(void)setlocale(LC_ALL, "");
@@ -216,6 +233,7 @@
rv = 1;
continue;
}
+#ifdef MOUNT_CHAR_DEVS
} else if (S_ISCHR(stbuf.st_mode)) {
if ((mntpt = getmntpt(*argv)) == NULL) {
mdev.fspec = *argv;
@@ -232,9 +250,23 @@
free(mntpath);
continue;
}
- if (mount(fstype, mntpt, MNT_RDONLY,
- &mdev) != 0) {
- warn("%s", *argv);
+ if (iov != NULL)
+ free_iovec(&iov, &iovlen);
+ build_iovec_argf(&iov, &iovlen, "fstype", "%s",
+ fstype);
+ build_iovec_argf(&iov, &iovlen, "fspath", "%s",
+ mntpath);
+ build_iovec_argf(&iov, &iovlen, "from", "%s",
+ *argv);
+ build_iovec(&iov, &iovlen, "errmsg", errmsg,
+ sizeof(errmsg));
+ if (nmount(iov, iovlen,
+ MNT_RDONLY|MNT_NOEXEC) < 0) {
+ if (errmsg[0])
+ warn("%s: %s", *argv,
+ errmsg);
+ else
+ warn("%s", *argv);
rv = 1;
(void)rmdir(mntpt);
free(mntpath);
@@ -253,6 +285,7 @@
free(mntpath);
continue;
}
+#endif
} else
mntpt = *argv;
@@ -297,7 +330,7 @@
prtstat(&mntbuf[i], &maxwidths);
if (cflag)
prtstat(&totalbuf, &maxwidths);
- return (rv);
+ exit(rv);
}
static char *
More information about the Midnightbsd-cvs
mailing list