Commit Graph

79 Commits

Author SHA1 Message Date
Mark Murray
6195fb4102 Remove clause 3 from the UCB licenses.
OK'ed by:	imp, core
2004-04-06 20:06:54 +00:00
Lukas Ertl
ae21f5ad2c 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
2004-03-09 10:02:44 +00:00
Mark Murray
16fc3635f7 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
2004-03-05 08:10:19 +00:00
Ian Dowse
0bd9f15133 Use int rather than size_t storage for printf field widths to avoid
many casts.

Reviewed by:	bde
2004-02-08 23:42:09 +00:00
Kris Kennaway
ea64ad7727 Fix format strings (intmax_t is %jd, not %qd)
Reviewed by:	tjr
2003-11-12 21:47:42 +00:00
Kirk McKusick
fde81c7d8e 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.
2003-11-12 08:01:40 +00:00
David E. O'Brien
be2c4e5415 Be a little bit more correct WRT counting numbers vs. integer numbers. 2003-09-13 20:46:58 +00:00
Mark Murray
eac4bdcca4 Get this area compiling with the highest WARNS= that it works with.
Obsolete WFORMAT= junk also removed where possible.

OK'ed by:	obrien
Tested on:	sparc64, alpha, i386
2003-06-13 07:04:02 +00:00
Bruce Evans
1da10b118b Catch up with revs 1.49-1.50 of df.c: don't mention -t in the BUGS section
since it has been fixed.
2003-06-03 12:00:35 +00:00
Bruce Evans
0e7d023f34 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.
2003-06-03 11:54:42 +00:00
Jordan K. Hubbard
c22acefba5 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
2003-06-02 22:33:12 +00:00
Tom Rhodes
bf88fa9352 df(1) and ls(1) print units in 'four or fewer' not 'three or less'.
PR:		35523
Submitted by:	Tomas Svensson <tsn@gbdev.net>
2003-05-06 21:54:46 +00:00
Mark Murray
f694b8adb6 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.
2003-05-03 16:02:52 +00:00
Mark Murray
b7dbd3e95e Fix a shedload of warnings, some memory leaks and clean up WARNS
and lint. This is now WARNS=9, std=c99 clean on i386.
2003-05-03 10:21:26 +00:00
David E. O'Brien
09a80d4867 Quiet warnings about copyright[]. 2003-05-01 16:58:57 +00:00
Mike Barcroft
dc474219b6 Back out rev 1.44; getbsize(3)'s original interface has been restored.
Approved by:	markm
2002-12-30 18:10:37 +00:00
Mark Murray
0b66b1e8eb Fix for changed getbsize arg type. 2002-10-23 22:09:05 +00:00
Tom Rhodes
55c639b2d9 Fix 'SYNOPSIS' and 'usage' 2002-08-26 04:56:23 +00:00
Tom Rhodes
7d971bbf29 s/filesystem/file system/ as discussed on -developers 2002-08-21 17:32:44 +00:00
Maxime Henrion
5965373e69 - 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.
2002-08-10 20:19:04 +00:00
David E. O'Brien
5eb43ac2f7 Consistently use __FBSDID 2002-06-30 05:13:54 +00:00
Ian Dowse
85ed93337f 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>
2002-05-18 21:10:40 +00:00
Poul-Henning Kamp
532aff98f6 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.
2002-05-12 19:24:09 +00:00
Philippe Charnier
e004acc891 Use `The .Nm utility' 2002-04-16 20:08:06 +00:00
Ian Dowse
62edbd31c7 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
2002-03-26 20:32:37 +00:00
Mark Murray
39661e26a5 Warnings fixes inspired by lint, a commercial lint and WARNS=4. 2002-02-22 20:57:53 +00:00
Warner Losh
f9bcb0beb5 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)
2002-02-02 06:24:13 +00:00
Ruslan Ermilov
cf5b29e126 Make ``df -l'' work when no network filesystems are loaded.
PR:		bin/32397
2001-12-19 08:38:02 +00:00
Philippe Charnier
7b3a12a825 Do not dot terminate errx() strings 2001-12-11 18:22:01 +00:00
David E. O'Brien
a748290789 Default to WARNS=2. Binary builds that cannot handle this must explicitly
set WARNS=0.

Reviewed by:	mike
2001-12-04 01:57:47 +00:00
David E. O'Brien
7ed17c0fba Remove a misplaced space. 2001-08-01 02:09:09 +00:00
Garrett Wollman
a067aeceed Fix style bugs introduced by rev 1.28. No functional changes. 2001-07-16 15:49:58 +00:00
Ruslan Ermilov
caa2db3be9 mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 10:04:09 +00:00
Dima Dorfman
982f5d88ff WARNS= -> WARNS?=
Submitted by:	Mike Barcroft <mike@q9media.com>
2001-06-22 21:38:30 +00:00
Jacques Vidrine
cc66540e0e 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.
2001-06-05 21:55:57 +00:00
Matt Jacob
b3e8643ffa Wrong. The size of size_t is *not* the same as the size of an integer.
MFC after:	2 weeks
2001-06-05 21:16:27 +00:00
Jim Pirzyk
a25695c3a4 Added the -l option to df, so to be compatable with other unicies.
PR:		bin/27240
Reviewed by:	GAWollman
MFC after:	2 weeks
2001-06-04 23:07:15 +00:00
Ruslan Ermilov
0b381bf1fd Remove vestiges of MFS. 2001-06-01 10:07:28 +00:00
Kris Kennaway
a95a13bb8f BDECFLAGS cleanup (modulo long long issues). Add WARNS. Tested on alpha.
Reviewed by:	the great man himself (except alpha cleanups)
2001-05-20 04:12:30 +00:00
Kris Kennaway
f3895a821a Fix operation of df on unmounted filesystems, and add the ability to run df
on unmounted non-UFS filesystem using '-t'

Submitted by:	bde
2001-05-09 08:44:15 +00:00
Kris Kennaway
e78527c437 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
2001-05-08 06:58:25 +00:00
Ruslan Ermilov
d0353b836e mdoc(7) police: split punctuation characters + misc fixes. 2001-02-01 16:38:02 +00:00
Ruslan Ermilov
be8b149795 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 11:39:41 +00:00
John W. De Boskey
93a3fa19b5 Add -g for gigabyte sizes.
Approved by:	jkh
2000-06-03 20:17:39 +00:00
Sheldon Hearn
f167d7fb3e Fix miscellaneous mdoc macro argument limit infringements.
PR:		18465
Reported by:	Kazu TAKAMUNE <takamune@avrl.mei.co.jp>
2000-05-09 14:02:06 +00:00
Bruce Evans
5ebae837e1 Fixed LDADD. Using ${LIBM} instead of -lm gave the wrong libm in most
cases and broke the world in some cases.

Fixed some style bugs (the usual ones for DPADD and LDADD, misplacement
of DPADD and LDADD, and misplacement of $FreeBSD$).
2000-03-27 14:53:26 +00:00
Michael Haro
dd6d33e86e 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>
1999-12-15 03:44:09 +00:00
Julian Elischer
5b42dac8ec 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>
1999-11-01 04:57:43 +00:00
Peter Wemm
2a4562393f $Id$ -> $FreeBSD$ 1999-08-27 23:15:48 +00:00
Sheldon Hearn
b84897d106 Don't suggest sysctl(8) as a means for discovering what filesystem types
are available; suggest lsvfs(1) instead.

Reported by:	Neil Blakey-Milner <nbm@rucus.ru.ac.za>
1999-08-26 16:47:03 +00:00