This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC v2 06/20] sysdeps/futex: Use futex_time64 if avaliable


On Jun 25 2019, Florian Weimer <fweimer@redhat.com> wrote:

> * Alistair Francis:
>
>> +/* __NR_futex isn't defined on all archs (RV32) so use __NR_futex_time64 */
>> +#ifdef __NR_futex_time64
>> +# define lll_futex_syscall(nargs, futexp, op, ...)                              \
>> +   ({                                                                           \
>> +     INTERNAL_SYSCALL_DECL (__err);                                             \
>> +     long int __ret = INTERNAL_SYSCALL (futex_time64, __err, nargs, futexp, op, \
>> +                                        __VA_ARGS__);                           \
>> +     (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__ret, __err))                \
>> +      ? -INTERNAL_SYSCALL_ERRNO (__ret, __err) : 0);                            \
>> +   })
>> +#else
>> +# define lll_futex_syscall(nargs, futexp, op, ...)                       \
>> +   ({                                                                    \
>> +     INTERNAL_SYSCALL_DECL (__err);                                      \
>> +     long int __ret = INTERNAL_SYSCALL (futex, __err, nargs, futexp, op, \
>> +                                        __VA_ARGS__);                    \
>> +     (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__ret, __err))         \
>> +      ? -INTERNAL_SYSCALL_ERRNO (__ret, __err) : 0);                     \
>> +   })
>> +#endif
>
> I don't think a compile-time check in generic code is correct here.  It
> will cause binaries to fail to run on older kernels which do not have
> the system call.  This is obviously not a concern for 32-bit RISC-V, but
> it is not acceptable for i386, for example.
>
> I still think you should define __NR_futex in RV32 <sysdep.h>.

For existing 32-bit archs there needs to be a runtime check (if both
__NR_futex and __NR_futex_time64 are defined).

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]