mbox series

[00/12] Y2038 preparation: use clock_[gs]ettime to implement the other time-getting and -setting functions

Message ID 20190820132152.24100-1-zackw@panix.com
Headers show
Series Y2038 preparation: use clock_[gs]ettime to implement the other time-getting and -setting functions | expand

Message

Zack Weinberg Aug. 20, 2019, 1:21 p.m. UTC
This patchset aims to make the Y2038 project a little easier by
implementing the other time-getting and time-setting functions
(time, ftime, stime, gettimeofday, and settimeofday) in terms of
clock_gettime and clock_settime.  Internal uses of (__)gettimeofday
are also all changed to __clock_gettime.  Internal uses of time() are
mostly left alone, since time() is easier and clearer when you don’t
care about sub-second resolution and don’t need a struct timespec for
some other reason.

As a consequence, gettimeofday will no longer report crude timezone
information under any circumstances.  If its ‘tzp’ argument is not
NULL, it will write zeroes to both fields of the ‘struct timezone’,
even if the gettimeofday system call exists and would have produced
different output.  Similarly, ftime will always write zeroes to the
timezone and dstflag fields of ‘struct timeb’.  Joseph Myers raised an
objection to this change; I rebutted the objection, and he did not
reply; I do not think either of us will persuade the other, so I’m
formally asking for a third maintainer to make a decision.

settimeofday _will_ still call the settimeofday system call and pass
down a non-null ‘tzp’ argument if it receives one, but, if _both_ of
its arguments are non-null, it will fail and set errno to EINVAL.
Also, its invocation of a settimeofday system call goes through an
internal sysdep function called __settimezone.  On the Hurd this is an
unconditional ENOSYS stub, and on Linux it’s an ENOSYS stub when
__NR_settimeofday is not defined.

Relatedly, there is a macro-based hack to issue warnings when
gettimeofday is called with a ‘tzp’ argument that is not a
compile-time null pointer.  I think this is probably a better option
at this stage than various suggested alternatives (e.g. renaming the
fields of ‘struct timezone’, or removing it from sys/time.h
altogether) because the remaining valid uses of settimeofday with
non-null ‘tzp’ should still be able to use struct timezone.  The hack
is in a separate patch because, well, it’s a hack and I’m hoping
someone has a better implementation idea.  (I tried an inline function
instead of a macro, but it threw false positives all over the place on
‘gettimeofday (&tv, 0)’...)

This patchset also includes an overhaul of Linux/Alpha’s GLIBC_2.0
compatibility symbols for several system calls that consume or produce
struct timeval.  It appears that early releases of glibc and/or Linux
for Alpha attempted to achieve some degree of binary compatibility
with OSF/1, but this came at the expense of using 32-bit time_t inside
struct timeval.  Up till now, we were invoking compatibility system
calls from the compatibility symbols.  This patch changes them to wrap
the 64-bit implementations and convert between 32-bit and 64-bit
struct timeval in user space.  If a 64-bit tv_sec value returned by
the kernel is found to be greater than INT32_MAX, the caller will
receive a saturated 32-bit struct timeval, { INT32_MAX, 0 }, and the
function will return -1 with errno set to EOVERFLOW.  Because many of
these calls are assumed unable to fail, we make sure to write all the
fields of any output data structure even when this happens.  I did
this partially because it simplified conversion of gettimeofday to
call clock_gettime, and partially as a worked example of the semantics
that I think are probably best for the 32-bit time_t compatibility
symbols we’re going to have to add for many other architectures.
Comments on these semantics are requested.

This patchset also includes a partial revision of manual/time.texi.
clock_gettime and clock_settime are now documented, and the
obsolescent status of stime, settimeofday, and gettimeofday is
clearer.  I only documented CLOCK_REALTIME and CLOCK_MONOTONIC,
because most of the other clock constants are either extremely
Linux-specific or they have to do with measuring CPU time, and I
didn’t touch the measuring-CPU-time part of time.texi.  (That part
also deserves a rewrite, but I don’t know enough about the topic and
this patchset is already long enough.)

Finally, there is a case for demoting ftime and stime to compatibility
symbols and removing their public prototypes (for ftime, we would stop
installing <sys/timeb.h> altogether).  I tried to investigate how much
this might break, using codesearch.debian.net, but the identifiers
‘ftime’ and ‘stime’ turn out to be heavily used for unrelated
purposes, so I didn’t get anywhere.

