This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
settimeofday breakage
- From: J William Piggott <elseifthen at gmx dot com>
- To: libc-alpha at sourceware dot org
- Date: Tue, 11 Feb 2020 10:33:45 -0500 (EST)
- Subject: settimeofday breakage
> NEWS Version 2.31
> Deprecated and removed features, and other changes affecting compatibility:
>
> However, to reduce the odds of this offset being set by accident,
> settimeofday can no longer be used to set the time and the offset
> simultaneously. If both of its two arguments are non-null, the call
> will fail (setting errno to EINVAL).
I do not know who wrote this and my comment is not personal, but I
question the stated justification for this breakage.
The behavior of this function when called with two args has been in
place for nearly 30 years; I have never see a report of the kernel time
zone being set by 'accident'.
Then there is this recent comment:
> Date: Thu, 6 Feb 2020 21:41:06 +0000
> From: Joseph Myers <joseph@codesourcery.com>
>
> On Wed, 5 Feb 2020, Adhemerval Zanella wrote:
>
> > Once POSIX does remove the symbol, we can remove its definition from
> > default visibility
>
> I don't see that being appropriate for a very long time.
>
That was regarding gettimeofday, but should apply equally to
settimeofday.
I don't see how these two positions are reconciled:
* get/settimeofday will be supported for the foreseeable future
* settimeofday will be intentionally broken to prevent an 'accident'
when using the 28 year old expected behavior.
Below is a table that I wrote for hwclock(8) to aid source readers in
understanding the block of code that follows it:
*
* +-------------------------------------------------------------------+
* | settimeofday(tv, tz) |
* |-------------------------------------------------------------------|
* | Arguments | System Time | PCIL | | warp_clock |
* | tv | tz | set | warped | set | firsttime | locked |
* |---------|---------|---------------|------|-----------|------------|
* | pointer | NULL | yes | no | no | 1 | no |
* | pointer | pointer | yes | no | no | 0 | yes |
* | NULL | ptr2utc | no | no | no | 0 | yes |
* | NULL | pointer | no | yes | yes | 0 | yes |
* +-------------------------------------------------------------------+
* ptr2utc: tz.tz_minuteswest is zero (UTC).
* PCIL: persistent_clock_is_local, sets the "11 minute mode" timescale.
* firsttime: locks the warp_clock function (initialized to 1 at boot).
*
Note the unique behavior when called with two arguments which cannot be
easily reproduced.
What I used to accomplish in hwclock(8) with one call, now takes *three*!