gmediaserver-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gmediaserver-devel] File size limit


From: Mark Broadbent
Subject: Re: [gmediaserver-devel] File size limit
Date: Sat, 07 Jul 2007 13:46:40 +0100
User-agent: Mozilla-Thunderbird 2.0.0.4 (X11/20070622)

Jan Ceuleers wrote:
Wayne Stallwood wrote:
On Tue, 2007-07-03 at 20:20 +0200, Jan Ceuleers wrote:
However, if I strace the process, the stat64() call actually returns zero:

stat64("/home/storage/Test/Eragon-001.avi", {st_mode=S_IFREG|0644, st_size=2200526492, ...}) = 0

Maybe I am being a bit daft here but isn't stat64 actually returning an exit status of 0 there and a file size of 2200526492 bytes
Absolutely correct. But if you check the source code, you'll see that the piece of code that generates the error message is only executed if the stat() call returns a negative value.

So: the source code contains a stat() call; the library appears to translate that into a stat64() call which returns zero; the library then presumably does some more checking and finds that the file is too large to be supported by the stat() call so it returns a negative value instead.

I have since changed the stat() call into a stat64 call myself (along with the necessary changes in variable declarations). This then causes the subsequent open() call to fail. Unfortunately there does not seem to be a 64-bit equivalent of the open() call, so I'm stuck.

Subsequent to my message I also found out that the block size of the ext3 filesystem might be relevant. The block size is 4K, so I would not expect this to be the reason for the failure.

This is fairly easy to fix (provided that all the correct types have been used with the stat, open APIs).

You don't need to explicitly use the stat64 call if you add the following to compile line:

gcc -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE

This will automatically switch to using the large file compatible system call variants (i.e. stat becomes stat64). When using open you will also need to use the O_LARGEFILE flag as well to successfully open it.

See http://www.suse.de/~aj/linux_lfs.html for more information.

Cheers
Mark




reply via email to

[Prev in Thread] Current Thread [Next in Thread]