[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

9100.0. "dd(1) - skip and iseek - any difference?" by MEOC02::JANKOWSKI () Tue Mar 11 1997 03:58

    In DU V4.0x dd(1) now has a new iseek option.
    
    What is the difference between 
      skip=number
          Skips number input records before starting copy.
    and
      iseek=number
          Seeks to the numberth record from the beginning of input file
          before copying.
    
Different wording suggests that there is a difference but I can't figure it
    out.
    
    Regards,
    
    Chris Jankowski
    Melbourne Australia
T.RTitleUserPersonal
Name
DateLines
9100.1Just a guess.SSDEVO::ROLLOWDr. File System's Home for Wayward Inodes.Tue Mar 11 1997 09:297
	I tried skip once a long time ago on ULTRIX and it
	appeared to do one lseek(2) for each record it had
	to skip.  I'd guess that it was originally designed
	for tapes that support Forward Skip Record, and
	done the hard way of reading records where they didn't.
	The disk adaptation was probably to lseek one record
	at a time.  With any luck, iseek does a single lseek.
9100.2skip does IO, iseek moves the file position indicatorNETRIX::"[email protected]"Farrell WoodsTue Mar 11 1997 09:528
Or to put it another way, "skip" does n "ibs"-sized reads from the input file.
"iseek" simply does an lseek(fd, ibs * n, SEEK_CUR).  The semantic difference
could perhaps be significant if you're reading from a thing where lseek
doesn't make sense.

	-- Farrell

[Posted by WWW Notes gateway]
9100.3why iseek in dd ?RUSURE::KATZThu Mar 13 1997 10:5920
The audit history in dd.c claims that iseek and oseek
were inserted for standards conformance. Apparently they
cause a seek to be done on the (i)nput or (o)utput file
before beginning the read/write phase. 
In general seeking is faster than reading (actually
doesn't result in any physical i/o). The iseek would
therefore be faster than skip (still skipping n records
at the beginning of the file; records being sized by
ibs or bs options, defaulting to 512 bytes on disk, but
on tape being a single tape record as formatted on the
tape[don't ask unless you really want to know])
The oseek (glad you pointed this out) now affords us the
opportunity to create a sparse record in the front of a
file. You might ask why you'd want to do that ? Well,
for some of us, sparse file creation is important for
testing. For others, probably only useful if you know
that you need to have blocks and blocks of zeroes in the
front of the file, this would force it to look that way.
Anyone else find a way to use these options ? Hollar.