• Glibc LFS on 32 bit (was: Don Norman: The Truth About Unix)

    From Geoff Clare@3:633/10 to All on Fri Apr 17 14:20:59 2026
    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)
  • From Bob Eager@3:633/10 to All on Fri Apr 17 13:48:25 2026
    On Fri, 17 Apr 2026 14:20:59 +0100, Geoff Clare wrote:

    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.

    I remember when the offset was a 16 bit integer! And one of the reasons
    UNIX disks were partitioned, because the device driver only handled 16
    bits on the API side. (and why the seek call is called lseek)

    --- PyGate Linux v1.5.14
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Fri Apr 17 22:44:59 2026
    On Fri, 17 Apr 2026 14:20:59 +0100, Geoff Clare wrote:

    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.

    Again, that?s just to suit different kernel calls. The kernel doesn?t
    know, doesn?t care, what ?off_t? means in your source code, or indeed
    any other name you might use.

    --- PyGate Linux v1.5.14
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)