[PD] Large File Support on Linux

Charles Goyard cg at fsck.fr
Thu Mar 21 09:37:19 CET 2013


Hi,

Here's a small summary of what has to be done, from
http://users.suse.com/~aj/linux_lfs.html :

"
In a nutshell for using LFS you can choose either of the following:

    Compile your programs with "gcc -D_FILE_OFFSET_BITS=64". This forces
    all file access calls to use the 64 bit variants. Several types
    change also, e.g. off_t becomes off64_t. It's therefore important to
    always use the correct types and to not use e.g. int instead of
    off_t. For portability with other platforms you should use getconf
    LFS_CFLAGS which will return -D_FILE_OFFSET_BITS=64 on Linux
    platforms but might return something else on e.g. Solaris. For
    linking, you should use the link flags that are reported via getconf
    LFS_LDFLAGS. On Linux systems, you do not need special link flags.
    Define _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE. With these
    defines you can use the LFS functions like open64 directly.
    Use the O_LARGEFILE flag with open to operate on large
    files.

    A complete documentation of the feature test macros like
    _FILE_OFFSET_BITS and _LARGEFILE_SOURCE is in the glibc
    manual (run e.g. "info libc 'Feature Test Macros'").

    The LFS API is also documented in the LFS standard which is
    available at
    http://ftp.sas.com/standards/large.file/x_open.20Mar96.html.
"


Note than open_via_file returns int and not off_t, so the automagic
stuff will fail.

I guess Miller is right and it should be targeted to 0.45 or 0.46,
that's not a small change.

Cheers,
Charles

Ivica Ico Bukvic wrote:
> Could one simply redefine lseek and fstat to use lseek64 and fstat64 instead
> and be done with it (again, assuming one is not concerned with backwards
> and/or x-platform compatibility)?



More information about the Pd-list mailing list