From patchwork Sat Jun 22 04:37:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1120602 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-102928-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="EtFo5EVs"; dkim=pass (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="hILZ3ztA"; 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 45W31d0tP8z9s6w for ; Sat, 22 Jun 2019 14:47:00 +1000 (AEST) 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=vw5XRjnHSY2xWYkk0s3a/ctaGjBHVlhuOvUgVQLaJb6kOQOr9Iyff Egi7qWa4HKmMxHyU4kE1FA+gGYdgXqTbaT7JqkbYYNVK80xi3GuKa282RTmSdINt enqSCRQv0a5l2M33Ed85J33BdS8Ft6yW12cBBW3ejK4bQW+X5j3gE4= 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=zJkwt3Ng9iqGPnnDByP3hPR46F4=; b=EtFo5EVsPyaylLzi1//c5Ja2kqe+ OVYQsvwxHjwPWOW2vgP4usrZLXKH+VQ4YljObnjgiWxAHSavjQ/a5GUhmMwmluyt hWOXLpuXLgl0YdIlykEC2yBV6dHaLivCHt7e8IvhFjL1YqFhIPCBbn5u3JUBAN/H QdLbR/9yTnnERM0= Received: (qmail 94281 invoked by alias); 22 Jun 2019 04:46:53 -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 94272 invoked by uid 89); 22 Jun 2019 04:46:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: esa5.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=1561178813; x=1592714813; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XyJVHBV++9p9/mGOLrTKC7pMrZt0csYv9vwgh3VvWIQ=; b=hILZ3ztAXFKa7Ege9Q2ucCrBMtHOpgfB3gwr8+ksL9XdapoI0gEg+DOP rGe4h2r+93CatSVrMDVsFnMS3JRU/eahhbjrJqGEq7hn49Sv8cToEt2l3 CDXpqHSZwJ+4qn+lp0oWRhjN2IxCWOHLOHUS1R2tsjCrhBVAC7ttXKc2M dV3PaByWmCmpiI0LqQxk2PaHGdkIdXFtnbcwavfoeXIMEhIZ9s58LzYNx /3gD8l2w20Y+FsiiDRu+FDMT938uaaPhCrfb7NqolrykDUPkwlKSmTqgj ZCMDtSEOXI5eRrL5r8oKtm+3CEwqPDPyiklsoSBcxYWMElir3R1T0xHZS g==; IronPort-SDR: PCO5vFk2Hp8ueL7cWQ3A3gK1rhwRaVA6U1Xy5wUxqDNAwpD3CiWd4yHddI2AmDhR1CT7OByqhF reEindnFF/EZs2hqwr9xHpODbBqnzENI26DNP07LU0jXXjvO4xLOqVLnWejjBmD3X67dqtShfZ O2KuweyFrzfHIJSFrjHLsL8ejkDpLrxZfCPeKVnR9fKivMGHml2/ACS2EEq2/aectFDrIdzl5z GmdUGQ7kSW6LM/64RLhZj/ujwcL5UMWHG/G95yUuEbXUAgWEi7ZfDZQExBZrW/uuY5WVbofPy3 q6ci0AEKJknaOmhNbdEemU74 IronPort-SDR: 3A6jF0Fdsdns4/FdsJShldCmWPuUeFDFG2Q0PLsQnspm0DIusyAc+6Pcu2fjq2Ai3SwfFY3KJn kRCzE0+9cWZCxUYUtrXP+ZwapsWHZFn7FpajcX4/xanAEElBfUltxmwCVvU6PaMFV+cwG2coyp FUtuvpO3ugB8XTZDSRU1jESnwKGuAFIAQYeSjXd+aqhDklaV5JTgWjhuBIIn1mIA430kSSDWmX MJzIEwrVU11tWd10ZeT1sYXcmZzCUSoq4MFtNgME/pvlIv4l75fojopmJIcmPR1E1EGbUvfYFK kd0= From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair.francis@wdc.com, alistair23@gmail.com Subject: [RFC v1 03/16] sysdeps/gettimeofday: Use clock_gettime64 syscall for gettimeofday Date: Fri, 21 Jun 2019 21:37:20 -0700 Message-Id: <131e5b75cc2173b6cfd75f169b9a971877bcd44f.1561177967.git.alistair.francis@wdc.com> In-Reply-To: References: MIME-Version: 1.0 Not all architectures support the obsolete gettimeofday so use the newer clock_gettime64 syscall. This fixes RV32 build issues. Signed-off-by: Alistair Francis --- ChangeLog | 1 + sysdeps/unix/sysv/linux/gettimeofday.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index a700783ef3..f1c7acb6ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ * sysdeps/unix/sysv/linux/nanosleep.c: Likewise. * sysdeps/unix/sysv/linux/nanosleep_nocancel.c: Likewise. * sysdeps/unix/sysv/linux/lowlevellock-futex.h: Use __NR_futex_time64 if we don't have __NR_futex. + * sysdeps/unix/sysv/linux/gettimeofday.c: Use clock_gettime64 syscall for gettimeofday. 2019-06-20 Dmitry V. Levin Florian Weimer diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c b/sysdeps/unix/sysv/linux/gettimeofday.c index a74f03825a..58be2fdcc5 100644 --- a/sysdeps/unix/sysv/linux/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/gettimeofday.c @@ -32,7 +32,21 @@ int __gettimeofday (struct timeval *tv, struct timezone *tz) { +#ifdef __NR_gettimeofday return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); +#else + int ret; + struct timespec now; + + ret = INLINE_VSYSCALL (clock_gettime64, 2, CLOCK_REALTIME, + &now); + + /* Convert from timespec to timeval */ + tv->tv_sec = now.tv_sec; + tv->tv_usec = now.tv_nsec / 1000; + + return ret; +#endif } libc_hidden_def (__gettimeofday) weak_alias (__gettimeofday, gettimeofday)