2019-05-29 01:10:25 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2007-07-21 23:10:01 +08:00
|
|
|
/*
|
2011-05-23 21:31:30 +08:00
|
|
|
* Fast user context implementation of clock_gettime, gettimeofday, and time.
|
2007-07-21 23:10:01 +08:00
|
|
|
*
|
2019-06-21 17:52:49 +08:00
|
|
|
* Copyright 2006 Andi Kleen, SUSE Labs.
|
|
|
|
* Copyright 2019 ARM Limited
|
|
|
|
*
|
2014-03-18 06:22:09 +08:00
|
|
|
* 32 Bit compat layer by Stefani Seibold <stefani@seibold.net>
|
|
|
|
* sponsored by Rohde & Schwarz GmbH & Co. KG Munich/Germany
|
2007-07-21 23:10:01 +08:00
|
|
|
*/
|
2014-03-18 06:22:10 +08:00
|
|
|
#include <linux/time.h>
|
2015-12-11 11:20:22 +08:00
|
|
|
#include <linux/kernel.h>
|
2019-06-21 17:52:49 +08:00
|
|
|
#include <linux/types.h>
|
2007-07-21 23:10:01 +08:00
|
|
|
|
2019-06-21 17:52:49 +08:00
|
|
|
#include "../../../../lib/vdso/gettimeofday.c"
|
2007-07-21 23:10:01 +08:00
|
|
|
|
2019-06-21 17:52:49 +08:00
|
|
|
extern int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz);
|
2019-11-05 18:10:01 +08:00
|
|
|
extern __kernel_old_time_t __vdso_time(__kernel_old_time_t *t);
|
2014-03-18 06:22:09 +08:00
|
|
|
|
2019-06-21 17:52:49 +08:00
|
|
|
int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
|
2015-12-11 11:20:22 +08:00
|
|
|
{
|
2019-06-21 17:52:49 +08:00
|
|
|
return __cvdso_gettimeofday(tv, tz);
|
2015-12-11 11:20:22 +08:00
|
|
|
}
|
|
|
|
|
2019-06-21 17:52:49 +08:00
|
|
|
int gettimeofday(struct __kernel_old_timeval *, struct timezone *)
|
|
|
|
__attribute__((weak, alias("__vdso_gettimeofday")));
|
2012-11-28 09:28:57 +08:00
|
|
|
|
2019-11-05 18:10:01 +08:00
|
|
|
__kernel_old_time_t __vdso_time(__kernel_old_time_t *t)
|
2012-11-28 09:28:57 +08:00
|
|
|
{
|
2019-06-21 17:52:49 +08:00
|
|
|
return __cvdso_time(t);
|
2012-11-28 09:28:57 +08:00
|
|
|
}
|
2017-03-03 21:21:42 +08:00
|
|
|
|
2019-11-05 18:10:01 +08:00
|
|
|
__kernel_old_time_t time(__kernel_old_time_t *t) __attribute__((weak, alias("__vdso_time")));
|
2012-11-28 09:28:57 +08:00
|
|
|
|
2019-06-21 23:43:04 +08:00
|
|
|
|
2019-06-21 17:52:49 +08:00
|
|
|
#if defined(CONFIG_X86_64) && !defined(BUILD_VDSO32_64)
|
|
|
|
/* both 64-bit and x32 use these */
|
|
|
|
extern int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts);
|
2019-06-21 17:52:50 +08:00
|
|
|
extern int __vdso_clock_getres(clockid_t clock, struct __kernel_timespec *res);
|
2007-07-21 23:10:01 +08:00
|
|
|
|
2019-06-21 17:52:49 +08:00
|
|
|
int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts)
|
2007-07-21 23:10:01 +08:00
|
|
|
{
|
2019-06-21 17:52:49 +08:00
|
|
|
return __cvdso_clock_gettime(clock, ts);
|
2007-07-21 23:10:01 +08:00
|
|
|
}
|
|
|
|
|
2019-06-21 17:52:49 +08:00
|
|
|
int clock_gettime(clockid_t, struct __kernel_timespec *)
|
|
|
|
__attribute__((weak, alias("__vdso_clock_gettime")));
|
2018-09-17 20:45:38 +08:00
|
|
|
|
2019-06-21 17:52:50 +08:00
|
|
|
int __vdso_clock_getres(clockid_t clock,
|
|
|
|
struct __kernel_timespec *res)
|
|
|
|
{
|
|
|
|
return __cvdso_clock_getres(clock, res);
|
|
|
|
}
|
|
|
|
int clock_getres(clockid_t, struct __kernel_timespec *)
|
|
|
|
__attribute__((weak, alias("__vdso_clock_getres")));
|
|
|
|
|
2019-06-21 17:52:49 +08:00
|
|
|
#else
|
|
|
|
/* i386 only */
|
|
|
|
extern int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts);
|
2019-06-21 17:52:50 +08:00
|
|
|
extern int __vdso_clock_getres(clockid_t clock, struct old_timespec32 *res);
|
2009-08-20 10:13:34 +08:00
|
|
|
|
2019-06-21 17:52:49 +08:00
|
|
|
int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts)
|
2007-07-21 23:10:01 +08:00
|
|
|
{
|
2019-06-21 17:52:49 +08:00
|
|
|
return __cvdso_clock_gettime32(clock, ts);
|
2007-07-21 23:10:01 +08:00
|
|
|
}
|
2018-09-17 20:45:41 +08:00
|
|
|
|
2019-06-21 17:52:49 +08:00
|
|
|
int clock_gettime(clockid_t, struct old_timespec32 *)
|
2007-07-21 23:10:01 +08:00
|
|
|
__attribute__((weak, alias("__vdso_clock_gettime")));
|
|
|
|
|
2019-06-21 17:52:51 +08:00
|
|
|
int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts)
|
|
|
|
{
|
|
|
|
return __cvdso_clock_gettime(clock, ts);
|
|
|
|
}
|
|
|
|
|
|
|
|
int clock_gettime64(clockid_t, struct __kernel_timespec *)
|
|
|
|
__attribute__((weak, alias("__vdso_clock_gettime64")));
|
|
|
|
|
2019-06-21 17:52:50 +08:00
|
|
|
int __vdso_clock_getres(clockid_t clock, struct old_timespec32 *res)
|
|
|
|
{
|
|
|
|
return __cvdso_clock_getres_time32(clock, res);
|
|
|
|
}
|
|
|
|
|
|
|
|
int clock_getres(clockid_t, struct old_timespec32 *)
|
|
|
|
__attribute__((weak, alias("__vdso_clock_getres")));
|
2019-06-21 17:52:49 +08:00
|
|
|
#endif
|