• 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)
  • From Geoff Clare@3:633/10 to All on Mon Apr 20 13:26:12 2026
    Lawrence D?Oliveiro wrote:

    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.

    The kernel doesn't care about the change of off_t size, but programmers
    very much need to care. If you try to mix object files compiled with
    different off_t sizes, and they interact in any way that involves
    off_t, it is not going to end well. The way glibc handles this for its
    own functions (that I mentioned but you didn't quote) is a special case
    of this, but for third-party libraries you're probably on your own.

    --
    Geoff Clare <netnews@gclare.org.uk>

    --- PyGate Linux v1.5.14
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Dan Cross@3:633/10 to All on Mon Apr 20 13:19:42 2026
    In article <4kihbm-blg.ln1@ID-313840.user.individual.net>,
    Geoff Clare <netnews@gclare.org.uk> wrote:
    Lawrence D?Oliveiro wrote:
    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.

    The kernel doesn't care about the change of off_t size, but programmers
    very much need to care. If you try to mix object files compiled with >different off_t sizes, and they interact in any way that involves
    off_t, it is not going to end well. The way glibc handles this for its
    own functions (that I mentioned but you didn't quote) is a special case
    of this, but for third-party libraries you're probably on your own.

    It's unclear to me what point Lawrence is trying to make; as
    usual, I suspect he doesn't have one.

    The kernel, of course, cares very much what a user program is
    using for `off_t`, since it will need to adjust to the different
    definitions accordingly (copy-in's and -outs need the size, of
    course, and it may exercise different error paths, and so on).

    If he simply means that the kernel is not concerned with the
    actual `typedef` or equivalent in a user program, since user
    programs are compiled separtely and outside of the domain of the
    program, then that may be true, but it's a pretty meaningless
    statement. But it would be typical of him, to fixate on some
    trivial detail and ignore the larger context.

    - Dan C.


    --- 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 Mon Apr 20 21:32:36 2026
    On Mon, 20 Apr 2026 13:26:12 +0100, Geoff Clare wrote:

    Lawrence D?Oliveiro wrote:

    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.

    The kernel doesn't care about the change of off_t size, but
    programmers very much need to care.

    Like I said, all it does is change which kernel calls your source code
    will make.

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