From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 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 dcvr.yhbt.net (Postfix) with ESMTPS id CF3CE1F461 for ; Wed, 17 Jul 2019 00:12:21 +0000 (UTC) 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:in-reply-to :references:mime-version:content-transfer-encoding; q=dns; s= default; b=OdY/iaFjDVVII9icDt/rEkNmxPmLciaCM9hhYmxSIwlcTG2h0cZKR gaf5JoEAJFX+Y9txC6uImiY06N9B2MmNWZsrcSxNOQsszXTm9fZMfd1OMPvFgOCu /adqa/Ch95p+UfIZjSFQPA6cihEFvEXs2wHeMp3xQTfAn9wVQCryIU= 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:in-reply-to :references:mime-version:content-transfer-encoding; s=default; bh=nnFWuIx6MgLTUWJB3Yytcpvj8sM=; b=jYZhsudAoG4MYKoLCtEFHCNSoAos xXwMdwXhoQKXuXQHYHE28KRKalCxx4eNnRFtFcTRh8PRXbA4TH/bZkva5d0pgYRO fmz9Hq6w4NCOpuApT3r8B7/jEI/IHTMSjunv2tv3mrmPMQOehuKX7SPBCTYoPK9I r65nKAOl9wXzJ/E= Received: (qmail 15570 invoked by alias); 17 Jul 2019 00:11: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 Received: (qmail 15494 invoked by uid 89); 17 Jul 2019 00:11:45 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: esa4.hgst.iphmx.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1563322304; x=1594858304; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ja+hgOQfjiA3Bk/oGNBYwkRBNPtZqBH6L2JpULdsFbY=; b=UhC89DK47958lUnY15AHON0B21k5e8HIRNrmwHDYy0r3GWodGeqXj7ZW t6GbR3vFhMN6ZyIVSWgnXmWcvvfdLDcc0nCg2vbVoggdyAAYxM/hLvJUs s7y9vycEADZDWo6dNvxoZf2AuKsJ5WaiGRD4mwET6zv61jDIjmO6A6kIZ nZAz+a49NOtC4NorVYJEiGkSgsHpoczO+dFplOzBGGEQ0qzWYRnkq9R79 rdBalcdLytO9NfFahfGwX/IujhG0fvv8rVo5ydnyfUOm6mq0nL4QGHOtR tdBaRu88tOD8Q6TXJ6L7pzpksCDhWlWmZ8VaKw1dLnjl5WNDYzLgO8lPY w==; IronPort-SDR: AEmiGnllEmj0W/yQ0md8/Lh/aV7tmMvQEnCiSx6znzVPGxhE4lNNOmvC45VQHh9K7Jdr9vEz5w Di+p2tOtfXV4Kvvo8Aitu/H8XPqSVzi1LmDsRAEO8NFJeZ8WQDtNqmryjANF5HHEubSd0dT1xB gQxYiF9iMZNcCgJz+TkTH644oMjQiGV9ZmI9TsPr/M6OcJcidxwL1THZZ9ErSOKTUCc/6pJNWc /f3i97NVrHlB73X+m4F9Rfx56BjEuJj2dgcU3QL2FURX7f7zlg5wQJfzItVxYo0mBNyBPrKrSs RV0= IronPort-SDR: Gl6mXgwMymifJdbyb7ZkkosaoKtS8SR5Eygh1J1/yLhk0B7E4nCtwAW/mR61jWvujPqkW466JE qFJNjzlaRKT4lmorhaw2GIR9tllHCuwaHBVFeS9KR354ge4crGmT8MK/1o64UUxMYyZsMG4rmq 1sdH4aDBRf84WwnAZcXLkoqaJGrLjdVhzCGGcvC9uvlhwf/9wIqVyANhg1p/rvxLKl3wrdtw/y 1ozo9K+g4QXw0Vy0WZm6a2v+qYGmi+CsHjAZDVEA9/T4IUcUVb7fazQO+wgktpLwZBhAscfo2Q Xdxz1g2TRRdaxepK1WhaPMAN IronPort-SDR: 9DZs/PNUDNHwl/8E8QB7KTSXg3p1dPJQGzBLborV10Z7e9QDpv3bN/50E5WI3gwIF6JvTGlwMQ dbxl5pY0qujBG+iGvlK4VG9xHUb9mdgBae7stXy04DotdFzPf4DOswv4xSRz+1vFqT1CJYNnp1 Owdz0j7XXrRme5h2eQyvS0Tykr/Gw1Ryr3896PAnyHYtLOcrZa+mtN4E+Si1hluAasCCNYWNFX rMNfjqnIgKdVlzKNsDhDrnBoVljmgZ7Sx7HX/Dp0OI2/1viqwrYp1QIIsUOBLP0ZFBSvCbTHFU Hso= From: Alistair Francis To: libc-alpha@sourceware.org Cc: arnd@arndb.de, adhemerval.zanella@linaro.org, fweimer@redhat.com, palmer@sifive.com, macro@wdc.com, zongbox@gmail.com, alistair.francis@wdc.com, alistair23@gmail.com Subject: [RFC v3 04/23] sysdeps/clock_gettime: Use clock_gettime64 if avaliable Date: Tue, 16 Jul 2019 17:08:51 -0700 Message-Id: <1f589e5a3fcaa4c103bc83169fffcdea9e1a6b2d.1563321715.git.alistair.francis@wdc.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Signed-off-by: Alistair Francis --- nptl/pthread_mutex_timedlock.c | 7 ++++++ sysdeps/unix/sysv/linux/clock_gettime.c | 30 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c index 52c258e33d..8d9cae7d87 100644 --- a/nptl/pthread_mutex_timedlock.c +++ b/nptl/pthread_mutex_timedlock.c @@ -402,10 +402,17 @@ __pthread_mutex_clocklock_common (pthread_mutex_t *mutex, /* Delay the thread until the timeout is reached. Then return ETIMEDOUT. */ struct timespec reltime; +#ifdef __NR_clock_gettime64 + struct __timespec64 now; + + INTERNAL_SYSCALL (clock_gettime64, __err, 2, CLOCK_REALTIME, + &now); +#else struct timespec now; INTERNAL_SYSCALL (clock_gettime, __err, 2, clockid, &now); +#endif reltime.tv_sec = abstime->tv_sec - now.tv_sec; reltime.tv_nsec = abstime->tv_nsec - now.tv_nsec; if (reltime.tv_nsec < 0) diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c index 5fc47fb7dc..4832069c34 100644 --- a/sysdeps/unix/sysv/linux/clock_gettime.c +++ b/sysdeps/unix/sysv/linux/clock_gettime.c @@ -27,10 +27,40 @@ #include /* Get current value of CLOCK and store it in TP. */ + +#if __WORDSIZE == 32 +int +__clock_gettime (clockid_t clock_id, struct timespec *tp) +{ + int ret; + +#ifdef __NR_clock_gettime64 + struct __timespec64 tp64; + ret = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, &tp64); + + tp->tv_sec = tp64.tv_sec; + tp->tv_nsec = tp64.tv_nsec; + + if (! in_time_t_range (tp->tv_sec)) + { + __set_errno (EOVERFLOW); + return -1; + } +#endif + +#ifndef __ASSUME_TIME64_SYSCALLS + ret = INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp); +#endif + + return ret; +} +#else int __clock_gettime (clockid_t clock_id, struct timespec *tp) { return INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp); } +#endif + weak_alias (__clock_gettime, clock_gettime) libc_hidden_def (__clock_gettime) -- 2.22.0