summaryrefslogtreecommitdiff
path: root/bin/dd/position.c
Commit message (Collapse)AuthorAgeFilesLines
* dd: Incorporate some changes from imp for status=progressKyle Evans2018-08-151-0/+2
| | | | | | | | | | | | | | | 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
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | 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
* dd(1): Incorrect casting of argumentsAlan Somers2017-08-251-1/+1
| | | | | | | | | | | | | | | 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
* Fix integer overflow detection in ddAlan Somers2017-05-311-1/+1
| | | | | | | | | | | | | | | 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
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | 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
* dd(1): Enable access to SIZE_T_MAX character devicesConrad Meyer2016-07-091-2/+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
* bin/dd: revert 273734, as it fails on 32bit platformsKurt Jaeger2014-10-271-1/+1
| | | | | | | | | Revert: insufficient testing on 32bit platforms PR: 191263 Notes: svn path=/head/; revision=273743
* bin/dd: Fix incorrect casting of argumentsKurt Jaeger2014-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | | 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 caused wrong behaviour in some boundary cases: $ dd if=/dev/zero of=/dev/null count=18446744073709551615 dd: count cannot be negative After the fix: $ dd if=/dev/zero of=/dev/null count=18446744073709551615 dd: count: Result too large PR: 191263 Submitted by: will@worrbase.com Approved by: cognet@ Notes: svn path=/head/; revision=273734
* Make dd's signal handler async safe.Eitan Adler2013-05-101-0/+3
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=250469
* Remove clause 3 from the UCB licenses.Mark Murray2004-04-061-4/+0
| | | | | | | OK'ed by: imp, core Notes: svn path=/head/; revision=127958
* WARNS=4 fixes. This would be WARNS=9 if we were -std=99 instead ofMark Murray2003-02-271-0/+1
| | | | | | | | | -ansi, due to 'long long'. Reviewed by: green (slightly earlier version) Notes: svn path=/head/; revision=111629
* Consistently use __FBSDIDDavid E. O'Brien2002-06-301-2/+2
| | | | Notes: svn path=/head/; revision=99109
* o __P has been reovedWarner Losh2002-02-021-2/+2
| | | | | | | | | | | | | | 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
* Allow negative seek offsets for files that can be seeked upon. ItBrian Feldman2000-10-221-0/+8
| | | | | | | | makes dd(1) a more complete "filter", even if this functionality is limited to seekable streams. Notes: svn path=/head/; revision=67451
* Various cleanups are made to reduce warnings and make code prettier :)Brian Feldman2000-07-011-3/+7
| | | | | | | | Also, check for ftruncate() return value and die on failure, but only try to ftruncate() when the file is a regular file. Notes: svn path=/head/; revision=62311
* Make count=0 set cpy_cnt to -1, which is slight overloading, but makesBrian Feldman1999-09-161-1/+1
| | | | | | | | | 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. Notes: svn path=/head/; revision=51335
* Even more dd(1) cleanups! Thanks to Bruce for staying on my case untilBrian Feldman1999-09-131-4/+8
| | | | | | | we're done (not yet!) :) Notes: svn path=/head/; revision=51249
* ISDISK -> ISSEEKBrian Feldman1999-09-121-2/+2
| | | | | | | Allow a device type of D_DISK or D_MEM to be ISSEEK. Notes: svn path=/head/; revision=51212
* Even more cleanups to dd(1). This is probably the culmination of theBrian Feldman1999-09-121-8/+6
| | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=51208
* Make a bit more headway with dd's argument parsing, etc. get_bsz() isBrian Feldman1999-09-111-2/+10
| | | | | | | | renamed get_num() since it's not just about block sizes. skip and seek can be any offset, including negative, now. Some style bogons are fixed. Notes: svn path=/head/; revision=51137
* $Id$ -> $FreeBSD$Peter Wemm1999-08-271-1/+1
| | | | Notes: svn path=/head/; revision=50471
* Implement seekability for disk devices (not just regular files).Brian Feldman1999-07-131-8/+4
| | | | | | | | | Also, fix pos_out() to do the same checks pos_in() did. Done for: jdp, luigi, the good of the world Notes: svn path=/head/; revision=48802
* This is the second round of dd(1) changes. Some changes made/reversed byBrian Feldman1999-06-201-2/+1
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=48051
* Miscellaneous dd(1) changes: mainly fixing variable types (size_t, ssize_t,Brian Feldman1999-06-191-8/+11
| | | | | | | | off_t, int, u_int64_t, etc.). dd(1) should now work properly with REALLY big amounts of data. Notes: svn path=/head/; revision=48026
* Restore Lite-2 sccsid. Restore include of sys/types.h.Philippe Charnier1998-05-131-2/+3
| | | | Notes: svn path=/head/; revision=36007
* Correct use of .Nm and other cosmetics. Add rcsid. Remove unused #inc.Philippe Charnier1998-05-061-7/+4
| | | | Notes: svn path=/head/; revision=35773
* Fixed overflow for attempts to seek to offsets > ULONG_MAX. See theBruce Evans1997-04-301-2/+2
| | | | | | | | | OpenBSD version for more complete fixes. E.g., to seek to offsets > INT_MAX using a block size of 1, block numbers need to be off_t's instead of u_long's. Notes: svn path=/head/; revision=25317
* Revert $FreeBSD$ to $Id$Peter Wemm1997-02-221-1/+1
| | | | Notes: svn path=/head/; revision=22988
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-141-1/+1
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=21673
* -Wall cleaning.Steve Price1996-12-141-2/+2
| | | | Notes: svn path=/head/; revision=20420
* Added $Id$David Greenman1994-09-241-0/+2
| | | | Notes: svn path=/head/; revision=3044
* BSD 4.4 Lite bin SourcesRodney W. Grimes1994-05-261-0/+166
Notes: svn path=/head/; revision=1556