2019-01-01 00:11:28 +00:00
|
|
|
/* Copyright (C) 2005-2019 Free Software Foundation, Inc.
|
2005-12-30 07:32:48 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
2005-12-30 07:32:48 +00:00
|
|
|
|
2016-10-07 07:56:47 +00:00
|
|
|
#if defined SHARED && !defined __powerpc64__
|
|
|
|
# define __gettimeofday __redirect___gettimeofday
|
|
|
|
#else
|
|
|
|
# define __redirect___gettimeofday __gettimeofday
|
|
|
|
#endif
|
2013-03-15 13:58:56 +00:00
|
|
|
|
2005-12-30 07:32:48 +00:00
|
|
|
#include <sys/time.h>
|
|
|
|
|
2013-03-15 13:58:56 +00:00
|
|
|
#ifdef SHARED
|
|
|
|
|
|
|
|
# include <dl-vdso.h>
|
2015-04-13 19:38:16 +00:00
|
|
|
# include <libc-vdso.h>
|
2013-11-07 11:34:22 +00:00
|
|
|
# include <dl-machine.h>
|
2013-03-15 13:58:56 +00:00
|
|
|
|
2016-10-07 07:56:47 +00:00
|
|
|
# ifndef __powerpc64__
|
|
|
|
# undef __gettimeofday
|
2013-03-15 13:58:56 +00:00
|
|
|
|
2016-10-07 07:56:47 +00:00
|
|
|
int
|
|
|
|
__gettimeofday_vsyscall (struct timeval *tv, struct timezone *tz)
|
2013-03-15 13:58:56 +00:00
|
|
|
{
|
2016-10-07 07:56:47 +00:00
|
|
|
return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
|
2013-03-15 13:58:56 +00:00
|
|
|
}
|
2014-01-16 12:53:18 +00:00
|
|
|
|
|
|
|
/* __GI___gettimeofday is defined as hidden and for ppc32 it enables the
|
|
|
|
compiler make a local call (symbol@local) for internal GLIBC usage. It
|
|
|
|
means the PLT won't be used and the ifunc resolver will be called directly.
|
|
|
|
For ppc64 a call to a function in another translation unit might use a
|
|
|
|
different toc pointer thus disallowing direct branchess and making internal
|
|
|
|
ifuncs calls safe. */
|
2016-10-07 07:56:47 +00:00
|
|
|
# undef libc_hidden_def
|
|
|
|
# define libc_hidden_def(name) \
|
|
|
|
__hidden_ver1 (__gettimeofday_vsyscall, __GI___gettimeofday, \
|
|
|
|
__gettimeofday_vsyscall);
|
|
|
|
|
|
|
|
# endif /* !__powerpc64__ */
|
|
|
|
|
|
|
|
static int
|
|
|
|
__gettimeofday_syscall (struct timeval *tv, struct timezone *tz)
|
2014-01-16 12:53:18 +00:00
|
|
|
{
|
2016-10-07 07:56:47 +00:00
|
|
|
return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
|
2014-01-16 12:53:18 +00:00
|
|
|
}
|
2016-10-07 07:56:47 +00:00
|
|
|
|
2019-06-21 13:36:52 +00:00
|
|
|
# define INIT_ARCH() \
|
|
|
|
PREPARE_VERSION_KNOWN (linux2615, LINUX_2_6_15); \
|
2016-10-07 07:56:47 +00:00
|
|
|
void *vdso_gettimeofday = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2615);
|
|
|
|
|
|
|
|
/* If the vDSO is not available we fall back syscall. */
|
|
|
|
libc_ifunc_hidden (__redirect___gettimeofday, __gettimeofday,
|
|
|
|
vdso_gettimeofday
|
|
|
|
? VDSO_IFUNC_RET (vdso_gettimeofday)
|
|
|
|
: (void *) __gettimeofday_syscall);
|
|
|
|
libc_hidden_def (__gettimeofday)
|
2013-03-15 13:58:56 +00:00
|
|
|
|
|
|
|
#else
|
2005-12-30 07:32:48 +00:00
|
|
|
|
2013-03-15 13:58:56 +00:00
|
|
|
# include <sysdep.h>
|
|
|
|
# include <errno.h>
|
2005-12-30 07:32:48 +00:00
|
|
|
|
|
|
|
int
|
2013-03-15 13:58:56 +00:00
|
|
|
__gettimeofday (struct timeval *tv, struct timezone *tz)
|
2005-12-30 07:32:48 +00:00
|
|
|
{
|
2013-03-15 13:58:56 +00:00
|
|
|
return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
|
2005-12-30 07:32:48 +00:00
|
|
|
}
|
2012-05-24 18:37:30 +00:00
|
|
|
libc_hidden_def (__gettimeofday)
|
2013-03-15 13:58:56 +00:00
|
|
|
|
|
|
|
#endif
|
2005-12-30 07:32:48 +00:00
|
|
|
weak_alias (__gettimeofday, gettimeofday)
|
2012-05-24 18:37:30 +00:00
|
|
|
libc_hidden_weak (gettimeofday)
|