Commit Graph

107 Commits

Author SHA1 Message Date
Enji Cooper
188e46ab03 Add supporting changes for Add limited sandbox capability to "make check"
Non-tests/... changes:
- Add HAS_TESTS= to Makefiles with libraries and programs to enable iteration
  and propagate the appropriate environment down to *.test.mk.

tests/... changes:
- Add appropriate support Makefile.inc's to set HAS_TESTS in a minimal manner,
  since tests/... is a special subdirectory tree compared to the others.

MFC after:	2 months
MFC with:	r322511
Reviewed by:	arch (silence), testing (silence)
Differential Revision:	D12014
2017-08-14 19:21:37 +00:00
Kyle Evans
476c601b7a du(1): Add --si option to display in terms of powers of 1000
Reviewed by:	cem (earlier version), emaste
Approved by:	emaste (mentor)
Differential Revision:	https://reviews.freebsd.org/D11748
2017-08-09 01:19:19 +00:00
Enji Cooper
8c09935728 Add HAS_TESTS to all Makefiles that use the SUBDIR.${MK_TESTS}+= tests idiom 2017-08-02 08:14:06 +00:00
Enji Cooper
74c9a5910c Add some initial basic tests for du(1)
Tests that exercise the following flags are added in this commit:
- -A
- -H
- -I
- -g
- -h
- -k
- -m

Additional tests will be added soon.

MFC after:	1 month
2017-06-12 07:43:58 +00:00
Enji Cooper
9bd154b8e6 du(1): trivial whitespace cleanup
MFC after:	1 month
2017-06-12 02:42:39 +00:00
Warner Losh
fbbd9655e5 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
2017-02-28 23:42:47 +00:00
Bryan Drewery
28323add09 Fix improper use of "its".
Sponsored by:	Dell EMC Isilon
2016-11-08 23:59:41 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Pedro F. Giffuni
8c5a59ee44 du(1): replace malloc + memset with calloc. 2015-02-17 21:12:45 +00:00
Baptiste Daroussin
3e11bd9e2a Convert to usr.bin/ to LIBADD
Reduce overlinking
2014-11-25 14:29:10 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
Joel Dahl
614b56b148 New sentence, new line.
Submitted by:	brueffer
2012-11-04 09:27:01 +00:00
Joel Dahl
625dbdefa0 Add a few basic examples. 2012-11-04 09:08:17 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Sergey Kandaurov
0fafb093b9 Document -g option in the usage string. 2012-07-26 20:41:36 +00:00
Dag-Erling Smørgrav
69739e8da5 Add -g (gigabyte) flag to complement -k (kilobyte) and -m (megabyte).
MFC after:	1 week
2012-07-18 19:28:22 +00:00
Jilles Tjoelker
6530d2f2d5 du: Allow multiple -HLP options, the last one wins.
This matches 4.4BSD tradition and other utilities with these options and is
required by POSIX (POSIX does not specify -P, only -HL).

MFC after:	2 weeks
2011-12-17 23:18:14 +00:00
Glen Barber
653fa5218a Update du(1):
- Sort arguments alphabetically where appropriate
- '-B blocksize' is not mutually exclusive of '-h|-k|-m'
- Mention '-t' in synopsis
- Other wording improvements
- Update usage() output to reflect the new synopsis [1]
- Other miscellaneous improvements

PR:		162438
Submitted by:	arundel
Reviewed by:	Benjamin Kaduk (kaduk ! mit.edu), jhb[1] (original version)
MFC after:	1 week
2011-12-09 02:30:56 +00:00
Ed Schouten
66c5875a45 Simplify getopt switch parsing.
Only one of these flags can be set. Just add them together and check the
value. Also, get rid of the listall variable. The code is already filled
with direct *flag-comparisons.

Obtained from:	Alexander Best (though modified)
2011-11-08 11:36:46 +00:00
Ed Schouten
d2aa301d2e Add missing static keywords to du(1) 2011-11-06 08:15:17 +00:00
Joel Dahl
da52b4caaf Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
Joel Dahl
f6ac23919b Fix typos and spelling mistakes. 2010-08-06 14:33:42 +00:00
Brian Somers
f0cc075c4f Add a -t switch for masking output that's above or below certain thresholds.
This switch makes it a lot easier to locate problem areas when a process
is threatening to consume all of your disk space.

