[PATCH][RFC] Enable LFS support for libcpp and gcc

Paolo Bonzini bonzini@gnu.org
Fri Feb 13 17:44:00 GMT 2009


> But the issue is that _off_t (off_t) remains a long on w64. We have
> _off64_t, but the type off_t wouldn't be suitable for w64 target.

So the solution would be something like this, plus using
size_t/fseeko/ftello uniformly (except in gcov-io.h):

AC_CHECK_SIZEOF([off_t], [], [#include <sys/types.h])
AC_CHECK_FUNC([fseeko])

if test $ac_cv_func_fseeko = yes && test "$ac_cv_sizeof_off_t" -gt 4
then
  # Alright, fseeko is present and allows 64-bit access.
else
  # See if we can use fseeko64, fall back to fseek otherwise.
  AC_CHECK_FUNC([fseeko64],
    [fseeko_suffix=o64],
    [fseeko_suffix=])

  AC_DEFINE([fseeko], [fseek$fseeko_suffix],
[Define to fseek or fseeko64 if fseeko is not present or does not enable
access to >2^32 bytes in a file.])
  AC_DEFINE([ftello], [ftell$fseeko_suffix],
[Define to ftell or ftello64 if ftello is not present or does not enable
access to >2^32 bytes in a file.])
fi

The reason for using size_t is that we're dealing with files that won't
be anyway bigger than the address space, as Richi pointed out correctly.

Paolo



More information about the Gcc-patches mailing list