This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[glibc] Deleted branch azanella/y2038-preliminaries


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>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]