summaryrefslogtreecommitdiffstats
path: root/bin/df
Commit message (Collapse)AuthorAgeFilesLines
* MFC r287236:delphij2015-09-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use exit() instead of return in main(). The difference in practice is subtle: C standard requires the language runtime to make return of int from main() behave like calling exit(), and in FreeBSD we do: exit(main(argc, argv, env)) In lib/csu/${ARCH}/crt1.c, so the real difference is using exit() explicitly would use an additional stack frame. Note however, if there is a on stack pointer is the last reference of an allocated memory block, returning from the function would, technically, result in a memory leak because we lost the last reference to the memory block, and calling exit() from C runtime could potentionally overwrite that stack frame that used to belong to the main() function. In practice, this is normally Okay because eventually the kernel would tear down the whole address space that belongs to the process in the _exit(2) system call, but the difference could confuse compilers (which may want to do stack overflow checks) and static analyzers. Replacing return with exit() in main() allows compilers/static analyzers to correctly omit or generate the right warnings when they do not treat main() specifically. With the current version of clang on FreeBSD/amd64, use of exit() would result in slightly smaller code being generated and eliminated a false positive warning of memory leak.
* MFC r260782:wblock2014-01-201-3/+3
| | | | -h and -H options backwards in manual page.
* MFC: r257288brueffer2013-11-111-1/+1
| | | | | | Clean up a spurious "." in SEE ALSO. Approved by: re (glebius)
* Complete revision 243104.grog2013-05-171-1/+3
|
* Don't appease clang static analyzer after all and roll backuqs2013-04-261-1/+0
| | | | | | | | | 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
* bin/df: Fix unitialized use in prtstatuqs2013-04-201-5/+7
| | | | | | | | | 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)
* Don't time travel back and use a present date.delphij2013-01-251-1/+1
| | | | Noticed by: mckusick
* - Wrap long line;delphij2013-01-242-2/+4
| | | | | | - Add -, to SYNOPSIS section. MFC after: 2 weeks
* Handle large negative block counts correctly.grog2012-12-121-1/+1
| | | | MFC after: 2 weeks
* Update man pages and clarify a number of options.grog2012-11-162-35/+65
| | | | | | Rework block count calculations to work correctly with small "block" sizes. MFC after: 14 days
* Fix section number for pstat and swapinfo cross references.pluknet2012-11-151-3/+3
| | | | MFC after: 3 days
* Add , (comma) option to print sizes grouped and separated by thousandsgrog2012-11-152-16/+57
| | | | | | | using the non-monetary separator returned by localeconv(3), typically a comma or period. MFC after: 14 days
* Revert 240527:eadler2012-09-161-1/+0
| | | | | | | mntbuf can poit to memory allocated by getmntinfo(3) which can't be freed PR: bin/171634 Approved by: cperciva (implicit)
* Free memory before exiting in order toeadler2012-09-141-0/+1
| | | | | | | | | 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
* Bump date to today (since I modified it)eadler2012-03-031-1/+1
| | | | | | PR: bin/165321 Approved by: gjb MFC after: 3 days
* Direct users to swapinfo and pstat from dfeadler2012-03-031-0/+2
| | | | | | | PR: bin/165321 Submitted by: jhs Approved by: bcr MFC after: 3 days
* Minor clarificationdes2011-10-181-1/+2
| | | | MFC after: 3 weeks
* Simplify df(1) by factoring out most of the common code:des2011-10-181-26/+27
| | | | | | | | | | | | | | | | | | | | | - 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
* Fix typos - remove duplicate "the".brucec2011-02-211-1/+1
| | | | | | PR: bin/154928 Submitted by: Eitan Adler <lists at eitanadler.com> MFC after: 3 days
* Staticify internal routines.delphij2009-06-231-1/+1
|
* Make "human-readable" (-H/-h) output also "humanize" inode counts.simon2009-06-072-6/+37
| | | | | | | | | 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
* Implement -T option as found in Linux df(1). When given, file system typepjd2008-11-232-7/+19
| | | | | | | will be included in output. Reviewed and tested by: keramida MFC after: 2 weeks
* Significantly reduce the memory leak as noted in BUGS section forscf2007-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)
* Back out all POSIXified *env() changes.ache2007-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.
* Eliminate error with -W* strict flags and make putenv() calls conforming toache2007-04-301-4/+4
| | | | standard in the same way as f.e. gcc internal portable code does.
* getblocksize expects pointer to long as a second argument, notkan2007-04-061-2/+2
| | | | a pointer to u_long.
* Fix a bug where the mutual exclusivity of the -l and -t options is notwill2007-03-081-1/+4
| | | | | | | recognized properly if -l is specified first. PR: bin/105721 MFC after: 1 week
* Fix markup.ru2007-02-281-2/+3
|
* Based on The Open Group Base Specifications Issue 6 IEEE Std 1003.1, ourcsjp2006-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
* Prefer strlcpy to strncpy. In one case, this saves us from re-zeroingimp2006-08-201-2/+2
| | | | | data that's alreday 0. In another, it saves us from zeroing data that will be overwritten again.
* Add the new standard EXIT STATUS section where appropriate.ru2005-01-161-7/+7
| | | | Sort standard sections in the (documented) preferred order.
* /*- or .\"- or #- to begin license clauses.imp2005-01-102-1/+2
|
* Scheduled mdoc(7) sweep.ru2005-01-091-1/+2
|
* Currently if a mount point is not accessible by the calling user,csjp2004-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
* Mechanically kill hard sentence breaks.ru2004-07-021-6/+12
|
* Convert fsbtoblk() from a macro to a function. The redundantdas2004-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
* Use humanize_number(3) to format sizes into a human readable form.pjd2004-05-242-88/+19
|
* Bump document date for the latest functional change.ru2004-05-161-5/+2
| | | | Minor markup tweaks.
* Fix some style issues in rev 1.58.obrien2004-04-221-13/+12
| | | | | Use 64-bit integer math vs. mixed FP & integer. Add -g to the usage().
* Add 'g' to SYNOPSIS.obrien2004-04-221-1/+1
|
* Fix printing of the "Mounted on" values for 'df -i'.obrien2004-04-221-2/+4
| | | | | | Fix spacing before "Mounted on" column in general. Submitted by: bde
* Add -c option simular to du(1).obrien2004-04-183-15/+51
| | | | | PR: 19635 Submitted by: cyrille.lefevre@laposte.net
* Remove clause 3 from the UCB licenses.markm2004-04-062-8/+0
| | | | OK'ed by: imp, core
* And a bandaid so that the output of "available space" is correct whenle2004-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
* Make NULL a (void*)0 whereever possible, and fix the warnings(-Werror)markm2004-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
* Use int rather than size_t storage for printf field widths to avoidiedowse2004-02-081-43/+41
| | | | | | many casts. Reviewed by: bde
* Fix format strings (intmax_t is %jd, not %qd)kris2003-11-121-2/+2
| | | | Reviewed by: tjr
* Update the statfs structure with 64-bit fields to allowmckusick2003-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.
* Be a little bit more correct WRT counting numbers vs. integer numbers.obrien2003-09-131-10/+10
|
* Get this area compiling with the highest WARNS= that it works with.markm2003-06-131-4/+3
| | | | | | | Obsolete WFORMAT= junk also removed where possible. OK'ed by: obrien Tested on: sparc64, alpha, i386
OpenPOWER on IntegriCloud