On Tue, Mar 27, 2001 at 11:56:26AM -0800, Peter Jay Salzman wrote:
> eric, first, let me tell you the reason for the limit in the first place.
>
> the 2GB limit isn't linux's fault. it's the fault of the ISO/ANSI C team.
> many operating systems use the (what i call) "strange" data types like
> fpos_t and off_t. these functions *can* break when you deal with files
> larger than 2GB. the answer is to retypedef the wierd data types. to wit:
>
> ssize_t write(int fd, const void *buf, size_t count);
> ^ ^
> | |
> wierd wierd
>
> i think you can get the definitions for these wierd types in types.h.
>
> however, there are functions like fseek() and ftell() which use a good old
> fasioned "long int" for the offset, and you can't play around with that.
>
>
> AFAIK, 2.2.18 does not support files larger than 2GB without a kernel patch.
> i do believe, though, that the patch made it into the 2.3 kernel.
write() isn't ISO/ANSI C. It's POSIX.
And actually, fpos_t is the /solution/ to the problem, not the cause
of it (off_t isn't ISO/ANSI C either). The fact that fseek() and
ftell() use old fassioned "long int" means that, if on your
implementation "long int" is 32-bits (which it is on both yours and
mine), it can only address a 2GB file. fpos_t was provided so that
your C implementation could choose to define it as the most
appropriate type for addressing files on your system. This is a good
thing, not a bad thing.
Micah