Zack Weinberg (12):
  Remove implementations of clock_[gs]ettime using [gs]ettimeofday.
  Change most internal uses of __gettimeofday to __clock_gettime.
  Don’t use the argument to time.
  Use clock_settime to implement stime.
  Use clock_settime to implement settimeofday.
  Use clock_gettime to implement time.
  Use clock_gettime to implement ftime.
  Use clock_gettime to implement gettimeofday.
  Finish move of clock_* functions to libc.
  Warn when gettimeofday is called with non-null tzp argument.
  Linux/Alpha: don’t use timeval32 system calls.
  Revise the documentation of ‘simple calendar time’.

 NEWS                                          |   53 +-
 include/sys/time.h                            |    7 +-
 include/time.h                                |    4 +-
 inet/deadline.c                               |    9 +-
 login/logout.c                                |    9 +-
 login/logwtmp.c                               |    7 +-
 manual/filesys.texi                           |    2 +-
 manual/llio.texi                              |   10 +-
 manual/threads.texi                           |    2 +-
 manual/time.texi                              | 1062 +++++++++--------
 misc/syslog.c                                 |    2 +-
 nis/nis_call.c                                |    4 +-
 nptl/pthread_join_common.c                    |    7 +-
 nptl/pthread_mutex_timedlock.c                |    7 +-
 nscd/nscd_helper.c                            |   24 +-
 resolv/gai_misc.c                             |    6 +-
 resolv/gai_suspend.c                          |    6 +-
 resolv/res_send.c                             |    6 +-
 rt/Makefile                                   |   15 +-
 rt/Versions                                   |    7 +-
 rt/clock-compat.c                             |   63 -
 string/strfry.c                               |    2 +-
 sunrpc/auth_des.c                             |   19 +-
 sunrpc/auth_unix.c                            |    9 +-
 sunrpc/create_xid.c                           |    6 +-
 sunrpc/svcauth_des.c                          |    7 +-
 support/support_test_main.c                   |   14 +-
 sysdeps/generic/memusage.h                    |   16 +-
 .../mach/{gettimeofday.c => clock_gettime.c}  |   25 +-
 .../hurd/{settimeofday.c => clock_settime.c}  |   27 +-
 sysdeps/mach/hurd/getitimer.c                 |    3 +-
 sysdeps/mach/hurd/i386/libc.abilist           |    1 -
 sysdeps/mach/hurd/i386/librt.abilist          |    5 -
 sysdeps/mach/hurd/setitimer.c                 |    3 +-
 sysdeps/mach/hurd/times.c                     |    6 +-
 sysdeps/mach/nanosleep.c                      |   33 +-
 sysdeps/mach/sleep.c                          |    4 +-
 sysdeps/mach/usleep.c                         |    5 -
 sysdeps/posix/gettimeofday.c                  |   67 --
 sysdeps/posix/tempname.c                      |    9 +-
 sysdeps/posix/time.c                          |   40 -
 sysdeps/pthread/aio_misc.c                    |    6 +-
 sysdeps/pthread/aio_suspend.c                 |    6 +-
 sysdeps/unix/clock_gettime.c                  |   64 -
 sysdeps/unix/make-syscalls.sh                 |    2 +-
 sysdeps/unix/syscalls.list                    |    2 -
 .../unix/sysv/linux/aarch64/gettimeofday.c    |   71 --
 sysdeps/unix/sysv/linux/aarch64/init-first.c  |    7 +-
 sysdeps/unix/sysv/linux/aarch64/libc-vdso.h   |    2 -
 sysdeps/unix/sysv/linux/aarch64/libc.abilist  |    1 -
 sysdeps/unix/sysv/linux/alpha/Makefile        |    2 +-
 sysdeps/unix/sysv/linux/alpha/Versions        |    1 -
 sysdeps/unix/sysv/linux/alpha/adjtime.c       |   70 +-
 .../linux/{time.c => alpha/gettimeofday.c}    |   31 +-
 sysdeps/unix/sysv/linux/alpha/libc.abilist    |    2 -
 sysdeps/unix/sysv/linux/alpha/librt.abilist   |    5 -
 sysdeps/unix/sysv/linux/alpha/osf_adjtime.c   |  135 +++
 sysdeps/unix/sysv/linux/alpha/osf_getitimer.c |   48 +
 sysdeps/unix/sysv/linux/alpha/osf_getrusage.c |   44 +
 .../unix/sysv/linux/alpha/osf_gettimeofday.c  |   53 +
 sysdeps/unix/sysv/linux/alpha/osf_setitimer.c |   55 +
 .../unix/sysv/linux/alpha/osf_settimeofday.c  |   51 +
 .../ftime.c => sysv/linux/alpha/osf_utimes.c} |   34 +-
 .../linux/alpha/osf_wait4.c}                  |   51 +-
 sysdeps/unix/sysv/linux/alpha/settimeofday.c  |   22 +
 sysdeps/unix/sysv/linux/alpha/syscalls.list   |   13 +-
 sysdeps/unix/sysv/linux/alpha/tv32-compat.h   |  151 +++
 sysdeps/unix/sysv/linux/arm/init-first.c      |    7 +-
 sysdeps/unix/sysv/linux/arm/libc-vdso.h       |    2 -
 sysdeps/unix/sysv/linux/arm/libc.abilist      |    1 -
 sysdeps/unix/sysv/linux/arm/librt.abilist     |    5 -
 sysdeps/unix/sysv/linux/clock_settime.c       |    1 +
 sysdeps/unix/sysv/linux/csky/libc.abilist     |    1 -
 sysdeps/unix/sysv/linux/ftime.c               |    3 -
 sysdeps/unix/sysv/linux/gettimeofday.c        |   39 -
 sysdeps/unix/sysv/linux/hppa/libc.abilist     |    1 -
 sysdeps/unix/sysv/linux/hppa/librt.abilist    |    5 -
 sysdeps/unix/sysv/linux/i386/gettimeofday.c   |   35 -
 sysdeps/unix/sysv/linux/i386/libc.abilist     |    1 -
 sysdeps/unix/sysv/linux/i386/librt.abilist    |    5 -
 sysdeps/unix/sysv/linux/i386/time.c           |   34 -
 sysdeps/unix/sysv/linux/ia64/libc.abilist     |    1 -
 sysdeps/unix/sysv/linux/ia64/librt.abilist    |    5 -
 .../sysv/linux/m68k/coldfire/libc.abilist     |    1 -
 .../sysv/linux/m68k/coldfire/librt.abilist    |    5 -
 .../unix/sysv/linux/m68k/m680x0/libc.abilist  |    1 -
 .../unix/sysv/linux/m68k/m680x0/librt.abilist |    5 -
 .../unix/sysv/linux/microblaze/libc.abilist   |    1 -
 .../unix/sysv/linux/microblaze/librt.abilist  |    5 -
 sysdeps/unix/sysv/linux/mips/init-first.c     |    7 +-
 sysdeps/unix/sysv/linux/mips/libc-vdso.h      |    2 -
 .../sysv/linux/mips/mips32/fpu/libc.abilist   |    1 -
 .../unix/sysv/linux/mips/mips32/librt.abilist |    5 -
 .../sysv/linux/mips/mips32/nofpu/libc.abilist |    1 -
 .../unix/sysv/linux/mips/mips64/librt.abilist |    5 -
 .../sysv/linux/mips/mips64/n32/libc.abilist   |    1 -
 .../sysv/linux/mips/mips64/n64/libc.abilist   |    1 -
 sysdeps/unix/sysv/linux/nios2/libc.abilist    |    1 -
 sysdeps/unix/sysv/linux/powerpc/Versions      |    1 -
 .../unix/sysv/linux/powerpc/gettimeofday.c    |   85 --
 sysdeps/unix/sysv/linux/powerpc/init-first.c  |   13 +-
 sysdeps/unix/sysv/linux/powerpc/libc-vdso.h   |    2 -
 .../linux/powerpc/powerpc32/fpu/libc.abilist  |    1 -
 .../linux/powerpc/powerpc32/librt.abilist     |    5 -
 .../powerpc/powerpc32/nofpu/libc.abilist      |    1 -
 .../linux/powerpc/powerpc64/be/libc.abilist   |    1 -
 .../linux/powerpc/powerpc64/be/librt.abilist  |    5 -
 .../linux/powerpc/powerpc64/le/libc.abilist   |    1 -
 sysdeps/unix/sysv/linux/powerpc/time.c        |   84 --
 sysdeps/unix/sysv/linux/riscv/init-first.c    |   10 +-
 sysdeps/unix/sysv/linux/riscv/libc-vdso.h     |    2 -
 .../unix/sysv/linux/riscv/rv64/libc.abilist   |    1 -
 sysdeps/unix/sysv/linux/s390/init-first.c     |    9 +-
 sysdeps/unix/sysv/linux/s390/libc-vdso.h      |    3 -
 .../unix/sysv/linux/s390/s390-32/libc.abilist |    1 -
 .../sysv/linux/s390/s390-32/librt.abilist     |    5 -
 .../unix/sysv/linux/s390/s390-64/libc.abilist |    1 -
 .../sysv/linux/s390/s390-64/librt.abilist     |    5 -
 sysdeps/unix/sysv/linux/settimezone.c         |   39 +
 sysdeps/unix/sysv/linux/sh/libc.abilist       |    1 -
 sysdeps/unix/sysv/linux/sh/librt.abilist      |    5 -
 sysdeps/unix/sysv/linux/sparc/init-first.c    |    8 +-
 sysdeps/unix/sysv/linux/sparc/libc-vdso.h     |    2 -
 .../sysv/linux/sparc/sparc32/libc.abilist     |    1 -
 .../sysv/linux/sparc/sparc32/librt.abilist    |    5 -
 .../sysv/linux/sparc/sparc64/libc.abilist     |    1 -
 .../sysv/linux/sparc/sparc64/librt.abilist    |    5 -
 sysdeps/unix/sysv/linux/sparc/sparc64/time.c  |    1 -
 sysdeps/unix/sysv/linux/syscalls.list         |    1 -
 sysdeps/unix/sysv/linux/x86/gettimeofday.c    |   61 -
 sysdeps/unix/sysv/linux/x86/time.c            |   59 -
 .../unix/sysv/linux/x86_64/64/libc.abilist    |    1 -
 .../unix/sysv/linux/x86_64/64/librt.abilist   |    5 -
 .../unix/sysv/linux/x86_64/x32/libc.abilist   |    1 -
 .../unix/sysv/linux/x86_64/x32/librt.abilist  |    5 -
 .../unix/sysv/linux/x86_64/x32/syscalls.list  |    2 -
 time/Makefile                                 |    8 +-
 time/Versions                                 |    2 +-
 {rt => time}/clock_getcpuclockid.c            |    0
 {rt => time}/clock_getres.c                   |    0
 {rt => time}/clock_gettime.c                  |    0
 {rt => time}/clock_nanosleep.c                |    0
 {rt => time}/clock_settime.c                  |    1 +
 time/ftime.c                                  |   26 +-
 time/getdate.c                                |    2 +-
 time/gettimeofday.c                           |   30 +-
 time/settimeofday.c                           |   24 +-
 sysdeps/unix/stime.c => time/settimezone.c    |   23 +-
 time/stime.c                                  |   15 +-
 time/sys/time.h                               |   36 +-
 time/time.c                                   |   17 +-
 {rt => time}/tst-clock.c                      |    0
 {rt => time}/tst-clock2.c                     |    0
 {rt => time}/tst-clock_nanosleep.c            |    0
 {rt => time}/tst-cpuclock1.c                  |    0
 time/tst_wcsftime.c                           |    2 +-
 156 files changed, 1580 insertions(+), 1775 deletions(-)
 delete mode 100644 rt/clock-compat.c
 rename sysdeps/mach/{gettimeofday.c => clock_gettime.c} (67%)
 rename sysdeps/mach/hurd/{settimeofday.c => clock_settime.c} (71%)
 delete mode 100644 sysdeps/posix/gettimeofday.c
 delete mode 100644 sysdeps/posix/time.c
 delete mode 100644 sysdeps/unix/clock_gettime.c
 delete mode 100644 sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
 rename sysdeps/unix/sysv/linux/{time.c => alpha/gettimeofday.c} (64%)
 create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_adjtime.c
 create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_getitimer.c
 create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_getrusage.c
 create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c
 create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_setitimer.c
 create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_settimeofday.c
 rename sysdeps/unix/{bsd/ftime.c => sysv/linux/alpha/osf_utimes.c} (60%)
 rename sysdeps/unix/{clock_settime.c => sysv/linux/alpha/osf_wait4.c} (55%)
 create mode 100644 sysdeps/unix/sysv/linux/alpha/settimeofday.c
 create mode 100644 sysdeps/unix/sysv/linux/alpha/tv32-compat.h
 delete mode 100644 sysdeps/unix/sysv/linux/ftime.c
 delete mode 100644 sysdeps/unix/sysv/linux/gettimeofday.c
 delete mode 100644 sysdeps/unix/sysv/linux/i386/gettimeofday.c
 delete mode 100644 sysdeps/unix/sysv/linux/i386/time.c
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/time.c
 create mode 100644 sysdeps/unix/sysv/linux/settimezone.c
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/time.c
 delete mode 100644 sysdeps/unix/sysv/linux/x86/gettimeofday.c
 delete mode 100644 sysdeps/unix/sysv/linux/x86/time.c
 rename {rt => time}/clock_getcpuclockid.c (100%)
 rename {rt => time}/clock_getres.c (100%)
 rename {rt => time}/clock_gettime.c (100%)
 rename {rt => time}/clock_nanosleep.c (100%)
 rename {rt => time}/clock_settime.c (96%)
 rename sysdeps/unix/stime.c => time/settimezone.c (67%)
 rename {rt => time}/tst-clock.c (100%)
 rename {rt => time}/tst-clock2.c (100%)
 rename {rt => time}/tst-clock_nanosleep.c (100%)
 rename {rt => time}/tst-cpuclock1.c (100%)

