public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 00/10] Y2038 preparation: use clock_[gs]ettime to implement the other time-getting and -setting functions.
@ 2019-08-28 15:32 Zack Weinberg
  2019-08-28 15:32 ` [PATCH v2 03/10] Use clock_settime to implement stime; withdraw stime Zack Weinberg
                   ` (10 more replies)
  0 siblings, 11 replies; 44+ messages in thread
From: Zack Weinberg @ 2019-08-28 15:32 UTC (permalink / raw)
  To: libc-alpha
  Cc: Joseph Myers, Florian Weimer, Lukasz Majewski, Alistair Francis,
	Stepan Golosunov, Arnd Bergmann, Adhemerval Zanella,
	Samuel Thibault

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.

The user-visible consequences of this patchset are:

 - The obsolete functions ftime and stime are no longer available to
   new binaries.  The header <sys/timeb.h> is no longer installed.
 - gettimeofday and ftime now always report a crude time zone
   corresponding to UTC.
 - settimeofday will fail with EINVAL when both of its arguments are
   non-null.
 - Programs that call gettimeofday with a non-null tzp argument will
   receive compile-time warnings (with GCC and when optimizing).
 - On Linux, the (v)syscalls time and gettimeofday are no longer used
   under any circumstances.

See the final patch in the series for edits to NEWS describing these
changes in more detail.

This patchset also includes a partial revision of manual/time.tex.i
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.)

This patchset has a structural dependency on the patch "Linux/Alpha:
don't use timeval32 system calls."  I think that patch needs to be
reviewed and discussed separately since it has implications for how we
implement 32-bit time_t compatibility in general.  Some but not all of
the patches in this set could be re-done to avoid the dependency, but
I don't think there's much point.

Each individual patch in this series has been tested with
build-many-glibcs targeting alpha-linux-gnu, i686-gnu, and
x86_64-linux-gnu-enable-obsolete.  The complete patch series has been
tested with a full build-many-glibcs run and a full "make xcheck" run
in the x86_64-linux-gnu-enable-obsolete configuration.

Changes since v1:

 - Demote ftime and stime to compat symbols.
 - Also use clock_gettime to implement timespec_get.
 - Better implementation of warnings for gettimeofday with non-null
   tzp argument.
 - Patch series reorganized for ease of review and to ensure all
   intermediate stages work correctly on all supported platforms.
   In particular, gettimeofday and settimeofday have fully operational
   implementations on the Hurd at all stages of the series.
 - I believe all previous review comments have been addressed.

