2013-06-11 13:12:42 +00:00
|
|
|
/* Time function internal interfaces.
|
2020-01-01 00:14:33 +00:00
|
|
|
Copyright (C) 1997-2020 Free Software Foundation, Inc.
|
2013-06-11 13:12:42 +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
|
|
|
|
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/>. */
|
2013-06-11 13:12:42 +00:00
|
|
|
|
1998-09-06 23:45:24 +00:00
|
|
|
#ifndef _SYS_TIME_H
|
2013-06-11 13:12:42 +00:00
|
|
|
# include <time/sys/time.h>
|
1998-08-09 17:39:48 +00:00
|
|
|
|
2013-06-11 13:12:42 +00:00
|
|
|
# ifndef _ISOMAC
|
1999-10-19 13:53:34 +00:00
|
|
|
extern int __gettimeofday (struct timeval *__tv,
|
2019-08-19 17:51:25 +00:00
|
|
|
void *__tz);
|
Use clock_settime to implement settimeofday.
Unconditionally, on all ports, use clock_settime to implement
settimeofday. Remove sysdeps/unix/clock_settime.c, which implemented
clock_settime by calling settimeofday; new OS ports must henceforth
provide a real implementation of clock_settime.
Hurd had a real implementation of settimeofday but not of
clock_settime; this patch converts it into an implementation of
clock_settime. It only supports CLOCK_REALTIME and microsecond
resolution; Hurd/Mach does not appear to have any support for
finer-resolution clocks.
The vestigial "set time zone" feature of settimeofday complicates the
generic settimeofday implementation a little. The only remaining uses
of this feature that aren't just bugs, are using it to inform the
Linux kernel of the offset between the hardware clock and UTC, on
systems where the hardware clock doesn't run in UTC (usually because
of dual-booting with Windows). There currently isn't any other way to
do this. However, the callers that do this call settimeofday with
_only_ the timezone argument non-NULL. Therefore, glibc's new
behavior is: callers of settimeofday must supply one and only one of
the two arguments. If both arguments are non-NULL, or both arguments
are NULL, the call fails and sets errno to EINVAL.
When only the timeval argument is supplied, settimeofday calls
__clock_settime(CLOCK_REALTIME), same as stime.
When only the timezone argument is supplied, settimeofday calls a new
internal function called __settimezone. On Linux, only, this function
will pass the timezone structure to the settimeofday system call. On
all other operating systems, and on Linux architectures that don't
define __NR_settimeofday, __settimezone is a stub that always sets
errno to ENOSYS and returns -1.
The settimeoday syscall is enabled on Linux by the flag
COMPAT_32BIT_TIME, which is an option to either 32-bits ABIs or COMPAT
builds (defined usually by 64-bit kernels that want to support 32-bit
ABIs, such as x86). The idea to future 64-bit time_t only ABIs
is to not provide settimeofday syscall.
The same semantics are implemented for Linux/Alpha's GLIBC_2.0 compat
symbol for settimeofday.
There are no longer any internal callers of __settimeofday, so the
internal prototype is removed.
Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
powerpc64-linux-gnu, powerpc-linux-gnu, and aarch64-linux-gnu.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
2019-08-28 12:25:49 +00:00
|
|
|
extern int __settimezone (const struct timezone *__tz)
|
2003-06-30 23:15:13 +00:00
|
|
|
attribute_hidden;
|
2012-01-08 04:57:22 +00:00
|
|
|
extern int __adjtime (const struct timeval *__delta,
|
1999-11-23 17:22:17 +00:00
|
|
|
struct timeval *__olddelta);
|
1999-10-19 13:53:34 +00:00
|
|
|
extern int __getitimer (enum __itimer_which __which,
|
1999-11-23 17:22:17 +00:00
|
|
|
struct itimerval *__value);
|
1999-10-19 13:53:34 +00:00
|
|
|
extern int __setitimer (enum __itimer_which __which,
|
2012-01-08 04:57:22 +00:00
|
|
|
const struct itimerval *__restrict __new,
|
2003-06-30 23:15:13 +00:00
|
|
|
struct itimerval *__restrict __old)
|
|
|
|
attribute_hidden;
|
2012-01-08 04:57:22 +00:00
|
|
|
extern int __utimes (const char *__file, const struct timeval __tvp[2])
|
2003-06-30 23:15:13 +00:00
|
|
|
attribute_hidden;
|
2012-01-08 04:57:22 +00:00
|
|
|
extern int __futimes (int fd, const struct timeval tvp[2]) attribute_hidden;
|
2002-04-14 09:14:45 +00:00
|
|
|
|
2013-06-11 13:12:42 +00:00
|
|
|
# endif
|
2012-02-26 04:18:39 +00:00
|
|
|
#endif
|