glibc/sysdeps/mach
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
..
htl Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
hurd Use clock_settime to implement settimeofday. 2019-10-30 17:05:14 -03:00
i386 Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
include hurd: Fix installed-headers tests 2018-07-20 03:28:08 +02:00
sys Installed-header hygiene (BZ#20366): obsolete BSD u_* types. 2016-09-23 08:43:56 -04:00
_strerror.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
adjtime.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
clock_gettime.c Use clock_gettime to implement gettimeofday. 2019-10-30 17:11:10 -03:00
configure hurd: Build stubs for new gnumach.defs 2018-01-28 19:38:29 +01:00
configure.ac hurd: Build stubs for new gnumach.defs 2018-01-28 19:38:29 +01:00
getloadavg.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
getsysstats.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
libc-lock.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
libmachuser.abilist hurd: add base abilist files 2018-01-28 17:26:35 +01:00
Makefile Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
mprotect.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
msync.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
munmap.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
nanosleep.c Change most internal uses of __gettimeofday to __clock_gettime. 2019-10-30 17:04:10 -03:00
pagecopy.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
readonly-area.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
sched_yield.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
strerror_l.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
Subdirs
sysdep.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
thread_state.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
usleep.c Change most internal uses of __gettimeofday to __clock_gettime. 2019-10-30 17:04:10 -03:00
xpg-strerror.c Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00