Comments

Joseph Myers Aug. 20, 2019, 3:10 p.m. UTC | #1
On Tue, 20 Aug 2019, Zack Weinberg wrote:

> Finally, there is a case for demoting ftime and stime to compatibility
> symbols and removing their public prototypes (for ftime, we would stop
> installing <sys/timeb.h> altogether).

Yes, I think that would make sense.  If we do that, we don't then need to 
add any _TIME_BITS=64 support for those functions.
Zack Weinberg Aug. 20, 2019, 3:21 p.m. UTC | #2
On Tue, Aug 20, 2019 at 11:10 AM Joseph Myers <joseph@codesourcery.com> wrote:
> On Tue, 20 Aug 2019, Zack Weinberg wrote:
>
> > Finally, there is a case for demoting ftime and stime to compatibility
> > symbols and removing their public prototypes (for ftime, we would stop
> > installing <sys/timeb.h> altogether).
>
> Yes, I think that would make sense.  If we do that, we don't then need to
> add any _TIME_BITS=64 support for those functions.

OK, I will add a patch to this branch that does that.  (The changes
already made to those functions in this patchset are still necessary,
since we will need to keep the implementations around.)

zw
Alistair Francis Aug. 20, 2019, 6:43 p.m. UTC | #3
On Tue, Aug 20, 2019 at 6:21 AM Zack Weinberg <zackw@panix.com> wrote:
>
> This patchset aims to make the Y2038 project a little easier by
> implementing the other time-getting and time-setting functions
> (time, ftime, stime, gettimeofday, and settimeofday) in terms of
> clock_gettime and clock_settime.  Internal uses of (__)gettimeofday
> are also all changed to __clock_gettime.  Internal uses of time() are
> mostly left alone, since time() is easier and clearer when you don’t
> care about sub-second resolution and don’t need a struct timespec for
> some other reason.

Thanks for the series, this should help. I'll rebase my work ontop of
this once it's merged into master.

>
> As a consequence, gettimeofday will no longer report crude timezone
> information under any circumstances.  If its ‘tzp’ argument is not
> NULL, it will write zeroes to both fields of the ‘struct timezone’,
> even if the gettimeofday system call exists and would have produced
> different output.  Similarly, ftime will always write zeroes to the
> timezone and dstflag fields of ‘struct timeb’.  Joseph Myers raised an
> objection to this change; I rebutted the objection, and he did not
> reply; I do not think either of us will persuade the other, so I’m
> formally asking for a third maintainer to make a decision.

I like this and think it makes a lot of sense.

Alistair

