This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
[glibc/zack/y2038-preliminaries] (28 commits) Revise the documentation of simple calendar time.
- From: Zack Weinberg <zack at sourceware dot org>
- To: glibc-cvs at sourceware dot org
- Date: 28 Aug 2019 13:02:51 -0000
- Subject: [glibc/zack/y2038-preliminaries] (28 commits) Revise the documentation of simple calendar time.
The branch 'zack/y2038-preliminaries' was updated to point to:
6a05e8f... Revise the documentation of simple calendar time.
It previously pointed to:
212269f... Revise the documentation of simple calendar time.
Diff:
!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
-------------------------------------------------------------------
212269f... Revise the documentation of simple calendar time.
53df1cd... Warn when gettimeofday is called with non-null tzp argument
46a8ff5... Use clock_gettime to implement gettimeofday.
cc1f7d7... Use clock_settime to implement settimeofday.
5509f57... Remove implementations of clock_[gs]ettime using [gs]ettime
c38d965... Use clock_settime to implement stime; withdraw stime.
29ec06e... Use clock_gettime to implement timespec_get.
be5b6cb... Use clock_gettime to implement ftime; withdraw ftime.
da8786f... Use clock_gettime to implement time.
ba7bd57... Finish move of clock_* functions to libc.
77a350d... Change most internal uses of __gettimeofday to __clock_gett
d53b35c... Linux/Alpha: don't use timeval32 system calls.
commit 212269f0cf38320dd6dcb1272ab67a98981bbfd8
Author: Zack Weinberg <zackw@panix.com>
Date: Mon Aug 19 10:31:07 2019 -0400
Revise the documentation of simple calendar time.
This is a thorough revision of all the material relating to the
functions time, stime, gettimeofday, settimeofday, clock_gettime,
clock_getres, clock_settime, and difftime, spilling over into the
discussion of time-related data types (which now get their own
section) and touching the adjtime family as well (which deserves its
own thorough revision, but I'd have to do a bunch of research first).
Substantive changes are:
* Document clock_gettime, clock_getres, and clock_settime. (Only
CLOCK_REALTIME and CLOCK_MONOTONIC are documented; the others are
either a bit too Linux-specific, or have more to do with measuring
CPU/processor time. That section _also_ deserves its own thorough
revision but again I'd have to do a bunch of research first.)
* Present gettimeofday, settimeofday, and struct timeval as obsolete
relative to clock_*.
* Remove the documentation of struct timezone. Matching POSIX,
say that the type of the second argument to gettimeofday and
settimeofday is [const] void *.
* Clarify ISO C and POSIX's requirements on time_t. Clarify the
circumstances under which difftime is equivalent to simple
subtraction.
* Consolidate documentation of most of the time-related data types
into a new section "Time Types," right after "Time Basics." (The
exceptions are struct tm, which stays in "Broken-down Time," and
struct times, which stays in "Processor And CPU Time."
* The "Elapsed Time" section is now called "Calculating Elapsed Time"
and includes only difftime and the discussion of how to compute
timeval differences by hand.
* Fold the "Simple Calendar Time," "High Resolution Calendar," and
"High Accuracy Clock" sections together into two new sections titled
"Getting the Time" and "Setting and Adjusting the Time."
ChangeLog:
* manual/time.texi: Major revision of text related to simple
calendar time. clock_gettime, clock_getres, and clock_settime
are now documented.
* manual/filesys.texi, manual/llio.texi, manual/threads.texi:
Update cross-references to renamed sections in time.texi.
commit 53df1cd2811b71aa4193cb250b95fc14b7f310a3
Author: Zack Weinberg <zackw@panix.com>
Date: Mon Aug 19 13:51:25 2019 -0400
Warn when gettimeofday is called with non-null tzp argument.
At this stage I donâ??t think we can issue warnings for settimeofday
with a non-null tzp argument, nor for arbitrary use of struct
timezone. But we can warn about gettimeofday with non-null tzp.
This uses a macro instead of an inline (fortify-style) function
because I got false positives with an inline, even with GCC 9.
* time/sys/time.h (__timezone_ptr_t): Delete.
(gettimeofday): Always declare second argument with type â??void *â??.
When possible, wrap with a macro that detects non-null and
non-constant second argument and issues a warning.
Improve commentary.
(settimeofday): Improve commentary.
* time/gettimeofday.c (gettimeofday):
Declare second argument as type â??void *â??.
commit 46a8ff532fbba72224afe018ede5b63e99b87101
Author: Zack Weinberg <zackw@panix.com>
Date: Fri Aug 16 19:28:17 2019 -0400
Use clock_gettime to implement gettimeofday.
Abstractly, this is the same change as using clock_gettime to
implement time, but the vestigial "get time zone" feature of
gettimeofday complicates matters a little. Unlike settimeofday, there
are *no* known uses of this feature that are not bugs, so it is simply
dummied out. (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.)
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.
Hurd having already been converted, this patch only affects Linux and
hypothetical future ports. Most Linux ports supplied a vDSO symbol
for gettimeofday, and some wrapped that with an ifunc, so this patch
deletes a lot of code. For ease of future edits to the many copies of
_libc_vdso_platform_setup, the variable "p" in each is now declared
separately from any use of it.
As with settimeofday, the alpha-linux-gnu configuration has two
versions, GLIBC_2.0 and GLIBC_2.1, with the older symbol using 32-bit
time_t (yes, really) and the same solution is implemented here.
__gettimeofday no longer has any internal callers, so remove its
internal prototype. The __gettimeofday@GLIBC_2.0 export remains, in
case it is used by any third-party code.
* time/gettimeofday.c: No longer a stub implementation.
Call __clock_gettime. If tz argument is not NULL, clear the
object it points to. Remove libc_hidden_def for __gettimeofday
and libc_hidden_weak for gettimeofday. Optionally override the
default symbol version for gettimeofday.
* include/sys/time.h: Remove internal prototype and libc_hidden_proto
for __gettimeofday, and libc_hidden_proto for gettimeofday.
* sysdeps/unix/sysv/linux/alpha/gettimeofday.c:
New file, uses time/gettimeofday.c but changes the default
symbol version to gettimeofday@@GLIBC_2.1.
* sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c
(gettimeofday@GLIBC_2.0): Use __clock_gettime instead of __gettimeofday.
If tz argument is not NULL, clear the object it points to.
* sysdeps/unix/sysv/linux/aarch64/init-first.c
* sysdeps/unix/sysv/linux/arm/init-first.c
* sysdeps/unix/sysv/linux/mips/init-first.c
* sysdeps/unix/sysv/linux/powerpc/init-first.c
* sysdeps/unix/sysv/linux/riscv/init-first.c
* sysdeps/unix/sysv/linux/s390/init-first.c
* sysdeps/unix/sysv/linux/sparc/init-first.c:
Do not define nor initialize VDSO_SYMBOL(gettimeofday).
* sysdeps/unix/sysv/linux/aarch64/libc-vdso.h
* sysdeps/unix/sysv/linux/arm/libc-vdso.h
* sysdeps/unix/sysv/linux/mips/libc-vdso.h
* sysdeps/unix/sysv/linux/powerpc/libc-vdso.h
* sysdeps/unix/sysv/linux/riscv/libc-vdso.h
* sysdeps/unix/sysv/linux/s390/libc-vdso.h
* sysdeps/unix/sysv/linux/sparc/libc-vdso.h:
Do not declare VDSO_SYMBOL(gettimeofday).
* sysdeps/unix/syscalls.list: Remove entry for gettimeofday.
* sysdeps/unix/sysv/linux/alpha/syscalls.list:
Remove entries for gettimeofday and osf_gettimeofday.
* sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list:
Remove entry for gettimeofday.
* sysdeps/posix/gettimeofday.c
* sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
* sysdeps/unix/sysv/linux/gettimeofday.c
* sysdeps/unix/sysv/linux/i386/gettimeofday.c
* sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
* sysdeps/unix/sysv/linux/x86/gettimeofday.c: Delete file.
* sysdeps/unix/make-syscalls.sh: Change an example in a comment
from referring to gettimeofday, to referring to sigaction.
commit cc1f7d7d359085fb10e3c7d99a3a3f950b4c8c0c
Author: Zack Weinberg <zackw@panix.com>
Date: Fri Aug 16 16:21:13 2019 -0400
Use clock_settime to implement settimeofday.
Unconditionally, on all ports, use clock_settime to implement
settimeofday. This is a little different from using clock_settime to
implement stime, because the vestigial "set time zone" feature of
settimeofday complicates matters.
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 same semantics are implemented for Linux/Alpha's GLIBC_2.0 compat
symbol for gettimeofday.
There are no longer any internal callers of __settimeofday, so the
internal prototype is removed.
* time/settimeofday.c (settimeofday): No longer a stub
implementation. Call __clock_settime or __settimezone depending
on arguments. Optionally override the default symbol version for
settimeofday.
* include/sys/time.h: Remove prototype for __settimeofday.
Add prototype for __settimezone.
* sysdeps/unix/syscalls.list: Remove entry for settimeofday.
* time/settimezone.c: New file.
(__settimezone): New stub implementation.
* sysdeps/unix/sysv/linux/settimezone.c: New file.
(__settimezone): Implement using settimeofday system call,
if available.
* time/Makefile (routines): Add settimezone.
* sysdeps/unix/sysv/linux/alpha/syscalls.list:
Remove entries for settimeofday and osf_settimeofday.
* sysdeps/unix/sysv/linux/alpha/osf_settimeofday.c
New file, defines settimeofday@GLIBC_2.0.
* sysdeps/unix/sysv/linux/alpha/settimeofday.c:
New file, defines settimeofday@@GLIBC_2.1.
commit 5509f57349a19bd4fe1bb71fd51b8a560698f3dd
Author: Zack Weinberg <zackw@panix.com>
Date: Fri Aug 16 15:11:47 2019 -0400
Remove implementations of clock_[gs]ettime using [gs]ettimeofday.
gettimeofday and settimeofday are obsolete in POSIX and will not be
provided by Linux for future new architectures. The preferred
interfaces are clock_gettime and clock_settime. Ports of glibc to
historic Unixes that provided these functions, but not clock_gettime
and clock_settime, are unlikely to be contributed anymore.
Accordingly, remove the generic-Unix implementations of clock_gettime
and clock_settime that forwarded to gettimeofday and settimeofday.
New OS ports must henceforth provide some implementation of
clock_gettime and clock_settime.
The generic-Unix implementations *were* being used on the Hurd. This
patch therefore also converts the Hurd gettimeofday and settimeofday
implementations into clock_gettime and clock_settime implementations.
They only support CLOCK_REALTIME, and they only supply microsecond
resolution. Hurd/Mach does not appear to have any support for
finer-resolution or monotonic clocks. Relatedly, 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.
This means Hurd temporarily has only ENOSYS stubs for gettimeofday and
settimeofday; this will be corrected in the next two patches, which
will be squashed together with this one after review.
* sysdeps/unix/clock_gettime.c, sysdeps/unix/clock_settime.c:
Delete file.
* sysdeps/mach/gettimeofday.c: Rename to .../clock_gettime.c
and convert into an implementation of clock_gettime.
* sysdeps/mach/hurd/settimeofday.c: Rename to .../clock_settime.c
and convert into an implementation of clock_settime.
commit c38d9652e3b147fd1c99d2e3972e57bc1289b5ab
Author: Zack Weinberg <zackw@panix.com>
Date: Fri Aug 16 15:03:16 2019 -0400
Use clock_settime to implement stime; withdraw stime.
Unconditionally, on all ports, use clock_settime to implement stime,
not settimeofday or a direct syscall. Then convert stime into a
compatibility symbol and remove its prototype from time.h.
* time/stime.c (stime): No longer a stub implementation.
Call __clock_settime. Demote to a compatibility symbol.
* sysdeps/unix/stime.c: Delete file.
* sysdeps/unix/sysv/linux/syscalls.list: Remove entry for stime.
* time/time.h: Remove prototype for stime.
commit 29ec06e86e29a0d33347aa5f6388a91fbe9c4269
Author: Zack Weinberg <zackw@panix.com>
Date: Thu Aug 22 17:10:35 2019 -0400
Use clock_gettime to implement timespec_get.
timespec_get is the same function as clock_gettime, with an obnoxious
coating of NIH painted on it by the ISO C committee. In addition to
the rename, it takes its arguments in a different order, it returns 0
on *failure* or a positive number on *success*, and it places
requirements on the numeric values of its TIME_* constants that make
it impossible for us to reuse the CLOCK_* constants we already have
for it. As such I think the most sensible GNUish policy for this
function is that we will provide it, but we will not recommend its
use, we will not go out of our way to make it efficient, and we will
not attempt to extend the set of TIME_* constants beyond the ones
defined in ISO C (and in POSIX, if it ever appears in POSIX).
This patch simply promotes the sysdeps/posix implementation to
universal, and removes the Linux-specific implementation, whose
apparent reason for existing was to cut out one function call's worth
of overhead. Oh well.
* sysdeps/posix/timespec_get.c
* sysdeps/unix/sysv/linux/timespec_get.c: Delete file.
* time/timespec_get.c: No longer a stub. Replace implementation
with the code formerly in sysdeps/posix/timespec_get.c.
commit be5b6cbd4f8224a33f6e3bedf6f6761b6f1c6f1a
Author: Zack Weinberg <zackw@panix.com>
Date: Fri Aug 16 20:56:02 2019 -0400
Use clock_gettime to implement ftime; withdraw ftime.
ftime is an obsolete variation on gettimeofday, offering only
millisecond time resolution; it was probably a system call in ooold
versions of BSD Unix. For historic reasons, we had three
implementations of it. These are all consolidated into time/ftime.c,
and then the function is made a compatibility symbol. The public
header file that declared it, its result structure, and nothing else,
is removed.
For some reason, the implementation of ftime in terms of gettimeofday
was rounding rather than truncating microseconds to milliseconds. In
all the other places where we use a higher-resolution time function to
implement a lower-resolution one, we truncate. ftime is changed to
match, just for tidiness' sake.
Like gettimeofday, ftime tries to report the time zone, and using that
information is always a bug. This patch dummies out the reported
timezone information; the timezone and dstflag fields of the
returned "struct timeb" will always be zero.
* time/sys/timeb.h
* time/tst-ftime.c
* time/sys/timeb.h
* sysdeps/unix/bsd/ftime.c
* sysdeps/unix/sysv/linux/ftime.c: Delete file.
* time/tst-ftime_l.c: Rename to tst-strftime_l.c.
* time/ftime.c (ftime): Make a compatibility-only symbol.
Replace implementation with the code formerly in
sysdeps/unix/bsd/ftime.c, then change that code to use
__clock_gettime instead of __gettimeofday and to truncate
rather than rounding. Always set the timezone and dstflag
fields of the timebuf argument to zero.
* time/Makefile (headers): Remove sys/timeb.h.
(tests): Remove tst-ftime, change tst-ftime_l to
tst-strftime_l.
* conform/Makefile: XFAIL all tests related to sys/timeb.h.
commit da8786fbbf21fefce5e95660cd2043900828e3d9
Author: Zack Weinberg <zackw@panix.com>
Date: Fri Aug 16 14:22:42 2019 -0400
Use clock_gettime to implement time.
Most ports were using gettimeofday to implement time, or they were
making a direct (v)syscall. Unconditionally switch to using
clock_gettime instead. All sysdeps implementations of time are
removed.
* time/time.c (time): No longer a stub implementation.
Call __clock_gettime.
* sysdeps/unix/sysv/linux/powerpc/Versions (GLIBC_PRIVATE):
Remove __vdso_time.
* sysdeps/unix/sysv/linux/powerpc/init-first.c (__vdso_time): Delete.
(_libc_vdso_platform_setup): Donâ??t initialize __vdso_time.
* sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list: Remove entry
for time.
* sysdeps/posix/time.c
* sysdeps/unix/sysv/linux/time.c
* sysdeps/unix/sysv/linux/i386/time.c
* sysdeps/unix/sysv/linux/powerpc/time.c
* sysdeps/unix/sysv/linux/sparc/sparc64/time.c
* sysdeps/unix/sysv/linux/x86/time.c:
Delete file.
commit ba7bd5775c1f61d167b4b09637c6f9d2e557c4bb
Author: Zack Weinberg <zackw@panix.com>
Date: Mon Aug 19 12:25:14 2019 -0400
Finish move of clock_* functions to libc.
In glibc 2.17, the functions clock_getcpuclockid, clock_getres,
clock_gettime, clock_nanosleep, and clock_settime were moved from
librt.so to libc.so, leaving compatibility stubs behind. Now that the
dynamic linker no longer insists on finding versioned symbols in the
same library that originally defined them, we do not need the stubs
anymore, and this means we donâ??t need GLIBC_PRIVATE __-prefix aliases
for most of the functions anymore either. (clock_gettime still needs
one.) For ports added before 2.17, libc.so needs to provide two
symbol versions for each, the default at GLIBC_2.17 plus a compat
version matching what librt had.
While Iâ??m at it, move the clock_*.c files and their tests from rt/ to
time/.
* rt/clock_getcpuclockid.c: Move to time/clock_getcpuclockid.c.
* rt/clock_getres.c: Move to time/clock_getres.c.
* rt/clock_gettime.c: Move to time/clock_gettime.c.
* rt/clock_nanosleep.c: Move to time/clock_nanosleep.c.
* rt/clock_settime.c: Move to time/clock_settime.c.
* rt/tst-clock.c: Move to time/tst-clock.c.
* rt/tst-clock2.c: Move to time/tst-clock2.c.
* rt/tst-clock_nanosleep.c: Move to time/tst-clock_nanosleep.c.
* rt/tst-cpuclock1.c: Move to time/tst-cpuclock1.c.
* rt/clock-compat.c: Delete file.
* time/clock_getcpuclockid.c
* time/clock_getres.c
* time/clock_gettime.c
* time/clock_nanosleep.c
* time/clock_settime.c
* sysdeps/posix/clock_getres.c
* sysdeps/unix/clock_gettime.c
* sysdeps/unix/clock_nanosleep.c
* sysdeps/unix/clock_settime.c
* sysdeps/unix/sysv/linux/clock_getcpuclockid.c
* sysdeps/unix/sysv/linux/clock_getres.c
* sysdeps/unix/sysv/linux/clock_gettime.c
* sysdeps/unix/sysv/linux/clock_nanosleep.c
* sysdeps/unix/sysv/linux/clock_settime.c: Define the function
defined by this file with default symbol version GLIBC_2_17,
and optionally a compatibility alias at symbol version GLIBC_2_2.
* include/time.h: Remove internal prototypes for clock_getres,
clock_nanosleep, and clock_getcpuclockid.
* sysdeps/unix/sysv/linux/clock_gettime.c: Prune includes.
Remove unused function realtime_gettime.
* rt/Makefile (clock-routines, routines): Remove variable.
(librt-routines): Remove clock-compat.
(tests): Remove tst-clock, tst-clock2, tst-clock_nanosleep,
and tst-cpuclock1.
* time/Makefile (routines): Add clock_getres, clock_gettime,
clock_settime, clock_getcpuclockid, and clock_nanosleep.
(tests): Add tst-clock, tst-clock2, tst-clock_nanosleep,
and tst-cpuclock1.
* rt/Versions (libc): Remove entire stanza.
(librt GLIBC_2.2): Remove all clock_* functions.
* time/Versions (libc GLIBC_2.2, libc GLIBC_2.17):
Add clock_getres, clock_gettime, clock_settime,
clock_getcpuclockid, and clock_nanosleep.
(libc GLIBC_PRIVATE): Add __clock_gettime.
* sysdeps/mach/hurd/i386/librt.abilist
* sysdeps/unix/sysv/linux/alpha/librt.abilist
* sysdeps/unix/sysv/linux/arm/librt.abilist
* sysdeps/unix/sysv/linux/hppa/librt.abilist
* sysdeps/unix/sysv/linux/i386/librt.abilist
* sysdeps/unix/sysv/linux/ia64/librt.abilist
* sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist
* sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist
* sysdeps/unix/sysv/linux/microblaze/librt.abilist
* sysdeps/unix/sysv/linux/mips/mips32/librt.abilist
* sysdeps/unix/sysv/linux/mips/mips64/librt.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/librt.abilist
* sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist
* sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist
* sysdeps/unix/sysv/linux/sh/librt.abilist
* sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist
* sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist
* sysdeps/unix/sysv/linux/x86_64/64/librt.abilist
* sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist:
Remove entries for clock_getres, clock_gettime, clock_settime,
clock_getcpuclockid, and clock_nanosleep.
* sysdeps/mach/hurd/i386/libc.abilist
* sysdeps/unix/sysv/linux/alpha/libc.abilist
* sysdeps/unix/sysv/linux/arm/libc.abilist
* sysdeps/unix/sysv/linux/hppa/libc.abilist
* sysdeps/unix/sysv/linux/i386/libc.abilist
* sysdeps/unix/sysv/linux/ia64/libc.abilist
* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
* sysdeps/unix/sysv/linux/sh/libc.abilist
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist:
Add another set of entries for clock_getres, clock_gettime,
clock_settime, clock_getcpuclockid, and clock_nanosleep at
whatever version GLIBC_2.2 maps to.
commit 77a350d8120bde87870d3b734f95de5d4348e40f
Author: Zack Weinberg <zackw@panix.com>
Date: Fri Aug 16 20:38:22 2019 -0400
Change most internal uses of __gettimeofday to __clock_gettime.
Since gettimeofday will shortly be implemented in terms of
clock_gettime on all platforms, internal code should use clock_gettime
directly; in addition to removing a layer of indirection, this will
allow us to remove the PLT-bypass gunk for gettimeofday. In many
cases, the changed code does fewer conversions.
The changed code always assumes __clock_gettime (CLOCK_REALTIME)
cannot fail. Most of the call sites were assuming gettimeofday could
not fail, but a few places were checking for errors. POSIX says
clock_gettime can only fail if the clock constant is invalid or
unsupported, and CLOCK_REALTIME is the one and only clock constant
that's required to be supported. For consistency I grepped the entire
source tree for any other places that checked for errors from
__clock_gettime (CLOCK_REALTIME), found one, and changed it too.
(For the record, POSIX also says gettimeofday can never fail.)
(It would be nice if we could declare that GNU systems will always
support CLOCK_MONOTONIC as well as CLOCK_REALTIME; there are several
places where we are using CLOCK_REALTIME where _MONOTONIC would be
more appropriate, and/or trying to use _MONOTONIC and then falling
back to _REALTIME. But the Hurd doesn't support CLOCK_MONOTONIC yet,
and it looks like adding it would involve substantial changes to
gnumach's internals and API. Oh well.)
A few Hurd-specific files were changed to use __host_get_time instead
of __clock_gettime, as this seemed tidier.
With the exception of support/support_test_main.c, test cases are not
modified, mainly because I didn't want to have to figure out which
test cases were testing gettimeofday specifically.
The definition of GETTIME in sysdeps/generic/memusage.h had a typo and
was not reading tv_sec at all. I fixed this. It appears nobody has been
generating malloc traces on a machine that doesn't have a superseding
definition.
* inet/deadline.c (__deadline_current_time)
* login/logout.c (logout)
* login/logwtmp.c (logwtmp)
* nis/nis_call.c (__nisfind_server)
* nptl/pthread_join_common.c (timedwait_tid)
* nptl/pthread_mutex_timedlock.c (__pthread_mutex_clocklock_common)
* nscd/nscd_helper.c (wait_on_socket, open_socket)
* resolv/gai_misc.c (handle_requests)
* resolv/gai_suspend.c (gai_suspend)
* resolv/res_send.c (evNowTime)
* sunrpc/auth_des.c (authdes_marshal, authdes_destroy)
* sunrpc/auth_unix.c (authunix_create, authunix_refresh)
* sunrpc/create_xid.c (_create_xid)
* sunrpc/svcauth_des.c (_svcauth_des)
* sysdeps/generic/memusage.h (GETTIME)
* sysdeps/mach/nanosleep.c (__libc_nanosleep)
* sysdeps/posix/tempname.c (RANDOM_BITS)
* sysdeps/pthread/aio_misc.c (handle_fildes_io)
* sysdeps/pthread/aio_suspend.c (aio_suspend):
Use __clock_gettime (CLOCK_REALTIME) instead of __gettimeofday.
Assume __clock_gettime (CLOCK_REALTIME) cannot fail.
Include time.h if necessary.
* sysdeps/posix/timespec_get.c (timespec_get):
Assume __clock_gettime (CLOCK_REALTIME) cannot fail.
* sysdeps/mach/hurd/getitimer.c (__getitimer)
* sysdeps/mach/hurd/setitimer.c (setitimer_locked)
* sysdeps/mach/hurd/times.c (__times):
Use __host_get_time instead of __gettimeofday.
Include mach.h if necessary.
* sysdeps/mach/usleep.c (usleep): Remove unnecessary calls to
__gettimeofday.
* support/support_test_main.c (print_timestamp): Take a struct
timespec argument, not a struct timeval.
(signal_handler): Update to match.
Use clock_gettime (CLOCK_REALTIME) instead of gettimeofday.
* sysdeps/generic/memusage.h (GETTIME): Correct typo causing
the seconds field of each timestamp to be ignored.
commit d53b35c896cfac8bdd043e539ab9596d35d11677
Author: Zack Weinberg <zackw@panix.com>
Date: Mon Aug 19 14:18:08 2019 -0400
Linux/Alpha: don't use timeval32 system calls.
Linux/Alpha has two versions of several system call wrappers that take
or return data of type "struct timeval" (possibly nested inside a
larger structure). The GLIBC_2.0 version is a compat symbol that
calls __NR_osf_foo or __NR_old_foo and uses a struct timeval with a
32-bit tv_sec field. The GLIBC_2.1 version is used for current code,
calls __NR_foo, and uses a struct timeval with a 64-bit tv_sec field.
This patch changes all of the compat symbols of this type to be
wrappers around their GLIBC_2.1 counterparts; the compatibility system
calls will no longer be used. It serves as a proposal for part of how
we do the transition to 64-bit time_t on systems that currently use
32-bit time_t:
* The patched glibc will NOT use system calls that involve 32-bit
time_t to implement its compatibility symbols. This will make both
our lives and the kernel maintainers' lives easier. The primary
argument I've seen against it is that the kernel could warn about
uses of the old system calls, helping people find old binaries that
need to be recompiled. I think there are several other ways we
could accomplish this, e.g. scripts to scan the filesystem for
binaries with references to the old symbol versions, or issuing
diagnostics ourselves.
* The compat symbols do NOT report failure after the Y2038 deadline.
An earlier revision of this patch had them return -1 and set errno
to EOVERFLOW, but Adhemerval pointed out that many of them have
already performed side effects at the point where we discover the
overflow, so that would break more than it fixes. Also, we don't
want people to be _checking_ for EOVERFLOW from these functions; we
want them to recompile with 64-bit time_t. So it's not actually
useful for them to report failure to the calling code.
* What they do do, when they encounter overflow, is saturate the
overflowed "struct timeval"(s): tv_sec is set to INT32_MAX and
tv_nsec is set to 999999. That means time stops advancing for
programs with 32-bit time_t when they reach the deadline. That's
obviously going to break stuff, but I think wrapping around is
probably going to break _more_ stuff. I'd be interested to hear
arguments against, if anyone has one.
The new header file tv32-compat.h is currently Alpha-specific but I
mean for it to be reused to aid in writing wrappers for all affected
architectures. I only put it in sysdeps/unix/sysv/linux/alpha for now
because I haven't checked whether the various "foo32" structures it
defines agree with the ABI for ports other than Linux/Alpha.
* sysdeps/unix/sysv/linux/alpha/tv32-compat.h: New file declaring
types and helper functions for 32/64-bit time_t conversion.
* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove entries for
osf_gettimeofday, osf_settimeofday, osf_getitimer, osf_setitimer,
osf_utimes, osf_getrusage, and osf_wait4. Add entry for adjtimex.
Change entries for gettimeofday, settimeofday, getitimer,
setitimer, utimes, getrusage, and wait4 to use argument type codes.
* sysdeps/unix/sysv/linux/alpha/adjtime.c: Delete file.
* sysdeps/unix/sysv/linux/alpha/osf_adjtime.c
* sysdeps/unix/sysv/linux/alpha/osf_getitimer.c
* sysdeps/unix/sysv/linux/alpha/osf_getrusage.c
* sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c
* sysdeps/unix/sysv/linux/alpha/osf_setitimer.c
* sysdeps/unix/sysv/linux/alpha/osf_settimeofday.c
* sysdeps/unix/sysv/linux/alpha/osf_utimes.c
* sysdeps/unix/sysv/linux/alpha/osf_wait4.c:
New files defining compatibility symbols formerly defined by
alpha/syscalls.list and alpha/adjtime.c.
* sysdeps/unix/sysv/linux/alpha/Makefile (sysdep_routines):
Add osf_adjtime.
Summary of changes (added commits):
-----------------------------------
6a05e8f... Revise the documentation of simple calendar time.
c50ec7c... Warn when gettimeofday is called with non-null tzp argument
10a1058... Use clock_gettime to implement gettimeofday.
6324433... Use clock_gettime to implement timespec_get.
2d38f1e... Use clock_gettime to implement ftime; withdraw ftime.
f4e5cd6... Use clock_gettime to implement time.
36843c0... Use clock_settime to implement settimeofday.
819549f... Use clock_settime to implement stime; withdraw stime.
9416726... Finish move of clock_* functions to libc.
34a3645... Change most internal uses of __gettimeofday to __clock_gett
fa487f6... Linux/Alpha: don't use timeval32 system calls.
35ffd20... misc: Use allocate_once in getmntent
ffced38... nptl: Move pthread_attr_setdetachstate implementation into
61d3db4... login: pututxline could fail to overwrite existing entries
3a9d025... Fix posix/tst-regex by using a dedicated input-file.
1bced8c... Don't put non-ASCII into installed headers
e6855a3... Fix spellings of contributor names in comments and doc
edd8d70... [MIPS] Raise highest supported EI_ABIVERSION value [BZ #249
33bc9ef... mips: Force RWX stack for hard-float builds that can run on
08d5710... linux: Make profil_counter a compat_symbol (BZ#17726)
a43565a... Refactor sigcontextinfo.h
624c109... Add RTLD_SINGLE_THREAD_P on generic single-thread.h
c0fd324... Chinese locales: Set first_weekday to 2 (bug 24682).
c8c8160... powerpc: Fix typos and field name in comments
42f527c... Mark IDN tests unsupported with libidn2 before 2.0.5.
c737ef0... Document strftime %Ob and %OB as C2X features.
f615e3f... Remove dead regex code
8a80ee5... Fix bad pointer / leak in regex code
commit 6a05e8fb3b53ebcf9bc4da0d946d4ab07f8dc910
Author: Zack Weinberg <zackw@panix.com>
Date: Mon Aug 19 10:31:07 2019 -0400
Revise the documentation of simple calendar time.
This is a thorough revision of all the material relating to the
functions time, stime, gettimeofday, settimeofday, clock_gettime,
clock_getres, clock_settime, and difftime, spilling over into the
discussion of time-related data types (which now get their own
section) and touching the adjtime family as well (which deserves its
own thorough revision, but I'd have to do a bunch of research first).
Substantive changes are:
* Document clock_gettime, clock_getres, and clock_settime. (Only
CLOCK_REALTIME and CLOCK_MONOTONIC are documented; the others are
either a bit too Linux-specific, or have more to do with measuring
CPU/processor time. That section _also_ deserves its own thorough
revision but again I'd have to do a bunch of research first.)
* Present gettimeofday, settimeofday, and struct timeval as obsolete
relative to clock_*.
* Remove the documentation of struct timezone. Matching POSIX,
say that the type of the second argument to gettimeofday and
settimeofday is [const] void *.
* Clarify ISO C and POSIX's requirements on time_t. Clarify the
circumstances under which difftime is equivalent to simple
subtraction.
* Consolidate documentation of most of the time-related data types
into a new section "Time Types," right after "Time Basics." (The
exceptions are struct tm, which stays in "Broken-down Time," and
struct times, which stays in "Processor And CPU Time."
* The "Elapsed Time" section is now called "Calculating Elapsed Time"
and includes only difftime and the discussion of how to compute
timeval differences by hand.
* Fold the "Simple Calendar Time," "High Resolution Calendar," and
"High Accuracy Clock" sections together into two new sections titled
"Getting the Time" and "Setting and Adjusting the Time."
ChangeLog:
* manual/time.texi: Major revision of text related to simple
calendar time. clock_gettime, clock_getres, and clock_settime
are now documented.
* manual/filesys.texi, manual/llio.texi, manual/threads.texi:
Update cross-references to renamed sections in time.texi.
commit c50ec7ce062883cbb3d1820b2c1ea262ca5fff5b
Author: Zack Weinberg <zackw@panix.com>
Date: Mon Aug 19 13:51:25 2019 -0400
Warn when gettimeofday is called with non-null tzp argument.
Since there are no known uses of gettimeofday's vestigial "get time
zone" feature that are not bugs, add a fortify-style wrapper inline to
sys/time.h that issues a warning whenever gettimeofday is called with
a second argument that is not a compile-time null pointer
constant.
At present this is only possible with GCC; clang does not implement
attribute((warning)). The wrapper is only activated when __OPTIMIZE__
is defined because it throws false positives when optimization is off,
even though it's an always-inline function.
An oversight in the implementation of __builtin_constant_p causes it
to fail to detect compile-time *pointer* constants unless they are
cast to an integer of a different size. (Loss of data in this cast is
harmless; the overall expression is still constant if and only if the
original pointer was.) This is GCC bug 95514. Thanks to
Kamil Cukrowski <kamilcukrowski@gmail.com> for the workaround.
As a precaution, I added a static assertion to debug/warning-nop.c to
make sure that the cast _is_ casting to an integer of a different
size; this is too unlikely a scenario to be worth checking in the
public header, but if someone ever adds a port where short is the
same size as intptr_t, we'll still catch it.
Also make the public prototype of gettimeofday declare its second
argument with type "void *" unconditionally, consistent with POSIX.
* time/sys/time.h (__timezone_ptr_t): Delete.
(gettimeofday): Always declare second argument with type "void *".
When possible, wrap with a fortify-style inline function that
detects non-null or non-constant second argument and issues a
warning. Improve commentary.
(settimeofday): Improve commentary.
* time/gettimeofday.c (gettimeofday): Declare second argument with
type "void *".
* debug/warning-nop.c: Include sys/time.h and stdint.h.
Add static_assert to verify the requirements of the workaround
for GCC bug 95514.
commit 10a105817921d6de8e7f5a68704168d5a8abf6d2
Author: Zack Weinberg <zackw@panix.com>
Date: Wed Aug 28 08:30:28 2019 -0400
Use clock_gettime to implement gettimeofday.
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.
Most Linux ports supplied a vDSO symbol for gettimeofday, and some
wrapped that with an ifunc, so this patch deletes a lot of code.
For ease of future edits to the many copies of _libc_vdso_platform_setup,
the variable "p" in each is now declared separately from any use of it.
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.
* time/gettimeofday.c: No longer a stub implementation.
Call __clock_gettime. If tz argument is not NULL, clear the
object it points to. Remove libc_hidden_* for __gettimeofday
and gettimeofday. Optionally override the default symbol
version for gettimeofday and __gettimeofday.
* include/sys/time.h: Remove internal prototype and libc_hidden_proto
for __gettimeofday, and libc_hidden_proto for gettimeofday.
* sysdeps/unix/sysv/linux/alpha/gettimeofday.c: Switch to
including time/gettimeofday.c.
* sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c
(gettimeofday@GLIBC_2.0): Use __clock_gettime instead of __gettimeofday.
If tz argument is not NULL, clear the object it points to.
* sysdeps/unix/sysv/linux/aarch64/init-first.c
* sysdeps/unix/sysv/linux/arm/init-first.c
* sysdeps/unix/sysv/linux/mips/init-first.c
* sysdeps/unix/sysv/linux/powerpc/init-first.c
* sysdeps/unix/sysv/linux/riscv/init-first.c
* sysdeps/unix/sysv/linux/s390/init-first.c
* sysdeps/unix/sysv/linux/sparc/init-first.c:
Do not define nor initialize VDSO_SYMBOL(gettimeofday).
* sysdeps/unix/sysv/linux/aarch64/libc-vdso.h
* sysdeps/unix/sysv/linux/arm/libc-vdso.h
* sysdeps/unix/sysv/linux/mips/libc-vdso.h
* sysdeps/unix/sysv/linux/powerpc/libc-vdso.h
* sysdeps/unix/sysv/linux/riscv/libc-vdso.h
* sysdeps/unix/sysv/linux/s390/libc-vdso.h
* sysdeps/unix/sysv/linux/sparc/libc-vdso.h:
Do not declare VDSO_SYMBOL(gettimeofday).
* sysdeps/unix/syscalls.list: Remove entry for gettimeofday.
* sysdeps/unix/sysv/linux/alpha/syscalls.list:
Remove entries for gettimeofday and osf_gettimeofday.
* sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list:
Remove entry for gettimeofday.
* sysdeps/posix/gettimeofday.c
* sysdeps/unix/clock_gettime.c
* sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
* sysdeps/unix/sysv/linux/gettimeofday.c
* sysdeps/unix/sysv/linux/i386/gettimeofday.c
* sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
* sysdeps/unix/sysv/linux/x86/gettimeofday.c: Delete file.
* sysdeps/mach/gettimeofday.c: Rename to
sysdeps/mach/clock_gettime.c and convert into an
implementation of clock_gettime.
commit 63244339c567e70037059a434c16b92302f9311c
Author: Zack Weinberg <zackw@panix.com>
Date: Thu Aug 22 17:10:35 2019 -0400
Use clock_gettime to implement timespec_get.
timespec_get is the same function as clock_gettime, with an obnoxious
coating of NIH painted on it by the ISO C committee. In addition to
the rename, it takes its arguments in a different order, it returns 0
on *failure* or a positive number on *success*, and it requires that
all of its TIME_* constants be positive. This last means we cannot
directly reuse the existing CLOCK_* constants for it, because
those have been allocated starting with CLOCK_REALTIME = 0 on all
existing platforms.
As such I think the most sensible GNUish policy for this function is
that we will provide it, but we will not recommend its use, we will
not go out of our way to make it efficient, and we will not attempt to
extend the set of TIME_* constants beyond the ones defined in ISO
C (and in POSIX, if it ever appears in POSIX).
This patch simply promotes the sysdeps/posix implementation to
universal, and removes the Linux-specific implementation, whose
apparent reason for existing was to cut out one function call's worth
of overhead. Oh well.
* sysdeps/posix/timespec_get.c
* sysdeps/unix/sysv/linux/timespec_get.c: Delete file.
* time/timespec_get.c: No longer a stub. Replace implementation
with the code formerly in sysdeps/posix/timespec_get.c.
commit 2d38f1e2a0db764a18eecf27d7a6eb1b6aa7e351
Author: Zack Weinberg <zackw@panix.com>
Date: Fri Aug 16 20:56:02 2019 -0400
Use clock_gettime to implement ftime; withdraw ftime.
ftime is an obsolete variation on gettimeofday, offering only
millisecond time resolution; it was probably a system call in ooold
versions of BSD Unix. For historic reasons, we had three
implementations of it. These are all consolidated into time/ftime.c,
and then the function is made a compatibility symbol. The public
header file that declared it, its result structure, and nothing else,
is removed.
For some reason, the implementation of ftime in terms of gettimeofday
was rounding rather than truncating microseconds to milliseconds. In
all the other places where we use a higher-resolution time function to
implement a lower-resolution one, we truncate. ftime is changed to
match, just for tidiness' sake.
Like gettimeofday, ftime tries to report the time zone, and using that
information is always a bug. This patch dummies out the reported
timezone information; the timezone and dstflag fields of the
returned "struct timeb" will always be zero.
* time/sys/timeb.h
* time/tst-ftime.c
* time/sys/timeb.h
* sysdeps/unix/bsd/ftime.c
* sysdeps/unix/sysv/linux/ftime.c: Delete file.
* time/tst-ftime_l.c: Rename to tst-strftime_l.c.
* time/ftime.c (ftime): Make a compatibility-only symbol.
Replace implementation with the code formerly in
sysdeps/unix/bsd/ftime.c, then change that code to use
__clock_gettime instead of __gettimeofday and to truncate
rather than rounding. Always set the timezone and dstflag
fields of the timebuf argument to zero.
* time/Makefile (headers): Remove sys/timeb.h.
(tests): Remove tst-ftime, change tst-ftime_l to
tst-strftime_l.
* conform/Makefile: XFAIL all tests related to sys/timeb.h.
commit f4e5cd6bbe38b3454bf683453d080b073ecec3ca
Author: Zack Weinberg <zackw@panix.com>
Date: Fri Aug 16 14:22:42 2019 -0400
Use clock_gettime to implement time.
Most ports were using gettimeofday to implement time, or they were
making a direct (v)syscall. Unconditionally switch to using
clock_gettime instead. All sysdeps implementations of time are
removed.
* time/time.c (time): No longer a stub implementation.
Call __clock_gettime.
* sysdeps/unix/sysv/linux/powerpc/Versions (GLIBC_PRIVATE):
Remove __vdso_time.
* sysdeps/unix/sysv/linux/powerpc/init-first.c (__vdso_time): Delete.
(_libc_vdso_platform_setup): Don't initialize __vdso_time.
* sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list: Remove entry
for time.
* sysdeps/posix/time.c
* sysdeps/unix/sysv/linux/time.c
* sysdeps/unix/sysv/linux/i386/time.c
* sysdeps/unix/sysv/linux/powerpc/time.c
* sysdeps/unix/sysv/linux/sparc/sparc64/time.c
* sysdeps/unix/sysv/linux/x86/time.c:
Delete file.
commit 36843c029fe57e561abfcc7af81445e404c5671d
Author: Zack Weinberg <zackw@panix.com>
Date: Wed Aug 28 08:25:49 2019 -0400
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 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.
* time/settimeofday.c (settimeofday): No longer a stub
implementation. Call __clock_settime or __settimezone depending
on arguments. Optionally override the default symbol version for
settimeofday.
* include/sys/time.h: Remove prototype for __settimeofday.
Add prototype for __settimezone.
* sysdeps/unix/syscalls.list: Remove entry for settimeofday.
* time/settimezone.c: New file.
(__settimezone): New stub implementation.
* sysdeps/unix/sysv/linux/settimezone.c: New file.
(__settimezone): Implement using settimeofday system call,
if available.
* time/Makefile (routines): Add settimezone.
* sysdeps/unix/sysv/linux/alpha/syscalls.list:
Remove entries for settimeofday and osf_settimeofday.
* sysdeps/unix/sysv/linux/alpha/osf_settimeofday.c
New file, defines settimeofday@GLIBC_2.0.
* sysdeps/unix/sysv/linux/alpha/settimeofday.c:
New file, defines settimeofday@@GLIBC_2.1.
* sysdeps/unix/clock_gettime.c: Delete file.
* sysdeps/mach/hurd/settimeofday.c: Rename to
sysdeps/mach/hurd/clock_settime.c and convert into an
implementation of clock_settime.
commit 819549fb3be40c00934de156b8ab993d84696319
Author: Zack Weinberg <zackw@panix.com>
Date: Fri Aug 16 15:03:16 2019 -0400
Use clock_settime to implement stime; withdraw stime.
Unconditionally, on all ports, use clock_settime to implement stime,
not settimeofday or a direct syscall. Then convert stime into a
compatibility symbol and remove its prototype from time.h.
* time/stime.c (stime): No longer a stub implementation.
Call __clock_settime. Demote to a compatibility symbol.
* sysdeps/unix/stime.c: Delete file.
* sysdeps/unix/sysv/linux/syscalls.list: Remove entry for stime.
* time/time.h: Remove prototype for stime.
commit 941672697c7e20605e5ba401dc5486fe42648e16
Author: Zack Weinberg <zackw@panix.com>
Date: Mon Aug 19 12:25:14 2019 -0400
Finish move of clock_* functions to libc.
In glibc 2.17, the functions clock_getcpuclockid, clock_getres,
clock_gettime, clock_nanosleep, and clock_settime were moved from
librt.so to libc.so, leaving compatibility stubs behind. Now that the
dynamic linker no longer insists on finding versioned symbols in the
same library that originally defined them, we do not need the stubs
anymore, and this means we don't need GLIBC_PRIVATE __-prefix aliases
for most of the functions anymore either. (clock_gettime still needs
one.) For ports added before 2.17, libc.so needs to provide two
symbol versions for each, the default at GLIBC_2.17 plus a compat
version matching what librt had.
While I'm at it, move the clock_*.c files and their tests from rt/ to
time/.
* rt/clock_getcpuclockid.c: Move to time/clock_getcpuclockid.c.
* rt/clock_getres.c: Move to time/clock_getres.c.
* rt/clock_gettime.c: Move to time/clock_gettime.c.
* rt/clock_nanosleep.c: Move to time/clock_nanosleep.c.
* rt/clock_settime.c: Move to time/clock_settime.c.
* rt/tst-clock.c: Move to time/tst-clock.c.
* rt/tst-clock2.c: Move to time/tst-clock2.c.
* rt/tst-clock_nanosleep.c: Move to time/tst-clock_nanosleep.c.
* rt/tst-cpuclock1.c: Move to time/tst-cpuclock1.c.
* rt/clock-compat.c: Delete file.
* time/clock_getcpuclockid.c
* time/clock_getres.c
* time/clock_gettime.c
* time/clock_nanosleep.c
* time/clock_settime.c
* sysdeps/posix/clock_getres.c
* sysdeps/unix/clock_gettime.c
* sysdeps/unix/clock_nanosleep.c
* sysdeps/unix/clock_settime.c
* sysdeps/unix/sysv/linux/clock_getcpuclockid.c
* sysdeps/unix/sysv/linux/clock_getres.c
* sysdeps/unix/sysv/linux/clock_gettime.c
* sysdeps/unix/sysv/linux/clock_nanosleep.c
* sysdeps/unix/sysv/linux/clock_settime.c: Define the function
defined by this file with default symbol version GLIBC_2_17,
and optionally a compatibility alias at symbol version GLIBC_2_2.
* include/time.h: Remove internal prototypes for clock_getres,
clock_nanosleep, and clock_getcpuclockid.
* sysdeps/unix/sysv/linux/clock_gettime.c: Prune includes.
Remove unused function realtime_gettime.
* rt/Makefile (clock-routines, routines): Remove variable.
(librt-routines): Remove clock-compat.
(tests): Remove tst-clock, tst-clock2, tst-clock_nanosleep,
and tst-cpuclock1.
* time/Makefile (routines): Add clock_getres, clock_gettime,
clock_settime, clock_getcpuclockid, and clock_nanosleep.
(tests): Add tst-clock, tst-clock2, tst-clock_nanosleep,
and tst-cpuclock1.
* rt/Versions (libc): Remove entire stanza.
(librt GLIBC_2.2): Remove all clock_* functions.
* time/Versions (libc GLIBC_2.2, libc GLIBC_2.17):
Add clock_getres, clock_gettime, clock_settime,
clock_getcpuclockid, and clock_nanosleep.
(libc GLIBC_PRIVATE): Add __clock_gettime.
* sysdeps/mach/hurd/i386/librt.abilist
* sysdeps/unix/sysv/linux/alpha/librt.abilist
* sysdeps/unix/sysv/linux/arm/librt.abilist
* sysdeps/unix/sysv/linux/hppa/librt.abilist
* sysdeps/unix/sysv/linux/i386/librt.abilist
* sysdeps/unix/sysv/linux/ia64/librt.abilist
* sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist
* sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist
* sysdeps/unix/sysv/linux/microblaze/librt.abilist
* sysdeps/unix/sysv/linux/mips/mips32/librt.abilist
* sysdeps/unix/sysv/linux/mips/mips64/librt.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/librt.abilist
* sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist
* sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist
* sysdeps/unix/sysv/linux/sh/librt.abilist
* sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist
* sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist
* sysdeps/unix/sysv/linux/x86_64/64/librt.abilist
* sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist:
Remove entries for clock_getres, clock_gettime, clock_settime,
clock_getcpuclockid, and clock_nanosleep.
* sysdeps/mach/hurd/i386/libc.abilist
* sysdeps/unix/sysv/linux/alpha/libc.abilist
* sysdeps/unix/sysv/linux/arm/libc.abilist
* sysdeps/unix/sysv/linux/hppa/libc.abilist
* sysdeps/unix/sysv/linux/i386/libc.abilist
* sysdeps/unix/sysv/linux/ia64/libc.abilist
* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
* sysdeps/unix/sysv/linux/sh/libc.abilist
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist:
Add another set of entries for clock_getres, clock_gettime,
clock_settime, clock_getcpuclockid, and clock_nanosleep at
whatever version GLIBC_2.2 maps to.
commit 34a36450131191a8ef7db02221062a376ac84339
Author: Zack Weinberg <zackw@panix.com>
Date: Fri Aug 16 20:38:22 2019 -0400
Change most internal uses of __gettimeofday to __clock_gettime.
Since gettimeofday will shortly be implemented in terms of
clock_gettime on all platforms, internal code should use clock_gettime
directly; in addition to removing a layer of indirection, this will
allow us to remove the PLT-bypass gunk for gettimeofday. (We can't
quite do that yet, but it'll be coming later in this patch series.)
In many cases, the changed code does fewer conversions.
The changed code always assumes __clock_gettime (CLOCK_REALTIME)
cannot fail. Most of the call sites were assuming gettimeofday could
not fail, but a few places were checking for errors. POSIX says
clock_gettime can only fail if the clock constant is invalid or
unsupported, and CLOCK_REALTIME is the one and only clock constant
that's required to be supported. For consistency I grepped the entire
source tree for any other places that checked for errors from
__clock_gettime (CLOCK_REALTIME), found one, and changed it too.
(For the record, POSIX also says gettimeofday can never fail.)
(It would be nice if we could declare that GNU systems will always
support CLOCK_MONOTONIC as well as CLOCK_REALTIME; there are several
places where we are using CLOCK_REALTIME where _MONOTONIC would be
more appropriate, and/or trying to use _MONOTONIC and then falling
back to _REALTIME. But the Hurd doesn't support CLOCK_MONOTONIC yet,
and it looks like adding it would involve substantial changes to
gnumach's internals and API. Oh well.)
A few Hurd-specific files were changed to use __host_get_time instead
of __clock_gettime, as this seemed tidier. We also assume this cannot
fail. Skimming the code in gnumach leads me to believe the only way
it could fail is if __mach_host_self also failed, and our
Hurd-specific code consistently assumes that can't happen, so I'm
going with that.
With the exception of support/support_test_main.c, test cases are not
modified, mainly because I didn't want to have to figure out which
test cases were testing gettimeofday specifically.
The definition of GETTIME in sysdeps/generic/memusage.h had a typo and
was not reading tv_sec at all. I fixed this. It appears nobody has been
generating malloc traces on a machine that doesn't have a superseding
definition.
There are a whole bunch of places where the code could be simplified
by factoring out timespec subtraction and/or comparison logic, but I
want to keep this patch as mechanical as possible.
* inet/deadline.c (__deadline_current_time)
* login/logout.c (logout)
* login/logwtmp.c (logwtmp)
* nis/nis_call.c (__nisfind_server)
* nptl/pthread_join_common.c (timedwait_tid)
* nptl/pthread_mutex_timedlock.c (__pthread_mutex_clocklock_common)
* nscd/nscd_helper.c (wait_on_socket, open_socket)
* resolv/gai_misc.c (handle_requests)
* resolv/gai_suspend.c (gai_suspend)
* resolv/res_send.c (evNowTime)
* sunrpc/auth_des.c (authdes_marshal, authdes_destroy)
* sunrpc/auth_unix.c (authunix_create, authunix_refresh)
* sunrpc/create_xid.c (_create_xid)
* sunrpc/svcauth_des.c (_svcauth_des)
* sysdeps/generic/memusage.h (GETTIME)
* sysdeps/mach/nanosleep.c (__libc_nanosleep)
* sysdeps/posix/tempname.c (RANDOM_BITS)
* sysdeps/pthread/aio_misc.c (handle_fildes_io)
* sysdeps/pthread/aio_suspend.c (aio_suspend):
Use __clock_gettime (CLOCK_REALTIME) instead of __gettimeofday.
Assume __clock_gettime (CLOCK_REALTIME) cannot fail.
Include time.h if necessary.
* sysdeps/posix/timespec_get.c (timespec_get):
Assume __clock_gettime (CLOCK_REALTIME) cannot fail.
* sysdeps/mach/hurd/getitimer.c (__getitimer)
* sysdeps/mach/hurd/setitimer.c (setitimer_locked)
* sysdeps/mach/hurd/times.c (__times):
Use __host_get_time instead of __gettimeofday.
Include mach.h if necessary.
Assume __host_get_time (__mach_host_self ()) cannot fail.
* sysdeps/mach/usleep.c (usleep): Remove unnecessary calls to
__gettimeofday.
* support/support_test_main.c (print_timestamp): Take a struct
timespec argument, not a struct timeval.
(signal_handler): Update to match.
Use clock_gettime (CLOCK_REALTIME) instead of gettimeofday.
Assume clock_gettime (CLOCK_REALTIME) cannot fail.
* sysdeps/generic/memusage.h (GETTIME): Correct typo causing
the seconds field of each timestamp to be ignored.
* sysdeps/unix/make-syscall.sh: Change an example in a comment
from referring to gettimeofday, to referring to sigaction.
commit fa487f626eb93791a4714f9d768fb1f1190d9403
Author: Zack Weinberg <zackw@panix.com>
Date: Mon Aug 19 14:18:08 2019 -0400
Linux/Alpha: don't use timeval32 system calls.
Linux/Alpha has two versions of several system call wrappers that take
or return data of type "struct timeval" (possibly nested inside a
larger structure). The GLIBC_2.0 version is a compat symbol that
calls __NR_osf_foo or __NR_old_foo and uses a struct timeval with a
32-bit tv_sec field. The GLIBC_2.1 version is used for current code,
calls __NR_foo, and uses a struct timeval with a 64-bit tv_sec field.
This patch changes all of the compat symbols of this type to be
wrappers around their GLIBC_2.1 counterparts; the compatibility system
calls will no longer be used. It serves as a proposal for part of how
we do the transition to 64-bit time_t on systems that currently use
32-bit time_t:
* The patched glibc will NOT use system calls that involve 32-bit
time_t to implement its compatibility symbols. This will make both
our lives and the kernel maintainers' lives easier. The primary
argument I've seen against it is that the kernel could warn about
uses of the old system calls, helping people find old binaries that
need to be recompiled. I think there are several other ways we
could accomplish this, e.g. scripts to scan the filesystem for
binaries with references to the old symbol versions, or issuing
diagnostics ourselves.
* The compat symbols do NOT report failure after the Y2038 deadline.
An earlier revision of this patch had them return -1 and set errno
to EOVERFLOW, but Adhemerval pointed out that many of them have
already performed side effects at the point where we discover the
overflow, so that would break more than it fixes. Also, we don't
want people to be _checking_ for EOVERFLOW from these functions; we
want them to recompile with 64-bit time_t. So it's not actually
useful for them to report failure to the calling code.
* What they do do, when they encounter overflow, is saturate the
overflowed "struct timeval"(s): tv_sec is set to INT32_MAX and
tv_nsec is set to 999999. That means time stops advancing for
programs with 32-bit time_t when they reach the deadline. That's
obviously going to break stuff, but I think wrapping around is
probably going to break _more_ stuff. I'd be interested to hear
arguments against, if anyone has one.
The new header file tv32-compat.h is currently Alpha-specific but I
mean for it to be reused to aid in writing wrappers for all affected
architectures. I only put it in sysdeps/unix/sysv/linux/alpha for now
because I haven't checked whether the various "foo32" structures it
defines agree with the ABI for ports other than Linux/Alpha.
* sysdeps/unix/sysv/linux/alpha/tv32-compat.h: New file declaring
types and helper functions for 32/64-bit time_t conversion.
* sysdeps/unix/sysv/linux/syscalls.list: Remove entry for adjtimex.
* sysdeps/unix/sysv/linux/adjtimex.c: New file, allow overriding
the version at which adjtimex and ntp_adjtime are defined.
* sysdeps/unix/sysv/linux/adjtime.c: Allow overriding the version
at which adjtime is defined.
(MOD_OFFSET, TIMEVAL, TIMEX, ADJTIME, ADJTIMEX, NO_LOCAL_ADJTIME)
(LINKAGE): Remove macros that are no longer needed.
* sysdeps/unix/sysv/linux/Makefile
(sysdep_routines) [subdir=misc]: Add adjtimex.
* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove entries for
osf_gettimeofday, osf_settimeofday, osf_getitimer, osf_setitimer,
osf_utimes, osf_getrusage, and osf_wait4.
Change entries for gettimeofday, settimeofday, getitimer,
setitimer, utimes, getrusage, and wait4 to use argument type codes.
* sysdeps/unix/sysv/linux/alpha/adjtime.c: Replace contents;
use the generic Linux implementation but override the version of
adjtime.
* sysdeps/unix/sysv/linux/alpha/adjtimex.c: New file, use the
generic Linux implementation but override the versions of
adjtimex and ntp_adjtime.
* sysdeps/unix/sysv/linux/alpha/osf_adjtime.c
* sysdeps/unix/sysv/linux/alpha/osf_getitimer.c
* sysdeps/unix/sysv/linux/alpha/osf_getrusage.c
* sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c
* sysdeps/unix/sysv/linux/alpha/osf_setitimer.c
* sysdeps/unix/sysv/linux/alpha/osf_settimeofday.c
* sysdeps/unix/sysv/linux/alpha/osf_utimes.c
* sysdeps/unix/sysv/linux/alpha/osf_wait4.c:
New files defining compatibility symbols formerly defined by
alpha/syscalls.list and alpha/adjtime.c.
* sysdeps/unix/sysv/linux/alpha/Makefile
(sysdep_routines) [subdir=misc]: Add osf_adjtime.
commit 35ffd20dbd76d3cb6b478c7a69bb40d8c827ed81
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Aug 28 12:01:48 2019 +0200
misc: Use allocate_once in getmntent
Both the buffer and struct mntent are now allocated on the heap.
This results in a slight reduction of RSS usage.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
commit ffced383cd7e092a1c6e50ca50f692d2fe2a7dbe
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Aug 28 12:01:14 2019 +0200
nptl: Move pthread_attr_setdetachstate implementation into libc
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
commit 61d3db428176d9d0822e4e680305fe34285edff2
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Aug 28 11:59:45 2019 +0200
login: pututxline could fail to overwrite existing entries [BZ #24902]
The internal_getut_r function updates the file_offset variable and
therefore must always update last_entry as well.
Previously, if pututxline could not upgrade the read lock to a
write lock, internal_getut_r would update file_offset only,
without updating last_entry, and a subsequent call would not
overwrite the existing utmpx entry at file_offset, instead
creating a new entry. This has been observed to cause unbounded
file growth in high-load situations.
This commit removes the buffer argument to internal_getut_r and
updates the last_entry variable directly, along with file_offset.
Initially reported and fixed by OndÅ?ej LysonÄ?k.
Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
commit 3a9d025fdd56f595ef9cb142486da4ee1b75281f
Author: Stefan Liebler <stli@linux.ibm.com>
Date: Wed Aug 28 10:29:24 2019 +0200
Fix posix/tst-regex by using a dedicated input-file.
The recent commit e6855a3bdfe147c52b29b5e7d70a95a8aa22ece0
changed the encoding of ChangeLog.old/ChangeLog.8 from ISO-8859 to UTF-8.
Unfortunately the test posix/tst-regex assumes the former encoding.
Furthermore Francesco Potortì is now written with 'ì' instead of 'i`'
which would lead to two further matches in the first call to test_expr.
This patch just copies the former ChangeLog.8 file to tst-regex.input
and adjusts the test in order to use this new input file.
ChangeLog:
* posix/tst-regex.c (do_test): Use tst-regex.input as input file.
* posix/tst-regex.input: New file.
commit 1bced8cadc82077f0201801239e89eb24b68e9aa
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Fri Aug 23 14:14:29 2019 -0700
Don't put non-ASCII into installed headers
Move non-ASCII contributor names from installed headers
into contrib.texi when possible, and when it's not (the
copyright notice in sysdeps/unix/sysv/linux/mips/sys/user.h)
go back to ASCIIfied names. Problem reported by Joseph Myers in:
https://www.sourceware.org/ml/libc-alpha/2019-08/msg00646.html
commit e6855a3bdfe147c52b29b5e7d70a95a8aa22ece0
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Fri Aug 23 13:07:38 2019 -0700
Fix spellings of contributor names in comments and doc
commit edd8d70b91e1ccef549a7c668499596cc4d56ad1
Author: Mihailo Stojanovic <mihailo.stojanovic@rt-rk.com>
Date: Fri Aug 23 16:47:27 2019 +0000
[MIPS] Raise highest supported EI_ABIVERSION value [BZ #24916]
This bumps the highest valid EI_ABIVERSION value to ABSOLUTE ABI.
New testcase loads the symbol from the GOT with the "lb" instruction
so that the EI_ABIVERSION header field of the shared object is set
to ABSOLUTE (it doesn't actually check the value of the symbol), and
makes sure that the main executable is executed without "ABI version
invalid" error.
Tested for all three ABIs (o32, n32, n64) using both static linker which
handles undefined weak symbols correctly [1] (and sets the EI_ABIVERSION
of the test module) and the one that doesn't (EI_ABIVERSION left as 0).
[1] https://sourceware.org/ml/binutils/2018-07/msg00268.html
[BZ #24916]
* sysdeps/mips/Makefile [$(subdir) = elf] (tests): Add
tst-undefined-weak.
[$(subdir) = elf] (modules-names): Add tst-undefined-weak-lib.
[$(subdir) = elf] ($(objpfx)tst-undefined-weak): Add dependency.
* sysdeps/mips/tst-undefined-weak-lib.S: New file.
* sysdeps/mips/tst-undefined-weak.c: Likewise.
* sysdeps/unix/sysv/linux/mips/ldsodefs.h (VALID_ELF_ABIVERSION):
Increment highest valid ABIVERSION value.
commit 33bc9efd91de1b14354291fc8ebd5bce96379f12
Author: Dragan Mladjenovic <dmladjenovic@wavecomp.com>
Date: Fri Aug 23 16:38:04 2019 +0000
mips: Force RWX stack for hard-float builds that can run on pre-4.8 kernels
Linux/Mips kernels prior to 4.8 could potentially crash the user
process when doing FPU emulation while running on non-executable
user stack.
Currently, gcc doesn't emit .note.GNU-stack for mips, but that will
change in the future. To ensure that glibc can be used with such
future gcc, without silently resulting in binaries that might crash
in runtime, this patch forces RWX stack for all built objects if
configured to run against minimum kernel version less than 4.8.
* sysdeps/unix/sysv/linux/mips/Makefile
(test-xfail-check-execstack):
Move under mips-has-gnustack != yes.
(CFLAGS-.o*, ASFLAGS-.o*): New rules.
Apply -Wa,-execstack if mips-force-execstack == yes.
* sysdeps/unix/sysv/linux/mips/configure: Regenerated.
* sysdeps/unix/sysv/linux/mips/configure.ac
(mips-force-execstack): New var.
Set to yes for hard-float builds with minimum_kernel < 4.8.0
or minimum_kernel not set at all.
(mips-has-gnustack): New var.
Use value of libc_cv_as_noexecstack
if mips-force-execstack != yes, otherwise set to no.
commit 08d57105bbcbb4f950cd7cdf881a50977e44b8c6
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Thu Aug 1 18:01:22 2019 +0000
linux: Make profil_counter a compat_symbol (BZ#17726)
As indicated by Joseph's comment on BZ#17726, this symbol is most
likely a historical ABI accident. This patch make it on both arm
and sparc ABIs a compat_symbol.
Checked against a build arm-linux-gnueabihf, sparcv9-linux-gnu, adn
sparc64-linux-gnu to see if the symbol is still present.
* gmon/Versions (libc) [GLIBC_2.31]: New entry.
* sysdeps/unix/sysv/linux/arm/profil-counter.h (profil_counter):
Make a compat_symbol.
* sysdeps/unix/sysv/linux/sparc/profil-counter.h
(__profil_counter_global): Likewise.
commit a43565ac447b1608ae2626f5012673560bb623ab
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Mon Dec 17 16:44:14 2018 -0200
Refactor sigcontextinfo.h
This patch refactor sigcontextinfo.h header to use SA_SIGINFO as default
for both gmon and debug implementations. This allows simplify
profil-counter.h on Linux to use a single implementation and remove the
requirements for newer ports to redefine __sigaction/sigaction to use
SA_SIGINFO.
The GET_PC macro is also replaced with a function sigcontext_get_pc that
returns an uintptr_t instead of a void pointer. It allows easier convertion
to integer on ILP32 architecture, such as x32, without the need to suppress
compiler warnings.
The patch also requires some refactor of register-dump.h file for some
architectures (to reflect it is now called from a sa_sigaction instead of
sa_handler signal context).
- Alpha, i386, and s390 are straighfoward to take in consideration the
new argument type.
- ia64 takes in consideration the kernel pass a struct sigcontextt
as third argument for sa_sigaction.
- sparc take in consideration the kernel pass a pt_regs struct
as third argument for sa_sigaction.
- m68k dummy function is removed and the FP state is dumped on
register_dump itself.
- For SH the register-dump.h file is consolidate on a common implementation
and the floating-point state is checked based on ownedfp field.
The register_dump does not change its output format in any affected
architecture.
I checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu,
arm-linux-gnueabihf, sparcv9-linux-gnu, sparc64-linux-gnu, powerpc-linux-gnu,
powerpc64-linux-gnu, and powerpc64le-linux-gnu.
I also checked the libSegFault.so through catchsegv on alpha-linux-gnu,
m68k-linux-gnu and sh4-linux-gnu to confirm the output has not changed.
Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer <fweimer@redhat.com>
* debug/segfault.c (install_handler): Use SA_SIGINFO if defined.
* sysdeps/generic/profil-counter.h (__profil_counter): Cast to
uintptr_t.
* sysdeps/generic/sigcontextinfo.h (GET_PC): Rename to
sigcontext_get_pc and return aligned cast to uintptr_t.
* sysdeps/mach/hurd/i386/sigcontextinfo.h (GET_PC): Likewise.
* sysdeps/posix/profil.c (profil_count): Change PC argument to
uintptr_t.
(__profil): Use SA_SIGINFO.
* sysdeps/posix/sprofil.c (profil_count): Change PCP argument to
uintptr_t.
(__sprofil): Use SA_SIGINFO.
* sysdeps/unix/sysv/linux/profil-counter.h: New file.
* sysdeps/unix/sysv/linux/aarch64/profil-counter.h: Remove file.
* sysdeps/unix/sysv/linux/csky/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/hppa/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/i386/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/microblaze/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/mips/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/nios2/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/riscv/profil-counter.h: Likewise.
* sysdeps/sysv/linux/s390/s390-32/profil-counter.h: Likewise.
* sysdeps/sysv/linux/s390/s390-64/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/sh/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/arm/profil-counter.h (__profil_counter):
Assume SA_SIGINFO and use sigcontext_get_pc instead of GET_PC.
* sysdeps/unix/sysv/linux/sparc/profil-counter.h: New file.
* sysdeps/unix/sysv/linux/sparc/sparc64/profil-counter.h: Remove file.
* sysdeps/unix/sysv/linux/sparc/sparc32/profil-counter.h: Likewise.
* sysdpes/unix/sysv/linux/aarch64/sigcontextinfo.h (SIGCONTEXT,
GET_PC, __sigaction, sigaction): Remove defines.
(sigcontext_get_pc): New function.
* sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/arm/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/csky/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/hppa/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/i386/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/mips/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/s390/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/microblaze/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/sh/sigcontextinfo.h: Likewise.
* sysdeps/sysv/linux/sparc/sparc32/sigcontextinfo.h: Likewise.
* sysdeps/sysv/linux/sparc/sparc64/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/alpha/register-dump.h (register_dump):
Handle CTX argument as ucontext_t.
* sysdeps/unix/sysv/linux/i386/register-dump.h: Likewise.
Likewise.
* sysdeps/unix/sysv/linux/m68k/register-dump.h: Likewise.
* sysdeps/sysv/linux/s390/s390-32/register-dump.h: Likewise.
* sysdeps/sysv/linux/s390/s390-64/register-dump.h: Likewise.
* sysdeps/unix/sysv/linux/sh/register-dump.h: New file.
* sysdeps/unix/sysv/linux/sh/sh4/register-dump.h: Remove File.
* sysdeps/unix/sysv/linux/sh/sh3/register-dump.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/register-dump.h: Likewise.
* sysdeps/unix/sysv/linux/Makefile (tests-internal): Add
tst-sigcontextinfo-get_pc.
* sysdeps/unix/sysv/linux/tst-sigcontextinfo-get_pc.c: New file.
(CFLAGS-tst-sigcontextinfo-get_pc.c): New rule.
commit 624c109b2a273dbfd6f87795a64ac1f6c5d89f10
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Aug 14 15:05:50 2019 -0300
Add RTLD_SINGLE_THREAD_P on generic single-thread.h
* sysdeps/generic/single-thread.h (RTLD_SINGLE_THREAD_P): Add
definition.
commit c0fd3244e71db39cef1e2d1d8ba12bb8b7375ce4
Author: Rafal Luzynski <digitalfreak@lingonborough.com>
Date: Thu Aug 22 23:50:04 2019 +0200
Chinese locales: Set first_weekday to 2 (bug 24682).
The first day of the week in China (Mainland) should be Monday according
to the national standard GB/T 7408-2005. References:
* https://www.doc88.com/p-1166696540287.html
* https://unicode-org.atlassian.net/browse/CLDR-11510
[BZ #24682]
* localedata/locales/bo_CN (first_weekday): Add, set to 2 (Monday).
* localedata/locales/ug_CN (first_weekday): Likewise.
* localedata/locales/zh_CN (first_weekday): Likewise.
commit c8c8160ceebb6dc1f95d626ab32c43126c4290fd
Author: Gustavo Romero <gromero@linux.vnet.ibm.com>
Date: Mon Aug 12 23:40:30 2019 -0400
powerpc: Fix typos and field name in comments
Fix a couple of typos and v_regs field name in mcontext_t.
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Fix typos and
field name in mcontext_t struct.
Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
commit 42f527c89dabfee80c674ffe6a498a665c6d8281
Author: Joseph Myers <joseph@codesourcery.com>
Date: Thu Aug 22 12:56:49 2019 +0000
Mark IDN tests unsupported with libidn2 before 2.0.5.
When using a system (e.g. Ubuntu 18.04) with libidn2 2.0.4 or earlier,
test results include:
FAIL: resolv/tst-resolv-ai_idn
FAIL: resolv/tst-resolv-ai_idn-latin1
It was previously stated
<https://sourceware.org/ml/libc-alpha/2018-05/msg00771.html> that "It
should fail to indicate you have bugs in your system libidn.".
However, the glibc testsuite should be indicating whether there are
bugs in glibc, not whether there are bugs in other system pieces - so
unless you consider it a glibc bug that it fails to work around the
libidn issues, these FAILs are not helpful. And as a general
principle, it's best for the expected glibc test results to be clean,
with Bugzilla used to track known bugs in glibc itself, rather than
people needing to know about the expected FAILs to tell if there are
problems with their glibc build. So, while there is an argument that
install.texi (not just the old NEWS entries for 2.28) should explain
the use of libidn2 and that 2.0.5 or later is recommended, test FAILs
are not the right way to indicate the presence of an old libidn2
version.
This patch accordingly makes those tests return UNSUPPORTED for older
libidn2 versions, just as they do when libidn2 isn't present at all.
As implied by that past discussion, it's possible this could result in
UNSUPPORTED for systems with older versions but whatever required
fixes backported so the tests previously passed, if there are any such
systems.
Tested for x86_64 on Ubuntu 18.04, including verifying that putting an
earlier version in place of 2.0.5 results in the tests FAILing whereas
using 2.0.5 as in the patch results in UNSUPPORTED. Florian reports
that the tests still run on Fedora 30, with libidn 2.2.0.
* resolv/tst-resolv-ai_idn-latin1.c (do_test): Mark test
unsupported with libidn2 before 2.0.5.
* resolv/tst-resolv-ai_idn.c (do_test): Likewise.
commit c737ef0d647fa5a3a290d2b77fe25fa8ba5b9cb9
Author: Joseph Myers <joseph@codesourcery.com>
Date: Thu Aug 22 12:38:40 2019 +0000
Document strftime %Ob and %OB as C2X features.
C2X standardizes strftime %Ob and %OB support. This patch updates the
glibc manual to say these are C2X features, while noting that the
details of what is the alternative form of a month name are not
specified in C2X.
Note: C2X seems unclear to me about whether %h being equivalent to %b
means %Oh is thereby allowed and equivalent to %Ob; I've asked WG14.
Tested with "make info" and "make pdf".
* manual/time.texi (strftime): Document %Ob and %OB as C2X
features.
commit f615e3fced100914b1ee4d690f380deb69a4be70
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Wed Aug 21 09:29:09 2019 -0700
Remove dead regex code
* posix/regex_internal.c (re_node_set_insert):
Remove unnecessary assignment. Reported by Tim Rühsen in:
https://lists.gnu.org/r/bug-gnulib/2019-08/msg00026.html
commit 8a80ee5e2bab17a1f8e1e78fab5c33ac7efa8b29
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Wed Aug 21 09:25:22 2019 -0700
Fix bad pointer / leak in regex code
This was found by Coverity (CID 1484201). [BZ#24844]
* posix/regex_internal.c (create_cd_newstate): Fix use of bad
pointer and/or memory leak when storage is exhausted.