mbox series

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

Message ID 20191025120832.27667-1-adhemerval.zanella@linaro.org
Headers show
Series Y2038 preparation: use clock_[gs]ettime to implement the other time-getting and -setting functions. | expand

Message

Adhemerval Zanella Netto Oct. 25, 2019, 12:08 p.m. UTC
This is an updated version from Zack Weinberg patchset [1].

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.  I also changed the
internal uses of time(), which allowed some cleanup in arch
specific code.

The user-visible consequences of this patchset are:

 - The obsolete function stime is no longer availabe to new binaries
   and the function ftime is marked as deprecated.
 - 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).

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.)

I ran build-many-glibcs on most abi targets (aarch64, alpha, arm-eabihf,
csky, hppa, ia64, m68k, m68k-coldfire, microblaze, microblazeel, mips64,
powerpc64, powercp64le, riscv64, s390x, and x86_64), I couldn't run
on i686-gnu due it is currently broken on master.

The patches were tested fully on x86_64-linux-gnu, i686-linux-gnu,
powerpc64le-linux-gnu, powerpc64-linux-gnu, powerpc-linux-gnu, and
aarch64-linux-gnu.

[1] https://sourceware.org/ml/libc-alpha/2019-08/msg00725.html

Adhemerval Zanella (3):
  Use clock_gettime to implement time.
  Change most internal uses of time to __clock_gettime.
  Use clock_gettime to implement gettimeofday.

