glibc/sysdeps/posix
Adhemerval Zanella 5e46749c64 Use clock_gettime to implement gettimeofday.
Consolidate generic gettimeofday implementation to use clock_gettime.
Linux ports that still provide gettimeofday through vDSO are not
changed.

Remove sysdeps/unix/clock_gettime.c, which implemented clock_gettime
using gettimeofday; new OS ports must provide a real implementation of
clock_gettime.

Rename sysdeps/mach/gettimeofday.c to sysdeps/mach/clock_gettime.c and
convert into an implementation of clock_gettime.  It only supports
CLOCK_REALTIME; Mach does not appear to have any support for monotonic
clocks.  It uses __host_get_time, which provides at best microsecond
resolution.  Hurd is currently using sysdeps/posix/clock_getres.c for
clock_getres; its output for CLOCK_REALTIME is based on
sysconf (_SC_CLK_TCK), and I do not know whether that gives the
correct result.

Unlike settimeofday, there are no known uses of gettimeofday's
vestigial "get time zone" feature that are not bugs.  (The per-process
timezone support in localtime and friends is unrelated, and the
programs that set the kernel's offset between the hardware clock and
UTC do not need to read it back.)  Therefore, this feature is dummied
out.  Henceforth, if gettimeofday's "struct timezone" argument is not
NULL, it will write zeroes to both fields.  Any program that is
actually looking at this data will thus think it is running in UTC,
which is probably more correct than whatever it was doing before.

[__]gettimeofday no longer has any internal callers, so we can now
remove its internal prototype and PLT bypass aliases.  The
__gettimeofday@GLIBC_2.0 export remains, in case it is used by any
third-party code.

It also allows to simplify the arch-specific implementation on x86 and
powerpc to remove the hack to disable the internal route to non iFUNC
variant for internal symbol.

This patch also fixes a missing optimization on aarch64, powerpc, and
x86 where the code used on static build do not use the vDSO.

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

Co-authored-by: Zack Weinberg <zackw@panix.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
2019-10-30 17:11:10 -03:00
..
alarm.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
clock_getres.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
clock.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
closedir.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
ctermid.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
cuserid.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
dirfd.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
dirstream.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
dl-fileid.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
dup2.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
dup.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
euidaccess.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
fdopendir.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
flock.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
fpathconf.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
gai_strerror-strs.h
gai_strerror.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
getaddrinfo.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
getcwd.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
getdtsz.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
gethostname.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
getpagesize.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
isatty.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
isfdtype.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
killpg.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
libc_fatal.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
Makefile
mkfifo.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
mkfifoat.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
nice.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
open64.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
opendir.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
pathconf.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
pause.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
posix_fallocate64.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
posix_fallocate.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
pread64.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
pread.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
preadv2.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
preadv64.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
preadv64v2.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
preadv_common.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
preadv.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
profil.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
pwrite64.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
pwrite.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
pwritev2.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
pwritev64.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
pwritev64v2.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
pwritev_common.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
pwritev.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
raise.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
readdir_r.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
readdir.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
readv.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
remove.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
rename.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
rewinddir.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
seekdir.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
shm_open.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
shm_unlink.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
shm-directory.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
shm-directory.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
sigblock.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
sigignore.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
sigintr.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
signal.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
sigpause.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
sigset.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
sigsetmask.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
sigsuspend.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
sigwait.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
sleep.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
spawni.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
sprofil.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
Subdirs
sysconf.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
system.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
sysv_signal.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
telldir.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
tempname.c Change most internal uses of __gettimeofday to __clock_gettime. 2019-10-30 17:04:10 -03:00
truncate.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
ttyname_r.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
ttyname.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
ulimit.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
usleep.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
utime.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
utimes.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
wait3.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
wait.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
waitid.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
writev.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00