On Thu, Nov 13, 2025, at 16:30, Thomas Weißschuh wrote:
>
> static void test_one_clock_gettime(int clock, const char *name)
> {
> + struct __kernel_timespec start, end;
> struct __kernel_old_timespec vdso;
> - struct timespec start, end;
> int vdso_ret, end_ret;
>
> printf("[RUN]\tTesting clock_gettime for clock %s (%d)...\n", name,
This looks confusing to me: I can see that the existing code is
wrong because it passes a (libc-defined) timespec into the
sys_clock_gettime() that expects __kernel_old_timespec.
It looks like you are changing a sometimes-wrong type into
a consistently wrong type, but then you also change the
sys_clock_gettime() definition to return __kernel_timespec
instead of __kernel_old_timespec, so it ends up working.
Why not always use __kernel_old_timespec for the local variables
and the sys_clock_gettime() calls here?
> @@ -305,7 +291,7 @@ static void test_one_clock_gettime64(int clock, const
> char *name)
>
> printf("[RUN]\tTesting clock_gettime64 for clock %s (%d)...\n", name,
> clock);
>
> - if (sys_clock_gettime64(clock, &start) < 0) {
> + if (sys_clock_gettime(clock, &start) < 0) {
> if (errno == EINVAL) {
> vdso_ret = VDSO_CALL(vdso_clock_gettime64, 2, clock,
> &vdso);
> if (vdso_ret == -EINVAL) {
This looks like the correct fix to me. We were already uses the same
types for syscall and vdso paths, and now the types match the interface.
Arnd