Re: [PATCH v3 4/6] selftests: futex: Add support for 32-bit systems with 64-bit time_t

From: Arnd Bergmann
Date: Fri Nov 26 2021 - 02:39:02 EST


On Fri, Nov 26, 2021 at 7:00 AM Alistair Francis
<alistair.francis@xxxxxxxxxxxxxxxxxx> wrote:
>
> From: Alistair Francis <alistair.francis@xxxxxxx>
>
> Using the new __kernel_futex_syscall*() functions let's add support for
> 32-bit systems with a 64-bit time_t. We can just direclty call the
> publically exposed __kernel_futex_syscall_timeout() and
> __kernel_futex_syscall_nr_requeue() functions to do this.
>
> Signed-off-by: Alistair Francis <alistair.francis@xxxxxxx>
> ---
> tools/testing/selftests/futex/functional/futex_requeue_pi.c | 2 +-
> tools/testing/selftests/futex/include/futextest.h | 5 +++--
> 2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/futex/functional/futex_requeue_pi.c b/tools/testing/selftests/futex/functional/futex_requeue_pi.c
> index 1ee5518ee6b7..d3673996fed4 100644
> --- a/tools/testing/selftests/futex/functional/futex_requeue_pi.c
> +++ b/tools/testing/selftests/futex/functional/futex_requeue_pi.c
> @@ -294,7 +294,7 @@ int unit_test(int broadcast, long lock, int third_party_owner, long timeout_ns)
> secs = (ts.tv_nsec + timeout_ns) / 1000000000;
> ts.tv_nsec = ((int64_t)ts.tv_nsec + timeout_ns) % 1000000000;
> ts.tv_sec += secs;
> - info("ts.tv_sec = %ld\n", ts.tv_sec);
> + info("ts.tv_sec = %lld\n", ts.tv_sec);
> info("ts.tv_nsec = %ld\n", ts.tv_nsec);
> tsp = &ts;
> }

I think this causes a warning on 64-bit builds now, you have to add a
cast to 'long long'
to make it work everywhere.

Arnd