]>
Commit | Line | Data |
---|---|---|
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 | 17 | extern int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz); |
7a59ed41 SS |
18 | extern time_t __vdso_time(time_t *t); |
19 | ||
7ac87074 | 20 | int __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 |
25 | int gettimeofday(struct __kernel_old_timeval *, struct timezone *) |
26 | __attribute__((weak, alias("__vdso_gettimeofday"))); | |
51c19b4f | 27 | |
7ac87074 | 28 | time_t __vdso_time(time_t *t) |
51c19b4f | 29 | { |
7ac87074 | 30 | return __cvdso_time(t); |
51c19b4f | 31 | } |
90b20432 | 32 | |
7ac87074 | 33 | time_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 */ | |
38 | extern int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts); | |
f66501dc | 39 | extern int __vdso_clock_getres(clockid_t clock, struct __kernel_timespec *res); |
2aae950b | 40 | |
7ac87074 | 41 | int __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 |
46 | int clock_gettime(clockid_t, struct __kernel_timespec *) |
47 | __attribute__((weak, alias("__vdso_clock_gettime"))); | |
49116f20 | 48 | |
f66501dc VF |
49 | int __vdso_clock_getres(clockid_t clock, |
50 | struct __kernel_timespec *res) | |
51 | { | |
52 | return __cvdso_clock_getres(clock, res); | |
53 | } | |
54 | int clock_getres(clockid_t, struct __kernel_timespec *) | |
55 | __attribute__((weak, alias("__vdso_clock_getres"))); | |
56 | ||
7ac87074 VF |
57 | #else |
58 | /* i386 only */ | |
59 | extern int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts); | |
f66501dc | 60 | extern int __vdso_clock_getres(clockid_t clock, struct old_timespec32 *res); |
da15cfda | 61 | |
7ac87074 | 62 | int __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 | 67 | int clock_gettime(clockid_t, struct old_timespec32 *) |
2aae950b AK |
68 | __attribute__((weak, alias("__vdso_clock_gettime"))); |
69 | ||
22ca9622 VF |
70 | int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts) |
71 | { | |
72 | return __cvdso_clock_gettime(clock, ts); | |
73 | } | |
74 | ||
75 | int clock_gettime64(clockid_t, struct __kernel_timespec *) | |
76 | __attribute__((weak, alias("__vdso_clock_gettime64"))); | |
77 | ||
f66501dc VF |
78 | int __vdso_clock_getres(clockid_t clock, struct old_timespec32 *res) |
79 | { | |
80 | return __cvdso_clock_getres_time32(clock, res); | |
81 | } | |
82 | ||
83 | int clock_getres(clockid_t, struct old_timespec32 *) | |
84 | __attribute__((weak, alias("__vdso_clock_getres"))); | |
7ac87074 | 85 | #endif |