History log of /freebsd-current/bin/df/df.c
Revision Date Author Comments
# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix


# 90aea514 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# c9685984 17-Jan-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

df: Return non-zero status on write failure.

While here, complete the libxo conversion and switch return value to standard constants.

MFC after: 1 week
Sponsored by: Klara, Inc.
Differential revision: https://reviews.freebsd.org/D38097


# 2eee44bd 10-Mar-2022 Baptiste Daroussin <bapt@FreeBSD.org>

df: do not report a 100% full inode usage on fs without inodes

Before:
devfs 2 2 0 100% 0 0 100% /dev

After:
devfs 2 2 0 100% 0 0 - /dev

The previous behaviour was confusing for end users and many monitoring tools

Note the linux df tools is also using the same syntax '-' for such filesystem

MFC After: 2 weeks
Reviewed by: manu, emaste, imp
Differential Revision: https://reviews.freebsd.org/D34515


# f0fd4a32 10-Feb-2022 Stefan Eßer <se@FreeBSD.org>

bin/df: allow -t option to be used together with -l

The df command provides a -l option to exclude all non-local file
systems and a -t option with a (positive or negative) list of file
system types to display.

This commit adds support for a combination of -l and -t. If both are
specified, the parameter list of the -t option is applied on top of
the selection of öocal file systems (independently of the order of
the -l and -t options).

E.g., "df -t noprocfs,sysfs -l" will select all local file systems
except those of type procfs and sysfs.

PR: 260921
Approved by: imp
Relnotes: yes
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D33748


# 570b31f6 20-Jul-2021 Mateusz Guzik <mjg@FreeBSD.org>

df: remove the unused fstype var

Found with cc --analyze

Sponsored by: Rubicon Communications, LLC ("Netgate")


# 1740c2db 13-Nov-2020 Mark Johnston <markj@FreeBSD.org>

df: Remove support for mounting devices

This was marked deprecated in r329092, over two and a half years ago.
This functionality is also buggy per PR 237368.

PR: 237368
Reviewed by: brooks, cem, emaste, imp
Differential Revision: https://reviews.freebsd.org/D27197


# e3e94324 09-Feb-2018 Brooks Davis <brooks@FreeBSD.org>

Add a deprecation warning when using the feature which mounts devices
to see how much space it on them.

Adjust MOUNT_CHAR_DEVS to allow the free space of already mounted
devices to be displayed and report an appropriate error if the
device isn't mounted.

Reviewed by: cem
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D8801


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# d0bc27e4 08-Aug-2017 Kyle Evans <kevans@FreeBSD.org>

df(1): Add --si as an alias for -H

Reviewed by: cem (earlier version), emaste
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D11749


# dfde8e4b 12-Jun-2017 Phil Shafer <phil@FreeBSD.org>

Use {T:Capacity} for header so html output looks tidy

Submitted by: phil
Approved by: sjg


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# facc3cb0 14-Dec-2016 Brooks Davis <brooks@FreeBSD.org>

Use nmount(2) rather than the obsolete mount(2).

Reviewed by: cem
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D8513


# 9dad1250 14-Dec-2016 Brooks Davis <brooks@FreeBSD.org>

Mount filesystems without executable permissions since they should never
be used.

Reviewed by: cem
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D8513


# 176d3efd 14-Dec-2016 Brooks Davis <brooks@FreeBSD.org>

Put the undocumented df feature of mounting filesystems from device nodes
under an ifdef. Leave enabled.

Reviewed by: cem
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D8513


# 246ef54f 31-Aug-2016 Conrad Meyer <cem@FreeBSD.org>

df(1): Allow duplicate -l flags gracefully

Rather than producing a misleading error message when duplicate -l flags are
provided to df(1), simply ignore extra flags and proceed as if only one was
specified. This seems most reasonable given the usage for -l:

-l Only display information about locally-mounted file systems.

l and t flags still conflict, as before.

PR: 208169
Reported by: by at reorigin.com
Reviewed by: allanjude


# d5183594 27-Aug-2015 Xin LI <delphij@FreeBSD.org>

Use exit() instead of return in main().

MFC after: 2 weeks


