[PATCH v2] Fix p{readv,writev}{64} consolidation implementation

Adhemerval Zanella adhemerval.zanella@linaro.org
Wed Jun 15 23:46:00 GMT 2016



On 15/06/2016 19:38, Mike Frysinger wrote:
> On 15 Jun 2016 18:20, Adhemerval Zanella wrote:
>> --- a/sysdeps/unix/sysv/linux/sysdep.h
>> +++ b/sysdeps/unix/sysv/linux/sysdep.h
>> @@ -47,3 +47,12 @@
>>  #define SYSCALL_LL64(val) \
>>    __LONG_LONG_PAIR ((long) ((val) >> 32), (long) ((val) & 0xffffffff))
>>  #endif
>> +
>> +/* Provide a macro to pass the off{64}_t argument on p{readv,writev}{64}.  */
>> +#if __WORDSIZE == 64 || defined __ASSUME_WORDSIZE64_ILP32
>> +# define LO_HI_LONG(val) (val)
>> +#else
>> +# define LO_HI_LONG(val) \
>> +  (off_t) (val),                                                          \
>> +  (off_t) ((((uint64_t) (val)) >> (sizeof (long) * 4)) >> (sizeof (long) * 4))
>> +#endif
> 
> does this really need to be this complicated ?  we're already making an
> assumption about the size for 64-bit & 64-bit/ilp32 ports, and you're
> using an uint64_t cast to start with, and SYSCALL_LL64 assumes 32.
>   (long) (val),
>   (long) (((uint64_t) (val)) >> 32)
> -mike
> 

I think your suggestion should be ok, this snippet I used came from
the previous version in fact.  I will change to just

/* Provide a macro to pass the off{64}_t argument on p{readv,writev}{64}.  */
#if __WORDSIZE == 64 || defined __ASSUME_WORDSIZE64_ILP32
# define LO_HI_LONG(val) (val)
#else
# define LO_HI_LONG(val) \
   (long) (val), \
   (long) (((uint64_t) (val)) >> 32)
#endif

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20160615/c1bb4d50/attachment.sig>


More information about the Libc-alpha mailing list