Commit 9b7fc3f1 authored by Thomas Weißschuh's avatar Thomas Weißschuh Committed by Thomas Gleixner
Browse files

vdso: Introduce aux_clock_resolution_ns()



Move the constant resolution to a shared header,
so the vDSO can use it and return it without going through a syscall.

Signed-off-by: default avatarThomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250701-vdso-auxclock-v1-10-df7d9f87b9b8@linutronix.de
parent 562f03ed
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _VDSO_AUXCLOCK_H
#define _VDSO_AUXCLOCK_H

#include <uapi/linux/time.h>
#include <uapi/linux/types.h>

static __always_inline u64 aux_clock_resolution_ns(void)
{
	return 1;
}

#endif /* _VDSO_AUXCLOCK_H */
+4 −2
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@
#include <linux/audit.h>
#include <linux/random.h>

#include <vdso/auxclock.h>

#include "tick-internal.h"
#include "ntp_internal.h"
#include "timekeeping_internal.h"
@@ -2876,8 +2878,8 @@ static int aux_get_res(clockid_t id, struct timespec64 *tp)
	if (!clockid_aux_valid(id))
		return -ENODEV;

	tp->tv_sec = 0;
	tp->tv_nsec = 1;
	tp->tv_sec = aux_clock_resolution_ns() / NSEC_PER_SEC;
	tp->tv_nsec = aux_clock_resolution_ns() % NSEC_PER_SEC;
	return 0;
}