Lawrence D?Oliveiro wrote:
On Wed, 15 Apr 2026 06:48:42 -0000 (UTC), Anthk wrote:
By default under GNU/Linux you need to pass a preprocessor flag to
enforce large file support on 32 bit programs.
All that does is choose which kernel calls your source code will make.
It does rather more than that. The primary thing it does is change
the definition of off_t so that it is a 64-bit integer instead of 32.
E.g. with glibc:
$ echo '#include <sys/types.h>' | gcc -m32 -E - | grep '[^l]off_t' __extension__ typedef long int __off_t;
typedef __off_t off_t;
$ echo '#include <sys/types.h>' | gcc -m32 -D_FILE_OFFSET_BITS=64 -E - | grep '[^l]off_t'
__extension__ typedef long int __off_t;
typedef __off64_t off_t;
As a consequence of this, every C library function that involves off_t
or structures containing off_t has to end up calling a different function.
Some of them just make kernel calls, but others don't. For example, the fseeko() function:
$ echo '#include <stdio.h>' | gcc -m32 -E - | grep fseeko
extern int fseeko (FILE *__stream, __off_t __off, int __whence);
$ echo '#include <stdio.h>' | gcc -m32 -D_FILE_OFFSET_BITS=64 -E - | grep fseeko
extern int fseeko (FILE *__stream, __off64_t __off, int __whence) __asm__ ("" "fseeko64")
--
Geoff Clare <
netnews@gclare.org.uk>
--- PyGate Linux v1.5.14
* Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)