Large file support and stat vs stat64 in extension modules
Ben Escoto
ben at remove.Stanford.EDU
Tue Sep 17 01:58:21 EDT 2002
On Tue, 10 Sep 2002 16:03:40 -0700, Ben Escoto wrote:
> Does anyone know how to correctly stat a file within an extension
> module? Why does:
Someone (Russ Allbery) recently helped me with this, so I thought I might
as well try answering my own question in case anyone else has this
problem. The basic answer seems to be to define _LARGEFILE_SOURCE and
_FILE_OFFSET_BITS=64. In fact, looking at Python's configure.in we see:
AC_DEFINE(_LARGEFILE_SOURCE)
AC_DEFINE(_FILE_OFFSET_BITS, 64)
so just compile everything with -D_LARGEFILE_SOURCE and
-D_FILE_OFFSET_BITS=64. If using distutils, adding
define_macros=[("_LARGEFILE_SOURCE", 1), ("_FILE_OFFSET_BITS", 64)]
when declaring the ext_modules does something similar and seems to work.
Again, this is a bit ad hoc, but seems to work, and I don't know of a
better way.
--
Ben Escoto
More information about the Python-list
mailing list