2019-05-28 10:10:25 -07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2007-07-21 08:10:01 -07:00
|
|
|
/*
|
2011-05-23 06:31:30 -07:00
|
|
|
* Fast user context implementation of clock_gettime, gettimeofday, and time.
|
2007-07-21 08:10:01 -07:00
|
|
|
*
|
2019-06-21 02:52:49 -07:00
|
|
|
* Copyright 2006 Andi Kleen, SUSE Labs.
|
|
|
|
* Copyright 2019 ARM Limited
|
|
|
|
*
|
2014-03-17 15: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 08:10:01 -07:00
|
|
|
*/
|
2014-03-17 15:22:10 -07:00
|
|
|
#include <linux/time.h>
|
2015-12-10 20:20:22 -07:00
|
|
|
#include <linux/kernel.h>
|
2019-06-21 02:52:49 -07:00
|
|
|
#include <linux/types.h>
|
2023-11-08 05:58:36 -07:00
|
|
|
#include <vdso/gettime.h>
|
2007-07-21 08:10:01 -07:00
|
|
|
|
2019-06-21 02:52:49 -07:00
|
|
|
#include "../../../../lib/vdso/gettimeofday.c"
|
2007-07-21 08:10:01 -07:00
|
|
|
|
2019-06-21 02:52:49 -07:00
|
|
|
int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
|
2015-12-10 20:20:22 -07:00
|
|
|
{
|
2019-06-21 02:52:49 -07:00
|
|
|
return __cvdso_gettimeofday(tv, tz);
|
2015-12-10 20:20:22 -07:00
|
|
|
}
|
|
|
|
|
2019-06-21 02:52:49 -07:00
|
|
|
int gettimeofday(struct __kernel_old_timeval *, struct timezone *)
|
|
|
|
__attribute__((weak, alias("__vdso_gettimeofday")));
|
2012-11-27 18:28:57 -07:00
|
|
|
|
2019-11-05 03:10:01 -07:00
|
|
|
__kernel_old_time_t __vdso_time(__kernel_old_time_t *t)
|
2012-11-27 18:28:57 -07:00
|
|
|
{
|
2019-06-21 02:52:49 -07:00
|
|
|
return __cvdso_time(t);
|
2012-11-27 18:28:57 -07:00
|
|
|
}
|
2017-03-03 06:21:42 -07:00
|
|
|
|
2019-11-05 03:10:01 -07:00
|
|
|
__kernel_old_time_t time(__kernel_old_time_t *t) __attribute__((weak, alias("__vdso_time")));
|
2012-11-27 18:28:57 -07:00
|
|
|
|
2019-06-21 08:43:04 -07:00
|
|
|
|
2019-06-21 02:52:49 -07:00
|
|
|
#if defined(CONFIG_X86_64) && !defined(BUILD_VDSO32_64)
|
|
|
|
/* both 64-bit and x32 use these */
|
|
|
|
int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts)
|
2007-07-21 08:10:01 -07:00
|
|
|
{
|
2019-06-21 02:52:49 -07:00
|
|
|
return __cvdso_clock_gettime(clock, ts);
|
2007-07-21 08:10:01 -07:00
|
|
|
}
|
|
|
|
|
2019-06-21 02:52:49 -07:00
|
|
|
int clock_gettime(clockid_t, struct __kernel_timespec *)
|
|
|
|
__attribute__((weak, alias("__vdso_clock_gettime")));
|
2018-09-17 05:45:38 -07:00
|
|
|
|
2019-06-21 02: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 02:52:49 -07:00
|
|
|
#else
|
|
|
|
/* i386 only */
|
|
|
|
int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts)
|
2007-07-21 08:10:01 -07:00
|
|
|
{
|
2019-06-21 02:52:49 -07:00
|
|
|
return __cvdso_clock_gettime32(clock, ts);
|
2007-07-21 08:10:01 -07:00
|
|
|
}
|
2018-09-17 05:45:41 -07:00
|
|
|
|
2019-06-21 02:52:49 -07:00
|
|
|
int clock_gettime(clockid_t, struct old_timespec32 *)
|
2007-07-21 08:10:01 -07:00
|
|
|
__attribute__((weak, alias("__vdso_clock_gettime")));
|
|
|
|
|
2019-06-21 02: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 02: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 02:52:49 -07:00
|
|
|
#endif
|