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 int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) 25 { 26 return __cvdso_gettimeofday(tv, tz); 27 } 28 29 int gettimeofday(struct __kernel_old_timeval *, struct timezone *) 30 __weak __alias(__vdso_gettimeofday); 31 32 #if defined(CONFIG_SPARC64) 33 int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts) 34 { 35 return __cvdso_clock_gettime(clock, ts); 36 } 37 38 int clock_gettime(clockid_t, struct __kernel_timespec *) 39 __weak __alias(__vdso_clock_gettime); 40 41 #else 42 43 int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts) 44 { 45 return __cvdso_clock_gettime32(clock, ts); 46 } 47 48 int clock_gettime(clockid_t, struct old_timespec32 *) 49 __weak __alias(__vdso_clock_gettime); 50 51 int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts) 52 { 53 return __cvdso_clock_gettime(clock, ts); 54 } 55 56 int clock_gettime64(clockid_t, struct __kernel_timespec *) 57 __weak __alias(__vdso_clock_gettime64); 58 59 #endif 60