aboutsummaryrefslogtreecommitdiff
path: root/bin/dd
Commit message (Collapse)AuthorAgeFilesLines
* Add O_DIRECT flag to DD for cache bypassRichard Scheffenegger2020-06-044-4/+17
| | | | | | | | | | | | | | | FreeBSD DD utility has not had support for the O_DIRECT flag, which is useful to bypass local caching, e.g. for unconditionally issuing NFS IO requests during testing. Reviewed by: rgrimes (mentor) Approved by: rgrimes (mentor, blanket) MFC after: 3 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D25066 Notes: svn path=/head/; revision=361806
* Add iflag=fullblock to ddMatt Macy2019-09-304-21/+76
| | | | | | | | | | | | | | | | | | | | Normally, count=n means read(2) will be called n times on the input to dd. If the read() returns short, as may happen when reading from a pipe, fewer bytes will be copied from the input. With conv=sync the buffer is padded with zeros to fill the rest of the block. iflag=fullblock causes dd to continue reading until the block is full, so that count=n means n full blocks are copied. This flag is compatible with illumos and GNU dd and is used in the ZFS test suite. Submitted by: Ryan Moeller Reviewed by: manpages, mmacy@ MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D21441 Notes: svn path=/head/; revision=352923
* Add oflag=fsync and oflag=sync capability to ddMatt Macy2019-09-304-7/+67
| | | | | | | | | | | | | | | Sets the O_FSYNC flag on the output file. oflag=fsync and oflag=sync are synonyms just as O_FSYNC and O_SYNC are synonyms. This functionality is intended to improve portability of dd commands in the ZFS test suite. Submitted by: Ryan Moeller Reviewed by: manpages, mmacy@ MFC after: 1 week Sponsored by: iXsytems, Inc. Differential Revision: https://reviews.freebsd.org/D21422 Notes: svn path=/head/; revision=352922
* dd: Check result of close(2) for errorsMatt Macy2019-09-301-1/+2
| | | | | | | | | | | | | | | close(2) can return errors from previous operations which should not be ignored. PR: 229616 Submitted by: Thomas Hurst Reported by: Thomas Hurst Reviewed by: mmacy@ Obtained from: Ryan Moeller MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21376 Notes: svn path=/head/; revision=352921
* Add conv=fdatasync flag to ddMatt Macy2019-09-305-37/+46
| | | | | | | | | | | | | | The fdatasync flag performs an fdatasync(2) on the output file before closing it. This will be useful for the ZFS test suite. Submitted by: Ryan Moeller Reviewed by: manpages, mmacy@ MFC after: 1 week Sponsored by: iXSystems, Inc. Differential Revision: https://reviews.freebsd.org/D21373 Notes: svn path=/head/; revision=352920
* Add conv=fsync flag to ddMatt Macy2019-09-034-0/+13
| | | | | | | | | | | | | The fsync flag performs an fsync(2) on the output file before closing it. This will be useful for the ZFS test suite. Submitted by: ryan@ixsystems.com Reviewed by: jilles@, imp@ MFC after: 1 week Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=351770
* .Xr trim(8) from dd(1).Edward Tomasz Napierala2019-03-261-2/+3
| | | | | | | | MFC after: 2 weeks Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=345548
* Replace hand-crafted naive byte-by-byte zero block detection routineMaxim Sobolev2018-11-292-7/+7
| | | | | | | | | | | | | | with macro based around memcmp(). The latter is expected to be some 8 times faster on a modern 64-bit architectures. In practice, throughput of doing conv=sparse from /dev/zero to /dev/null went up some 5-fold here from 1.9GB/sec to 9.7GB/sec with this change (bs=128k). MFC after: 2 weeks Notes: svn path=/head/; revision=341257
* capsicum: use a new capsicum helpers in toolsMariusz Zaborski2018-11-041-4/+3
| | | | | | | Use caph_{rights,ioctls,fcntls}_limit to simplify the code. Notes: svn path=/head/; revision=340138
* dd(1): Correct padding in status=progressKyle Evans2018-09-131-3/+3
| | | | | | | | | | | | | | | | | | Output padding is specified via outlen, which is set using the return value of fprintf. Because it's printing that padding plus a trailing byte, it grows by one each iteration rather than reflecting actual length. Additionally, iec was sized improperly for scaling up similarly to si. Fixing this revealed that the humanize_number(3) call to populate persec was using the wrong width. Submitted by: Thomas Hurst <tom@hur.st> Reviewed by: imp Approved by: re (kib) Differential Revision: https://reviews.freebsd.org/D16960 Notes: svn path=/head/; revision=338646
* dd(1): Kill off duplicate progress definition following r337865Kyle Evans2018-08-151-1/+0
| | | | | | | Reported by: mmacy Notes: svn path=/head/; revision=337869
* dd: Incorporate some changes from imp for status=progressKyle Evans2018-08-155-31/+32
| | | | | | | | | | | | | | | Notable changes from what landed in r337505: - sigalarm handler isn't setup unless we're actually using it - Humanized versions of the amount of data transferred in the progress update Submitted by: imp Reviewed by: kevans MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D16642 Notes: svn path=/head/; revision=337865
* dd: add status=progress supportKyle Evans2018-08-086-2/+59
| | | | | | | | | | | | This reports the current status on a single line every second, mirroring similar functionality in GNU dd, and carefully interacts with SIGINFO. PR: 229615 Submitted by: Thomas Hurst <tom@hur.st> (modified for style(9) nits by me) MFC after: 1 week Notes: svn path=/head/; revision=337505
* Convert `cap_enter() < 0 && errno != ENOSYS` to `caph_enter() < 0`.Mariusz Zaborski2018-06-191-1/+1
| | | | | | | No functional change intended. Notes: svn path=/head/; revision=335395
* dd(1): Use a local swapbytes() function.Eitan Adler2018-01-261-1/+16
| | | | | | | | | | swab(3) has restrict qualifiers for src and dst. Avoid relying on undefined overlapping swab behavior. Obtained From: OpenBSD Notes: svn path=/head/; revision=328427
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-208-0/+16
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Pacify GCC on mips32 after r322893Alan Somers2017-08-251-4/+4
| | | | | | | | | | | | | Though technically correct, GCC complains about usingi a "%zd" format specifier for a long. Reported by: cem MFC after: 3 weeks X-MFC-With: 322893 Sponsored by: Spectra Logic Notes: svn path=/head/; revision=322898
* dd(1): Incorrect casting of argumentsAlan Somers2017-08-255-25/+25
| | | | | | | | | | | | | | | dd(1) casts many of its numeric arguments from uintmax_t to intmax_t and back again to detect whether or not the original arguments were negative. This is not correct, and causes problems with boundary cases, for example when count is SSIZE_MAX-1. PR: 191263 Submitted by: will@worrbase.com Reviewed by: pi, asomers MFC after: 3 weeks Notes: svn path=/head/; revision=322893
* Add HAS_TESTS to all Makefiles that are currently using theEnji Cooper2017-08-021-0/+1
| | | | | | | | | `SUBDIR.${MK_TESTS}+= tests` idiom. This is a follow up to r321912. Notes: svn path=/projects/make-check-sandbox/; revision=321914
* Convert traditional ${MK_TESTS} conditional idiom for including testEnji Cooper2017-08-021-3/+1
| | | | | | | | | | | | | | directories to SUBDIR.${MK_TESTS} idiom This is being done to pave the way for future work (and homogenity) in ^/projects/make-check-sandbox . No functional change intended. MFC after: 1 weeks Notes: svn path=/head/; revision=321912
* Remove unnecessary make logic added in r319339Enji Cooper2017-07-181-4/+0
| | | | | | | | | This makes the change cleaner and easier to backport to ^/stable/10. MFC after: now Notes: svn path=/head/; revision=321138
* Fix bin/dd/dd2_tests:seek_overflow on UFS and TMPFSAlan Somers2017-06-031-8/+23
| | | | | | | | | | | | | Split the postive and negative parts into separate test cases. The positive test case can only run on ZFS, because only ZFS supports files that large. PR: 219757 Reported by: ngie MFC after: 18 days X-MFC-with: 319339 Notes: svn path=/head/; revision=319551
* Mark :seek_overflow as an expected failureEnji Cooper2017-06-031-0/+2
| | | | | | | | | | MFC after: 18 days MFC with: r319339 PR: 219757 Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=319544
* Stylistic tweaksEnji Cooper2017-06-031-2/+4
| | | | | | | | | | | Move opening braces of functions from the last column to column 0. MFC after: 18 days MFC with: r319339 Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=319543
* Fix integer overflow detection in ddAlan Somers2017-05-313-1/+56
| | | | | | | | | | | | | | | dd(1) tried to detect whether the seek offset would overflow, but it failed to account for the case where the provided argument was negative and the file was a regular file (negative seeks are allowed for character devices). I fixed it, and added a regression test. Reported by: Coverity CID: 1368659 MFC after: 3 weeks Sponsored by: Spectra Logic Corp Notes: svn path=/head/; revision=319339
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-05-091-0/+1
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=318000
* Fix indentation in dd(1)Eric van Gyzen2017-04-021-5/+5
| | | | | | | | | | | | | | Quoting http://mdocml.bsd.lv/mdoc/details/width.html Do not use macros in the argument specifying the width, since that's not portable. While GNU troff can handle it, mandoc cannot. MFC after: 3 days Sponsored by: Dell EMC Notes: svn path=/head/; revision=316430
* Renumber copyright clause 4Warner Losh2017-02-289-9/+9
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=314436
* Fix regression when stdin/out/err fds are are overridden by shell.Bartek Rutkowski2016-12-121-4/+10
| | | | | | | | | | | Submitted by: Pawel Biernacki <pawel.biernacki@gmail.com> Reported by: ngie Approved by: ngie Sponsored by: Mysterious Code Ltd. Differential Revision: https://reviews.freebsd.org/D8543 Notes: svn path=/head/; revision=309921
* Capsicum support for dd(1)Bartek Rutkowski2016-12-091-0/+30
| | | | | | | | | | | | | Adds Capsicum sandboxing to dd utility. Submitted by: Pawel Biernacki <pawel.biernacki@gmail.com> Reviewed by: allanjude, emaste, oshogbo Approved by: oshogbo Sponsored by: Mysterious Code Ltd. Differential Revision: https://reviews.freebsd.org/D8543 Notes: svn path=/head/; revision=309735
* [dd] Revert the capsicum bits for now until it gets fixed.Adrian Chadd2016-11-191-30/+0
| | | | | | | | | | dd is a bootstrap tool and that header isn't installed as part of the bootstrap environment for previous releases (eg freebsd-10.) We'll figure it out in post and then re-commit it. Notes: svn path=/head/; revision=308860
* Restore dd changes included accidentally in r308857.Ruslan Bukin2016-11-191-0/+30
| | | | Notes: svn path=/head/; revision=308858
* Bring in support for Ingenic XBurst JZ4780 andRuslan Bukin2016-11-191-30/+0
| | | | | | | | | | | | | X1000 systems on chips. Imgtec CI20 and Ingenic CANNA boards supported. Submitted by: Alexander Kabaev <kan@FreeBSD.org> Reviewed by: Ruslan Bukin <br@FreeBSD.org> Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=308857
* Capsicum support for dd(1)Bartek Rutkowski2016-11-181-0/+30
| | | | | | | | | | | | | Adds Capsicum sandboxing to dd utility. Submitted by: Pawel Biernacki <pawel.biernacki@gmail.com> Reviewed by: allanjude, emaste, oshogbo Approved by: oshogbo Sponsored by: Mysterious Code Ltd. Differential Revision: https://reviews.freebsd.org/D8543 Notes: svn path=/head/; revision=308810
* Add history section for dd(1)Sevan Janiyan2016-10-051-1/+6
| | | | | | | | | | | | | First version of UNIX to include dd found using TUHS http://minnie.tuhs.org/cgi-bin/utree.pl?file=V5/usr/source/s1/dd.c PR: 211777 Approved by: bcr (mentor) MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D8104 Notes: svn path=/head/; revision=306715
* Remove last remnants of acd(4), mcd(4), and scd(4) drivers.Alex Kozlov2016-08-251-2/+2
| | | | | | | Approved by: jhb Notes: svn path=/head/; revision=304814
* dd(1): Enable access to SIZE_T_MAX character devicesConrad Meyer2016-07-092-10/+31
| | | | | | | | | | | On machines where SIZE_T_MAX exceeds OFF_MAX (signed 64-bit), permit seeking character devices to negative off_t values. This enables dd(1) to interact with kernel KVA in /dev/kmem on amd64, for example. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=302500
* Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installedEnji Cooper2016-05-041-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | after r298107 Summary of changes: - Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that namespacing is kept with FILES appropriately, and that this shouldn't need to be repeated if the namespace changes -- only the definition of PACKAGE needs to be changed - Allow PACKAGE to be overridden by callers instead of forcing it to always be `tests`. In the event we get to the point where things can be split up enough in the base system, it would make more sense to group the tests with the blocks they're a part of, e.g. byacc with byacc-tests, etc - Remove PACKAGE definitions where possible, i.e. where FILES wasn't used previously. - Remove unnecessary TESTSPACKAGE definitions; this has been elided into bsd.tests.mk - Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES; ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk. - Fix installation of files under data/ subdirectories in lib/libc/tests/hash and lib/libc/tests/net/getaddrinfo - Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup) Document the proposed changes in share/examples/tests/tests/... via examples so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of replacing FILES. share/mk/bsd.README didn't seem like the appropriate method of communicating that info. MFC after: never probably X-MFC with: r298107 PR: 209114 Relnotes: yes Tested with: buildworld, installworld, checkworld; buildworld, packageworld Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=299094
* MFHGlen Barber2016-03-101-0/+11
|\ | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=296625
| * DIRDEPS_BUILD: Connect MK_TESTS.Bryan Drewery2016-03-091-0/+11
| | | | | | | | | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=296587
* | MFHGlen Barber2016-03-025-7/+60
|\| | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=296318
| * Add speed limit to dd(1). This is useful for testing RCTL disk io limitsEdward Tomasz Napierala2016-02-285-7/+60
| | | | | | | | | | | | | | | | | | | | | | | | (when they actually get committed, that is), and might also come in handy in other situations. Reviewed by: wblock@ (man page) MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=296156
* | MFHGlen Barber2016-02-226-27/+53
|\| | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295886
| * Make the "invalid numeric value" error message actually displayableEdward Tomasz Napierala2016-02-211-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | (was a dead code before). Submitted by: bde@ (earlier version) Reviewed by: bde@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=295854
| * Reorganize the handling all-zeroes terminal block in sparse modeThomas Quinot2016-02-185-19/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The intent of the previous code in that case was to force an explicit write, but the implementation was incorrect, and as a result the write was never performed. This new implementation instead uses ftruncate(2) to extend the file with a trailing hole. Also introduce regression tests for these cases. PR: 189284 (original PR whose fix introduced this bug) PR: 207092 Differential Revision: D5248 Reviewed by: sobomax,kib MFC after: 2 weeks Notes: svn path=/head/; revision=295749
* | MFHGlen Barber2016-02-101-6/+8
|\| | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295458
| * Improve comment to reflect recent changes.Edward Tomasz Napierala2016-02-091-2/+4
| | | | | | | | | | | | | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=295428
| * Use a proper type for return value of postfix_to_mult(); the way it'sEdward Tomasz Napierala2016-02-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | being used wouldn't work if the value returned didn't fit in intmax_t. Submitted by: bde@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=295427
| * Use proper functions for parsing the numeric values.Edward Tomasz Napierala2016-02-091-2/+2
| | | | | | | | | | | | | | | | | | Submitted by: bde@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=295426