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


* 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>.

Thanks,
Florian


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