Re: Filesize limitation

Richard B. Johnson (root@chaos.analogic.com)
Mon, 3 Nov 1997 14:34:17 -0500 (EST)


On Mon, 3 Nov 1997, Andre Uratsuka Manoel wrote:

>
>
> On Mon, 3 Nov 1997, Richard B. Johnson wrote:
>
> -> On Mon, 3 Nov 1997, Andre Uratsuka Manoel wrote:
> ->
> -> >
> -> There is plenty of "room" available in the object types that would
> -> define a file in Linux for an ext2 file-system (like fpos_t, etc.)
> ->
> -> I don't have a spare disk large enough to make a 2Gb file. However,
> -> I would guess that if you can't make one (with large enough media), there
> -> is either a bug in the program that tries to create it or possibly a
> -> bug in the kernel. You don't need 64 bits to manipulate a 2 Gb file.
> ->
> ->
>
> That's good, but it seems to me libc users a signed integer
> (ssize_t) for functions like read, write, seek, tell. Couldn't that
> cause problems, too?
>
> Also, the possibility of bugs in the program is still there.
>
> Thanks and regards
> Andre
>
>

Don't see how....

#include <stdio.h>

main()
{
long foo = 0x07fffffff; /* Largest signed 32-bit */
printf("%ld bytes \n", foo);
foo /= 1024;
printf("%ld kilobytes\n", foo);
foo /= 1024;
printf("%ld megabytes\n", foo);
}

2147483647 bytes
2097151 kilobytes
2047 megabytes

As you can see, 2 Gb fits fine. ssize_t is a 32-bit (long) int under
Linux.

Cheers,
Dick Johnson

Richard B. Johnson
Project Engineer
Analogic Corporation
Penguin : Linux version 2.1.60 on an i586 machine (66.15 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.