History log of /freebsd-10.1-release/bin/dd/dd.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 266488 21-May-2014 thomas

MFC rev. 265593:
(dd_out): Fix handling of all-zeroes block at end of input with
conv=sparse.

PR: bin/189174
PR: bin/189284
Reviewed by: kib


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 250469 10-May-2013 eadler

Make dd's signal handler async safe.

PR: bin/75258
Submitted by: "Oleg V. Nauman" <oleg@reis.zp.ua>
Arrival Date: Sun Dec 19 14:50:21 GMT 2004
Reviewed by: mjg, jhb
Reviewed by: jilles (earlier version)
MFC after: 1 week


# 249811 23-Apr-2013 kib

Literally follow POSIX:
If the bs= expr operand is specified and no conversions other than sync,
noerror, or notrunc are requested, the data returned from each input
block shall be written as a separate output block.

In particular, when both bs=size and conv=sparce were specified, the
resulted file was fully filled, instead of sparce.

PR: standards/177742
Submitted by: Matthew Rezny <mrezny@hexaneinc.com>
MFC after: 2 weeks


# 249063 03-Apr-2013 brooks

IFP4 change 222074.

Introduce an explicit close of the output descriptor so that work done
on close is accounted for in the summary output triggered at exit
(implicit close()s occur after atexit() hooks).

This is useful because some devices such as cfi(4) may perform
signficant work after a close occurs (e.g. erasing and rewriting a
block of flash).


# 239991 01-Sep-2012 ed