PR:		144192
Submitted by:	gk
MFC after:	3 weeks
2010-06-20 08:27:03 +00:00
Ed Schouten
b7946da96b Build usr.bin/ with WARNS=6 by default.
Also add some missing $FreeBSD$ to keep svn happy.
2010-01-02 10:27:05 +00:00
Warner Losh
d1588599c0 Report the next directory being scanned when a ^T is pressed (or any
SIGINFO).  Provides some progress report for the impatient.  This
won't report that we're blocking in our walk due to disk/network
problems, however.  There's no really good way to report that
condition that I'm aware of...
2009-04-30 01:24:53 +00:00
Max Laier
246b6a6d70 Restore (intmax_t) casts I lost during the last change & unbreak the build. 2008-11-06 23:55:28 +00:00
Max Laier
fd543f2759 Add two new options to du(1):
-A      Display the apparent size instead of the disk usage.  This can be
             helpful when operating on compressed volumes or sparse files.

     -B blocksize
             Calculate block counts in blocksize byte blocks.  This is differ-
             ent from the -k, -m options or setting BLOCKSIZE and gives an
             estimate of how much space the examined file hierachy would
             require on a filesystem with the given blocksize.  Unless in -A
             mode, blocksize is rounded up to the next multiple of 512.

The former is similar to GNU's du(1) --apparent-size.  The latter is
different from what GNU's du(1) -B does, which is equivalent to setting
BLOCKSIZE in our implementation and is rather pointless as it doesn't add
any real value (i.e. you can achieve the same with a simple awk-script).

No change in the normal output or processing.

Reviewed by:			keramida@, Peter French
Otherwise silience from:	freebsd-hackers@
2008-11-06 16:30:38 +00:00
Max Laier
0551897af2 Declare functions and variables static and save a few byte. This is a
style(9)-change, too.  Separate commit as it changes the object.
2008-11-04 19:23:48 +00:00
Max Laier
40850176c9 style(9): mostly avoiding line wrap by not indenting cases. No obj change. 2008-11-04 19:17:32 +00:00
Giorgos Keramidas
fe5628d3c1 Implement from scratch a -l option for du(1), to match the same option
of the GNU utility.  The default behavior of our original `du' is to
count hardlinked files only once for each invocation of the utility.
With the new -l option they count towards the final size every time
they are found.

PR:		bin/117944
Submitted by:	keramida
Reviewed by:	des, obrien
MFC after:	2 weeks
2008-02-25 19:06:43 +00:00
Kevin Lo
d4c16fe37d setenv(3) sets errno on failure, use warn() instead
Pointed out by: ru
2007-11-08 01:24:31 +00:00
Kevin Lo
ee8f97394e Check return value for setenv() 2007-11-06 10:35:50 +00:00
Sean Farley
2966d28c32 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)
2007-07-04 00:00:41 +00:00
Andrey A. Chernov
ba174a5e38 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.
2007-05-01 16:02:44 +00:00
Andrey A. Chernov
97e49dd4b5 Eliminate error with -W* strict flags and make putenv() calls conforming to
standard and portable in the same way as f.e. gcc internal portable code does.
2007-04-30 05:14:29 +00:00
Ruslan Ermilov
cb29445a92 Markup fixes. 2006-09-29 15:20:48 +00:00
Maxim Konovalov
fadc7151b7 o Implement "-n" flag: ignore files and directories with user "nodump"
flag set.  Useful for calculation dump -h dump size.

PR:		bin/96864
Submitted by:	Dmitry Kazarov
Obtained from:	NetBSD (man page)
MFC after:	1 month
2006-05-06 22:04:59 +00:00
Ruslan Ermilov
f682f10c76 Sync program's usage() with manpage's SYNOPSIS. 2005-05-21 09:55:10 +00:00
Stefan Farfeleder
6c97c3d1d3 Remove unused variables. 2005-04-09 14:31:41 +00:00
Pawel Jakub Dawidek
dc347bc474 Use 64bit 'fts_bignum' field instead of 32bit (on 32bit archs) field
'fts_number' to remember number of blocks.
This makes du(1) 64bit-clean.

This work is part of the BigDisk project:

	http://www.FreeBSD.org/projects/bigdisk/

Discussed on:	arch@
MFC after:	5 days
2005-01-07 00:12:24 +00:00
Giorgos Keramidas
d2c50f8bab Add a missing full-stop to match the rest of the items in a list. 2004-10-24 00:26:35 +00:00
Stefan Farfeleder
14cc87e479 Use the length modifier 'll' instead of 'q' to print long longs. 2004-07-28 16:03:13 +00:00
Tim J. Robbins
e781c653dd Respect locale settings from the environment. 2004-07-15 08:54:41 +00:00