[PATCH] io: Fix record locking contants for powerpc64 with __USE_FILE_OFFSET64

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Tue Aug 29 13:20:47 GMT 2023



On 29/08/23 04:59, Florian Weimer via Libc-alpha wrote:
> * Aurelien Jarno:
> 
>> diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
>> index f7615a447e..d8a291a331 100644
>> --- a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
>> +++ b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
>> @@ -33,7 +33,7 @@
>>  # define __O_LARGEFILE	0200000
>>  #endif
>>  
>> -#if __WORDSIZE == 64
>> +#if __WORDSIZE == 64 && !defined __USE_FILE_OFFSET64
>>  # define F_GETLK	5
>>  # define F_SETLK	6
>>  # define F_SETLKW	7
> 
> I find this puzzling.  Why would __USE_FILE_OFFSET64 have an effect if
> __WORDSIZE is 64?

This is a historical artifact from powerpc64. Instead of following other 64-bit
architectures and define F_GETLK the same whether _FILE_OFFSET_BITS is defined,
the port used powerpc definitiosn that required different values to support LFS.

This patch is not wrong, but at same time not really required.  The powercp64
fcntl will handle F_GETLK/F_SETLK/F_SETLKW with the historical values with
the FCNTL_ADJUST_CMD macro, so old binaries will continue to work as expected.


More information about the Libc-alpha mailing list