# b6ff8745 06-Nov-2014 Marcel Moolenaar <marcel@FreeBSD.org>

Convert to use libxo.

Obtained from: Phil Shafer <phil@juniper.net>
Sponsored by: Juniper Networks, Inc.


# e83643f4 25-Apr-2013 Ulrich Spörlein <uqs@FreeBSD.org>

Don't appease clang static analyzer after all and roll back
the free(3) of mntbuf ... again. There's no point in doing
useless extra work when we're about to exit.

See also r240565.

Not reading file history: uqs


# 11ed25f2 19-Apr-2013 Ulrich Spörlein <uqs@FreeBSD.org>

bin/df: Fix unitialized use in prtstat

While here:
- use NULL in the context of pointers
- use memset instead of bzero throughout the file
- free memory to appease clang static analyzer

Found by: Coverity Scan (the UNINIT one)


# 7eb55d4d 23-Jan-2013 Xin LI <delphij@FreeBSD.org>

- Wrap long line;
- Add -, to SYNOPSIS section.

MFC after: 2 weeks


# 6b7aceb8 11-Dec-2012 Greg Lehey <grog@FreeBSD.org>

Handle large negative block counts correctly.

MFC after: 2 weeks


# 71cfc678 15-Nov-2012 Greg Lehey <grog@FreeBSD.org>

Update man pages and clarify a number of options.
Rework block count calculations to work correctly with small "block" sizes.

MFC after: 14 days


# 019e4a53 14-Nov-2012 Greg Lehey <grog@FreeBSD.org>

Add , (comma) option to print sizes grouped and separated by thousands
using the non-monetary separator returned by localeconv(3), typically
a comma or period.

MFC after: 14 days


# 65e415b1 16-Sep-2012 Eitan Adler <eadler@FreeBSD.org>

Revert 240527:
mntbuf can poit to memory allocated by getmntinfo(3) which can't be freed

PR: bin/171634
Approved by: cperciva (implicit)


# c5c62e59 14-Sep-2012 Eitan Adler <eadler@FreeBSD.org>

Free memory before exiting in order to
help tools understand that we're not leaking it.

PR: bin/171634
Submitted by: Erik Cederstrand <erik@cederstrand.dk>
Approved by: cperciva
MFC after: 3 days


# 7b0514fa 18-Oct-2011 Dag-Erling Smørgrav <des@FreeBSD.org>

Simplify df(1) by factoring out most of the common code:

- In the argc == 0 case, just populate the mount list as before, but
do not calculate widths, update totals or print anything.

- In the argv > 0 case, collect information about the requested file
systems and store it in the mount list, but do not calculate
widths, update totals or print anything.

- In either case, once all the information has been collected,
iterate once through the mount list to calculate widths and totals,
then once more to print everything.

This also fixes two bugs: firstly, column widths were not calculated
correctly if more than one file system was specified on the command
line; and secondly, file systems with MNT_IGNORE were included in the
totals even if -a was not specified.

Noticed by: Paul Schenkeveld
MFC after: 3 weeks


# 6bccea7c 21-Feb-2011 Rebecca Cran <brucec@FreeBSD.org>

Fix typos - remove duplicate "the".

PR: bin/154928
Submitted by: Eitan Adler <lists at eitanadler.com>
MFC after: 3 days


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 431586a8 23-Jun-2009 Xin LI <delphij@FreeBSD.org>

Staticify internal routines.


# b93ce3b7 07-Jun-2009 Simon L. B. Nielsen <simon@FreeBSD.org>

Make "human-readable" (-H/-h) output also "humanize" inode counts.
Base 10 is always used for the inode counts as I could not think of any
reason base 2 inode counts would be useful.

Minor mdoc markup fix to df(1) while here anyway.

MFC after: 3 weeks


# b56ca465 23-Nov-2008 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Implement -T option as found in Linux df(1). When given, file system type
will be included in output.

Reviewed and tested by: keramida
MFC after: 2 weeks


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 2966d28c 03-Jul-2007 Sean Farley <scf@FreeBSD.org>

Significantly reduce the memory leak as noted in BUGS section for
setenv(3) by tracking the size of the memory allocated instead of using
strlen() on the current value.

