1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * Copyright 2006 Andi Kleen, SUSE Labs. 4 * 5 * Fast user context implementation of clock_gettime, gettimeofday, and time. 6 * 7 * The code should have no internal unresolved relocations. 8 * Check with readelf after changing. 9 * Also alternative() doesn't work. 10 */ 11 /* 12 * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved. 13 */ 14 15 #include <linux/compiler.h> 16 #include <linux/types.h> 17 18 #include <vdso/gettime.h> 19 20 #include <asm/vdso/gettimeofday.h> 21 22 #include "../../../../lib/vdso/gettimeofday.c" 23 24 #if defined(CONFIG_SPARC64) || defined(CONFIG_COMPAT_32BIT_TIME) 25 int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) 26 { 27 return __cvdso_gettimeofday(tv, tz); 28 } 29 30 int gettimeofday(struct __kernel_old_timeval *, struct timezone *) 31 __weak __alias(__vdso_gettimeofday); 32 #endif 33 34 #if defined(CONFIG_SPARC64) 35 int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts) 36 { 37 return __cvdso_clock_gettime(clock, ts); 38 } 39 40 int clock_gettime(clockid_t, struct __kernel_timespec *) 41 __weak __alias(__vdso_clock_gettime); 42 43 #else 44 45 #if defined(CONFIG_COMPAT_32BIT_TIME) 46 int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts) 47 { 48 return __cvdso_clock_gettime32(clock, ts); 49 } 50 51 int clock_gettime(clockid_t, struct old_timespec32 *) 52 __weak __alias(__vdso_clock_gettime); 53 #endif 54 55 int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts) 56 { 57 return __cvdso_clock_gettime(clock, ts); 58 } 59 60 int clock_gettime64(clockid_t, struct __kernel_timespec *) 61 __weak __alias(__vdso_clock_gettime64); 62 63 #endif 64