Message ID | 20200131170354.25539-1-alistair.francis@wdc.com |
---|---|
State | New |
Headers | show |
Series | tst-clone3: Use __NR_futex_time64 if we don't have __NR_futex | expand |
On Fri, Jan 31, 2020 at 6:10 PM Alistair Francis <alistair.francis@wdc.com> wrote: > > We can't include sysdep.h in the test case (it introduces lots of > strange failures) so __NR_futex isn't redifined to __NR_futex_time64 by > 64-bit time_t 32-bit archs (y2038 safe). > > To allow the test to pass let's just do the __NR_futex_time64 syscall if > we don't have __NR_futex defined. > --- > sysdeps/unix/sysv/linux/tst-clone3.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/sysdeps/unix/sysv/linux/tst-clone3.c b/sysdeps/unix/sysv/linux/tst-clone3.c > index 400eb89a5b..613cb4a811 100644 > --- a/sysdeps/unix/sysv/linux/tst-clone3.c > +++ b/sysdeps/unix/sysv/linux/tst-clone3.c > @@ -56,7 +56,11 @@ f (void *a) > static inline int > futex_wait (int *futexp, int val) > { > +#ifdef __NR_futex > return syscall (__NR_futex, futexp, FUTEX_WAIT, val); > +#else > + return syscall (__NR_futex_time64, futexp, FUTEX_WAIT, val); > +#endif > } There are other references to __NR_futex and INTERNAL_SYSCALL (futex, ...) that likely suffer from the same problem. Would it make sense to address those all at once? Arnd
On Fri, Jan 31, 2020 at 1:47 PM Arnd Bergmann <arnd@arndb.de> wrote: > > On Fri, Jan 31, 2020 at 6:10 PM Alistair Francis > <alistair.francis@wdc.com> wrote: > > > > We can't include sysdep.h in the test case (it introduces lots of > > strange failures) so __NR_futex isn't redifined to __NR_futex_time64 by > > 64-bit time_t 32-bit archs (y2038 safe). > > > > To allow the test to pass let's just do the __NR_futex_time64 syscall if > > we don't have __NR_futex defined. > > --- > > sysdeps/unix/sysv/linux/tst-clone3.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/sysdeps/unix/sysv/linux/tst-clone3.c b/sysdeps/unix/sysv/linux/tst-clone3.c > > index 400eb89a5b..613cb4a811 100644 > > --- a/sysdeps/unix/sysv/linux/tst-clone3.c > > +++ b/sysdeps/unix/sysv/linux/tst-clone3.c > > @@ -56,7 +56,11 @@ f (void *a) > > static inline int > > futex_wait (int *futexp, int val) > > { > > +#ifdef __NR_futex > > return syscall (__NR_futex, futexp, FUTEX_WAIT, val); > > +#else > > + return syscall (__NR_futex_time64, futexp, FUTEX_WAIT, val); > > +#endif > > } > > There are other references to __NR_futex and INTERNAL_SYSCALL (futex, ...) > that likely suffer from the same problem. Would it make sense to address > those all at once? This is normally handled by something like this: # ifndef __NR_futex # define __NR_futex __NR_futex_time64 # endif in sysdep.h. This test is the only case I have seen where sysdep.h isn't included (and I couldn't easily include it) hence the manual fixup. Alistair > > Arnd
On Fri, Jan 31, 2020 at 9:10 AM Alistair Francis <alistair.francis@wdc.com> wrote: > > We can't include sysdep.h in the test case (it introduces lots of > strange failures) so __NR_futex isn't redifined to __NR_futex_time64 by > 64-bit time_t 32-bit archs (y2038 safe). > > To allow the test to pass let's just do the __NR_futex_time64 syscall if > we don't have __NR_futex defined. Ping! > --- > sysdeps/unix/sysv/linux/tst-clone3.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/sysdeps/unix/sysv/linux/tst-clone3.c b/sysdeps/unix/sysv/linux/tst-clone3.c > index 400eb89a5b..613cb4a811 100644 > --- a/sysdeps/unix/sysv/linux/tst-clone3.c > +++ b/sysdeps/unix/sysv/linux/tst-clone3.c > @@ -56,7 +56,11 @@ f (void *a) > static inline int > futex_wait (int *futexp, int val) > { > +#ifdef __NR_futex > return syscall (__NR_futex, futexp, FUTEX_WAIT, val); > +#else > + return syscall (__NR_futex_time64, futexp, FUTEX_WAIT, val); > +#endif > } > > static int > -- > 2.25.0 >
On 31/01/2020 14:03, Alistair Francis wrote: > We can't include sysdep.h in the test case (it introduces lots of > strange failures) so __NR_futex isn't redifined to __NR_futex_time64 by > 64-bit time_t 32-bit archs (y2038 safe). > > To allow the test to pass let's just do the __NR_futex_time64 syscall if > we don't have __NR_futex defined. LGTM, thanks. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> > --- > sysdeps/unix/sysv/linux/tst-clone3.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/sysdeps/unix/sysv/linux/tst-clone3.c b/sysdeps/unix/sysv/linux/tst-clone3.c > index 400eb89a5b..613cb4a811 100644 > --- a/sysdeps/unix/sysv/linux/tst-clone3.c > +++ b/sysdeps/unix/sysv/linux/tst-clone3.c > @@ -56,7 +56,11 @@ f (void *a) > static inline int > futex_wait (int *futexp, int val) > { > +#ifdef __NR_futex > return syscall (__NR_futex, futexp, FUTEX_WAIT, val); > +#else > + return syscall (__NR_futex_time64, futexp, FUTEX_WAIT, val); > +#endif > } > > static int >
diff --git a/sysdeps/unix/sysv/linux/tst-clone3.c b/sysdeps/unix/sysv/linux/tst-clone3.c index 400eb89a5b..613cb4a811 100644 --- a/sysdeps/unix/sysv/linux/tst-clone3.c +++ b/sysdeps/unix/sysv/linux/tst-clone3.c @@ -56,7 +56,11 @@ f (void *a) static inline int futex_wait (int *futexp, int val) { +#ifdef __NR_futex return syscall (__NR_futex, futexp, FUTEX_WAIT, val); +#else + return syscall (__NR_futex_time64, futexp, FUTEX_WAIT, val); +#endif } static int