]> git.ipfire.org Git - thirdparty/kernel/stable.git/blame - arch/x86/entry/vdso/vclock_gettime.c
x86/vdso: Add clock_gettime64() entry point
[thirdparty/kernel/stable.git] / arch / x86 / entry / vdso / vclock_gettime.c
CommitLineData
7e300dab 1// SPDX-License-Identifier: GPL-2.0-only
2aae950b 2/*
f144a6b4 3 * Fast user context implementation of clock_gettime, gettimeofday, and time.
2aae950b 4 *
7ac87074
VF
5 * Copyright 2006 Andi Kleen, SUSE Labs.
6 * Copyright 2019 ARM Limited
7 *
7a59ed41
SS
8 * 32 Bit compat layer by Stefani Seibold <stefani@seibold.net>
9 * sponsored by Rohde & Schwarz GmbH & Co. KG Munich/Germany
2aae950b 10 */
7c03156f 11#include <linux/time.h>
76480a6a 12#include <linux/kernel.h>
7ac87074 13#include <linux/types.h>
2aae950b 14
7ac87074 15#include "../../../../lib/vdso/gettimeofday.c"
2aae950b 16
7ac87074 17extern int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz);
7a59ed41
SS
18extern time_t __vdso_time(time_t *t);
19
7ac87074 20int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
76480a6a 21{
7ac87074 22 return __cvdso_gettimeofday(tv, tz);
76480a6a
AL
23}
24
7ac87074
VF
25int gettimeofday(struct __kernel_old_timeval *, struct timezone *)
26 __attribute__((weak, alias("__vdso_gettimeofday")));
51c19b4f 27
7ac87074 28time_t __vdso_time(time_t *t)
51c19b4f 29{
7ac87074 30 return __cvdso_time(t);
51c19b4f 31}
90b20432 32
7ac87074 33time_t time(time_t *t) __attribute__((weak, alias("__vdso_time")));
51c19b4f 34
ff17bbe0 35
7ac87074
VF
36#if defined(CONFIG_X86_64) && !defined(BUILD_VDSO32_64)
37/* both 64-bit and x32 use these */
38extern int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts);
f66501dc 39extern int __vdso_clock_getres(clockid_t clock, struct __kernel_timespec *res);
2aae950b 40
7ac87074 41int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts)
2aae950b 42{
7ac87074 43 return __cvdso_clock_gettime(clock, ts);
2aae950b
AK
44}
45
7ac87074
VF
46int clock_gettime(clockid_t, struct __kernel_timespec *)
47 __attribute__((weak, alias("__vdso_clock_gettime")));
49116f20 48
f66501dc
VF
49int __vdso_clock_getres(clockid_t clock,
50 struct __kernel_timespec *res)
51{
52 return __cvdso_clock_getres(clock, res);
53}
54int clock_getres(clockid_t, struct __kernel_timespec *)
55 __attribute__((weak, alias("__vdso_clock_getres")));
56
7ac87074
VF
57#else
58/* i386 only */
59extern int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts);
f66501dc 60extern int __vdso_clock_getres(clockid_t clock, struct old_timespec32 *res);
da15cfda 61
7ac87074 62int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts)
2aae950b 63{
7ac87074 64 return __cvdso_clock_gettime32(clock, ts);
2aae950b 65}
f3e83938 66
7ac87074 67int clock_gettime(clockid_t, struct old_timespec32 *)
2aae950b
AK
68 __attribute__((weak, alias("__vdso_clock_gettime")));
69
22ca9622
VF
70int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts)
71{
72 return __cvdso_clock_gettime(clock, ts);
73}
74
75int clock_gettime64(clockid_t, struct __kernel_timespec *)
76 __attribute__((weak, alias("__vdso_clock_gettime64")));
77
f66501dc
VF
78int __vdso_clock_getres(clockid_t clock, struct old_timespec32 *res)
79{
80 return __cvdso_clock_getres_time32(clock, res);
81}
82
83int clock_getres(clockid_t, struct old_timespec32 *)
84 __attribute__((weak, alias("__vdso_clock_getres")));
7ac87074 85#endif