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