public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] Deleted branch azanella/y2038-preliminaries
@ 2019-10-31 14:12 Adhemerval Zanella
  0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella @ 2019-10-31 14:12 UTC (permalink / raw)
  To: glibc-cvs

The branch 'azanella/y2038-preliminaries' was deleted.
It previously pointed to:

 8373719... Revise the documentation of simple calendar time.

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
-------------------------------------------------------------------

  8373719... Revise the documentation of simple calendar time.
  8860ddf... Make second argument of gettimeofday as 'void *'
  ec2eecf... Use clock_gettime to implement gettimeofday.
  8390b0f... Use clock_gettime to implement timespec_get.
  68dfb40... Consolidate and deprecate ftime
  ec97ba2... Change most internal uses of time to __clock_gettime.
  bfc9f61... Use clock_gettime to implement time.
  6203fd6... Use clock_settime to implement settimeofday.
  8fba8f1... Use clock_settime to implement stime; withdraw stime.
  16079f4... Change most internal uses of __gettimeofday to __clock_gett
  6ab2b36... Linux/Alpha: don't use timeval32 system calls.

commit 8373719be7abcc5bf8618a580982063e1fa0eeac
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."

commit 8860ddfdac37caa8a781c93c0530b550e16705c7
Author: Zack Weinberg <zackw@panix.com>
Date:   Mon Aug 19 13:51:25 2019 -0400

    Make second argument of gettimeofday as 'void *'
    
    Also make the public prototype of gettimeofday declare its second
    argument with type "void *" unconditionally, consistent with POSIX.
    
    It is also consistent with POSIX.
    
    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: Adhemerval Zanella <adhemerval.zanella@linaro.org>

commit ec2eecfcc064d6ea55142836f3ff9bb811de77ff
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Oct 24 19:19:33 2019 +0000

    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>

commit 8390b0ff848ee65c47fdd49cf818a746defead99
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.
    
    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.
    
    Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
    powerpc64-linux-gnu, powerpc-linux-gnu, and aarch64-linux-gnu.

commit 68dfb406a9d4a244358e7e6bd6d752f19f8a703a
Author: Zack Weinberg <zackw@panix.com>
Date:   Wed Sep 4 16:51:23 2019 +0000

    Consolidate and deprecate 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 deprecated.
    
    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.
    
    Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
    powerpc64-linux-gnu, and powerpc-linux-gnu.
    
    Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

commit ec97ba21a650bab7cd22c7b0da351974ebdc5f1b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Oct 24 21:01:40 2019 +0000

    Change most internal uses of time to __clock_gettime.
    
    As for gettimeofday, time will be implemented based on clock_gettime
    on all platforms and 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.
    
    The changed code always assumes __clock_gettime (CLOCK_REALTIME)
    or __clock_gettime (CLOCK_REALTIME_COURSE) (for Linux case) cannot
    fail, using the same rationale for gettimeofday change.  And internal
    helper was added (time_now).
    
    Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
    powerpc64-linux-gnu, and powerpc-linux-gnu.

commit bfc9f6179a0fdb070428010b0c5f022cca4a8c9d
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Oct 24 17:52:30 2019 +0000

    Use clock_gettime to implement time.
    
    Change the default implementation of time to call clock_gettime,
    to align with new Linux ports that are expected to only implement
    __NR_clock_gettime.  Arch-specific implementation that either call
    the time vDSO or route to gettimeofday vDSO are not removed.
    
    Also for Linux, CLOCK_REALTIME_COARSE is used instead of generic
    CLOCK_REALTIME clockid.  This takes less CPU time and its behavior
    better matches what the current glibc does.
    
    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>

commit 6203fd6ed5c8ed242cf7d13af7722f056207eefb
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 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>

commit 8fba8f190900f725492e32376c4f70497a80dc6b
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.
    
    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>

commit 16079f436d4d29c74dfefd1862e52b02f3823918
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.
    
    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>

commit 6ab2b361543488a0086345e28b3e199cae84a79f
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.
    
    Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [glibc] Deleted branch azanella/y2038-preliminaries
@ 2019-10-25 11:25 Adhemerval Zanella
  0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella @ 2019-10-25 11:25 UTC (permalink / raw)
  To: glibc-cvs