Zack Weinberg (10):
  Change most internal uses of __gettimeofday to __clock_gettime.
  Finish move of clock_* functions to libc.
  Use clock_settime to implement stime; withdraw stime.
  Use clock_settime to implement settimeofday.
  Use clock_gettime to implement time.
  Use clock_gettime to implement ftime; withdraw ftime.
  Use clock_gettime to implement timespec_get.
  Use clock_gettime to implement gettimeofday.
  Warn when gettimeofday is called with non-null tzp argument.
  Revise the documentation of simple calendar time.

 NEWS                                          |   62 +-
 conform/Makefile                              |    9 +
 debug/warning-nop.c                           |    9 +
 include/sys/time.h                            |    7 +-
 include/time.h                                |    4 +-
 inet/deadline.c                               |    8 +-
 login/logout.c                                |    9 +-
 login/logwtmp.c                               |    7 +-
 manual/filesys.texi                           |    2 +-
 manual/llio.texi                              |   10 +-
 manual/threads.texi                           |    2 +-
 manual/time.texi                              | 1071 ++++++++++-------
 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                             |    7 +-
 rt/Makefile                                   |   15 +-
 rt/Versions                                   |   16 -
 rt/clock-compat.c                             |   63 -
 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                   |   23 +-
 sysdeps/generic/memusage.h                    |   16 +-
 sysdeps/mach/clock_gettime.c                  |   51 +
 sysdeps/mach/gettimeofday.c                   |   43 -
 .../hurd/{settimeofday.c => clock_settime.c}  |   36 +-
 sysdeps/mach/hurd/getitimer.c                 |    6 +-
 sysdeps/mach/hurd/i386/libc.abilist           |    5 +
 sysdeps/mach/hurd/i386/librt.abilist          |    5 -
 sysdeps/mach/hurd/setitimer.c                 |    8 +-
 sysdeps/mach/hurd/times.c                     |    7 +-
 sysdeps/mach/nanosleep.c                      |   36 +-
 sysdeps/mach/usleep.c                         |    5 -
 sysdeps/posix/clock_getres.c                  |   11 +-
 sysdeps/posix/gettimeofday.c                  |   67 --
 sysdeps/posix/tempname.c                      |    9 +-
 sysdeps/posix/time.c                          |   40 -
 sysdeps/posix/timespec_get.c                  |   38 -
 sysdeps/pthread/aio_misc.c                    |    6 +-
 sysdeps/pthread/aio_suspend.c                 |    6 +-
 sysdeps/unix/bsd/ftime.c                      |   40 -
 sysdeps/unix/clock_gettime.c                  |   64 -
 sysdeps/unix/clock_nanosleep.c                |   10 +-
 sysdeps/unix/clock_settime.c                  |   54 -
 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 -
 .../linux/{time.c => alpha/gettimeofday.c}    |   31 +-
 sysdeps/unix/sysv/linux/alpha/libc.abilist    |    5 +
 sysdeps/unix/sysv/linux/alpha/librt.abilist   |    5 -
 .../unix/sysv/linux/alpha/osf_gettimeofday.c  |   11 +-
 .../unix/sysv/linux/alpha/osf_settimeofday.c  |   16 +-
 sysdeps/unix/sysv/linux/alpha/settimeofday.c  |   22 +
 sysdeps/unix/sysv/linux/alpha/syscalls.list   |    2 -
 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      |    5 +
 sysdeps/unix/sysv/linux/arm/librt.abilist     |    5 -
 sysdeps/unix/sysv/linux/clock_getcpuclockid.c |   10 +-
 sysdeps/unix/sysv/linux/clock_getres.c        |   11 +-
 sysdeps/unix/sysv/linux/clock_gettime.c       |   11 +-
 sysdeps/unix/sysv/linux/clock_nanosleep.c     |   10 +-
 sysdeps/unix/sysv/linux/clock_settime.c       |   11 +-
 sysdeps/unix/sysv/linux/ftime.c               |    3 -
 sysdeps/unix/sysv/linux/gettimeofday.c        |   49 -
 sysdeps/unix/sysv/linux/hppa/libc.abilist     |    5 +
 sysdeps/unix/sysv/linux/hppa/librt.abilist    |    5 -
 sysdeps/unix/sysv/linux/i386/gettimeofday.c   |   35 -
 sysdeps/unix/sysv/linux/i386/libc.abilist     |    5 +
 sysdeps/unix/sysv/linux/i386/librt.abilist    |    5 -
 sysdeps/unix/sysv/linux/i386/time.c           |   34 -
 sysdeps/unix/sysv/linux/ia64/libc.abilist     |    5 +
 sysdeps/unix/sysv/linux/ia64/librt.abilist    |    5 -
 .../sysv/linux/m68k/coldfire/libc.abilist     |    5 +
 .../sysv/linux/m68k/coldfire/librt.abilist    |    5 -
 .../unix/sysv/linux/m68k/m680x0/libc.abilist  |    5 +
 .../unix/sysv/linux/m68k/m680x0/librt.abilist |    5 -
 .../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   |    5 +
 .../unix/sysv/linux/mips/mips32/librt.abilist |    5 -
 .../sysv/linux/mips/mips32/nofpu/libc.abilist |    5 +
 .../unix/sysv/linux/mips/mips64/librt.abilist |    5 -
 .../sysv/linux/mips/mips64/n32/libc.abilist   |    5 +
 .../sysv/linux/mips/mips64/n64/libc.abilist   |    5 +
 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  |    5 +
 .../linux/powerpc/powerpc32/librt.abilist     |    5 -
 .../powerpc/powerpc32/nofpu/libc.abilist      |    5 +
 .../linux/powerpc/powerpc64/be/libc.abilist   |    5 +
 .../linux/powerpc/powerpc64/be/librt.abilist  |    5 -
 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 -
 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 |    5 +
 .../sysv/linux/s390/s390-32/librt.abilist     |    5 -
 .../unix/sysv/linux/s390/s390-64/libc.abilist |    5 +
 .../sysv/linux/s390/s390-64/librt.abilist     |    5 -
 .../{stime.c => sysv/linux/settimezone.c}     |   30 +-
 sysdeps/unix/sysv/linux/sh/libc.abilist       |    5 +
 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     |    5 +
 .../sysv/linux/sparc/sparc32/librt.abilist    |    5 -
 .../sysv/linux/sparc/sparc64/libc.abilist     |    5 +
 .../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/timespec_get.c        |   46 -
 sysdeps/unix/sysv/linux/x86/gettimeofday.c    |   61 -
 sysdeps/unix/sysv/linux/x86/time.c            |   59 -
 .../unix/sysv/linux/x86_64/64/libc.abilist    |    5 +
 .../unix/sysv/linux/x86_64/64/librt.abilist   |    5 -
 .../unix/sysv/linux/x86_64/x32/libc.abilist   |    5 +
 .../unix/sysv/linux/x86_64/x32/librt.abilist  |    5 -
 .../unix/sysv/linux/x86_64/x32/syscalls.list  |    2 -
 time/Makefile                                 |   20 +-
 time/Versions                                 |   13 +
 {rt => time}/clock_getcpuclockid.c            |    9 +-
 time/clock_getres.c                           |   39 +
 {rt => time}/clock_gettime.c                  |   11 +-
 {rt => time}/clock_nanosleep.c                |   11 +-
 {rt => time}/clock_settime.c                  |   12 +-
 time/ftime.c                                  |   40 +-
 time/gettimeofday.c                           |   32 +-
 time/settimeofday.c                           |   24 +-
 rt/clock_getres.c => time/settimezone.c       |   12 +-
 time/stime.c                                  |   25 +-
 time/sys/time.h                               |   47 +-
 time/sys/timeb.h                              |   43 -
 time/time.c                                   |   12 +-
 time/time.h                                   |    6 -
 time/timespec_get.c                           |   14 +-
 {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-ftime.c                              |   58 -
 time/{tst-ftime_l.c => tst-strftime_l.c}      |    0
 153 files changed, 1376 insertions(+), 2011 deletions(-)
 delete mode 100644 rt/clock-compat.c
 create mode 100644 sysdeps/mach/clock_gettime.c
 delete mode 100644 sysdeps/mach/gettimeofday.c
 rename sysdeps/mach/hurd/{settimeofday.c => clock_settime.c} (60%)
 delete mode 100644 sysdeps/posix/gettimeofday.c
 delete mode 100644 sysdeps/posix/time.c
 delete mode 100644 sysdeps/posix/timespec_get.c
 delete mode 100644 sysdeps/unix/bsd/ftime.c
 delete mode 100644 sysdeps/unix/clock_gettime.c
 delete mode 100644 sysdeps/unix/clock_settime.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/settimeofday.c
 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
 rename sysdeps/unix/{stime.c => sysv/linux/settimezone.c} (64%)
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/time.c
 delete mode 100644 sysdeps/unix/sysv/linux/timespec_get.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 (75%)
 create mode 100644 time/clock_getres.c
 rename {rt => time}/clock_gettime.c (74%)
 rename {rt => time}/clock_nanosleep.c (76%)
 rename {rt => time}/clock_settime.c (71%)
 rename rt/clock_getres.c => time/settimezone.c (73%)
 delete mode 100644 time/sys/timeb.h
 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%)
 delete mode 100644 time/tst-ftime.c
 rename time/{tst-ftime_l.c => tst-strftime_l.c} (100%)

