Message ID | d570d35acb1d9027cf7558ba47bf0fb3f5272860.1563321715.git.alistair.francis@wdc.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 14937 invoked by alias); 17 Jul 2019 00:11:41 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <libc-alpha.sourceware.org> List-Unsubscribe: <mailto:libc-alpha-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:libc-alpha-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 14866 invoked by uid 89); 17 Jul 2019 00:11:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 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: 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=1563322300; x=1594858300; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7BcjHw/mfXm4bJKMMV4PVboGHVo7TskTMkdOq7F4FCE=; b=jx2zbNfqOn2A0dJUWyc5SukvNM1e3gBidGsRRaTg1mWvtBYVXMbPe9n/ +Fm+kCN1Mseh729z7PmbltogL5fjkeuluwm3BNZ4QOAEMi1jAXTNT7H9C t7jmCQsqQp32S8nHJR0oEiZNGgJLACaHwnbBfVLmdkYdcDUf9B9zDD8Lt 8C1GRU8HsF8D/FB1TORCQ1i0rv0Qlp70dJK6GuEJKa344mGrwtGHfQqg0 xMVFK579EuGQwkdEVcka1ytEoNe7FBVYnVVdQa0H6NkNQN5JTMjK/Ev0l 3K6ymsncz+aKdPDfQYcqQBAvLRpmPp4laYbbCGqKU9zVFuoURGrvpYcPW A==; IronPort-SDR: ydN58vf940vYSBeGucRj31qNqhBJuL4hXh2u5/7vASmLKubULXp1AXJ91402gGeZSTTGcRw0Ij pTkfTzg02I8tto3vqsJ/IIAO4dFy4jqzQweeonZfUh/lV+gPP2iMsvA44koV3af+l6YjuxUrW7 VjHhcAOTXbBCfUE3lZ7ysAOWaXze9EOkNfP9ZoKSh1Nb+u4p1NTl9h158psprzfYS98yM1JHGD bztMs1PXU6oCmYMNqHmj7vZqv4Oxp0sM51oG6GBPcOyAH9ZmRLt5jLqxj/mX/c/YMwX90MtSeo Jq4= IronPort-SDR: DSl3dJ5+6OU6cyqt3E5hrlx9z36sdEQ553L6BCZBt0WhyHNqPoNBOlWLntzgF0hP/Roqqmo7IM 7DqT/Hmt/IHqMQNq6sgSVGrvdebINrfhpAQxf+2ViGLJY9n9qHeHNDBehZhoGa7FKdlAxmzZHJ iezwQ9s4x4i97WqNhPXzsNBnW2Xh14rrHIGNPt/4ndgyRaM0GJ6bZ7Z3957DimxWz7J1bNsTMW SK6JfPm68YUgfKgB2Q7HqjQGdFH5ZX2wt4Kp0D9mr3RaIEVYbdqjlx2OkwM/pdUZwp/32ZKCCC +ZM2SW4u/d2qwbPLQUdocmEQ IronPort-SDR: Y2E4wkGxn9Gc9u98z798jGhO7depKPTcb1xcsz4Q3CFdRYUyuHtgb1YXHDyRJOj3FBfYcbqUEh tUKZSfVXMkt7ZJDETnITsNIlBCOOQj+RAZoDgXXtJ7WIZKAcFBbWkwTQMT8d2+ZqyLWKXRzdi6 9JAp4rSrw1OX62sVXC/RGU81aS60XFQe8BDVKm/bcgLoKRa4cX0HbkSer3alogqQ4n4I37OIro BYmWhF1n0/SWntC2GqH2OQWh0j3ZJRsOM2ctQdobBR+guM42X5xufZ8A6NRLQ4cR2lKSTq2pqD 7vM= From: Alistair Francis <alistair.francis@wdc.com> 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 02/23] sysdeps/gettimeofday: Use clock_gettime64 if avaliable Date: Tue, 16 Jul 2019 17:08:46 -0700 Message-Id: <d570d35acb1d9027cf7558ba47bf0fb3f5272860.1563321715.git.alistair.francis@wdc.com> In-Reply-To: <cover.1563321715.git.alistair.francis@wdc.com> References: <cover.1563321715.git.alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit |
Commit Message
Alistair Francis
July 17, 2019, 12:08 a.m. UTC
Not all architectures support the obsolete gettimeofday so use the
newer clock_gettime64 syscall if it is avaliable. This fixes RV32
build issues.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
ChangeLog | 1 +
sysdeps/unix/sysv/linux/gettimeofday.c | 28 ++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
Comments
* Alistair Francis: > diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c b/sysdeps/unix/sysv/linux/gettimeofday.c > index a74f03825a..151b1e606c 100644 > --- a/sysdeps/unix/sysv/linux/gettimeofday.c > +++ b/sysdeps/unix/sysv/linux/gettimeofday.c > @@ -32,7 +32,35 @@ > int > __gettimeofday (struct timeval *tv, struct timezone *tz) > { > +#ifdef __ASSUME_TIME64_SYSCALLS > + int ret; > + struct __timespec64 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; > +#else > +# ifdef __NR_clock_gettime64 > + long int ret; > + struct __timespec64 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; > + > + if (ret == 0 || errno != ENOSYS) > + return ret; > +# endif > return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); > +#endif > } This loses vDSO acceleration if glibc is compiled with kernel headers which define __NR_clock_gettime64, but the run-time kernel does not have clock_gettime64 in the vDSO. And the kernel folks really want us to call clock_gettime when the user calls the 32-bit function, for tracability of legacy processes. Thanks, Florian
Hi Alistair, > Not all architectures support the obsolete gettimeofday so use the > newer clock_gettime64 syscall if it is avaliable. This fixes RV32 > build issues. > > Signed-off-by: Alistair Francis <alistair.francis@wdc.com> > --- > ChangeLog | 1 + > sysdeps/unix/sysv/linux/gettimeofday.c | 28 > ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) > > diff --git a/ChangeLog b/ChangeLog > index 477b9b49b3..9ca390a9c3 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1028,6 +1028,7 @@ > * nptl/thrd_sleep.c: Use clock_nanosleep_time64 instead of > nanosleep. > * sysdeps/unix/sysv/linux/nanosleep.c: Likewise. > * sysdeps/unix/sysv/linux/nanosleep_nocancel.c: Likewise. > + * sysdeps/unix/sysv/linux/gettimeofday.c: Use > clock_gettime64 syscall for gettimeofday. > 2019-06-20 Dmitry V. Levin <ldv@altlinux.org> > Florian Weimer <fweimer@redhat.com> > diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c > b/sysdeps/unix/sysv/linux/gettimeofday.c index a74f03825a..151b1e606c > 100644 --- a/sysdeps/unix/sysv/linux/gettimeofday.c > +++ b/sysdeps/unix/sysv/linux/gettimeofday.c > @@ -32,7 +32,35 @@ > int > __gettimeofday (struct timeval *tv, struct timezone *tz) > { > +#ifdef __ASSUME_TIME64_SYSCALLS I'm not the glibc expert but according to [1], the __ASSUME_TIME64_SYSCALLS will be defined also for __WORDSIZE = 64 archs. This means that this code will be executed on x86_64 and return with an ENOTSUPP error as those archs shall not define clock_gettime64 and will just use the clock_settime. Please consider re-using pattern from clock_settime conversion [2]. > + int ret; > + struct __timespec64 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; > +#else > +# ifdef __NR_clock_gettime64 > + long int ret; > + struct __timespec64 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; > + > + if (ret == 0 || errno != ENOSYS) > + return ret; > +# endif > return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); > +#endif > } > libc_hidden_def (__gettimeofday) > weak_alias (__gettimeofday, gettimeofday) Note: [1] - https://github.com/lmajewski/y2038_glibc/commit/1fdbc6002101a78a8a6a076bbb642b3082c2225d [2] - https://github.com/lmajewski/y2038_glibc/commit/69f842a8519ca13ed11fab0ff1bcc6fa1a524192 Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Hi, > Hi Alistair, > > > Not all architectures support the obsolete gettimeofday so use the > > newer clock_gettime64 syscall if it is avaliable. This fixes RV32 > > build issues. > > > > Signed-off-by: Alistair Francis <alistair.francis@wdc.com> > > --- > > ChangeLog | 1 + > > sysdeps/unix/sysv/linux/gettimeofday.c | 28 > > ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) > > > > diff --git a/ChangeLog b/ChangeLog > > index 477b9b49b3..9ca390a9c3 100644 > > --- a/ChangeLog > > +++ b/ChangeLog > > @@ -1028,6 +1028,7 @@ > > * nptl/thrd_sleep.c: Use clock_nanosleep_time64 instead of > > nanosleep. > > * sysdeps/unix/sysv/linux/nanosleep.c: Likewise. > > * sysdeps/unix/sysv/linux/nanosleep_nocancel.c: Likewise. > > + * sysdeps/unix/sysv/linux/gettimeofday.c: Use > > clock_gettime64 syscall for gettimeofday. > > 2019-06-20 Dmitry V. Levin <ldv@altlinux.org> > > Florian Weimer <fweimer@redhat.com> > > diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c > > b/sysdeps/unix/sysv/linux/gettimeofday.c index > > a74f03825a..151b1e606c 100644 --- > > a/sysdeps/unix/sysv/linux/gettimeofday.c +++ > > b/sysdeps/unix/sysv/linux/gettimeofday.c @@ -32,7 +32,35 @@ > > int > > __gettimeofday (struct timeval *tv, struct timezone *tz) > > { > > +#ifdef __ASSUME_TIME64_SYSCALLS > > I'm not the glibc expert but according to [1], the > __ASSUME_TIME64_SYSCALLS will be defined also for __WORDSIZE = 64 > archs. > > This means that this code will be executed on x86_64 and return with > an ENOTSUPP error as those archs shall not define clock_gettime64 and ^^^^^^^ - sorry s/ENOTSUPP/ENOSYS/g > will just use the clock_settime. > > Please consider re-using pattern from clock_settime conversion [2]. > > > + int ret; > > + struct __timespec64 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; > > +#else > > +# ifdef __NR_clock_gettime64 > > + long int ret; > > + struct __timespec64 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; > > + > > + if (ret == 0 || errno != ENOSYS) > > + return ret; > > +# endif > > return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); > > +#endif > > } > > libc_hidden_def (__gettimeofday) > > weak_alias (__gettimeofday, gettimeofday) > > Note: > > [1] - > https://github.com/lmajewski/y2038_glibc/commit/1fdbc6002101a78a8a6a076bbb642b3082c2225d > > [2] - > https://github.com/lmajewski/y2038_glibc/commit/69f842a8519ca13ed11fab0ff1bcc6fa1a524192 > > Best regards, > > Lukasz Majewski > > -- > > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: > lukma@denx.de Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
On Wed, Jul 17, 2019 at 5:43 AM Lukasz Majewski <lukma@denx.de> wrote: > > Hi Alistair, > > > Not all architectures support the obsolete gettimeofday so use the > > newer clock_gettime64 syscall if it is avaliable. This fixes RV32 > > build issues. > > > > Signed-off-by: Alistair Francis <alistair.francis@wdc.com> > > --- > > ChangeLog | 1 + > > sysdeps/unix/sysv/linux/gettimeofday.c | 28 > > ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) > > > > diff --git a/ChangeLog b/ChangeLog > > index 477b9b49b3..9ca390a9c3 100644 > > --- a/ChangeLog > > +++ b/ChangeLog > > @@ -1028,6 +1028,7 @@ > > * nptl/thrd_sleep.c: Use clock_nanosleep_time64 instead of > > nanosleep. > > * sysdeps/unix/sysv/linux/nanosleep.c: Likewise. > > * sysdeps/unix/sysv/linux/nanosleep_nocancel.c: Likewise. > > + * sysdeps/unix/sysv/linux/gettimeofday.c: Use > > clock_gettime64 syscall for gettimeofday. > > 2019-06-20 Dmitry V. Levin <ldv@altlinux.org> > > Florian Weimer <fweimer@redhat.com> > > diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c > > b/sysdeps/unix/sysv/linux/gettimeofday.c index a74f03825a..151b1e606c > > 100644 --- a/sysdeps/unix/sysv/linux/gettimeofday.c > > +++ b/sysdeps/unix/sysv/linux/gettimeofday.c > > @@ -32,7 +32,35 @@ > > int > > __gettimeofday (struct timeval *tv, struct timezone *tz) > > { > > +#ifdef __ASSUME_TIME64_SYSCALLS > > I'm not the glibc expert but according to [1], the > __ASSUME_TIME64_SYSCALLS will be defined also for __WORDSIZE = 64 archs. > > This means that this code will be executed on x86_64 and return with an > ENOTSUPP error as those archs shall not define clock_gettime64 and > will just use the clock_settime. > > Please consider re-using pattern from clock_settime conversion [2]. Yep, good point. I have updated this to better match what is being discussed on the list and your patches. Alistair > > > + int ret; > > + struct __timespec64 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; > > +#else > > +# ifdef __NR_clock_gettime64 > > + long int ret; > > + struct __timespec64 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; > > + > > + if (ret == 0 || errno != ENOSYS) > > + return ret; > > +# endif > > return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); > > +#endif > > } > > libc_hidden_def (__gettimeofday) > > weak_alias (__gettimeofday, gettimeofday) > > Note: > > [1] - > https://github.com/lmajewski/y2038_glibc/commit/1fdbc6002101a78a8a6a076bbb642b3082c2225d > > [2] - > https://github.com/lmajewski/y2038_glibc/commit/69f842a8519ca13ed11fab0ff1bcc6fa1a524192 > > Best regards, > > Lukasz Majewski > > -- > > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
On Wed, Jul 17, 2019 at 09:09:08AM +0200, Florian Weimer wrote: > * Alistair Francis: > > > diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c b/sysdeps/unix/sysv/linux/gettimeofday.c > > index a74f03825a..151b1e606c 100644 > > --- a/sysdeps/unix/sysv/linux/gettimeofday.c > > +++ b/sysdeps/unix/sysv/linux/gettimeofday.c > > @@ -32,7 +32,35 @@ > > int > > __gettimeofday (struct timeval *tv, struct timezone *tz) > > { > > +#ifdef __ASSUME_TIME64_SYSCALLS > > + int ret; > > + struct __timespec64 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; > > +#else > > +# ifdef __NR_clock_gettime64 > > + long int ret; > > + struct __timespec64 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; > > + > > + if (ret == 0 || errno != ENOSYS) > > + return ret; > > +# endif > > return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); > > +#endif > > } > > This loses vDSO acceleration if glibc is compiled with kernel headers > which define __NR_clock_gettime64, but the run-time kernel does not have > clock_gettime64 in the vDSO. > > And the kernel folks really want us to call clock_gettime when the user > calls the 32-bit function, for tracability of legacy processes. May or may not be relevant to glibc plans, but I want to chime in to mention that this (kernel tracability of legacy processes) is not going to work with musl, except possibly static-linked programs with old libc. Our legacy compat functions are just going to be thin, implementation-agnostic wrappers around the new functions, so even if a program is still calling the old clock_gettime symbol with 32-bit timespec, it's going to be executing the new one as its backend, and thereby calling the 64-bit syscall or vdso if available. In the case of new libc with old application on old kernel, there will actually be two conversions: 32->64 in the core (new) function after the 64-bit syscall fails with ENOSYS and we fallback to the old syscall, and 64->32 in the old-ABI-compat wrapper. This is a consequence of not duplicating functionality and ending up with two versions of everything to maintain, and also avoids incentivizing continued use of the old ABI for users with old kernels (as a way to bypass conversion costs). In any case, just grepping dynsym tables for references to legacy symbols seems like a more effective way of finding problems than grepping for syslog spam... Rich
On Fri, 19 Jul 2019, Rich Felker wrote: > > And the kernel folks really want us to call clock_gettime when the user > > calls the 32-bit function, for tracability of legacy processes. > > May or may not be relevant to glibc plans, but I want to chime in to > mention that this (kernel tracability of legacy processes) is not > going to work with musl, except possibly static-linked programs with > old libc. Our legacy compat functions are just going to be thin, > implementation-agnostic wrappers around the new functions, so even if > a program is still calling the old clock_gettime symbol with 32-bit > timespec, it's going to be executing the new one as its backend, and > thereby calling the 64-bit syscall or vdso if available. And as far as I'm concerned glibc should do likewise (I have a sustained objection to duplication of nontrivial function implementations at either the source and binary level for time_t variants when thin wrappers would do the job just as well, given the principle that the particular choice of syscalls for a given function is not a stable interface). (Where a function is defined entirely in syscalls.list, it might continue to use the old syscall, subject to working out the best way to set up function aliasing for that case.) > In any case, just grepping dynsym tables for references to legacy > symbols seems like a more effective way of finding problems than > grepping for syslog spam... Yes.
diff --git a/ChangeLog b/ChangeLog index 477b9b49b3..9ca390a9c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1028,6 +1028,7 @@ * nptl/thrd_sleep.c: Use clock_nanosleep_time64 instead of nanosleep. * sysdeps/unix/sysv/linux/nanosleep.c: Likewise. * sysdeps/unix/sysv/linux/nanosleep_nocancel.c: Likewise. + * sysdeps/unix/sysv/linux/gettimeofday.c: Use clock_gettime64 syscall for gettimeofday. 2019-06-20 Dmitry V. Levin <ldv@altlinux.org> Florian Weimer <fweimer@redhat.com> diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c b/sysdeps/unix/sysv/linux/gettimeofday.c index a74f03825a..151b1e606c 100644 --- a/sysdeps/unix/sysv/linux/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/gettimeofday.c @@ -32,7 +32,35 @@ int __gettimeofday (struct timeval *tv, struct timezone *tz) { +#ifdef __ASSUME_TIME64_SYSCALLS + int ret; + struct __timespec64 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; +#else +# ifdef __NR_clock_gettime64 + long int ret; + struct __timespec64 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; + + if (ret == 0 || errno != ENOSYS) + return ret; +# endif return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); +#endif } libc_hidden_def (__gettimeofday) weak_alias (__gettimeofday, gettimeofday)