File sizes > 2^32 bytes?

Bob Lenk rml at hpfcdc.HP.COM
Thu May 25 09:38:42 AEST 1989


>                                                   What does POSIX
> say about the maximum file size?

A file size is represented by the type off_t, which is required to be an
arithmetic type.  This type is returned in the stat structure field
st_size and used in the interface to lseek() and fcntl() (for file
locking).  An implementation can implement an arithmetic type longer
than 32 bits.  This will result in backward compatibility issues for
most existing implementations.

>                                            (Are there any utilities
> that actually interpret the sign bit of the file size/seek position,
> which would prevent using the last 2 GB of the 32 bits?)

The kernel does.  The interface to lseek() permits negative values,
which are especially useful relative to current position or to EOF.
The current POSIX standard fails to explicitly require that off_t be
a signed type, but any implementation that tried to interpret it as
unsigned would have troubles.  The current draft of a supplement to
1003.1 adds this requirement.

		Bob Lenk
		hplabs!hpfcla!rml
		rml at hpfcla.hp.com



More information about the Comp.unix.wizards mailing list