>
> settimeofday _will_ still call the settimeofday system call and pass
> down a non-null ‘tzp’ argument if it receives one, but, if _both_ of
> its arguments are non-null, it will fail and set errno to EINVAL.
> Also, its invocation of a settimeofday system call goes through an
> internal sysdep function called __settimezone.  On the Hurd this is an
> unconditional ENOSYS stub, and on Linux it’s an ENOSYS stub when
> __NR_settimeofday is not defined.
>
> Relatedly, there is a macro-based hack to issue warnings when
> gettimeofday is called with a ‘tzp’ argument that is not a
> compile-time null pointer.  I think this is probably a better option
> at this stage than various suggested alternatives (e.g. renaming the
> fields of ‘struct timezone’, or removing it from sys/time.h
> altogether) because the remaining valid uses of settimeofday with
> non-null ‘tzp’ should still be able to use struct timezone.  The hack
> is in a separate patch because, well, it’s a hack and I’m hoping
> someone has a better implementation idea.  (I tried an inline function
> instead of a macro, but it threw false positives all over the place on
> ‘gettimeofday (&tv, 0)’...)
>
> This patchset also includes an overhaul of Linux/Alpha’s GLIBC_2.0
> compatibility symbols for several system calls that consume or produce
> struct timeval.  It appears that early releases of glibc and/or Linux
> for Alpha attempted to achieve some degree of binary compatibility
> with OSF/1, but this came at the expense of using 32-bit time_t inside
> struct timeval.  Up till now, we were invoking compatibility system
> calls from the compatibility symbols.  This patch changes them to wrap
> the 64-bit implementations and convert between 32-bit and 64-bit
> struct timeval in user space.  If a 64-bit tv_sec value returned by
> the kernel is found to be greater than INT32_MAX, the caller will
> receive a saturated 32-bit struct timeval, { INT32_MAX, 0 }, and the
> function will return -1 with errno set to EOVERFLOW.  Because many of
> these calls are assumed unable to fail, we make sure to write all the
> fields of any output data structure even when this happens.  I did
> this partially because it simplified conversion of gettimeofday to
> call clock_gettime, and partially as a worked example of the semantics
> that I think are probably best for the 32-bit time_t compatibility
> symbols we’re going to have to add for many other architectures.
> Comments on these semantics are requested.
>
> This patchset also includes a partial revision of manual/time.texi.
> clock_gettime and clock_settime are now documented, and the
> obsolescent status of stime, settimeofday, and gettimeofday is
> clearer.  I only documented CLOCK_REALTIME and CLOCK_MONOTONIC,
> because most of the other clock constants are either extremely
> Linux-specific or they have to do with measuring CPU time, and I
> didn’t touch the measuring-CPU-time part of time.texi.  (That part
> also deserves a rewrite, but I don’t know enough about the topic and
> this patchset is already long enough.)
>
> Finally, there is a case for demoting ftime and stime to compatibility
> symbols and removing their public prototypes (for ftime, we would stop
> installing <sys/timeb.h> altogether).  I tried to investigate how much
> this might break, using codesearch.debian.net, but the identifiers
> ‘ftime’ and ‘stime’ turn out to be heavily used for unrelated
> purposes, so I didn’t get anywhere.
>
> Zack Weinberg (12):
>   Remove implementations of clock_[gs]ettime using [gs]ettimeofday.
>   Change most internal uses of __gettimeofday to __clock_gettime.
>   Don’t use the argument to time.
>   Use clock_settime to implement stime.
>   Use clock_settime to implement settimeofday.
>   Use clock_gettime to implement time.
>   Use clock_gettime to implement ftime.
>   Use clock_gettime to implement gettimeofday.
>   Finish move of clock_* functions to libc.
>   Warn when gettimeofday is called with non-null tzp argument.
>   Linux/Alpha: don’t use timeval32 system calls.
>   Revise the documentation of ‘simple calendar time’.
>
>  NEWS                                          |   53 +-
>  include/sys/time.h                            |    7 +-
>  include/time.h                                |    4 +-
>  inet/deadline.c                               |    9 +-
>  login/logout.c                                |    9 +-
>  login/logwtmp.c                               |    7 +-
>  manual/filesys.texi                           |    2 +-
>  manual/llio.texi                              |   10 +-
>  manual/threads.texi                           |    2 +-
>  manual/time.texi                              | 1062 +++++++++--------
>  misc/syslog.c                                 |    2 +-
>  nis/nis_call.c                                |    4 +-
>  nptl/pthread_join_common.c                    |    7 +-
>  nptl/pthread_mutex_timedlock.c                |    7 +-
>  nscd/nscd_helper.c                            |   24 +-
>  resolv/gai_misc.c                             |    6 +-
>  resolv/gai_suspend.c                          |    6 +-
>  resolv/res_send.c                             |    6 +-
>  rt/Makefile                                   |   15 +-
>  rt/Versions                                   |    7 +-
>  rt/clock-compat.c                             |   63 -
>  string/strfry.c                               |    2 +-
>  sunrpc/auth_des.c                             |   19 +-
>  sunrpc/auth_unix.c                            |    9 +-
>  sunrpc/create_xid.c                           |    6 +-
>  sunrpc/svcauth_des.c                          |    7 +-
>  support/support_test_main.c                   |   14 +-
>  sysdeps/generic/memusage.h                    |   16 +-
>  .../mach/{gettimeofday.c => clock_gettime.c}  |   25 +-
>  .../hurd/{settimeofday.c => clock_settime.c}  |   27 +-
>  sysdeps/mach/hurd/getitimer.c                 |    3 +-
>  sysdeps/mach/hurd/i386/libc.abilist           |    1 -
>  sysdeps/mach/hurd/i386/librt.abilist          |    5 -
>  sysdeps/mach/hurd/setitimer.c                 |    3 +-
>  sysdeps/mach/hurd/times.c                     |    6 +-
>  sysdeps/mach/nanosleep.c                      |   33 +-
>  sysdeps/mach/sleep.c                          |    4 +-
>  sysdeps/mach/usleep.c                         |    5 -
>  sysdeps/posix/gettimeofday.c                  |   67 --
>  sysdeps/posix/tempname.c                      |    9 +-
>  sysdeps/posix/time.c                          |   40 -
>  sysdeps/pthread/aio_misc.c                    |    6 +-
>  sysdeps/pthread/aio_suspend.c                 |    6 +-
>  sysdeps/unix/clock_gettime.c                  |   64 -
>  sysdeps/unix/make-syscalls.sh                 |    2 +-
>  sysdeps/unix/syscalls.list                    |    2 -
>  .../unix/sysv/linux/aarch64/gettimeofday.c    |   71 --
>  sysdeps/unix/sysv/linux/aarch64/init-first.c  |    7 +-
>  sysdeps/unix/sysv/linux/aarch64/libc-vdso.h   |    2 -
>  sysdeps/unix/sysv/linux/aarch64/libc.abilist  |    1 -
>  sysdeps/unix/sysv/linux/alpha/Makefile        |    2 +-
>  sysdeps/unix/sysv/linux/alpha/Versions        |    1 -
>  sysdeps/unix/sysv/linux/alpha/adjtime.c       |   70 +-
>  .../linux/{time.c => alpha/gettimeofday.c}    |   31 +-
>  sysdeps/unix/sysv/linux/alpha/libc.abilist    |    2 -
>  sysdeps/unix/sysv/linux/alpha/librt.abilist   |    5 -
>  sysdeps/unix/sysv/linux/alpha/osf_adjtime.c   |  135 +++
>  sysdeps/unix/sysv/linux/alpha/osf_getitimer.c |   48 +
>  sysdeps/unix/sysv/linux/alpha/osf_getrusage.c |   44 +
>  .../unix/sysv/linux/alpha/osf_gettimeofday.c  |   53 +
>  sysdeps/unix/sysv/linux/alpha/osf_setitimer.c |   55 +
>  .../unix/sysv/linux/alpha/osf_settimeofday.c  |   51 +
>  .../ftime.c => sysv/linux/alpha/osf_utimes.c} |   34 +-
>  .../linux/alpha/osf_wait4.c}                  |   51 +-
>  sysdeps/unix/sysv/linux/alpha/settimeofday.c  |   22 +
>  sysdeps/unix/sysv/linux/alpha/syscalls.list   |   13 +-
>  sysdeps/unix/sysv/linux/alpha/tv32-compat.h   |  151 +++
>  sysdeps/unix/sysv/linux/arm/init-first.c      |    7 +-
>  sysdeps/unix/sysv/linux/arm/libc-vdso.h       |    2 -
>  sysdeps/unix/sysv/linux/arm/libc.abilist      |    1 -
>  sysdeps/unix/sysv/linux/arm/librt.abilist     |    5 -
>  sysdeps/unix/sysv/linux/clock_settime.c       |    1 +
>  sysdeps/unix/sysv/linux/csky/libc.abilist     |    1 -
>  sysdeps/unix/sysv/linux/ftime.c               |    3 -
>  sysdeps/unix/sysv/linux/gettimeofday.c        |   39 -
>  sysdeps/unix/sysv/linux/hppa/libc.abilist     |    1 -
>  sysdeps/unix/sysv/linux/hppa/librt.abilist    |    5 -
>  sysdeps/unix/sysv/linux/i386/gettimeofday.c   |   35 -
>  sysdeps/unix/sysv/linux/i386/libc.abilist     |    1 -
>  sysdeps/unix/sysv/linux/i386/librt.abilist    |    5 -
>  sysdeps/unix/sysv/linux/i386/time.c           |   34 -
>  sysdeps/unix/sysv/linux/ia64/libc.abilist     |    1 -
>  sysdeps/unix/sysv/linux/ia64/librt.abilist    |    5 -
>  .../sysv/linux/m68k/coldfire/libc.abilist     |    1 -
>  .../sysv/linux/m68k/coldfire/librt.abilist    |    5 -
>  .../unix/sysv/linux/m68k/m680x0/libc.abilist  |    1 -
>  .../unix/sysv/linux/m68k/m680x0/librt.abilist |    5 -
>  .../unix/sysv/linux/microblaze/libc.abilist   |    1 -
>  .../unix/sysv/linux/microblaze/librt.abilist  |    5 -
>  sysdeps/unix/sysv/linux/mips/init-first.c     |    7 +-
>  sysdeps/unix/sysv/linux/mips/libc-vdso.h      |    2 -
>  .../sysv/linux/mips/mips32/fpu/libc.abilist   |    1 -
>  .../unix/sysv/linux/mips/mips32/librt.abilist |    5 -
>  .../sysv/linux/mips/mips32/nofpu/libc.abilist |    1 -
>  .../unix/sysv/linux/mips/mips64/librt.abilist |    5 -
>  .../sysv/linux/mips/mips64/n32/libc.abilist   |    1 -
>  .../sysv/linux/mips/mips64/n64/libc.abilist   |    1 -
>  sysdeps/unix/sysv/linux/nios2/libc.abilist    |    1 -
>  sysdeps/unix/sysv/linux/powerpc/Versions      |    1 -
>  .../unix/sysv/linux/powerpc/gettimeofday.c    |   85 --
>  sysdeps/unix/sysv/linux/powerpc/init-first.c  |   13 +-
>  sysdeps/unix/sysv/linux/powerpc/libc-vdso.h   |    2 -
>  .../linux/powerpc/powerpc32/fpu/libc.abilist  |    1 -
>  .../linux/powerpc/powerpc32/librt.abilist     |    5 -
>  .../powerpc/powerpc32/nofpu/libc.abilist      |    1 -
>  .../linux/powerpc/powerpc64/be/libc.abilist   |    1 -
>  .../linux/powerpc/powerpc64/be/librt.abilist  |    5 -
>  .../linux/powerpc/powerpc64/le/libc.abilist   |    1 -
>  sysdeps/unix/sysv/linux/powerpc/time.c        |   84 --
>  sysdeps/unix/sysv/linux/riscv/init-first.c    |   10 +-
>  sysdeps/unix/sysv/linux/riscv/libc-vdso.h     |    2 -
>  .../unix/sysv/linux/riscv/rv64/libc.abilist   |    1 -
>  sysdeps/unix/sysv/linux/s390/init-first.c     |    9 +-
>  sysdeps/unix/sysv/linux/s390/libc-vdso.h      |    3 -
>  .../unix/sysv/linux/s390/s390-32/libc.abilist |    1 -
>  .../sysv/linux/s390/s390-32/librt.abilist     |    5 -
>  .../unix/sysv/linux/s390/s390-64/libc.abilist |    1 -
>  .../sysv/linux/s390/s390-64/librt.abilist     |    5 -
>  sysdeps/unix/sysv/linux/settimezone.c         |   39 +
>  sysdeps/unix/sysv/linux/sh/libc.abilist       |    1 -
>  sysdeps/unix/sysv/linux/sh/librt.abilist      |    5 -
>  sysdeps/unix/sysv/linux/sparc/init-first.c    |    8 +-
>  sysdeps/unix/sysv/linux/sparc/libc-vdso.h     |    2 -
>  .../sysv/linux/sparc/sparc32/libc.abilist     |    1 -
>  .../sysv/linux/sparc/sparc32/librt.abilist    |    5 -
>  .../sysv/linux/sparc/sparc64/libc.abilist     |    1 -
>  .../sysv/linux/sparc/sparc64/librt.abilist    |    5 -
>  sysdeps/unix/sysv/linux/sparc/sparc64/time.c  |    1 -
>  sysdeps/unix/sysv/linux/syscalls.list         |    1 -
>  sysdeps/unix/sysv/linux/x86/gettimeofday.c    |   61 -
>  sysdeps/unix/sysv/linux/x86/time.c            |   59 -
>  .../unix/sysv/linux/x86_64/64/libc.abilist    |    1 -
>  .../unix/sysv/linux/x86_64/64/librt.abilist   |    5 -
>  .../unix/sysv/linux/x86_64/x32/libc.abilist   |    1 -
>  .../unix/sysv/linux/x86_64/x32/librt.abilist  |    5 -
>  .../unix/sysv/linux/x86_64/x32/syscalls.list  |    2 -
>  time/Makefile                                 |    8 +-
>  time/Versions                                 |    2 +-
>  {rt => time}/clock_getcpuclockid.c            |    0
>  {rt => time}/clock_getres.c                   |    0
>  {rt => time}/clock_gettime.c                  |    0
>  {rt => time}/clock_nanosleep.c                |    0
>  {rt => time}/clock_settime.c                  |    1 +
>  time/ftime.c                                  |   26 +-
>  time/getdate.c                                |    2 +-
>  time/gettimeofday.c                           |   30 +-
>  time/settimeofday.c                           |   24 +-
>  sysdeps/unix/stime.c => time/settimezone.c    |   23 +-
>  time/stime.c                                  |   15 +-
>  time/sys/time.h                               |   36 +-
>  time/time.c                                   |   17 +-
>  {rt => time}/tst-clock.c                      |    0
>  {rt => time}/tst-clock2.c                     |    0
>  {rt => time}/tst-clock_nanosleep.c            |    0
>  {rt => time}/tst-cpuclock1.c                  |    0
>  time/tst_wcsftime.c                           |    2 +-
>  156 files changed, 1580 insertions(+), 1775 deletions(-)
>  delete mode 100644 rt/clock-compat.c
>  rename sysdeps/mach/{gettimeofday.c => clock_gettime.c} (67%)
>  rename sysdeps/mach/hurd/{settimeofday.c => clock_settime.c} (71%)
>  delete mode 100644 sysdeps/posix/gettimeofday.c
>  delete mode 100644 sysdeps/posix/time.c
>  delete mode 100644 sysdeps/unix/clock_gettime.c
>  delete mode 100644 sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
>  rename sysdeps/unix/sysv/linux/{time.c => alpha/gettimeofday.c} (64%)
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_adjtime.c
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_getitimer.c
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_getrusage.c
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_setitimer.c
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_settimeofday.c
>  rename sysdeps/unix/{bsd/ftime.c => sysv/linux/alpha/osf_utimes.c} (60%)
>  rename sysdeps/unix/{clock_settime.c => sysv/linux/alpha/osf_wait4.c} (55%)
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/settimeofday.c
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/tv32-compat.h
>  delete mode 100644 sysdeps/unix/sysv/linux/ftime.c
>  delete mode 100644 sysdeps/unix/sysv/linux/gettimeofday.c
>  delete mode 100644 sysdeps/unix/sysv/linux/i386/gettimeofday.c
>  delete mode 100644 sysdeps/unix/sysv/linux/i386/time.c
>  delete mode 100644 sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
>  delete mode 100644 sysdeps/unix/sysv/linux/powerpc/time.c
>  create mode 100644 sysdeps/unix/sysv/linux/settimezone.c
>  delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/time.c
>  delete mode 100644 sysdeps/unix/sysv/linux/x86/gettimeofday.c
>  delete mode 100644 sysdeps/unix/sysv/linux/x86/time.c
>  rename {rt => time}/clock_getcpuclockid.c (100%)
>  rename {rt => time}/clock_getres.c (100%)
>  rename {rt => time}/clock_gettime.c (100%)
>  rename {rt => time}/clock_nanosleep.c (100%)
>  rename {rt => time}/clock_settime.c (96%)
>  rename sysdeps/unix/stime.c => time/settimezone.c (67%)
>  rename {rt => time}/tst-clock.c (100%)
>  rename {rt => time}/tst-clock2.c (100%)
>  rename {rt => time}/tst-clock_nanosleep.c (100%)
>  rename {rt => time}/tst-cpuclock1.c (100%)
>
> --
> 2.23.0.rc1
>
Paul Eggert Aug. 20, 2019, 6:55 p.m. UTC | #4
Zack Weinberg wrote:

