[LTP] [PATCH V2 5/6] syscalls: Don't pass struct timespec to tst_syscall()

Arnd Bergmann arnd@arndb.de
Fri May 22 10:02:52 CEST 2020


On Fri, May 22, 2020 at 8:54 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:

>
>  int tst_clock_getres(clockid_t clk_id, struct timespec *res)
>  {
> -       return tst_syscall(__NR_clock_getres, clk_id, res);
> +       int (*func)(clockid_t clk_id, void *ts);
> +       struct tst_ts tts = { 0, };
> +       int ret;
> +
> +#if defined(__NR_clock_getres_time64)
> +       tts.type = TST_KERN_TIMESPEC;
> +       func = sys_clock_getres64;
> +#elif defined(__NR_clock_getres)
> +       tts.type = TST_KERN_OLD_TIMESPEC;
> +       func = sys_clock_getres;
> +#else
> +       tts.type = TST_LIBC_TIMESPEC;
> +       func = libc_clock_getres;
> +#endif
> +
> +       ret = func(clk_id, tst_ts_get(&tts));

This is not enough to run on old kernels that have __NR_clock_getres
but don't have __NR_clock_getres_time64, you need a runtime fallback
instead of a compile-time fallback.

As Cyril mentioned though, you don't need the libc fallback in
the end, since all kernels we would test can be expected to
have at least one of the other two.

       Arnd


More information about the ltp mailing list