1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00

linux: Consolidate time implementation

The IFUNC bypass to vDSO is used when USE_IFUNC_TIME is set.
Currently powerpc and x86 defines it.  Otherwise the generic
implementation is used, which calls clock_gettime.

Checked on powerpc64le-linux-gnu, powerpc64-linux-gnu,
powerpc-linux-gnu-power4, x86_64-linux-gnu, and i686-linux-gnu.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
This commit is contained in:
Adhemerval Zanella
2019-12-16 09:58:32 -03:00
parent c701bcc6f4
commit e760874ee3
3 changed files with 54 additions and 55 deletions

View File

@@ -16,28 +16,5 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <time.h>
#include <sysdep.h>
#include <sysdep-vdso.h>
static time_t
time_vsyscall (time_t *t)
{
return INLINE_VSYSCALL (time, 1, t);
}
#ifdef SHARED
# include <dl-vdso.h>
# include <libc-vdso.h>
#undef INIT_ARCH
#define INIT_ARCH()
/* If the vDSO is not available we fall back on the syscall. */
libc_ifunc (time, (get_vdso_symbol ("__vdso_time") ?: time_vsyscall))
#else
time_t
time (time_t *t)
{
return time_vsyscall (t);
}
#endif
#define USE_IFUNC_TIME
#include <sysdeps/unix/sysv/linux/time.c>