-- 
2.23.0

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

end of thread, other threads:[~2019-09-10 17:32 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-28 15:32 [PATCH v2 00/10] Y2038 preparation: use clock_[gs]ettime to implement the other time-getting and -setting functions Zack Weinberg
2019-08-28 15:32 ` [PATCH v2 03/10] Use clock_settime to implement stime; withdraw stime Zack Weinberg
2019-08-30 17:55   ` Adhemerval Zanella
2019-08-28 15:32 ` [PATCH v2 07/10] Use clock_gettime to implement timespec_get Zack Weinberg
2019-09-02 19:25   ` Adhemerval Zanella
2019-08-28 15:32 ` [PATCH v2 10/10] Revise the documentation of simple calendar time Zack Weinberg
2019-08-29  1:09   ` Paul Eggert
2019-08-29 17:41     ` Zack Weinberg
2019-08-30 19:17       ` Paul Eggert
2019-08-28 15:32 ` [PATCH v2 02/10] Finish move of clock_* functions to libc Zack Weinberg
2019-08-30 17:41   ` Adhemerval Zanella
2019-09-03  7:29   ` Florian Weimer
2019-09-03 13:25     ` Adhemerval Zanella
2019-09-03 13:31       ` Florian Weimer
2019-09-03 13:44         ` Adhemerval Zanella
2019-09-03 14:35           ` Zack Weinberg
2019-09-03 18:50             ` Adhemerval Zanella
2019-08-28 15:32 ` [PATCH v2 08/10] Use clock_gettime to implement gettimeofday Zack Weinberg
2019-08-28 18:28   ` Florian Weimer
2019-09-02 19:31     ` Adhemerval Zanella
2019-08-28 15:32 ` [PATCH v2 05/10] Use clock_gettime to implement time Zack Weinberg
2019-08-28 18:16   ` Florian Weimer
2019-08-28 18:36     ` Zack Weinberg
2019-08-28 18:49       ` Florian Weimer
2019-08-28 20:01     ` Paul Eggert
2019-08-28 20:21       ` Florian Weimer
2019-08-28 21:12         ` Paul Eggert
2019-08-28 21:39           ` Florian Weimer
2019-08-29 17:49             ` Zack Weinberg
2019-09-02 13:32               ` Florian Weimer
2019-09-02 18:35                 ` Adhemerval Zanella
2019-08-28 15:32 ` [PATCH v2 06/10] Use clock_gettime to implement ftime; withdraw ftime Zack Weinberg
2019-09-02 18:42   ` Adhemerval Zanella
2019-08-28 15:32 ` [PATCH v2 01/10] Change most internal uses of __gettimeofday to __clock_gettime Zack Weinberg
2019-08-29 20:30   ` Adhemerval Zanella
2019-08-29 20:42     ` Samuel Thibault
2019-08-28 15:47 ` [PATCH v2 04/10] Use clock_settime to implement settimeofday Zack Weinberg
2019-09-02 13:22   ` Adhemerval Zanella
2019-09-03 14:45     ` Zack Weinberg
2019-08-28 15:47 ` [PATCH v2 09/10] Warn when gettimeofday is called with non-null tzp argument Zack Weinberg
2019-09-03 19:56   ` Adhemerval Zanella
2019-08-28 17:15 ` [PATCH v2 00/10] Y2038 preparation: use clock_[gs]ettime to implement the other time-getting and -setting functions Joseph Myers
2019-09-03 14:43   ` Zack Weinberg
2019-09-10 17:32     ` 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).