Large file support and stat vs stat64 in extension modules
Skip Montanaro
skip at pobox.com
Wed Sep 11 13:23:16 EDT 2002
>> Did you #include <sys/stat.h>?
Ben> Yes, but perhaps I'm not including something else. Here is a short
Ben> program (test.c):
...
Dunno what else might be causing it. I modified your program slightly:
#define __USE_FILE_OFFSET64
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
main()
{
struct stat st;
if (stat("/home/ben/work/big/bigfile", &st) != 0)
perror("Error");
else printf("OK\n");
}
and ran it through gcc -E. I expected the stat() call to be transformed,
but it wasn't. Apparently, I don't have large file support builtin. In
fact, I saw
extern int stat (__const char *__restrict __file,
struct stat *__restrict __buf) ;
extern int fstat (int __fd, struct stat *__buf) ;
in the output, suggesting that by the time that little bit of code in
sys/stat.h was executed __USE_FILE_OFFSET64 had been #undef'd.
--
Skip Montanaro
skip at pobox.com
consulting: http://manatee.mojam.com/~skip/resume.html
More information about the Python-list
mailing list