> If a 64-bit tv_sec value returned by
> the kernel is found to be greater than INT32_MAX, the caller will
> receive a saturated 32-bit struct timeval, { INT32_MAX, 0 },

Shouldn't that saturated value be { INT32_MAX, 999999 }?

PS. Thanks for all this work. The idea looks good.
Lukasz Majewski Aug. 21, 2019, 8 a.m. UTC | #5
Hi Zack,

> This patchset aims to make the Y2038 project a little easier by
> implementing the other time-getting and time-setting functions
> (time, ftime, stime, gettimeofday, and settimeofday) in terms of
> clock_gettime and clock_settime.  Internal uses of (__)gettimeofday
> are also all changed to __clock_gettime.  Internal uses of time() are
> mostly left alone, since time() is easier and clearer when you don’t
> care about sub-second resolution and don’t need a struct timespec for
> some other reason.
> 
> As a consequence, gettimeofday will no longer report crude timezone
> information under any circumstances.  If its ‘tzp’ argument is not
> NULL, it will write zeroes to both fields of the ‘struct timezone’,
> even if the gettimeofday system call exists and would have produced
> different output.  Similarly, ftime will always write zeroes to the
> timezone and dstflag fields of ‘struct timeb’.  Joseph Myers raised an
> objection to this change; I rebutted the objection, and he did not
> reply; I do not think either of us will persuade the other, so I’m
> formally asking for a third maintainer to make a decision.
> 
> settimeofday _will_ still call the settimeofday system call and pass
> down a non-null ‘tzp’ argument if it receives one, but, if _both_ of
> its arguments are non-null, it will fail and set errno to EINVAL.
> Also, its invocation of a settimeofday system call goes through an
> internal sysdep function called __settimezone.  On the Hurd this is an
> unconditional ENOSYS stub, and on Linux it’s an ENOSYS stub when
> __NR_settimeofday is not defined.
> 
> Relatedly, there is a macro-based hack to issue warnings when
> gettimeofday is called with a ‘tzp’ argument that is not a
> compile-time null pointer.  I think this is probably a better option
> at this stage than various suggested alternatives (e.g. renaming the
> fields of ‘struct timezone’, or removing it from sys/time.h
> altogether) because the remaining valid uses of settimeofday with
> non-null ‘tzp’ should still be able to use struct timezone.  The hack
> is in a separate patch because, well, it’s a hack and I’m hoping
> someone has a better implementation idea.  (I tried an inline function
> instead of a macro, but it threw false positives all over the place on
> ‘gettimeofday (&tv, 0)’...)
> 
> This patchset also includes an overhaul of Linux/Alpha’s GLIBC_2.0
> compatibility symbols for several system calls that consume or produce
> struct timeval.  It appears that early releases of glibc and/or Linux
> for Alpha attempted to achieve some degree of binary compatibility
> with OSF/1, but this came at the expense of using 32-bit time_t inside
> struct timeval.  Up till now, we were invoking compatibility system
> calls from the compatibility symbols.  This patch changes them to wrap
> the 64-bit implementations and convert between 32-bit and 64-bit
> struct timeval in user space.  If a 64-bit tv_sec value returned by
> the kernel is found to be greater than INT32_MAX, the caller will
> receive a saturated 32-bit struct timeval, { INT32_MAX, 0 }, and the
> function will return -1 with errno set to EOVERFLOW.  Because many of
> these calls are assumed unable to fail, we make sure to write all the
> fields of any output data structure even when this happens.  I did
> this partially because it simplified conversion of gettimeofday to
> call clock_gettime, and partially as a worked example of the semantics
> that I think are probably best for the 32-bit time_t compatibility
> symbols we’re going to have to add for many other architectures.
> Comments on these semantics are requested.
> 
> This patchset also includes a partial revision of manual/time.texi.
> clock_gettime and clock_settime are now documented, and the
> obsolescent status of stime, settimeofday, and gettimeofday is
> clearer.  I only documented CLOCK_REALTIME and CLOCK_MONOTONIC,
> because most of the other clock constants are either extremely
> Linux-specific or they have to do with measuring CPU time, and I
> didn’t touch the measuring-CPU-time part of time.texi.  (That part
> also deserves a rewrite, but I don’t know enough about the topic and
> this patchset is already long enough.)
> 
> Finally, there is a case for demoting ftime and stime to compatibility
> symbols and removing their public prototypes (for ftime, we would stop
> installing <sys/timeb.h> altogether).  I tried to investigate how much
> this might break, using codesearch.debian.net, but the identifiers
> ‘ftime’ and ‘stime’ turn out to be heavily used for unrelated
> purposes, so I didn’t get anywhere.
> 

