[Mesa-dev] [PATCH] configure.ac: Add AC_SYS_LARGEFILE

Michel Dänzer michel at daenzer.net
Tue Sep 2 20:38:17 PDT 2014


On 03.09.2014 06:50, Emil Velikov wrote:
> On 02/09/14 08:17, Michel Dänzer wrote:
>>
>> diff --git a/src/gallium/auxiliary/os/os_mman.h b/src/gallium/auxiliary/os/os_mman.h
>> index b48eb053..19478d2 100644
>> --- a/src/gallium/auxiliary/os/os_mman.h
>> +++ b/src/gallium/auxiliary/os/os_mman.h
>> @@ -40,9 +40,6 @@
>>   #include "pipe/p_compiler.h"
>>
>>   #if defined(PIPE_OS_UNIX)
>> -#  ifndef _FILE_OFFSET_BITS
>> -#    error _FILE_OFFSET_BITS must be defined to 64
>> -#  endif
> Can you leave the above hunk, afaics it serves as a safeguard which is always
> a nice thing to have :)

AC_SYS_LARGEFILE doesn't define _FILE_OFFSET_BITS on 64-bit, because 
it's not necessary there for large file support. That's why I converted 
the configure script check generated by AC_SYS_LARGEFILE to the 
STATIC_ASSERT below instead. I just double-checked that the 
STATIC_ASSERT fails on 32-bit without AC_SYS_LARGEFILE but passes with it.


>>   #  include <sys/mman.h>
>>   #else
>>   #  error Unsupported OS
>> @@ -77,7 +74,15 @@ static INLINE void *os_mmap(void *addr, size_t length, int prot, int flags, int
>>   #  define os_mmap(addr, length, prot, flags, fd, offset) mmap(addr, length, prot, flags, fd, offset)
>>   #endif
>>
>> -#define os_munmap(addr, length) munmap(addr, length)
>> +static INLINE int os_munmap(void *addr, size_t length)
>> +{
>> +   /* Copied from configure code generated by AC_SYS_LARGEFILE */
>> +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
>> +   STATIC_ASSERT(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1);
>> +#undef LARGE_OFF_T
>> +
>> +   return munmap(addr, length);
>> +}



-- 
Earthling Michel Dänzer            |                  http://www.amd.com
Libre software enthusiast          |                Mesa and X developer


More information about the mesa-dev mailing list