History log of /openbsd-current/bin/df/df.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.61 01-Jan-2023 millert

Round up fractional percentages, as per POSIX.
From nabijaczleweli, OK deraadt@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.60 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.59 14-Aug-2016 krw

Another %qd -> %lld + (long long) for off_t's.


Revision tags: OPENBSD_6_0_BASE
# 1.58 14-Mar-2016 mmcc

replace __progname with getprogname(3)

from Michal Mazurek, ok tb@


# 1.57 07-Mar-2016 mmcc

simplify print formatting logic, replace exit() in main() with return

from Michal Mazurek, ok tb@


# 1.56 01-Mar-2016 mmcc

tidy up function declarations and definitions

from Michal Mazurek, ok tb@


Revision tags: OPENBSD_5_9_BASE
# 1.55 08-Feb-2016 mmcc

remove needless headers

ok tb@, from Michal Mazurek


# 1.54 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.53 04-Oct-2015 deraadt

df is a tame "stdio rpath" program, the rpath due to getfsstat and statfs.
those two system calls were put into the "rpath" catagory because they
expose pathname information.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.52 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.51 20-May-2014 krw

As suggested by guenther@ and millert@, replace seek+[read|write] with
p[read|write]. Makes the code much clearer by eliminating extra error
checking and verbiage.

No intentional functional change.

Tweaks by and ok guenther@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.50 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.49 16-Mar-2008 otto

actually print the now available large numbers


Revision tags: OPENBSD_4_3_BASE
# 1.48 22-Dec-2007 chl

fix df posix mode bug

from otto@

prompted by otto@ who is aftk for now


# 1.47 02-Sep-2007 deraadt

use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.46 29-Oct-2006 otto

like -i, -h is incompatible with -P; suggested by jmc@; ok ray@


# 1.45 21-Sep-2006 pedro

Remove LFS-related code, no binary change


Revision tags: OPENBSD_4_0_BASE
# 1.44 11-May-2006 deraadt

handle malloc failure; jan.niemann@tu-bs.de


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.43 20-Feb-2005 pedro

Better handling of large filesystems, okay henning@ and millert@, with
input from martin@ and miod@.


# 1.42 28-Jan-2005 mickey

widen the avail/used columns by one space to accomodate for >100g filesystems. the total is already wide enough due to the header length; dhartmei@ ok


# 1.41 18-Nov-2004 millert

Sync usage with man page; Paul de Weerd


# 1.40 15-Oct-2004 millert

Don't print header if we didn't print any usage lines. Noticed and
tested by robert@


# 1.39 14-Sep-2004 deraadt

fd leak (and who said lint never finds real bugs)


# 1.38 14-Sep-2004 deraadt

remove unused variable


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.37 29-Jul-2003 deraadt

spacing


# 1.36 02-Jul-2003 deraadt

missing protos


# 1.35 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


# 1.34 26-May-2003 ian

Use prt_scaled from libutil. ok pjanzen@, millert@


Revision tags: OPENBSD_3_3_BASE
# 1.33 19-Feb-2003 tedu

LFS is dead. saves some space on install floppies too.

ok deraadt@


Revision tags: OPENBSD_3_2_BASE
# 1.32 04-Jul-2002 deraadt

ansi


Revision tags: OPENBSD_3_1_BASE
# 1.31 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.30 06-Sep-2001 mpech

o) __progname aria;

millert@ ok.


# 1.29 09-Jul-2001 millert

Compute %used in -P mode as a double, just like we do in normal printing
mode. Fixes an int wraparound problem noted by mike@erdelynet.com


Revision tags: OPENBSD_2_9_BASE
# 1.28 23-Feb-2001 pjanzen

Avoid potential uninitialized variable


Revision tags: OPENBSD_2_8_BASE
# 1.27 18-Oct-2000 mickey

sort out printf formats according to types, 64bit arithmetics in ffs_df; millert@ ok


Revision tags: OPENBSD_2_7_BASE
# 1.26 24-Mar-2000 millert

Make f_bsize signed. Having it unsigned causes surprising (and unwanted)
type coercions. With this fixed I can back out the hack in df.


# 1.25 31-Dec-1999 millert

In prtstat() use u_int32_t and int32_t, not long and cast
sfsp->f_bsize to be signed when using the fsbtoblk() macro so
we get signed divide, not unsigned divide. Fixes a bug in df
when the filesystem has < 0 blocks available to the user.
Guess I should have just made f_bsize signed when struct statfs
was changed.