Thanks for your work. This simplifies things a lot as the more rarely
used/obsolete functions/syscalls are replaced with clock_settime or
clock_gettime.

> Zack Weinberg (12):
>   Remove implementations of clock_[gs]ettime using [gs]ettimeofday.
>   Change most internal uses of __gettimeofday to __clock_gettime.
>   Don’t use the argument to time.
>   Use clock_settime to implement stime.
>   Use clock_settime to implement settimeofday.
>   Use clock_gettime to implement time.
>   Use clock_gettime to implement ftime.
>   Use clock_gettime to implement gettimeofday.
>   Finish move of clock_* functions to libc.
>   Warn when gettimeofday is called with non-null tzp argument.
>   Linux/Alpha: don’t use timeval32 system calls.
>   Revise the documentation of ‘simple calendar time’.
> 
>  NEWS                                          |   53 +-
>  include/sys/time.h                            |    7 +-
>  include/time.h                                |    4 +-
>  inet/deadline.c                               |    9 +-
>  login/logout.c                                |    9 +-
>  login/logwtmp.c                               |    7 +-
>  manual/filesys.texi                           |    2 +-
>  manual/llio.texi                              |   10 +-
>  manual/threads.texi                           |    2 +-
>  manual/time.texi                              | 1062
> +++++++++-------- misc/syslog.c                                 |
> 2 +- nis/nis_call.c                                |    4 +-
>  nptl/pthread_join_common.c                    |    7 +-
>  nptl/pthread_mutex_timedlock.c                |    7 +-
>  nscd/nscd_helper.c                            |   24 +-
>  resolv/gai_misc.c                             |    6 +-
>  resolv/gai_suspend.c                          |    6 +-
>  resolv/res_send.c                             |    6 +-
>  rt/Makefile                                   |   15 +-
>  rt/Versions                                   |    7 +-
>  rt/clock-compat.c                             |   63 -
>  string/strfry.c                               |    2 +-
>  sunrpc/auth_des.c                             |   19 +-
>  sunrpc/auth_unix.c                            |    9 +-
>  sunrpc/create_xid.c                           |    6 +-
>  sunrpc/svcauth_des.c                          |    7 +-
>  support/support_test_main.c                   |   14 +-
>  sysdeps/generic/memusage.h                    |   16 +-
>  .../mach/{gettimeofday.c => clock_gettime.c}  |   25 +-
>  .../hurd/{settimeofday.c => clock_settime.c}  |   27 +-
>  sysdeps/mach/hurd/getitimer.c                 |    3 +-
>  sysdeps/mach/hurd/i386/libc.abilist           |    1 -
>  sysdeps/mach/hurd/i386/librt.abilist          |    5 -
>  sysdeps/mach/hurd/setitimer.c                 |    3 +-
>  sysdeps/mach/hurd/times.c                     |    6 +-
>  sysdeps/mach/nanosleep.c                      |   33 +-
>  sysdeps/mach/sleep.c                          |    4 +-
>  sysdeps/mach/usleep.c                         |    5 -
>  sysdeps/posix/gettimeofday.c                  |   67 --
>  sysdeps/posix/tempname.c                      |    9 +-
>  sysdeps/posix/time.c                          |   40 -
>  sysdeps/pthread/aio_misc.c                    |    6 +-
>  sysdeps/pthread/aio_suspend.c                 |    6 +-
>  sysdeps/unix/clock_gettime.c                  |   64 -
>  sysdeps/unix/make-syscalls.sh                 |    2 +-
>  sysdeps/unix/syscalls.list                    |    2 -
>  .../unix/sysv/linux/aarch64/gettimeofday.c    |   71 --
>  sysdeps/unix/sysv/linux/aarch64/init-first.c  |    7 +-
>  sysdeps/unix/sysv/linux/aarch64/libc-vdso.h   |    2 -
>  sysdeps/unix/sysv/linux/aarch64/libc.abilist  |    1 -
>  sysdeps/unix/sysv/linux/alpha/Makefile        |    2 +-
>  sysdeps/unix/sysv/linux/alpha/Versions        |    1 -
>  sysdeps/unix/sysv/linux/alpha/adjtime.c       |   70 +-
>  .../linux/{time.c => alpha/gettimeofday.c}    |   31 +-
>  sysdeps/unix/sysv/linux/alpha/libc.abilist    |    2 -
>  sysdeps/unix/sysv/linux/alpha/librt.abilist   |    5 -
>  sysdeps/unix/sysv/linux/alpha/osf_adjtime.c   |  135 +++
>  sysdeps/unix/sysv/linux/alpha/osf_getitimer.c |   48 +
>  sysdeps/unix/sysv/linux/alpha/osf_getrusage.c |   44 +
>  .../unix/sysv/linux/alpha/osf_gettimeofday.c  |   53 +
>  sysdeps/unix/sysv/linux/alpha/osf_setitimer.c |   55 +
>  .../unix/sysv/linux/alpha/osf_settimeofday.c  |   51 +
>  .../ftime.c => sysv/linux/alpha/osf_utimes.c} |   34 +-
>  .../linux/alpha/osf_wait4.c}                  |   51 +-
>  sysdeps/unix/sysv/linux/alpha/settimeofday.c  |   22 +
>  sysdeps/unix/sysv/linux/alpha/syscalls.list   |   13 +-
>  sysdeps/unix/sysv/linux/alpha/tv32-compat.h   |  151 +++
>  sysdeps/unix/sysv/linux/arm/init-first.c      |    7 +-
>  sysdeps/unix/sysv/linux/arm/libc-vdso.h       |    2 -
>  sysdeps/unix/sysv/linux/arm/libc.abilist      |    1 -
>  sysdeps/unix/sysv/linux/arm/librt.abilist     |    5 -
>  sysdeps/unix/sysv/linux/clock_settime.c       |    1 +
>  sysdeps/unix/sysv/linux/csky/libc.abilist     |    1 -
>  sysdeps/unix/sysv/linux/ftime.c               |    3 -
>  sysdeps/unix/sysv/linux/gettimeofday.c        |   39 -
>  sysdeps/unix/sysv/linux/hppa/libc.abilist     |    1 -
>  sysdeps/unix/sysv/linux/hppa/librt.abilist    |    5 -
>  sysdeps/unix/sysv/linux/i386/gettimeofday.c   |   35 -
>  sysdeps/unix/sysv/linux/i386/libc.abilist     |    1 -
>  sysdeps/unix/sysv/linux/i386/librt.abilist    |    5 -
>  sysdeps/unix/sysv/linux/i386/time.c           |   34 -
>  sysdeps/unix/sysv/linux/ia64/libc.abilist     |    1 -
>  sysdeps/unix/sysv/linux/ia64/librt.abilist    |    5 -
>  .../sysv/linux/m68k/coldfire/libc.abilist     |    1 -
>  .../sysv/linux/m68k/coldfire/librt.abilist    |    5 -
>  .../unix/sysv/linux/m68k/m680x0/libc.abilist  |    1 -
>  .../unix/sysv/linux/m68k/m680x0/librt.abilist |    5 -
>  .../unix/sysv/linux/microblaze/libc.abilist   |    1 -
>  .../unix/sysv/linux/microblaze/librt.abilist  |    5 -
>  sysdeps/unix/sysv/linux/mips/init-first.c     |    7 +-
>  sysdeps/unix/sysv/linux/mips/libc-vdso.h      |    2 -
>  .../sysv/linux/mips/mips32/fpu/libc.abilist   |    1 -
>  .../unix/sysv/linux/mips/mips32/librt.abilist |    5 -
>  .../sysv/linux/mips/mips32/nofpu/libc.abilist |    1 -
>  .../unix/sysv/linux/mips/mips64/librt.abilist |    5 -
>  .../sysv/linux/mips/mips64/n32/libc.abilist   |    1 -
>  .../sysv/linux/mips/mips64/n64/libc.abilist   |    1 -
>  sysdeps/unix/sysv/linux/nios2/libc.abilist    |    1 -
>  sysdeps/unix/sysv/linux/powerpc/Versions      |    1 -
>  .../unix/sysv/linux/powerpc/gettimeofday.c    |   85 --
>  sysdeps/unix/sysv/linux/powerpc/init-first.c  |   13 +-
>  sysdeps/unix/sysv/linux/powerpc/libc-vdso.h   |    2 -
>  .../linux/powerpc/powerpc32/fpu/libc.abilist  |    1 -
>  .../linux/powerpc/powerpc32/librt.abilist     |    5 -
>  .../powerpc/powerpc32/nofpu/libc.abilist      |    1 -
>  .../linux/powerpc/powerpc64/be/libc.abilist   |    1 -
>  .../linux/powerpc/powerpc64/be/librt.abilist  |    5 -
>  .../linux/powerpc/powerpc64/le/libc.abilist   |    1 -
>  sysdeps/unix/sysv/linux/powerpc/time.c        |   84 --
>  sysdeps/unix/sysv/linux/riscv/init-first.c    |   10 +-
>  sysdeps/unix/sysv/linux/riscv/libc-vdso.h     |    2 -
>  .../unix/sysv/linux/riscv/rv64/libc.abilist   |    1 -
>  sysdeps/unix/sysv/linux/s390/init-first.c     |    9 +-
>  sysdeps/unix/sysv/linux/s390/libc-vdso.h      |    3 -
>  .../unix/sysv/linux/s390/s390-32/libc.abilist |    1 -
>  .../sysv/linux/s390/s390-32/librt.abilist     |    5 -
>  .../unix/sysv/linux/s390/s390-64/libc.abilist |    1 -
>  .../sysv/linux/s390/s390-64/librt.abilist     |    5 -
>  sysdeps/unix/sysv/linux/settimezone.c         |   39 +
>  sysdeps/unix/sysv/linux/sh/libc.abilist       |    1 -
>  sysdeps/unix/sysv/linux/sh/librt.abilist      |    5 -
>  sysdeps/unix/sysv/linux/sparc/init-first.c    |    8 +-
>  sysdeps/unix/sysv/linux/sparc/libc-vdso.h     |    2 -
>  .../sysv/linux/sparc/sparc32/libc.abilist     |    1 -
>  .../sysv/linux/sparc/sparc32/librt.abilist    |    5 -
>  .../sysv/linux/sparc/sparc64/libc.abilist     |    1 -
>  .../sysv/linux/sparc/sparc64/librt.abilist    |    5 -
>  sysdeps/unix/sysv/linux/sparc/sparc64/time.c  |    1 -
>  sysdeps/unix/sysv/linux/syscalls.list         |    1 -
>  sysdeps/unix/sysv/linux/x86/gettimeofday.c    |   61 -
>  sysdeps/unix/sysv/linux/x86/time.c            |   59 -
>  .../unix/sysv/linux/x86_64/64/libc.abilist    |    1 -
>  .../unix/sysv/linux/x86_64/64/librt.abilist   |    5 -
>  .../unix/sysv/linux/x86_64/x32/libc.abilist   |    1 -
>  .../unix/sysv/linux/x86_64/x32/librt.abilist  |    5 -
>  .../unix/sysv/linux/x86_64/x32/syscalls.list  |    2 -
>  time/Makefile                                 |    8 +-
>  time/Versions                                 |    2 +-
>  {rt => time}/clock_getcpuclockid.c            |    0
>  {rt => time}/clock_getres.c                   |    0
>  {rt => time}/clock_gettime.c                  |    0
>  {rt => time}/clock_nanosleep.c                |    0
>  {rt => time}/clock_settime.c                  |    1 +
>  time/ftime.c                                  |   26 +-
>  time/getdate.c                                |    2 +-
>  time/gettimeofday.c                           |   30 +-
>  time/settimeofday.c                           |   24 +-
>  sysdeps/unix/stime.c => time/settimezone.c    |   23 +-
>  time/stime.c                                  |   15 +-
>  time/sys/time.h                               |   36 +-
>  time/time.c                                   |   17 +-
>  {rt => time}/tst-clock.c                      |    0
>  {rt => time}/tst-clock2.c                     |    0
>  {rt => time}/tst-clock_nanosleep.c            |    0
>  {rt => time}/tst-cpuclock1.c                  |    0
>  time/tst_wcsftime.c                           |    2 +-
>  156 files changed, 1580 insertions(+), 1775 deletions(-)
>  delete mode 100644 rt/clock-compat.c
>  rename sysdeps/mach/{gettimeofday.c => clock_gettime.c} (67%)
>  rename sysdeps/mach/hurd/{settimeofday.c => clock_settime.c} (71%)
>  delete mode 100644 sysdeps/posix/gettimeofday.c
>  delete mode 100644 sysdeps/posix/time.c
>  delete mode 100644 sysdeps/unix/clock_gettime.c
>  delete mode 100644 sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
>  rename sysdeps/unix/sysv/linux/{time.c => alpha/gettimeofday.c} (64%)
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_adjtime.c
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_getitimer.c
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_getrusage.c
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_setitimer.c
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_settimeofday.c
>  rename sysdeps/unix/{bsd/ftime.c => sysv/linux/alpha/osf_utimes.c}
> (60%) rename sysdeps/unix/{clock_settime.c =>
> sysv/linux/alpha/osf_wait4.c} (55%) create mode 100644
> sysdeps/unix/sysv/linux/alpha/settimeofday.c create mode 100644
> sysdeps/unix/sysv/linux/alpha/tv32-compat.h delete mode 100644
> sysdeps/unix/sysv/linux/ftime.c delete mode 100644
> sysdeps/unix/sysv/linux/gettimeofday.c delete mode 100644
> sysdeps/unix/sysv/linux/i386/gettimeofday.c delete mode 100644
> sysdeps/unix/sysv/linux/i386/time.c delete mode 100644
> sysdeps/unix/sysv/linux/powerpc/gettimeofday.c delete mode 100644
> sysdeps/unix/sysv/linux/powerpc/time.c create mode 100644
> sysdeps/unix/sysv/linux/settimezone.c delete mode 100644
> sysdeps/unix/sysv/linux/sparc/sparc64/time.c delete mode 100644
> sysdeps/unix/sysv/linux/x86/gettimeofday.c delete mode 100644
> sysdeps/unix/sysv/linux/x86/time.c rename {rt =>
> time}/clock_getcpuclockid.c (100%) rename {rt => time}/clock_getres.c
> (100%) rename {rt => time}/clock_gettime.c (100%)
>  rename {rt => time}/clock_nanosleep.c (100%)
>  rename {rt => time}/clock_settime.c (96%)
>  rename sysdeps/unix/stime.c => time/settimezone.c (67%)
>  rename {rt => time}/tst-clock.c (100%)
>  rename {rt => time}/tst-clock2.c (100%)
>  rename {rt => time}/tst-clock_nanosleep.c (100%)
>  rename {rt => time}/tst-cpuclock1.c (100%)
> 



Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de