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: 33264 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)