Convert all calls to POSIX from historic BSD API:
- unsetenv returns an int.
- putenv takes a char * instead of const char *.
- putenv no longer makes a copy of the input string.
- errno is set appropriately for POSIX. Exceptions involve bad environ
variable and internal initialization code. These both set errno to
EFAULT.

Several patches to base utilities to handle the POSIX changes from
Andrey Chernov's previous commit. A few I re-wrote to use setenv()
instead of putenv().

New regression module for tools/regression/environ to test these
functions. It also can be used to test the performance.

Bump __FreeBSD_version to 700050 due to API change.

PR: kern/99826
Approved by: wes
Approved by: re (kensmith)


# ba174a5e 01-May-2007 Andrey A. Chernov <ache@FreeBSD.org>

Back out all POSIXified *env() changes.

Not because I admit they are technically wrong and not because of bug
reports (I receive nothing). But because I surprisingly meets so
strong opposition and resistance so lost any desire to continue that.

Anyone who interested in POSIX can dig out what changes and how
through cvs diffs.


# 7c450364 29-Apr-2007 Andrey A. Chernov <ache@FreeBSD.org>

Eliminate error with -W* strict flags and make putenv() calls conforming to
standard in the same way as f.e. gcc internal portable code does.


# 2897dce8 06-Apr-2007 Alexander Kabaev <kan@FreeBSD.org>

getblocksize expects pointer to long as a second argument, not
a pointer to u_long.


# 27f82335 07-Mar-2007 Will Andrews <will@FreeBSD.org>

Fix a bug where the mutual exclusivity of the -l and -t options is not
recognized properly if -l is specified first.

PR: bin/105721
MFC after: 1 week


# df464e43 20-Sep-2006 Christian S.J. Peron <csjp@FreeBSD.org>

Based on The Open Group Base Specifications Issue 6 IEEE Std 1003.1, our
current implementation of df(1) is does not properly format the output under
certain conditions. Right now -kP and -Pk are not the same thing. Further,
when we set the BLOCKSIZE environment variable, we use "1k" instead of "1024",
making the header display incorrectly.

To quote the specification:

"When both the -k and -P options are specified, the following header line
shall be written (in the POSIX locale):

"Filesystem 1024-blocks Used Available Capacity Mounted on\n"

- If -P has been specified, check to make sure that -k has not already been
specified, if so, simply break instead of clobbering the previous blocksize
- Use 1024 instead of 1k to make the header POSIX compliant

Reported by: Andriy Gapon
Discussed with: bde, ru
MFC after: 1 week


# d7c881e8 20-Aug-2006 Warner Losh <imp@FreeBSD.org>

Prefer strlcpy to strncpy. In one case, this saves us from re-zeroing
data that's alreday 0. In another, it saves us from zeroing data that
will be overwritten again.


# 9ddb49cb 10-Jan-2005 Warner Losh <imp@FreeBSD.org>

