Speed of seeks

Chris Torek chris at umcp-cs.UUCP
Sat May 17 06:43:29 AEST 1986


In article <645 at baylor.UUCP> peter at baylor.UUCP (Peter da Silva) writes:
>a mistake often made by library writers is to try to make seek
>offsets simple integers. According to the library, the argument to
>an absolute seek() (lseek(fd, off, 0) or lseek(fd, off, 2)) only
>needs to be the returned value from a tell() call: it may indeed
>be a magic cookie like a sector/offset pair (and in fact "magic
>cookie" is the way it's described in the manual). It is under
>RSX/11M and on the ATARI 800.

Add `f' in front of the names (fseek, ftell) and you are correct;
Unix systems, however---or at least 4.3beta---claim that lseek
offsets are in `bytes'.  (There is no `tell' system call.)

Actually, those who write libraries such that fseek takes a byte
index either have missed that point, or are very clever:  Because
PDP-11 and Vax Unix systems have always had fseek and ftell return
byte indicies, there is no doubt quite a bit of code that depends
on that behaviour.  These programs are technically broken, but it
is hard to keep a customer happy by informing it [note non-sexist
word :-)] of this fact.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris at umcp-cs		ARPA:	chris at mimsy.umd.edu



More information about the Comp.unix.wizards mailing list