Revision tags: OPENBSD_2_6_BASE
# 1.24 31-May-1999 millert

New struct statfs with mount options. NOTE: this replaces statfs(2),
fstatfs(2), and getfsstat(2) so you will need to build a new kernel
before doing a "make build" or you will get "unimplemented syscall" errors.

The new struct statfs has the following featuires:
o Has a u_int32_t flags field--now softdep can have a real flag.

o Uses u_int32_t instead of longs (nicer on the alpha). Note: the man
page used to lie about setting invalid/unused fields to -1. SunOS does
that but our code never has.

o Gets rid of f_type completely. It hasn't been used since NetBSD 0.9
and having it there but always 0 is confusing. It is conceivable
that this may cause some old code to not compile but that is better
than silently breaking.

o Adds a mount_info union that contains the FSTYPE_args struct. This
means that "mount" can now tell you all the options a filesystem was
mounted with. This is especially nice for NFS.

Other changes:
o The linux statfs emulation didn't convert between BSD fs names
and linux f_type numbers. Now it does, since the BSD f_type
number is useless to linux apps (and has been removed anyway)

o FreeBSD's struct statfs is different from our (both old and new)
and thus needs conversion. Previously, the OpenBSD syscalls
were used without any real translation.

o mount(8) will now show extra info when invoked with no arguments.
However, to see *everything* you need to use the -v (verbose) flag.


Revision tags: OPENBSD_2_5_BASE
# 1.23 31-Jan-1999 millert

When adjusting units for -h mode, use the absolute value to check for
kb, mega, giga, etc. Based on a change from kstailey@openbsd.org but
fixed differently.


Revision tags: OPENBSD_2_4_BASE
# 1.22 18-Aug-1998 deraadt

people who fail to update man pages and usage lines will henceforth be shot on sight


# 1.21 17-Aug-1998 deraadt

fix df -P on 0-size filesystems


Revision tags: OPENBSD_2_3_BASE
# 1.20 20-Nov-1997 millert