The branch 'azanella/y2038-preliminaries' was deleted.
It previously pointed to:

 4589d9d... Revise the documentation of simple calendar time.

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
-------------------------------------------------------------------

  4589d9d... Revise the documentation of simple calendar time.
  3a123f1... Make second argument of gettimeofday as 'void *'
  b30d257... Use clock_gettime to implement gettimeofday.
  6274fd5... Use clock_gettime to implement timespec_get.
  bf49c54... Consolidate and deprecate ftime
  95062eb... Use clock_gettime to implement time.
  6870041... Use clock_settime to implement settimeofday.
  310c0d5... Use clock_settime to implement stime; withdraw stime.
  7c21cd0... Change most internal uses of __gettimeofday to __clock_gett
  928c86c... Linux/Alpha: don't use timeval32 system calls.

commit 4589d9ddc5298f2897d11830fed2bfe38ecda7cc
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 3a123f1a0681dcf7f7f2f5f4f3cc9aeefb8adc3f
Author: Zack Weinberg <zackw@panix.com>
Date:   Mon Aug 19 13:51:25 2019 -0400

    Make second argument of gettimeofday as 'void *'
    
    Also make the public prototype of gettimeofday declare its second
    argument with type "void *" unconditionally, consistent with POSIX.
    
    It is also consistent with POSIX.
    
    	* time/sys/time.h (__timezone_ptr_t): Delete.
    	(gettimeofday): Always declare second argument with type "void *".
    	(settimeofday): Improve commentary.
    
    	* include/sys/time.h (__gettimeofday)
    	* sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
    	* sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
    	* sysdeps/unix/sysv/linux/x86/gettimeofday.c
    	* time/gettimeofday.c (gettimeofday): Declare second argument with
    	type "void *".

commit b30d257ea8f557bdadca09f5b112538e7b807eb9
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Sep 4 19:56:10 2019 +0000

    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.
    
    	* 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 libc_hidden_proto for __gettimeofday,
    	and for 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/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/gettimeofday.c
    	* sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
    	* sysdeps/unix/sysv/linux/x86/gettimeofday.c: Remove internal
    	alias and simplify implementation.
    
    	* sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list: Remove
    	gettimeofday.
    
    	* sysdeps/unix/clock_gettime.c
    	* sysdeps/unix/sysv/linux/gettimeofday.c
    	* sysdeps/unix/sysv/linux/i386/gettimeofday.c
    	* sysdeps/posix/gettimeofday.c: Delete file.
    
    	* sysdeps/mach/gettimeofday.c: Rename to
    	sysdeps/mach/clock_gettime.c and convert into an
    	implementation of clock_gettime.

commit 6274fd520b91d687793c3589a61c287350595e4a
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.
    
    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.
    
    	* 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 bf49c54dab20abe5f0a5efc73f934e475af10233
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Sep 4 16:51:23 2019 +0000

    Consolidate and deprecate 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 deprecated.
    
    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.
    
    	* sysdeps/unix/bsd/ftime.c
    	* sysdeps/unix/sysv/linux/ftime.c: Remove file.
    
    	* time/ftime.c (ftime): 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/sys/timeb.h (ftime): Add nonnull and deprecate attribute.
    	* time/tst-ftime.c (do_test): Handle ftime deprecation.

commit 95062ebe070a05a9afd2bfa76f13af47128dec15
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Sep 4 18:12:24 2019 +0000

    Use clock_gettime to implement time.
    
    Consolidate generic time implementation to use clock_gettime. Linux
    ports that still use either time or gettime syscall or vDSO are not
    changed.
    
    	* time/time.c (time): No longer a stub implementation.
    	Call __clock_gettime.
    
    	* sysdeps/unix/sysv/linux/powerpc/time.c: Use new generic
    	implementation.
    
    	* sysdeps/posix/time.c
    	* sysdeps/unix/sysv/linux/sparc/sparc64/time.c
    	* sysdeps/unix/sysv/linux/time.c: Remove file.

commit 68700415e7c8fac44c730dc315f3832bf4f6c041
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 310c0d50df06d41d2605288deaec31c578bf1780
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 7c21cd098fcc767f7cce4f644def3896fabe3fb4
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 928c86cae76f23add74e44c5540cc73f57cf4412
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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-31 14:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-31 14:12 [glibc] Deleted branch azanella/y2038-preliminaries Adhemerval Zanella
  -- strict thread matches above, loose matches on Subject: below --
2019-10-25 11:25 Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).