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

Viresh Kumar viresh.kumar@linaro.org
Fri May 22 10:42:05 CEST 2020


On 22-05-20, 10:02, Arnd Bergmann wrote:
> 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,

What about reversing the order of the two ? Check __NR_clock_getres
first ?

> you need a runtime fallback
> instead of a compile-time fallback.

Why so ?

-- 
viresh


More information about the ltp mailing list