Fix units conversion wrt -h flag to be correct (and consistent with
the GNU df's -h flag).


Revision tags: OPENBSD_2_2_BASE
# 1.19 01-Sep-1997 deraadt

i am bored enough to fix terminal space/tab uglies


# 1.18 19-Aug-1997 denny

Add -P option, the POSIX 1003.2 output format (strictly specified for parsing).


# 1.17 23-Jul-1997 kstailey

tabify


# 1.16 16-Jun-1997 denny

Better support for unmounted filesystems (i.e. df /dev/rsd0a):
- interpret the superblock of lfs, ext2fs, and ffs filesystems.
- never mount() an offline filesystem, always read its superblock.
- use the same algorithm as statfs() for ffs, get the same answers.

Even so, now I'm really unsure this code should remain in df.
Similar functionality should be added to dumpfs or fsck instead.


# 1.15 01-Jun-1997 downsj

From denny@c200234-a.frmt1.sfba.home.com, check superblock magic number.

I'm unsure if this code should even remain in df.


Revision tags: OPENBSD_2_1_BASE
# 1.14 14-Apr-1997 kstailey

make -h columns more compact


# 1.13 14-Apr-1997 kstailey

switch from <blank> to "B" for byte suffix; columns look too ugly otherwise


# 1.12 14-Apr-1997 kstailey

fix Avail column in -h mode (again)


# 1.11 14-Apr-1997 kstailey

fix Avail column in -h mode


# 1.10 14-Apr-1997 kstailey

new "-h" (human-readable) output flag now works, please test. thx


# 1.9 12-Apr-1997 kstailey

start of -h (human readable) flag. more to come


# 1.8 04-Apr-1997 deraadt

when mktemp() is hard to fix, use 10 X


# 1.7 24-Dec-1996 deraadt

indicate this mktemp is vulnerable to a DOS attack, however the impact is very low


# 1.6 14-Dec-1996 mickey

-Wall'ing.


# 1.5 07-Dec-1996 deraadt

handle -t & -l in more cases; netbsd pr#2869, hubert.feyrer@rz.uni-regensburg.de


Revision tags: OPENBSD_2_0_BASE
# 1.4 02-Aug-1996 deraadt

zap getopt() case of -?, come on, it is the default!


# 1.3 23-Jun-1996 deraadt

update rcsid


# 1.2 06-Nov-1995 deraadt

complete ufs -> ffs change (From John Kohl; PR #1403)


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.60 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.59 14-Aug-2016 krw

Another %qd -> %lld + (long long) for off_t's.


Revision tags: OPENBSD_6_0_BASE
# 1.58 14-Mar-2016 mmcc

replace __progname with getprogname(3)

from Michal Mazurek, ok tb@


# 1.57 07-Mar-2016 mmcc

simplify print formatting logic, replace exit() in main() with return

from Michal Mazurek, ok tb@


# 1.56 01-Mar-2016 mmcc

tidy up function declarations and definitions

from Michal Mazurek, ok tb@


Revision tags: OPENBSD_5_9_BASE
# 1.55 08-Feb-2016 mmcc

remove needless headers

ok tb@, from Michal Mazurek


# 1.54 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.53 04-Oct-2015 deraadt

df is a tame "stdio rpath" program, the rpath due to getfsstat and statfs.
those two system calls were put into the "rpath" catagory because they
expose pathname information.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.52 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.51 20-May-2014 krw

As suggested by guenther@ and millert@, replace seek+[read|write] with
p[read|write]. Makes the code much clearer by eliminating extra error
checking and verbiage.

No intentional functional change.

Tweaks by and ok guenther@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.50 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.49 16-Mar-2008 otto

actually print the now available large numbers


Revision tags: OPENBSD_4_3_BASE
# 1.48 22-Dec-2007 chl

fix df posix mode bug

from otto@

prompted by otto@ who is aftk for now


# 1.47 02-Sep-2007 deraadt

use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.46 29-Oct-2006 otto

like -i, -h is incompatible with -P; suggested by jmc@; ok ray@


# 1.45 21-Sep-2006 pedro

Remove LFS-related code, no binary change


Revision tags: OPENBSD_4_0_BASE
# 1.44 11-May-2006 deraadt

handle malloc failure; jan.niemann@tu-bs.de


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.43 20-Feb-2005 pedro

Better handling of large filesystems, okay henning@ and millert@, with
input from martin@ and miod@.


# 1.42 28-Jan-2005 mickey

widen the avail/used columns by one space to accomodate for >100g filesystems. the total is already wide enough due to the header length; dhartmei@ ok


# 1.41 18-Nov-2004 millert

Sync usage with man page; Paul de Weerd


# 1.40 15-Oct-2004 millert

Don't print header if we didn't print any usage lines. Noticed and
tested by robert@


# 1.39 14-Sep-2004 deraadt

fd leak (and who said lint never finds real bugs)


# 1.38 14-Sep-2004 deraadt

remove unused variable


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.37 29-Jul-2003 deraadt

spacing


# 1.36 02-Jul-2003 deraadt

missing protos


# 1.35 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


# 1.34 26-May-2003 ian

Use prt_scaled from libutil. ok pjanzen@, millert@


Revision tags: OPENBSD_3_3_BASE
# 1.33 19-Feb-2003 tedu

LFS is dead. saves some space on install floppies too.

ok deraadt@


Revision tags: OPENBSD_3_2_BASE
# 1.32 04-Jul-2002 deraadt

ansi


Revision tags: OPENBSD_3_1_BASE
# 1.31 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.30 06-Sep-2001 mpech

o) __progname aria;

millert@ ok.


# 1.29 09-Jul-2001 millert

Compute %used in -P mode as a double, just like we do in normal printing
mode. Fixes an int wraparound problem noted by mike@erdelynet.com


Revision tags: OPENBSD_2_9_BASE
# 1.28 23-Feb-2001 pjanzen

Avoid potential uninitialized variable


Revision tags: OPENBSD_2_8_BASE
# 1.27 18-Oct-2000 mickey

sort out printf formats according to types, 64bit arithmetics in ffs_df; millert@ ok


Revision tags: OPENBSD_2_7_BASE
# 1.26 24-Mar-2000 millert

Make f_bsize signed. Having it unsigned causes surprising (and unwanted)
type coercions. With this fixed I can back out the hack in df.


# 1.25 31-Dec-1999 millert

In prtstat() use u_int32_t and int32_t, not long and cast
sfsp->f_bsize to be signed when using the fsbtoblk() macro so
we get signed divide, not unsigned divide. Fixes a bug in df
when the filesystem has < 0 blocks available to the user.
Guess I should have just made f_bsize signed when struct statfs
was changed.


Revision tags: OPENBSD_2_6_BASE
# 1.24 31-May-1999 millert

New struct statfs with mount options. NOTE: this replaces statfs(2),
fstatfs(2), and getfsstat(2) so you will need to build a new kernel
before doing a "make build" or you will get "unimplemented syscall" errors.

The new struct statfs has the following featuires:
o Has a u_int32_t flags field--now softdep can have a real flag.

o Uses u_int32_t instead of longs (nicer on the alpha). Note: the man
page used to lie about setting invalid/unused fields to -1. SunOS does
that but our code never has.

o Gets rid of f_type completely. It hasn't been used since NetBSD 0.9
and having it there but always 0 is confusing. It is conceivable
that this may cause some old code to not compile but that is better
than silently breaking.

o Adds a mount_info union that contains the FSTYPE_args struct. This
means that "mount" can now tell you all the options a filesystem was
mounted with. This is especially nice for NFS.

Other changes:
o The linux statfs emulation didn't convert between BSD fs names
and linux f_type numbers. Now it does, since the BSD f_type
number is useless to linux apps (and has been removed anyway)

o FreeBSD's struct statfs is different from our (both old and new)
and thus needs conversion. Previously, the OpenBSD syscalls
were used without any real translation.

o mount(8) will now show extra info when invoked with no arguments.
However, to see *everything* you need to use the -v (verbose) flag.


Revision tags: OPENBSD_2_5_BASE
# 1.23 31-Jan-1999 millert

When adjusting units for -h mode, use the absolute value to check for
kb, mega, giga, etc. Based on a change from kstailey@openbsd.org but
fixed differently.


Revision tags: OPENBSD_2_4_BASE
# 1.22 18-Aug-1998 deraadt

people who fail to update man pages and usage lines will henceforth be shot on sight


# 1.21 17-Aug-1998 deraadt

fix df -P on 0-size filesystems


Revision tags: OPENBSD_2_3_BASE
# 1.20 20-Nov-1997 millert

Fix units conversion wrt -h flag to be correct (and consistent with
the GNU df's -h flag).


Revision tags: OPENBSD_2_2_BASE
# 1.19 01-Sep-1997 deraadt

i am bored enough to fix terminal space/tab uglies


# 1.18 19-Aug-1997 denny

Add -P option, the POSIX 1003.2 output format (strictly specified for parsing).


# 1.17 23-Jul-1997 kstailey

tabify


# 1.16 16-Jun-1997 denny

Better support for unmounted filesystems (i.e. df /dev/rsd0a):
- interpret the superblock of lfs, ext2fs, and ffs filesystems.
- never mount() an offline filesystem, always read its superblock.
- use the same algorithm as statfs() for ffs, get the same answers.

Even so, now I'm really unsure this code should remain in df.
Similar functionality should be added to dumpfs or fsck instead.


# 1.15 01-Jun-1997 downsj

From denny@c200234-a.frmt1.sfba.home.com, check superblock magic number.

I'm unsure if this code should even remain in df.


Revision tags: OPENBSD_2_1_BASE
# 1.14 14-Apr-1997 kstailey

make -h columns more compact


# 1.13 14-Apr-1997 kstailey

switch from <blank> to "B" for byte suffix; columns look too ugly otherwise


# 1.12 14-Apr-1997 kstailey

fix Avail column in -h mode (again)


# 1.11 14-Apr-1997 kstailey

fix Avail column in -h mode


# 1.10 14-Apr-1997 kstailey

new "-h" (human-readable) output flag now works, please test. thx


# 1.9 12-Apr-1997 kstailey

start of -h (human readable) flag. more to come


# 1.8 04-Apr-1997 deraadt

when mktemp() is hard to fix, use 10 X


# 1.7 24-Dec-1996 deraadt

indicate this mktemp is vulnerable to a DOS attack, however the impact is very low


# 1.6 14-Dec-1996 mickey

-Wall'ing.


# 1.5 07-Dec-1996 deraadt

handle -t & -l in more cases; netbsd pr#2869, hubert.feyrer@rz.uni-regensburg.de


Revision tags: OPENBSD_2_0_BASE
# 1.4 02-Aug-1996 deraadt

zap getopt() case of -?, come on, it is the default!


# 1.3 23-Jun-1996 deraadt

update rcsid


# 1.2 06-Nov-1995 deraadt

complete ufs -> ffs change (From John Kohl; PR #1403)


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.59 14-Aug-2016 krw

Another %qd -> %lld + (long long) for off_t's.


Revision tags: OPENBSD_6_0_BASE
# 1.58 14-Mar-2016 mmcc

replace __progname with getprogname(3)

from Michal Mazurek, ok tb@


# 1.57 07-Mar-2016 mmcc

simplify print formatting logic, replace exit() in main() with return

from Michal Mazurek, ok tb@


# 1.56 01-Mar-2016 mmcc

tidy up function declarations and definitions

from Michal Mazurek, ok tb@


Revision tags: OPENBSD_5_9_BASE
# 1.55 08-Feb-2016 mmcc

remove needless headers

ok tb@, from Michal Mazurek


# 1.54 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.53 04-Oct-2015 deraadt

df is a tame "stdio rpath" program, the rpath due to getfsstat and statfs.
those two system calls were put into the "rpath" catagory because they
expose pathname information.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.52 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.51 20-May-2014 krw

As suggested by guenther@ and millert@, replace seek+[read|write] with
p[read|write]. Makes the code much clearer by eliminating extra error
checking and verbiage.

No intentional functional change.

Tweaks by and ok guenther@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.50 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.49 16-Mar-2008 otto

actually print the now available large numbers


Revision tags: OPENBSD_4_3_BASE
# 1.48 22-Dec-2007 chl

fix df posix mode bug

from otto@

prompted by otto@ who is aftk for now


# 1.47 02-Sep-2007 deraadt

use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.46 29-Oct-2006 otto

like -i, -h is incompatible with -P; suggested by jmc@; ok ray@


# 1.45 21-Sep-2006 pedro

Remove LFS-related code, no binary change


Revision tags: OPENBSD_4_0_BASE
# 1.44 11-May-2006 deraadt

handle malloc failure; jan.niemann@tu-bs.de


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.43 20-Feb-2005 pedro

Better handling of large filesystems, okay henning@ and millert@, with
input from martin@ and miod@.


# 1.42 28-Jan-2005 mickey

widen the avail/used columns by one space to accomodate for >100g filesystems. the total is already wide enough due to the header length; dhartmei@ ok


# 1.41 18-Nov-2004 millert

Sync usage with man page; Paul de Weerd


# 1.40 15-Oct-2004 millert

Don't print header if we didn't print any usage lines. Noticed and
tested by robert@


# 1.39 14-Sep-2004 deraadt

fd leak (and who said lint never finds real bugs)


# 1.38 14-Sep-2004 deraadt

remove unused variable


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.37 29-Jul-2003 deraadt

spacing


# 1.36 02-Jul-2003 deraadt

missing protos


# 1.35 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


# 1.34 26-May-2003 ian

Use prt_scaled from libutil. ok pjanzen@, millert@


Revision tags: OPENBSD_3_3_BASE
# 1.33 19-Feb-2003 tedu

LFS is dead. saves some space on install floppies too.

ok deraadt@


Revision tags: OPENBSD_3_2_BASE
# 1.32 04-Jul-2002 deraadt

ansi


Revision tags: OPENBSD_3_1_BASE
# 1.31 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.30 06-Sep-2001 mpech

o) __progname aria;

millert@ ok.


# 1.29 09-Jul-2001 millert

Compute %used in -P mode as a double, just like we do in normal printing
mode. Fixes an int wraparound problem noted by mike@erdelynet.com


Revision tags: OPENBSD_2_9_BASE
# 1.28 23-Feb-2001 pjanzen

Avoid potential uninitialized variable


Revision tags: OPENBSD_2_8_BASE
# 1.27 18-Oct-2000 mickey

sort out printf formats according to types, 64bit arithmetics in ffs_df; millert@ ok


Revision tags: OPENBSD_2_7_BASE
# 1.26 24-Mar-2000 millert

Make f_bsize signed. Having it unsigned causes surprising (and unwanted)
type coercions. With this fixed I can back out the hack in df.


# 1.25 31-Dec-1999 millert

In prtstat() use u_int32_t and int32_t, not long and cast
sfsp->f_bsize to be signed when using the fsbtoblk() macro so
we get signed divide, not unsigned divide. Fixes a bug in df
when the filesystem has < 0 blocks available to the user.
Guess I should have just made f_bsize signed when struct statfs
was changed.


Revision tags: OPENBSD_2_6_BASE
# 1.24 31-May-1999 millert

New struct statfs with mount options. NOTE: this replaces statfs(2),
fstatfs(2), and getfsstat(2) so you will need to build a new kernel
before doing a "make build" or you will get "unimplemented syscall" errors.

The new struct statfs has the following featuires:
o Has a u_int32_t flags field--now softdep can have a real flag.

o Uses u_int32_t instead of longs (nicer on the alpha). Note: the man
page used to lie about setting invalid/unused fields to -1. SunOS does
that but our code never has.

o Gets rid of f_type completely. It hasn't been used since NetBSD 0.9
and having it there but always 0 is confusing. It is conceivable
that this may cause some old code to not compile but that is better
than silently breaking.

o Adds a mount_info union that contains the FSTYPE_args struct. This
means that "mount" can now tell you all the options a filesystem was
mounted with. This is especially nice for NFS.

Other changes:
o The linux statfs emulation didn't convert between BSD fs names
and linux f_type numbers. Now it does, since the BSD f_type
number is useless to linux apps (and has been removed anyway)

o FreeBSD's struct statfs is different from our (both old and new)
and thus needs conversion. Previously, the OpenBSD syscalls
were used without any real translation.

o mount(8) will now show extra info when invoked with no arguments.
However, to see *everything* you need to use the -v (verbose) flag.


Revision tags: OPENBSD_2_5_BASE
# 1.23 31-Jan-1999 millert

When adjusting units for -h mode, use the absolute value to check for
kb, mega, giga, etc. Based on a change from kstailey@openbsd.org but
fixed differently.


Revision tags: OPENBSD_2_4_BASE
# 1.22 18-Aug-1998 deraadt

people who fail to update man pages and usage lines will henceforth be shot on sight


# 1.21 17-Aug-1998 deraadt

fix df -P on 0-size filesystems


Revision tags: OPENBSD_2_3_BASE
# 1.20 20-Nov-1997 millert

Fix units conversion wrt -h flag to be correct (and consistent with
the GNU df's -h flag).


Revision tags: OPENBSD_2_2_BASE
# 1.19 01-Sep-1997 deraadt

i am bored enough to fix terminal space/tab uglies


# 1.18 19-Aug-1997 denny

Add -P option, the POSIX 1003.2 output format (strictly specified for parsing).


# 1.17 23-Jul-1997 kstailey

tabify


# 1.16 16-Jun-1997 denny

Better support for unmounted filesystems (i.e. df /dev/rsd0a):
- interpret the superblock of lfs, ext2fs, and ffs filesystems.
- never mount() an offline filesystem, always read its superblock.
- use the same algorithm as statfs() for ffs, get the same answers.

Even so, now I'm really unsure this code should remain in df.
Similar functionality should be added to dumpfs or fsck instead.


# 1.15 01-Jun-1997 downsj

From denny@c200234-a.frmt1.sfba.home.com, check superblock magic number.

I'm unsure if this code should even remain in df.


Revision tags: OPENBSD_2_1_BASE
# 1.14 14-Apr-1997 kstailey

make -h columns more compact


# 1.13 14-Apr-1997 kstailey

switch from <blank> to "B" for byte suffix; columns look too ugly otherwise


# 1.12 14-Apr-1997 kstailey

fix Avail column in -h mode (again)


# 1.11 14-Apr-1997 kstailey

fix Avail column in -h mode


# 1.10 14-Apr-1997 kstailey

new "-h" (human-readable) output flag now works, please test. thx


# 1.9 12-Apr-1997 kstailey

start of -h (human readable) flag. more to come


# 1.8 04-Apr-1997 deraadt

when mktemp() is hard to fix, use 10 X


# 1.7 24-Dec-1996 deraadt

indicate this mktemp is vulnerable to a DOS attack, however the impact is very low


# 1.6 14-Dec-1996 mickey

-Wall'ing.


# 1.5 07-Dec-1996 deraadt

handle -t & -l in more cases; netbsd pr#2869, hubert.feyrer@rz.uni-regensburg.de


Revision tags: OPENBSD_2_0_BASE
# 1.4 02-Aug-1996 deraadt

zap getopt() case of -?, come on, it is the default!


# 1.3 23-Jun-1996 deraadt

update rcsid


# 1.2 06-Nov-1995 deraadt

complete ufs -> ffs change (From John Kohl; PR #1403)


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision