Large file support and stat vs stat64 in extension modules

Ben Escoto ben at remove.Stanford.EDU
Tue Sep 10 19:03:40 EDT 2002


Hi, I'm writing an extension module in C and am having trouble
statting files longer than 2GB, at least under linux (Redhat 7.2, intel).
If I simply use the stat() system call, I get an EOVERFLOW error
(OSError: [Errno 75] Value too large for defined data type).  It seems
that I should be using the newer stat64() call, but:

1.  posixmodule.c appears just to use plain old stat().  I cannot figure
    out why I get errors and it works fine.  Quite a mystery.

2.  I don't know what #if defined's to put in to choose between stat and
    stat64 correctly.

Does anyone know how to correctly stat a file within an extension module?
Why does:

    struct stat st;
    res = stat("bigfile", &st)

not work for me, but in posixmodule.c the same thing (apparently) is done
and works fine?


-- 
Ben Escoto



More information about the Python-list mailing list