From patchwork Fri Oct 25 12:08:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 1184082 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-106281-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="ZX+5kX1d"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="CqwrGq74"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4702vn4n8sz9sPZ for ; Fri, 25 Oct 2019 23:08:53 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; q=dns; s= default; b=Na1yYFJqc7DgJt+r2n4uvNhmUYCzodXs4R1k57ArgDSAlRdBjdAiJ BbKy+HhXFwl4yGJUk45T4g1kcDuAV1/LKWGLwPudvxaQ94pAu2tHTIPHC4C7glz3 4nXiMW3nT7GBgKVutMB9MnvNrQCuq+gshsmC+qay8B7aFiYx59lNdc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; s=default; bh=F1GupYnbY35DHURtlMRrwzOgL/o=; b=ZX+5kX1dvPf81Lvfh4F38EqsGoVp RJxPfomRi+dOhXaJU4MqHIIfi1ILKxvwseKeBlRJKu0oxDoib8mCygJAYQ+lS2Ps BQUNunsXLpv3QqvRWhzzfr1Cy64pyyCwlb24X91aNLpxzfnOAG7kb1W5Z/Qq4AJi gAGU3zz8Owy1Ais= Received: (qmail 76336 invoked by alias); 25 Oct 2019 12:08:45 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 76327 invoked by uid 89); 25 Oct 2019 12:08:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-13.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=withdraw, aims X-HELO: mail-qk1-f195.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=10SPGclZ4SGETbtTnWpx2c/jR4w84NuY3nO6ko3Rf5Q=; b=CqwrGq74tkgFcGBOjd1Am3sA2gAFgRMTAihCX/S+bC3n3S5yAfLYb1O+h0OfmIutEl lk3k8iy54iMTBUB0fo+sV8EFvak06BW9aWq9ykMvv6/rPVv+7lTi7gIjB3P1VGwZXAZ9 j6L7kyqlnIAPdKWGlxyjpC7UhVY6GzcwqK2tNH1KTidzzjH/K96vSB2e4/1ClGnx0W44 TbuwV/INBUurHmWAvsB4yA1FugGwgN9DPWDOvSowDivbG9ssKv9HdNvYtAmbhSguGfsV pZ1OiXXwU8PcY/Zd6iRT9I2RQ76EgU2giJDxkhf51/X6Syk6qFH3QJLa8m2f2MuvOMxm 5teQ== From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Lukasz Majewski Subject: [PATCH v2 00/11] Y2038 preparation: use clock_[gs]ettime to implement the other time-getting and -setting functions. Date: Fri, 25 Oct 2019 09:08:21 -0300 Message-Id: <20191025120832.27667-1-adhemerval.zanella@linaro.org> 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%)