aboutsummaryrefslogtreecommitdiff
path: root/bin/df
Commit message (Collapse)AuthorAgeFilesLines
* Implement -T option as found in Linux df(1). When given, file system typePawel Jakub Dawidek2008-11-232-7/+19
| | | | | | | | | | will be included in output. Reviewed and tested by: keramida MFC after: 2 weeks Notes: svn path=/head/; revision=185200
* Significantly reduce the memory leak as noted in BUGS section forSean Farley2007-07-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=171195
* Back out all POSIXified *env() changes.Andrey A. Chernov2007-05-011-4/+4
| | | | | | | | | | | | 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. Notes: svn path=/head/; revision=169177
* Eliminate error with -W* strict flags and make putenv() calls conforming toAndrey A. Chernov2007-04-301-4/+4
| | | | | | | standard in the same way as f.e. gcc internal portable code does. Notes: svn path=/head/; revision=169112
* getblocksize expects pointer to long as a second argument, notAlexander Kabaev2007-04-061-2/+2
| | | | | | | a pointer to u_long. Notes: svn path=/head/; revision=168428
* Fix a bug where the mutual exclusivity of the -l and -t options is notWill Andrews2007-03-081-1/+4
| | | | | | | | | | recognized properly if -l is specified first. PR: bin/105721 MFC after: 1 week Notes: svn path=/head/; revision=167326
* Fix markup.Ruslan Ermilov2007-02-281-2/+3
| | | | Notes: svn path=/head/; revision=167105
* Based on The Open Group Base Specifications Issue 6 IEEE Std 1003.1, ourChristian S.J. Peron2006-09-201-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=162483
* Prefer strlcpy to strncpy. In one case, this saves us from re-zeroingWarner Losh2006-08-201-2/+2
| | | | | | | | data that's alreday 0. In another, it saves us from zeroing data that will be overwritten again. Notes: svn path=/head/; revision=161470
* Add the new standard EXIT STATUS section where appropriate.Ruslan Ermilov2005-01-161-7/+7
| | | | | | | Sort standard sections in the (documented) preferred order. Notes: svn path=/head/; revision=140353
* /*- or .\"- or #- to begin license clauses.Warner Losh2005-01-102-1/+2
| | | | Notes: svn path=/head/; revision=139969
* Scheduled mdoc(7) sweep.Ruslan Ermilov2005-01-091-1/+2
| | | | Notes: svn path=/head/; revision=139943
* Currently if a mount point is not accessible by the calling user,Christian S.J. Peron2004-07-202-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=132465
* Mechanically kill hard sentence breaks.Ruslan Ermilov2004-07-021-6/+12
| | | | Notes: svn path=/head/; revision=131484
* Convert fsbtoblk() from a macro to a function. The redundantDavid Schultz2004-06-041-8/+13
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=130060
* Use humanize_number(3) to format sizes into a human readable form.Pawel Jakub Dawidek2004-05-242-88/+19
| | | | Notes: svn path=/head/; revision=129678
* Bump document date for the latest functional change.Ruslan Ermilov2004-05-161-5/+2
| | | | | | | Minor markup tweaks. Notes: svn path=/head/; revision=129295
* Fix some style issues in rev 1.58.David E. O'Brien2004-04-221-13/+12
| | | | | | | | Use 64-bit integer math vs. mixed FP & integer. Add -g to the usage(). Notes: svn path=/head/; revision=128555
* Add 'g' to SYNOPSIS.David E. O'Brien2004-04-221-1/+1
| | | | Notes: svn path=/head/; revision=128554
* Fix printing of the "Mounted on" values for 'df -i'.David E. O'Brien2004-04-221-2/+4
| | | | | | | | | Fix spacing before "Mounted on" column in general. Submitted by: bde Notes: svn path=/head/; revision=128553
* Add -c option simular to du(1).David E. O'Brien2004-04-183-15/+51
| | | | | | | | PR: 19635 Submitted by: cyrille.lefevre@laposte.net Notes: svn path=/head/; revision=128410
* Remove clause 3 from the UCB licenses.Mark Murray2004-04-062-8/+0
| | | | | | | OK'ed by: imp, core Notes: svn path=/head/; revision=127958
* And a bandaid so that the output of "available space" is correct whenLukas Ertl2004-03-091-1/+2
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=126770
* Make NULL a (void*)0 whereever possible, and fix the warnings(-Werror)Mark Murray2004-03-051-1/+1
| | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=126643
* Use int rather than size_t storage for printf field widths to avoidIan Dowse2004-02-081-43/+41
| | | | | | | | | many casts. Reviewed by: bde Notes: svn path=/head/; revision=125611
* Fix format strings (intmax_t is %jd, not %qd)Kris Kennaway2003-11-121-2/+2
| | | | | | | Reviewed by: tjr Notes: svn path=/head/; revision=122582
* Update the statfs structure with 64-bit fields to allowKirk McKusick2003-11-121-23/+25
| | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=122537
* Be a little bit more correct WRT counting numbers vs. integer numbers.David E. O'Brien2003-09-131-10/+10
| | | | Notes: svn path=/head/; revision=120037
* Get this area compiling with the highest WARNS= that it works with.Mark Murray2003-06-131-4/+3
| | | | | | | | | | Obsolete WFORMAT= junk also removed where possible. OK'ed by: obrien Tested on: sparc64, alpha, i386 Notes: svn path=/head/; revision=116282
* Catch up with revs 1.49-1.50 of df.c: don't mention -t in the BUGS sectionBruce Evans2003-06-031-3/+1
| | | | | | | since it has been fixed. Notes: svn path=/head/; revision=115770
* Fixed exit code in previous commit. "var++" to set a flag to nonzeroBruce Evans2003-06-031-5/+9
| | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=115769
* From the df man page:Jordan K. Hubbard2003-06-021-0/+9
| | | | | | | | | | | | | -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 Notes: svn path=/head/; revision=115744
* df(1) and ls(1) print units in 'four or fewer' not 'three or less'.Tom Rhodes2003-05-061-2/+2
| | | | | | | | PR: 35523 Submitted by: Tomas Svensson <tsn@gbdev.net> Notes: svn path=/head/; revision=114791
* WARNS cleaning for the Alpha. On alpha, size_t is a long, and itMark Murray2003-05-031-13/+17
| | | | | | | | solicits a warning when used for the '*' in printf("%*d"). Cast to u_int for universal use. Notes: svn path=/head/; revision=114582
* Fix a shedload of warnings, some memory leaks and clean up WARNSMark Murray2003-05-031-39/+61
| | | | | | | and lint. This is now WARNS=9, std=c99 clean on i386. Notes: svn path=/head/; revision=114579
* Quiet warnings about copyright[].David E. O'Brien2003-05-011-2/+2
| | | | Notes: svn path=/head/; revision=114433
* Back out rev 1.44; getbsize(3)'s original interface has been restored.Mike Barcroft2002-12-301-4/+3
| | | | | | | Approved by: markm Notes: svn path=/head/; revision=108452
* Fix for changed getbsize arg type.Mark Murray2002-10-231-3/+4
| | | | Notes: svn path=/head/; revision=105824
* Fix 'SYNOPSIS' and 'usage'Tom Rhodes2002-08-262-2/+2
| | | | Notes: svn path=/head/; revision=102432
* s/filesystem/file system/ as discussed on -developersTom Rhodes2002-08-212-22/+22
| | | | Notes: svn path=/head/; revision=102230
* - Introduce a new struct xvfsconf, the userland version of struct vfsconf.Maxime Henrion2002-08-101-11/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | - 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. Notes: svn path=/head/; revision=101651
* Consistently use __FBSDIDDavid E. O'Brien2002-06-301-3/+2
| | | | Notes: svn path=/head/; revision=99109
* Unconditionally update the maximum field width statistics when weIan Dowse2002-05-181-5/+3
| | | | | | | | | | 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> Notes: svn path=/head/; revision=96879
* Remove the private code for reading UFS superblocks, this does not belongPoul-Henning Kamp2002-05-122-109/+35
| | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=96470
* Use `The .Nm utility'Philippe Charnier2002-04-161-1/+3
| | | | Notes: svn path=/head/; revision=94869
* Make the columns in the output of df(1) line up, even for very largeIan Dowse2002-03-261-39/+106
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=93246
* Warnings fixes inspired by lint, a commercial lint and WARNS=4.Mark Murray2002-02-221-5/+4
| | | | Notes: svn path=/head/; revision=91081
* o __P has been reovedWarner Losh2002-02-021-41/+23
| | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=90108
* Make ``df -l'' work when no network filesystems are loaded.Ruslan Ermilov2001-12-191-2/+4
| | | | | | | PR: bin/32397 Notes: svn path=/head/; revision=88182
* Do not dot terminate errx() stringsPhilippe Charnier2001-12-111-1/+1
| | | | Notes: svn path=/head/; revision=87666