/*- or .\"- or #- to begin license clauses.


# 239c9e60 20-Jul-2004 Christian S.J. Peron <csjp@FreeBSD.org>

Currently if a mount point is not accessible by the calling user,
invalid information will be printed if the -t flag is specified.

$ df -t ufs
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad0s1a 495726 139944 316124 31% /
/dev/ad0s1e 253678 6438 226946 3% /tmp
/dev/ad0s1f 56206340 13594248 38115586 26% /usr
/dev/ad0s1d 694126 19812 618784 3% /var
/dev/ad0s1d 694126 19812 618784 3% /var
$

Note that the mount point which is not accessible shows
up as the previous file system that was printed. The reason
for this is that df -t will call statfs(2) on the pathname
supplied by getfsstat(2).

This is done to refresh the file system statistics in the
event that a previous file system had a long delay in
providing its stats.

This change affects the df utility in the following ways:
o Teach df has to deal with statfs(2) failing. If statfs(2)
fails, fall back on the possibly stale stats provided by
the initial call to getfsstat(2).
o Print a warning that the fs stats could possibly be stale
o Modify the man page and document this new behavior
as a bug.

Approved by: bmilekic (mentor)
PR: 68165


# 841fe8e8 04-Jun-2004 David Schultz <das@FreeBSD.org>

Convert fsbtoblk() from a macro to a function. The redundant
instances of 64-bit arithmetic were costing 775 bytes, and the
inlining offered no benefit. Moreover, ambiguity as to the argument
types led to the introduction of a bug (see rev 1.56).

Also, remove some casts that are now clearly redundant.

Inspired by: 67467


# 7d3940bb 24-May-2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Use humanize_number(3) to format sizes into a human readable form.


# c6f13844 22-Apr-2004 David E. O'Brien <obrien@FreeBSD.org>

Fix some style issues in rev 1.58.
Use 64-bit integer math vs. mixed FP & integer.
Add -g to the usage().


# cca108e6 22-Apr-2004 David E. O'Brien <obrien@FreeBSD.org>

Fix printing of the "Mounted on" values for 'df -i'.
Fix spacing before "Mounted on" column in general.

Submitted by: bde


# 076419d2 18-Apr-2004 David E. O'Brien <obrien@FreeBSD.org>

Add -c option simular to du(1).

PR: 19635
Submitted by: cyrille.lefevre@laposte.net


# 6195fb41 06-Apr-2004 Mark Murray <markm@FreeBSD.org>

Remove clause 3 from the UCB licenses.

OK'ed by: imp, core


# ae21f5ad 09-Mar-2004 Lukas Ertl <le@FreeBSD.org>

And a bandaid so that the output of "available space" is correct when
using -m and -g switches and "available space" is negative (i.e. when
the file system is already using the root-reserved minimum free space).

Obtained from: Stefan Farfeleder <stefan@fafoe.narf.at>
PR: bin/62536
Submitted by: Peter van Dijk <peter@dataloss.nl>
Approved by: grog (mentor), bde


# 16fc3635 05-Mar-2004 Mark Murray <markm@FreeBSD.org>

Make NULL a (void*)0 whereever possible, and fix the warnings(-Werror)
that this provokes. "Wherever possible" means "In the kernel OR NOT
C++" (implying C).

There are places where (void *) pointers are not valid, such as for
function pointers, but in the special case of (void *)0, agreement
settles on it being OK.

Most of the fixes were NULL where an integer zero was needed; many
of the fixes were NULL where ascii <nul> ('\0') was needed, and a
few were just "other".

Tested on: i386 sparc64


# 0bd9f151 08-Feb-2004 Ian Dowse <iedowse@FreeBSD.org>

Use int rather than size_t storage for printf field widths to avoid
many casts.

Reviewed by: bde


# ea64ad77 12-Nov-2003 Kris Kennaway <kris@FreeBSD.org>

Fix format strings (intmax_t is %jd, not %qd)

Reviewed by: tjr


# fde81c7d 12-Nov-2003 Kirk McKusick <mckusick@FreeBSD.org>

Update the statfs structure with 64-bit fields to allow
accurate reporting of multi-terabyte filesystem sizes.

You should build and boot a new kernel BEFORE doing a `make world'
as the new kernel will know about binaries using the old statfs
structure, but an old kernel will not know about the new system
calls that support the new statfs structure. Running an old kernel
after a `make world' will cause programs such as `df' that do a
statfs system call to fail with a bad system call.

Reviewed by: Bruce Evans <bde@zeta.org.au>
Reviewed by: Tim Robbins <tjr@freebsd.org>
Reviewed by: Julian Elischer <julian@elischer.org>
Reviewed by: the hoards of <arch@freebsd.org>
Sponsored by: DARPA & NAI Labs.


# be2c4e54 13-Sep-2003 David E. O'Brien <obrien@FreeBSD.org>

Be a little bit more correct WRT counting numbers vs. integer numbers.


# 0e7d023f 03-Jun-2003 Bruce Evans <bde@FreeBSD.org>

Fixed exit code in previous commit. "var++" to set a flag to nonzero
is a style bug at best. When the variable isn't a flag, it potentially
overflows after a large number of settings. Here the number of settings
is limited by ARG_MAX, but the variable is the exit code so it became
bogus after the second setting and effectively overflowed to 0 after
approx. 128 settings.

Fixed some style bugs involving comments in and near previous commit.

Clarification of previous commit message: df -t didn't give undefined
behaviour, and the behaviour used to conform perfectly with the man
page, since the buggy behaviour is documented in the BUGS section. -t
just worked when no files or file systems were specified, and was just
ignored if a file or file system was specified.


# c22acefb 02-Jun-2003 Jordan K. Hubbard <jkh@FreeBSD.org>

From the df man page:
-t Only print out statistics for filesystems of the specified types.

Make the behavior of df(1) conform to its man page (behavior is otherwise
undefined).

Submitted by: Rob Braun <bbraun@apple.com>
Obtained from: Apple


# f694b8ad 03-May-2003 Mark Murray <markm@FreeBSD.org>

WARNS cleaning for the Alpha. On alpha, size_t is a long, and it
solicits a warning when used for the '*' in printf("%*d"). Cast
to u_int for universal use.


# b7dbd3e9 03-May-2003 Mark Murray <markm@FreeBSD.org>

Fix a shedload of warnings, some memory leaks and clean up WARNS
and lint. This is now WARNS=9, std=c99 clean on i386.


# 09a80d48 01-May-2003 David E. O'Brien <obrien@FreeBSD.org>

Quiet warnings about copyright[].


# dc474219 30-Dec-2002 Mike Barcroft <mike@FreeBSD.org>

Back out rev 1.44; getbsize(3)'s original interface has been restored.

Approved by: markm


# 0b66b1e8 23-Oct-2002 Mark Murray <markm@FreeBSD.org>

Fix for changed getbsize arg type.


# 55c639b2 25-Aug-2002 Tom Rhodes <trhodes@FreeBSD.org>

Fix 'SYNOPSIS' and 'usage'


# 7d971bbf 21-Aug-2002 Tom Rhodes <trhodes@FreeBSD.org>

s/filesystem/file system/ as discussed on -developers


# 5965373e 10-Aug-2002 Maxime Henrion <mux@FreeBSD.org>

- Introduce a new struct xvfsconf, the userland version of struct vfsconf.
- Make getvfsbyname() take a struct xvfsconf *.
- Convert several consumers of getvfsbyname() to use struct xvfsconf.
- Correct the getvfsbyname.3 manpage.
- Create a new vfs.conflist sysctl to dump all the struct xvfsconf in the
kernel, and rewrite getvfsbyname() to use this instead of the weird
existing API.
- Convert some {set,get,end}vfsent() consumers to use the new vfs.conflist
sysctl.
- Convert a vfsload() call in nfsiod.c to kldload() and remove the useless
vfsisloadable() and endvfsent() calls.
- Add a warning printf() in vfs_sysctl() to tell people they are using
an old userland.

After these changes, it's possible to modify struct vfsconf without
breaking the binary compatibility. Please note that these changes don't
break this compatibility either.

When bp will have updated mount_smbfs(8) with the patch I sent him, there
will be no more consumers of the {set,get,end}vfsent(), vfsisloadable()
and vfsload() API, and I will promptly delete it.


# 5eb43ac2 29-Jun-2002 David E. O'Brien <obrien@FreeBSD.org>

Consistently use __FBSDID


# 85ed9333 18-May-2002 Ian Dowse <iedowse@FreeBSD.org>

Unconditionally update the maximum field width statistics when we
refetch the filesystem information in MNT_WAIT mode. This avoids
incorrect column alignment that sometimes occurs with NFS filesystems.

Submitted by: Ian <freebsd@damnhippie.dyndns.org>


# 532aff98 12-May-2002 Poul-Henning Kamp <phk@FreeBSD.org>

Remove the private code for reading UFS superblocks, this does not belong
in df(1) when we have multiple filesystem types, and the complications of
handling UFS2 pushes this over the edge.

Use the .../mount/extern.h to get prototypes of the functions we
borrow from there. Constify things to match. (why aren't these
functions in a lib anyway ?)

Make everything static and set WARNS?=5.

The way the "df diskdevice" thing works for unmounted diskdevices
is not very general.

Sponsored by: DARPA & NAI Labs.


# 62edbd31 26-Mar-2002 Ian Dowse <iedowse@FreeBSD.org>

Make the columns in the output of df(1) line up, even for very large
filesystems. We now keep track of the maximum width required for
every variable-width field instead of just the first one.

PR: bin/15510
MFC after: 1 week


# 39661e26 22-Feb-2002 Mark Murray <markm@FreeBSD.org>

Warnings fixes inspired by lint, a commercial lint and WARNS=4.


# f9bcb0be 01-Feb-2002 Warner Losh <imp@FreeBSD.org>

o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
they already are.

Approved by: arch@, new style(9)


# cf5b29e1 19-Dec-2001 Ruslan Ermilov <ru@FreeBSD.org>

Make ``df -l'' work when no network filesystems are loaded.

PR: bin/32397


# 7b3a12a8 11-Dec-2001 Philippe Charnier <charnier@FreeBSD.org>

Do not dot terminate errx() strings


# 7ed17c0f 31-Jul-2001 David E. O'Brien <obrien@FreeBSD.org>

Remove a misplaced space.


# a067aece 16-Jul-2001 Garrett Wollman <wollman@FreeBSD.org>

Fix style bugs introduced by rev 1.28. No functional changes.


# cc66540e 05-Jun-2001 Jacques Vidrine <nectar@FreeBSD.org>

Add parens to get the cast that was meant in previous commit.
While we're at it, this file seems to prefer `unsigned int'
over `u_int', so go with that.


# b3e8643f 05-Jun-2001 Matt Jacob <mjacob@FreeBSD.org>

Wrong. The size of size_t is *not* the same as the size of an integer.

MFC after: 2 weeks


# a25695c3 04-Jun-2001 Jim Pirzyk <pirzyk@FreeBSD.org>

Added the -l option to df, so to be compatable with other unicies.

PR: bin/27240
Reviewed by: GAWollman
MFC after: 2 weeks


# a95a13bb 19-May-2001 Kris Kennaway <kris@FreeBSD.org>

BDECFLAGS cleanup (modulo long long issues). Add WARNS. Tested on alpha.

Reviewed by: the great man himself (except alpha cleanups)


# f3895a82 09-May-2001 Kris Kennaway <kris@FreeBSD.org>

Fix operation of df on unmounted filesystems, and add the ability to run df
on unmounted non-UFS filesystem using '-t'

Submitted by: bde


# e78527c4 08-May-2001 Kris Kennaway <kris@FreeBSD.org>

GC some dead code relating to running df on unmounted block devices,
and remove the setgid operator bit from the installed binary: if you want
to view free disk space on an unmounted device, you should have read
permissions to access it.

Reviewed by: phk


# 93a3fa19 03-Jun-2000 John W. De Boskey <jwd@FreeBSD.org>

Add -g for gigabyte sizes.

Approved by: jkh


# dd6d33e8 14-Dec-1999 Michael Haro <mharo@FreeBSD.org>

add human readable output (-h and -H)

Obtained from: parts of human readable code from OpenBSD
Reviewed by: obrien

add POSIX, byte and megabyte block size ouput flags

PR: 13579 (POSIX flag)
Submitted by: Mike Meyer <mwm@phone.net>


# 5b42dac8 31-Oct-1999 Julian Elischer <julian@FreeBSD.org>

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>


# 2a456239 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# dd4cdf58 15-Dec-1998 Peter Wemm <peter@FreeBSD.org>

Cleaning out old stuff from one of my source trees:
use mkdtemp() rather than mktemp() and fix a trivial memory leak.


# 80214f04 13-Oct-1997 Joerg Wunsch <joerg@FreeBSD.org>

Style police: keep a variable list in alphabetical order, and add
pointless paren's to return statements.

Nitpicked by: bde :)


# b8904f2a 12-Oct-1997 Joerg Wunsch <joerg@FreeBSD.org>

Make df(1) exit with non-success status if something went wrong.

PR: bin/4415


# 16cc192a 07-Aug-1997 Steve Price <steve@FreeBSD.org>

Add Bruce's _NEW_VFSCONF flag to make this compile cleanly and
sccsid -> rcsid.


# 93ef08af 28-Mar-1997 Warner Losh <imp@FreeBSD.org>

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


# a78192e3 13-Mar-1997 Bruce Evans <bde@FreeBSD.org>

Merged from Lite2. The -t option is now handled better. The only visible
change should be that the usage message now actually matches the man page.


# 9408216e 10-Mar-1997 Guido van Rooij <guido@FreeBSD.org>

This is a funny one: df for a device that was not mounted used to fail
for root only.


# b97fa2ef 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# faa69d1a 17-Feb-1997 Bruce Evans <bde@FreeBSD.org>

Attempt to import Lite2's df.


# 0e2dcf57 16-Feb-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Include <ufs/ufs/ufsmount.h>.


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 8a166df9 13-Dec-1996 Steve Price <steve@FreeBSD.org>

Merge Lite2 mods, cleanup man page, and -Wall cleaning.


# 2ffc1ec6 11-Dec-1996 Jordan K. Hubbard <jkh@FreeBSD.org>

The manual page of df called cd9660 file systems by the name
isofs while the df command itself used the name iso9660fs or
cdfs. Both of these were inconsistent with the name cd9660 which
is used by the mount command. I modified df to recognize all of
the names cd9660, cdfs, isofs, and iso9660fs, and take them all
to refer to the same thing. Naturally I added a note of this
behaviour in the manual page too.

Submitted-By: Jukka Ukkonen <jau@jau.csc.fi>


# 51ea8b57 14-Jan-1996 Bruce Evans <bde@FreeBSD.org>

Partially fixed negative and truncated "Avail" counts in df output.
This fixes PR943.

ffs/ffs_vfsops.c:
ffs_statfs() multiplied by (100 - minfree) as part of calculating the
minfree percentage (complemented in 100%), so with the standard minfree
of 8, it was broken for file systems of size >= 1TB/92 = 11GB. Use the
standard freespace() macro instead. This also fixes a rounding bug (the
"Avail" count was sometimes 1 too small).

ffs/* (not fixed):
The freespace() macro multiplies by minfree, so with the standard
minfree of 8, it is broken for file systems of size >= 1TB/8 = 128GB.
This bug is more serious since it affects block allocation.

ffs/ffs_alloc.c (not fixed):
Ordinary users are sometimes allowed to allocate 1 (partial) block
too many so that the "Avail" count goes negative. E.g., if there is
1 fragment available and the file is fairly large, one more full
block is allocated.

df/df.c:
ufs_df() used/uses essentially the same code as ffs_statfs(), so it
had/has the same bugs.

ufs_df() gratuitously replaced "Avail" counts of < 0 by 0, so it
gave different results for non-mounted file systems in this case.


# 2162b2d2 29-May-1995 Rodney W. Grimes <rgrimes@FreeBSD.org>

Remove trailing whitespace.

Reviewed by: phk


# 0fd510b7 19-Mar-1995 Joerg Wunsch <joerg@FreeBSD.org>

You will find enclosed some changes to make gcc -Wall more happy in
/usr/src/bin. Note that some patches are still needed in that directory.

I (Joerg) finished most of Philippe's cleanup. /bin/sh will still
need *allot* of work, however.

Submitted by: charnier@lirmm.fr (Philippe Charnier)


# 89730b29 23-Sep-1994 David Greenman <dg@FreeBSD.org>

Added $Id$


# 9d4081ee 12-Aug-1994 David Greenman <dg@FreeBSD.org>

The last commit was bogus...the putenv doesn't affect the parent process,
so the BLOCKSIZE doesn't need to be preserved.
Also initialized the flags variables, and used 1k instead of 1024 for
BLOCKSIZE.


# ebf93438 12-Aug-1994 David Greenman <dg@FreeBSD.org>

Implemented the -k flag more properly...don't destroy the user's setting
of the BLOCKSIZE environment variable.


# 7f0eabfd 10-Aug-1994 Garrett Wollman <wollman@FreeBSD.org>

Gimme back my `-k' option!
Also document `-t' option in the usage message.


# 4b88c807 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite bin Sources