Zack Weinberg (8):
  Linux/Alpha: don't use timeval32 system calls.
  Change most internal uses of __gettimeofday to __clock_gettime.
  Use clock_settime to implement stime; withdraw stime.
  Use clock_settime to implement settimeofday.
  Consolidate and deprecate ftime
  Use clock_gettime to implement timespec_get.
  Make second argument of gettimeofday as 'void *'
  Revise the documentation of simple calendar time.

 NEWS                                          |   46 +
 include/sys/time.h                            |    7 +-
 include/time.h                                |   11 +-
 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                              | 1072 ++++++++++-------
 misc/syslog.c                                 |    2 +-
 nis/nis_call.c                                |    4 +-
 nptl/pthread_join_common.c                    |    7 +-
 nptl/pthread_mutex_timedlock.c                |    7 +-
 nscd/nscd_gethst_r.c                          |    2 +-
 nscd/nscd_helper.c                            |   28 +-
 resolv/gai_misc.c                             |    6 +-
 resolv/gai_suspend.c                          |    6 +-
 resolv/res_send.c                             |    7 +-
 string/strfry.c                               |    4 +-
 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/{unix => mach}/clock_gettime.c        |   37 +-
 sysdeps/{unix => mach/hurd}/clock_settime.c   |   51 +-
 sysdeps/mach/hurd/getitimer.c                 |   11 +-
 sysdeps/mach/hurd/setitimer.c                 |   13 +-
 sysdeps/mach/hurd/times.c                     |    7 +-
 sysdeps/mach/nanosleep.c                      |   36 +-
 sysdeps/mach/usleep.c                         |    5 -
 sysdeps/posix/gettimeofday.c                  |   67 --
 sysdeps/posix/tempname.c                      |    9 +-
 sysdeps/pthread/aio_misc.c                    |    6 +-
 sysdeps/pthread/aio_suspend.c                 |    6 +-
 sysdeps/unix/make-syscalls.sh                 |    2 +-
 sysdeps/unix/syscalls.list                    |    2 -
 sysdeps/unix/sysv/linux/Makefile              |    2 +-
 .../unix/sysv/linux/aarch64/gettimeofday.c    |   38 +-
 sysdeps/unix/sysv/linux/adjtime.c             |   40 +-
 sysdeps/unix/sysv/linux/adjtimex.c            |   40 +
 sysdeps/unix/sysv/linux/alpha/Makefile        |    2 +-
 sysdeps/unix/sysv/linux/alpha/adjtime.c       |   82 +-
 sysdeps/unix/sysv/linux/alpha/adjtimex.c      |   22 +
 .../linux/{time.c => alpha/gettimeofday.c}    |   31 +-
 sysdeps/unix/sysv/linux/alpha/osf_adjtime.c   |  130 ++
 .../sysv/linux/alpha/osf_getitimer.c}         |   40 +-
 .../linux/alpha/osf_getrusage.c}              |   33 +-
 .../unix/sysv/linux/alpha/osf_gettimeofday.c  |   48 +
 sysdeps/unix/sysv/linux/alpha/osf_setitimer.c |   49 +
 .../sysv/linux/alpha/osf_settimeofday.c}      |   51 +-
 .../gettimeofday.c => alpha/osf_utimes.c}     |   36 +-
 .../sysv/linux/alpha/osf_wait4.c}             |   41 +-
 sysdeps/unix/sysv/linux/alpha/settimeofday.c  |   22 +
 sysdeps/unix/sysv/linux/alpha/syscalls.list   |   26 +-
 sysdeps/unix/sysv/linux/alpha/tv32-compat.h   |  146 +++
 sysdeps/unix/sysv/linux/check_native.c        |    2 +-
 sysdeps/unix/sysv/linux/check_pf.c            |    2 +-
 sysdeps/unix/sysv/linux/ftime.c               |    3 -
 sysdeps/unix/sysv/linux/getsysstats.c         |    2 +-
 sysdeps/unix/sysv/linux/gettimeofday.c        |   39 -
 sysdeps/unix/sysv/linux/ifaddrs.c             |    2 +-
 .../unix/sysv/linux/powerpc/gettimeofday.c    |   71 +-
 sysdeps/unix/sysv/linux/powerpc/time.c        |   71 +-
 sysdeps/unix/sysv/linux/settimezone.c         |   36 +
 sysdeps/unix/sysv/linux/syscalls.list         |    2 -
 .../linux/{i386/time.c => time-internal.h}    |   24 +-
 sysdeps/unix/sysv/linux/timespec_get.c        |   46 -
 sysdeps/unix/sysv/linux/x86/gettimeofday.c    |   47 +-
 sysdeps/unix/sysv/linux/x86/time.c            |   34 +-
 .../unix/sysv/linux/x86_64/x32/gettimeofday.c |    1 +
 .../unix/sysv/linux/x86_64/x32/syscalls.list  |    1 -
 time/Makefile                                 |    8 +-
 time/ftime.c                                  |   26 +-
 time/getdate.c                                |    2 +-
 time/gettimeofday.c                           |   32 +-
 time/settimeofday.c                           |   24 +-
 sysdeps/unix/stime.c => time/settimezone.c    |   23 +-
 time/stime.c                                  |   25 +-
 time/sys/time.h                               |   23 +-
 time/sys/timeb.h                              |    3 +-
 .../timespec_get.c => time/time-internal.h    |   26 +-
 time/time.c                                   |   14 +-
 time/time.h                                   |    6 -
 time/timespec_get.c                           |   14 +-
 time/tst-ftime.c                              |    7 +
 88 files changed, 1681 insertions(+), 1393 deletions(-)
 rename sysdeps/{unix => mach}/clock_gettime.c (65%)
 rename sysdeps/{unix => mach/hurd}/clock_settime.c (65%)
 delete mode 100644 sysdeps/posix/gettimeofday.c
 create mode 100644 sysdeps/unix/sysv/linux/adjtimex.c
 create mode 100644 sysdeps/unix/sysv/linux/alpha/adjtimex.c
 rename sysdeps/unix/sysv/linux/{time.c => alpha/gettimeofday.c} (64%)
 create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_adjtime.c
 rename sysdeps/{mach/gettimeofday.c => unix/sysv/linux/alpha/osf_getitimer.c} (50%)
 rename sysdeps/unix/{bsd/ftime.c => sysv/linux/alpha/osf_getrusage.c} (59%)
 create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c
 create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_setitimer.c
 rename sysdeps/{mach/hurd/settimeofday.c => unix/sysv/linux/alpha/osf_settimeofday.c} (54%)
 rename sysdeps/unix/sysv/linux/{i386/gettimeofday.c => alpha/osf_utimes.c} (56%)
 rename sysdeps/{posix/time.c => unix/sysv/linux/alpha/osf_wait4.c} (51%)
 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
 create mode 100644 sysdeps/unix/sysv/linux/settimezone.c
 rename sysdeps/unix/sysv/linux/{i386/time.c => time-internal.h} (62%)
 delete mode 100644 sysdeps/unix/sysv/linux/timespec_get.c
 create mode 100644 sysdeps/unix/sysv/linux/x86_64/x32/gettimeofday.c
 rename sysdeps/unix/stime.c => time/settimezone.c (67%)
 rename sysdeps/posix/timespec_get.c => time/time-internal.h (62%)

-- 
2.17.1