Rework all non-contributed files that use `struct timezone'.

This structure is not part of POSIX. According to POSIX, gettimeofday()
has the following prototype:

int gettimeofday(struct timeval *restrict tp, void *restrict tzp);

Also, POSIX states that gettimeofday() shall return 0 (as long as tzp is
not used). Remove dead error handling code. Also use NULL for a
nul-pointer instead of integer 0.

While there, change all pieces of code that only use tv_sec to use
time(3), as this provides less overhead.


# 133762 15-Aug-2004 rwatson

Add a "fillchar" command line argument to dd(1) that permits the user
to specify an alternative padding character when using a conversion
mode, or when using noerror with sync and an input error occurs. This
facilities reading old and error-prone media by allowing the user to
more effectively mark error blocks in the output stream.


# 127958 06-Apr-2004 markm

Remove clause 3 from the UCB licenses.

OK'ed by: imp, core


# 126667 05-Mar-2004 phk

Teach dd(1) about parity bits.


# 114433 01-May-2003 obrien

Quiet warnings about copyright[].


# 111629 27-Feb-2003 markm

WARNS=4 fixes. This would be WARNS=9 if we were -std=99 instead of
-ansi, due to 'long long'.

Reviewed by: green (slightly earlier version)


# 109873 26-Jan-2003 phk

Don't call DIOCWLABEL on disks, it is not implemented, and calling it
like this negated any practical value of the feature.


# 99109 30-Jun-2002 obrien

Consistently use __FBSDID


# 91807 07-Mar-2002 markm

1) Rev.1.35 of dd.c has a more serious regression. It backs out rev.1.31,
thus breaking systems with unpolluted <sys/stat.h>'s.

2) Back out an initialisation of a variable in BSS.

Reported by: bde (1), many(2)


# 91079 22-Feb-2002 markm

Fix warnings inspired by lint, a commercial lint and WARNS=4.


# 90108 02-Feb-2002 imp

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)


# 89788 25-Jan-2002 green

Commit general cleanups (separate get_num() and get_off_t() functions to
debogosify some of the command-line string-number conversions into
an unsigned and signed variant.)


# 78985 29-Jun-2001 green

Use __unused for non-used variables.

Submitted by: Mike Barcroft <mike@q9media.com>


# 66907 09-Oct-2000 wollman

Don't depend on <sys/stat.h> bogusly including <sys/time.h> (and thereby
<time.h>).


# 63688 20-Jul-2000 green

Make the comment regarding ftruncate() correct.


# 62311 01-Jul-2000 green

Various cleanups are made to reduce warnings and make code prettier :)
Also, check for ftruncate() return value and die on failure, but only
try to ftruncate() when the file is a regular file.


# 60859 24-May-2000 obrien

Fix ``dd if=/dev/zero of=/dev/daN'' on the Alpha by allowing the label
to be overwritten.

Submitted by: green


# 51913 03-Oct-1999 green

Nuke the FIODTYPE compatibility bits. It's time.


# 51335 16-Sep-1999 green

Make count=0 set cpy_cnt to -1, which is slight overloading, but makes
what I was trying to do work much better (ie at all. I could have sworn
it was working...) Fix a SEEK_SET to be SEEK_CUR, and make Bruce's
lseek() test work correctly.


# 51249 13-Sep-1999 green

Even more dd(1) cleanups! Thanks to Bruce for staying on my case until
we're done (not yet!) :)


# 51212 12-Sep-1999 green

ISDISK -> ISSEEK

Allow a device type of D_DISK or D_MEM to be ISSEEK.


# 51208 12-Sep-1999 green

Even more cleanups to dd(1). This is probably the culmination of the
BDEification process of dd(1). Most of the changes are from BDE's archive.
Support for negative offsets is gone again, but the case where you
lseek() onto byte -1 of something from a negative offset using seek/skip
is fixed; if you end up on -1, you won't get a false positive lseek failure.
The biggest changes are to data types (more size_t, for instance) and
argument parsing. skip/seek on /dev/{,k}mem now occurs (instead of "read
until you reach the offset") due to mem devices now being D_DISK. Some
const things are now correctly declared as such, and the "case table"
building is better. The only thing that seems to be left to make dd(1)
everything TOG wants it to be is l10n.


# 50487 28-Aug-1999 green

Relax things a bit. Not having FIODTYPE will be a warning for now.

Pointy hat: green
Pointed out by: peter


# 50471 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 50460 27-Aug-1999 green

Use FIODTYPE to unbogosify much of the file type checking in dd.


# 48802 13-Jul-1999 green

Implement seekability for disk devices (not just regular files).
Also, fix pos_out() to do the same checks pos_in() did.

Done for: jdp, luigi, the good of the world


# 48051 20-Jun-1999 green

This is the second round of dd(1) changes. Some changes made/reversed by
request of Bruce. More changes may follow later. 'g' multiplier has
been added (i.e. dd seek=5g if=bigfile.) Some minor corrections were made
as well.

Noticed by: bde


# 48026 19-Jun-1999 green

Miscellaneous dd(1) changes: mainly fixing variable types (size_t, ssize_t,
off_t, int, u_int64_t, etc.). dd(1) should now work properly with REALLY
big amounts of data.


# 46073 25-Apr-1999 imp

First set of fixes to keep egcs happy. These include {} around single
statement if blocks[*] when the else could be ambiguous, not defaulting
to int type and removal of some unused variables.

[*] This is explicitly allowed by style(9) when the single statement
spans more than one line.

Reviewed by: obrien, chuckr


# 36007 13-May-1998 charnier

Restore Lite-2 sccsid. Restore include of sys/types.h.


# 35773 06-May-1998 charnier

Correct use of .Nm and other cosmetics. Add rcsid. Remove unused #inc.


# 32324 07-Jan-1998 joerg

Use the correct value in the call to swab(3) with conv=swab. Previously,
dd if=/dev/zero of=/dev=null obs=23520 conv=swab
coredumped.

Please somebody review it, i'm not 105 % sure i'm understanding all
this mess correctly.

Detected by: Holm Tiffe <holm@geophysik.tu-freiberg.de>


# 30312 11-Oct-1997 joerg

Teach dd(1) about an option to write sparse files. Can be useful for
things like diskless clients' swap files etc.

Submitted by: pascal@zuo.dec.com (Pascal Pederiva) (ages ago, with many
stylistic changes by me)


# 28430 19-Aug-1997 jlemon

Pad the input buffer whenever sync is used, not just if the noerror flag
is also set.
Change osync to not to tack on an empty block if the input buffer is null,
or an even multiple of the blocksize.
Also change osync to pad the output with nulls/spaces depending whether
this is a block-oriented conversion or not (same as sync).

PR: 3818


# 22988 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 20420 14-Dec-1996 steve

-Wall cleaning.


# 19720 13-Nov-1996 phk

Bruce says: "You have been programming in the kernel for too long :-)."

and he's right ... I forgot about this floating point stuff you can
use in user-land :-)

Increase precision of duration to microseconds.
No heuristics to avoid overflow in calculation needed - just depend
on DBL_MAX being a bit larger than LONG_MAX.

Use double instead of `struct timeval' in dd.h so that everything
doesn't have to include <sys/time.h>.

Fixed style bugs in recent and old FreeBSD changes.

Reviewed by: phk
Submitted by: bde


# 19694 12-Nov-1996 phk

Increase precision of duration to milliseconds.
Some heuristics to avoid overflow in calculation attempted.


# 11747 23-Oct-1995 ache

Add setlocale LC_CTYPE


# 5702 17-Jan-1995 ache

More koshering [ul]case fix, don't use pre-initialized tables at all,
treat 0xFF as valid character.


# 5701 17-Jan-1995 ache

Make conv=[lu]case works with localized ctype (8bit)


# 3044 24-Sep-1994 dg

Added $Id$


# 1557 26-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1556,
which included commits to RCS files with non-trunk default branches.


# 1556 26-May-1994 rgrimes

BSD 4.4 Lite bin Sources