Large files (>4G) under linux

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Large files (>4G) under linux

Hans-Martin Mosner
 
Hello,
in an effort to play with large (video) files I now build a VM which is
capable of handling such files.
There are basically 2 small changes:
- add the option --CFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-g -O2 -fomit-frame-pointer" to the cmake call in .../unix/Makefile
- use fseeko and ftello in sqFilePluginBasicPrims.c

The first just adds the two defines to the C compiler options in
addition to options which were default anyway.

However, I'm feeling somewhat uneasy about the second change. There's a
comment by Tim Rowledge in the file which states that he removed ftello
and fseeko in 2002 to make the file ansi-compliant. The linux man page
for these function states that they are in POSIX.1-2001, which should be
old enough to depend on these functions in any posix environment.

So what do you think about it? I definitely want the VM to be able to
handle large files.

Cheers,
Hans-Martin
Reply | Threaded
Open this post in threaded view
|

Re: Large files (>4G) under linux

David T. Lewis
 
On Thu, Jun 03, 2010 at 11:05:35PM +0200, Hans-Martin Mosner wrote:

>  
> Hello,
> in an effort to play with large (video) files I now build a VM which is
> capable of handling such files.
> There are basically 2 small changes:
> - add the option --CFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
> -g -O2 -fomit-frame-pointer" to the cmake call in .../unix/Makefile
> - use fseeko and ftello in sqFilePluginBasicPrims.c
>
> The first just adds the two defines to the C compiler options in
> addition to options which were default anyway.
>
> However, I'm feeling somewhat uneasy about the second change. There's a
> comment by Tim Rowledge in the file which states that he removed ftello
> and fseeko in 2002 to make the file ansi-compliant. The linux man page
> for these function states that they are in POSIX.1-2001, which should be
> old enough to depend on these functions in any posix environment.
>
> So what do you think about it? I definitely want the VM to be able to
> handle large files.

How about adding this to sqFilePluginBasicPrims.c:

#ifdef HAVE_FSEEKO
#define fseek fseeko
#define ftell ftello
#endif

Then arrange for cmake/configure to set HAVE_FSEEKO in config.h.

This leaves the default implementation unchanged, but allows use of
fseeko() and ftello() for platforms that support it.

Dave