[comp.unix.questions] size of a file

peralta@pinocchio.Encore.COM (Rick Peralta) (01/18/90)

In most implementations a pointer to the offset in the file is maintained.
The file (and filesystem) cannot ecxcede the limit of the int.  So, how
can a very large file be accommodated?  On a 16 bit machine this must have
been a critical problem.  Does anyone know how it was overcome?


 - Rick "Maybe compiler vodo, floating point hacks, secret math libraries..."

gwyn@smoke.BRL.MIL (Doug Gwyn) (01/18/90)

In article <10890@encore.Encore.COM> peralta@multimax.encore.com (Rick Peralta) writes:
>In most implementations a pointer to the offset in the file is maintained.
>The file (and filesystem) cannot ecxcede the limit of the int.  So, how
>can a very large file be accommodated?  On a 16 bit machine this must have
>been a critical problem.  Does anyone know how it was overcome?

On modern UNIX systems the file offset is a long (at least 32 bits).
This still causes problems for a few systems with huge files..

Before long was added to C, i.e. up through Sixth Edition UNIX,
it was necessary to perform a seek in two parts, one involving
a (512-byte) block offset and the other involving a byte offset
(usually within the block).  The 16-bit system call was seek(),
thus the improved 32-bit version was called lseek().