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