#1488 can't open files larger than 4GB.

WSL
closed
Earnie Boyd
large files (1)
Task
works-for-me
Unknown
False
2013-02-19
2010-11-02
shayap
No

when I try to open files that are larger than 4GB.

this simple program

#define _FILE_OFFSET_BITS 64
#define _LARGEFILE64_SOURCE 1
#define _LARGEFILE_SOURCE 1

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(int argc, char *argv[])
{
FILE * filp;
int fd;

if \( \(filp = fopen\(argv\[1\], "r+"\)\) == NULL\) \{
    perror\("fopen: failed to open"\);
\}

if \( \(fd = open\(argv\[1\], O\_RDWR\)\) == -1\) \{
    perror\("open: failed to open"\);
\}

}

fails at both fopen and open when argv[1] is a file that is larger than 4GB. succeeds when the file is smaller than 4GB.

Discussion

  • shayap
    shayap
    2010-11-02

    info, I forgot to include.

    This is win7 - 64 bit

    gcc version 4.5.1 (tdm-1)
    ld version 2.20.51.20100613

    uname -a (transcribed)
    MINGW32_NT-6.1 TRILLIAN2 1.0.15(0.47/3/2) 2010-07-06 22:04 i686 Msys

     
  • shayap
    shayap
    2010-11-02

    so mingw obviously supports this as other libs I have (libdvdcss and libcdio) work fine w/ the large file.

    Hoewve,r I can't for the life of me figure out how to do it correctly in my own program. It seems very non obvious.

     
  • Earnie Boyd
    Earnie Boyd
    2013-02-08

    • labels: MinGW --> large files
    • status: open --> pending
    • assigned_to: Earnie Boyd
    • milestone: --> WSL
    • type: --> Task
    • resolution: --> later
    • category: --> Unknown
    • patch_attached: --> False
     
  • Earnie Boyd
    Earnie Boyd
    2013-02-19

    This works-for-me with the current set of binaries.

     
  • Earnie Boyd
    Earnie Boyd
    2013-02-19

    • status: pending --> closed
    • resolution: later --> works-for-me