I just installed a vanilla CentOS 6 and when I try to get large file support using the -D_FILE_OFFSET_BITS=64 the field st_size is still only 32 bits
uname -a:
Linux vm01 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
What I can see this host is 64 bits.
My simple test program to see if st_size accept value larger than 32 bits:
#include <sys/stat.h>
int main(int argc, char *argv[]) {
struct stat s;
s.st_size = 1024*1024*1024*1024; // 1 Tbyte
return 0;
}
Compile command:
gcc -c test.c -D_FILE_OFFSET_BITS=64 -o test
Result:
test.c: In function ‘main’: test.c:7: warning: left shift count >= width of type
I don't understand why gcc complains as according to all doc I've read the stat should support large file such as 64 bits for the st_size.
gcc -v
Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
Can someone help me solve this mystery?
Thanks