[ELDK] File Size limited to 2GB

Jonathan Haws Jonathan.Haws at sdl.usu.edu
Wed Oct 21 00:44:31 CEST 2009


> > I am writing some code that needs to write files that are larger
> than
> > 2 GB.  My file system on my disk is EXT2, so I know it supports
> larger
> > files than that, however when I hit a 2 GB file size, I get errors
> > trying to write a file.
> >
> > I have tried including the flag O_LARGEFILE, however that is not
> > defined for a 32-bit system.  I checked the system limits with
> ulimit
> > -a and it says I have an unlimited file size (in blocks).  I
> believe
> > the limit is also inherent in older versions of GLibc, but I am
> > running 2.6.
> >
> > Any ideas?  What flag in the kernel am I missing?  Or is it
> something
> > in how my drive if formatted?  Any kind of help would be
> appreciated.
> 
> You may want to read the libc documentation, especially section
> "1.3.4 Feature Test Macros" and the related documentation about the
> macros _LARGEFILE_SOURCE, _LARGEFILE64_SOURCE, and
> _FILE_OFFSET_BITS.
> 

That was the tidbit that I needed.  All I needed to do was:

#define _LARGEFILE64_SOURCE
#define _FILE_OFFSET_BITS 64

Then everything worked just fine.

I appreciate the help!

Jonathan


More information about the eldk mailing list