Message ID | 3ee6c1e52cbefe6f6dbd7aef423f13607ff50402.1565398513.git.alistair.francis@wdc.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 73089 invoked by alias); 10 Aug 2019 01:03:25 -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 72976 invoked by uid 89); 10 Aug 2019 01:03:24 -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=HX-Languages-Length:2114 X-HELO: esa6.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=1565399004; x=1596935004; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Jza6dVxMRAK1X+RBW+fiutzDdZqA8FtMv6QBR+fZM18=; b=iqIpdvH23/NLUUW7xKTsgpc7/70PSDa9GnCdkH3L/aFMl6Amf9F19VxY jlC7X/O+qhEqljmLt7+e1nlgj7dZ+VB3bjvfSJkzIQxDIoZZb8E1c0Cpv tvyxilKgFt5FJsJi3o8KpvCS5QbYOclptCOKuV+0DsVjci9zd++8qCuqK EGuX0a68jjese8w48iPR441gjI5jVZuUC0Nc5f/HQU6JEa+x0MCVRNh+E YKc4MeP2pzya6Uhx6JSTkyiZ31a2d8rNwQgkgymSX2/FrINU1iLX1uftc EyhuWldxEsu2gAV+6E/8sFMCnAoO4tdmPBx4eGooBeUEnwVAb+KJLlI5v g==; IronPort-SDR: qJvPQpeGYjQT25xl4Lt183LdtneKzE+s6aT+cRXkcaEbnQYFf7l9S++a7EVqmFf3QkeivtP7QF oqM1PRufrkK7/ZoqxtTeWj09JHe6t833CtW25RKuMhqJ0NpTZ51qBmDvcGPvY/tPSGDGC8sWbf dkEnmRApfJdHOlYSBAz9F5XHojqyTUrkLz74vTZca0eK2zYoCJtuC/EPdIu747khCFkoPc3cOJ cnHsdvIsw1i/gfegL/FcFDBYkeYmwD5gbH+BwCA2rltA4SwxVUBQD3mZzyLWmcaIl7ZZaUTozX eaA= IronPort-SDR: a3mBvwPKMmLAeeR7Pc3yibUcb5zA5V1C7jMhOnfADenynXJCbRRHZ49fEyyLB2cyqz+OVKvQlf PyQJBlgOUurGAzM5db/WU1MxJ7YqbYEv5ymVMZuQthy3R+pmKiaFGjWJL1lnLUGx20Erf599dr 9GZblkL3jx9XR6L4bNKnvQVouUM/UQbNQFTZiPeydyUxs2B86mJ/Wcmm4+tN6v8NRwCqNdgYH5 +CAk65qfUuOVz4RrgohyKMWF7UDOhx4zW52GDdMPafDOwYF3ciNfbD4PZMM3tpTdAsMqXMhP7T kv6S34mrSSkJF+6fLSiOnflv IronPort-SDR: PYL6CxbAMyyYne3mCk/R4HwJYYhIKrPKesk8I0EbgUcdgnUApsv0zjISstCdaBxBBsSS9Q339q LE+KnZIzKAGzTh3aWq8Th8FhjKqVEvOT/VAl7Z7XBNJhPJsJmza/p0jZBuByXURZOiArzGcBaD cTMx6XhDX+MRRVz3hB3Ho4mDrNIktDc5/IacTg1Cq6s0aJiTxJT8d2wgXfv2xsj34/qOqferGQ IpfgwcdjxHThIzdZJT9I81pOskxXbWfLp8MkhOxHM3STk4okNNlny1ZtvoHh4NvPfF71asucf5 BgQ= 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 v4 06/24] sysdeps/timespec_get: Use clock_gettime64 if avaliable Date: Fri, 9 Aug 2019 18:00:03 -0700 Message-Id: <3ee6c1e52cbefe6f6dbd7aef423f13607ff50402.1565398513.git.alistair.francis@wdc.com> In-Reply-To: <cover.1565398513.git.alistair.francis@wdc.com> References: <cover.1565398513.git.alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit |
Commit Message
Alistair Francis
Aug. 10, 2019, 1 a.m. UTC
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
sysdeps/unix/sysv/linux/timespec_get.c | 56 +++++++++++++++++++++++++-
1 file changed, 54 insertions(+), 2 deletions(-)
Comments
On Fri, 9 Aug 2019, Alistair Francis wrote: > diff --git a/sysdeps/unix/sysv/linux/timespec_get.c b/sysdeps/unix/sysv/linux/timespec_get.c > index 52080ddf08a..97ef9c5f799 100644 > --- a/sysdeps/unix/sysv/linux/timespec_get.c > +++ b/sysdeps/unix/sysv/linux/timespec_get.c > @@ -24,6 +24,58 @@ > #endif > #include <sysdep-vdso.h> > > +int > +__timespec_get (struct timespec *ts, int base) > +{ > +#ifdef __ASSUME_TIME64_SYSCALLS > + return INTERNAL_VSYSCALL (clock_gettime64, err, 2, CLOCK_REALTIME, ts); > +#else This has the usual problems with missing conversions.
On Mon, Aug 12, 2019 at 12:46 PM Joseph Myers <joseph@codesourcery.com> wrote: > > On Fri, 9 Aug 2019, Alistair Francis wrote: > > > diff --git a/sysdeps/unix/sysv/linux/timespec_get.c b/sysdeps/unix/sysv/linux/timespec_get.c > > index 52080ddf08a..97ef9c5f799 100644 > > --- a/sysdeps/unix/sysv/linux/timespec_get.c > > +++ b/sysdeps/unix/sysv/linux/timespec_get.c > > @@ -24,6 +24,58 @@ > > #endif > > #include <sysdep-vdso.h> > > > > +int > > +__timespec_get (struct timespec *ts, int base) > > +{ > > +#ifdef __ASSUME_TIME64_SYSCALLS > > + return INTERNAL_VSYSCALL (clock_gettime64, err, 2, CLOCK_REALTIME, ts); > > +#else > > This has the usual problems with missing conversions. Is this the type of layout you are looking for? (untested, just a general idea) int __timespec_get64 (struct __timespec64 *ts, int base) { #ifdef __ASSUME_TIME64_SYSCALLS return INTERNAL_VSYSCALL (clock_gettime64, err, 2, CLOCK_REALTIME, ts); #else long int ret; # ifdef __NR_clock_gettime64 ret = INTERNAL_VSYSCALL (clock_gettime64, err, 2, CLOCK_REALTIME, ts); if (ret == 0 || errno != ENOSYS) { return ret; } # endif /* __NR_clock_gettime64 */ struct timespec ts32; if (! in_time_t_range (ts->tv_sec)) { __set_errno (EOVERFLOW); return -1; } valid_timespec64_to_timespec (ts, &ts32); ret = INTERNAL_VSYSCALL (clock_gettime, err, 2, CLOCK_REALTIME, &ts32); if ((ret == 0 || errno != ENOSYS) && ts) { ts->tv_sec = ts32.tv_sec; ts->tv_nsec = ts32.tv_nsec; } return ret; #endif } #if __TIMESIZE != 64 int __timespec_get32 (struct timespec *ts, int base) { struct __timespec64 ts64; ret = __timespec_get64 (ts64, base); if ((ret == 0 || errno != ENOSYS) && ts) { ts->tv_sec = ts64.tv_sec; ts->tv_nsec = ts64.tv_nsec; } return ret; } #endif #if __TIMESIZE == 64 # define __timespec_get __timespec_get64 #else # define __timespec_get __timespec_get32 #endif /* Set TS to calendar time based in time base BASE. */ int timespec_get (struct timespec *ts, int base) { switch (base) { int res; INTERNAL_SYSCALL_DECL (err); case TIME_UTC: res = __timespec_get (ts, base); if (INTERNAL_SYSCALL_ERROR_P (res, err)) return 0; break; default: return 0; } return base; } Alistair > > -- > Joseph S. Myers > joseph@codesourcery.com
On Thu, 15 Aug 2019, Alistair Francis wrote: > Is this the type of layout you are looking for? (untested, just a general idea) I'm not convinced making timespec_get into a wrapper round another function is a good thing. You need to end up, in the __TIMESIZE == 32 case, with two functions that have the public timespec_get semantics - not two internal functions and a single wrapper - in preparation for when we support _TIME_BITS == 64. So I'd expect defining __timespec_get64 as a function with the public semantics (not as an internal function that only calls the syscall), and conditionally defining timespec_get as a thin wrapper in the case of 32-bit time_t, and having a #define of __timespec_get64 to timespec_get in an internal header in the case of 64-bit time_t. > int > __timespec_get64 (struct __timespec64 *ts, int base) > { > #ifdef __ASSUME_TIME64_SYSCALLS > return INTERNAL_VSYSCALL (clock_gettime64, err, 2, CLOCK_REALTIME, ts); > #else You need # ifndef __NR_clock_gettime64 # define __NR_clock_gettime64 __NR_clock_gettime # endif here, because 64-bit platforms define __ASSUME_TIME64_SYSCALLS but with unsuffixed syscall names. > long int ret; > # ifdef __NR_clock_gettime64 > ret = INTERNAL_VSYSCALL (clock_gettime64, err, 2, CLOCK_REALTIME, ts); > > if (ret == 0 || errno != ENOSYS) > { > return ret; > } You need to check INTERNAL_SYSCALL_ERRNO (...) not errno; errno isn't set by INTERNAL_*, only by INLINE_*. No braces when only a single statement is inside them. > ret = INTERNAL_VSYSCALL (clock_gettime, err, 2, CLOCK_REALTIME, &ts32); > > if ((ret == 0 || errno != ENOSYS) && ts) No need to consider ENOSYS here. NULL ts isn't valid so no need to check for it being non-NULL. > /* Set TS to calendar time based in time base BASE. */ > int > timespec_get (struct timespec *ts, int base) > { > switch (base) > { > int res; > INTERNAL_SYSCALL_DECL (err); > case TIME_UTC: > res = __timespec_get (ts, base); > if (INTERNAL_SYSCALL_ERROR_P (res, err)) > return 0; This wrapper is using an uninitialized variable err.
On Thu, Aug 15, 2019 at 12:46 PM Joseph Myers <joseph@codesourcery.com> wrote: > > On Thu, 15 Aug 2019, Alistair Francis wrote: > > > Is this the type of layout you are looking for? (untested, just a general idea) > > I'm not convinced making timespec_get into a wrapper round another > function is a good thing. > > You need to end up, in the __TIMESIZE == 32 case, with two functions that > have the public timespec_get semantics - not two internal functions and a > single wrapper - in preparation for when we support _TIME_BITS == 64. So > I'd expect defining __timespec_get64 as a function with the public > semantics (not as an internal function that only calls the syscall), and > conditionally defining timespec_get as a thin wrapper in the case of > 32-bit time_t, and having a #define of __timespec_get64 to timespec_get in > an internal header in the case of 64-bit time_t. Ok, so more like this? #if __TIMESIZE == 64 # define timespec_get __timespec_get64 #else # define timespec_get __timespec_get32 #endif /* Set TS to calendar time based in time base BASE. */ int __timespec_get64 (struct timespec *ts, int base) { switch (base) { int res; INTERNAL_SYSCALL_DECL (err); case TIME_UTC: #ifdef __ASSUME_TIME64_SYSCALLS res = INTERNAL_VSYSCALL (clock_gettime64, err, 2, CLOCK_REALTIME, ts); #else # ifdef __NR_clock_gettime64 res = INTERNAL_VSYSCALL (clock_gettime64, err, 2, CLOCK_REALTIME, ts); # endif /* __NR_clock_gettime64 */ struct timespec ts32; if (! in_time_t_range (ts->tv_sec)) { __set_errno (EOVERFLOW); return -1; } valid_timespec64_to_timespec (ts, &ts32); res = INTERNAL_VSYSCALL (clock_gettime, err, 2, CLOCK_REALTIME, &ts32); if (res == 0 || !INTERNAL_SYSCALL_ERROR_P (res, err)) { ts->tv_sec = ts32.tv_sec; ts->tv_nsec = ts32.tv_nsec; } #endif if (INTERNAL_SYSCALL_ERROR_P (res, err)) return 0; break; default: return 0; } return base; } #if __TIMESIZE != 64 int __timespec_get32 (struct timespec *ts, int base) { struct __timespec64 ts64; ret = __timespec_get64 (ts64, base); if (res == 0 || !INTERNAL_SYSCALL_ERROR_P (res, err)) { ts->tv_sec = ts64.tv_sec; ts->tv_nsec = ts64.tv_nsec; } return ret; } #endif > > > int > > __timespec_get64 (struct __timespec64 *ts, int base) > > { > > #ifdef __ASSUME_TIME64_SYSCALLS > > return INTERNAL_VSYSCALL (clock_gettime64, err, 2, CLOCK_REALTIME, ts); > > #else > > You need > > # ifndef __NR_clock_gettime64 > # define __NR_clock_gettime64 __NR_clock_gettime > # endif > > here, because 64-bit platforms define __ASSUME_TIME64_SYSCALLS but with > unsuffixed syscall names. The kernel defines 64 suffixed syscalls, is this required because older kernels don't do this? > > > long int ret; > > # ifdef __NR_clock_gettime64 > > ret = INTERNAL_VSYSCALL (clock_gettime64, err, 2, CLOCK_REALTIME, ts); > > > > if (ret == 0 || errno != ENOSYS) > > { > > return ret; > > } > > You need to check INTERNAL_SYSCALL_ERRNO (...) not errno; errno isn't set > by INTERNAL_*, only by INLINE_*. Fixed! Thanks > > No braces when only a single statement is inside them. > > > ret = INTERNAL_VSYSCALL (clock_gettime, err, 2, CLOCK_REALTIME, &ts32); > > > > if ((ret == 0 || errno != ENOSYS) && ts) > > No need to consider ENOSYS here. NULL ts isn't valid so no need to check > for it being non-NULL. Fixed > > > /* Set TS to calendar time based in time base BASE. */ > > int > > timespec_get (struct timespec *ts, int base) > > { > > switch (base) > > { > > int res; > > INTERNAL_SYSCALL_DECL (err); > > case TIME_UTC: > > res = __timespec_get (ts, base); > > if (INTERNAL_SYSCALL_ERROR_P (res, err)) > > return 0; > > This wrapper is using an uninitialized variable err. Good point, fixed. Alistair > > -- > Joseph S. Myers > joseph@codesourcery.com
On Thu, 15 Aug 2019, Alistair Francis wrote: > Ok, so more like this? > > #if __TIMESIZE == 64 > # define timespec_get __timespec_get64 > #else > # define timespec_get __timespec_get32 > #endif No. Please see what's done for mktime, for example (but it's simpler here because mktime supports being built outside of glibc, which is irrelevant for timespec_get). * The function __mktime64 is defined, unconditionally. * The function mktime is defined as a thin wrapper, conditionally (only when 32-bit time is supported). * There's no __mktime32 anywhere. * mktime-internal.h deals with defining __mktime64 back to mktime in the case where __TIMESIZE == 64 and so only a single function is needed with no wrapper. > > # ifndef __NR_clock_gettime64 > > # define __NR_clock_gettime64 __NR_clock_gettime > > # endif > > > > here, because 64-bit platforms define __ASSUME_TIME64_SYSCALLS but with > > unsuffixed syscall names. > > The kernel defines 64 suffixed syscalls, is this required because > older kernels don't do this? The kernel does *not* define 64-suffixed syscalls on platforms where __SYSCALL_WORDSIZE == 64. It defined unsuffixed syscalls with the same semantics.
On Thu, Aug 15, 2019 at 1:59 PM Joseph Myers <joseph@codesourcery.com> wrote: > > On Thu, 15 Aug 2019, Alistair Francis wrote: > > > Ok, so more like this? > > > > #if __TIMESIZE == 64 > > # define timespec_get __timespec_get64 > > #else > > # define timespec_get __timespec_get32 > > #endif > > No. Please see what's done for mktime, for example (but it's simpler here > because mktime supports being built outside of glibc, which is irrelevant > for timespec_get). > > * The function __mktime64 is defined, unconditionally. > > * The function mktime is defined as a thin wrapper, conditionally (only > when 32-bit time is supported). > > * There's no __mktime32 anywhere. > > * mktime-internal.h deals with defining __mktime64 back to mktime in the > case where __TIMESIZE == 64 and so only a single function is needed with > no wrapper. There is no internal header for timespec_get, would you prefer me to create one or put the define in time/time.h? > > > > # ifndef __NR_clock_gettime64 > > > # define __NR_clock_gettime64 __NR_clock_gettime > > > # endif > > > > > > here, because 64-bit platforms define __ASSUME_TIME64_SYSCALLS but with > > > unsuffixed syscall names. > > > > The kernel defines 64 suffixed syscalls, is this required because > > older kernels don't do this? > > The kernel does *not* define 64-suffixed syscalls on platforms where > __SYSCALL_WORDSIZE == 64. It defined unsuffixed syscalls with the same > semantics. Ah, you are right. I have added these defines. Alistair > > -- > Joseph S. Myers > joseph@codesourcery.com
On Thu, 15 Aug 2019, Alistair Francis wrote: > There is no internal header for timespec_get, would you prefer me to > create one or put the define in time/time.h? time/time.h is an installed header, so it mustn't go there. include/time.h would be fine (it has several such defines, for __localtime64 etc.).
On Thu, Aug 15, 2019 at 2:19 PM Joseph Myers <joseph@codesourcery.com> wrote: > > On Thu, 15 Aug 2019, Alistair Francis wrote: > > > There is no internal header for timespec_get, would you prefer me to > > create one or put the define in time/time.h? > > time/time.h is an installed header, so it mustn't go there. > include/time.h would be fine (it has several such defines, for > __localtime64 etc.). Ok, I have this in include/time.h: #if __TIMESIZE == 64 #define timespec_get __timespec_get64 #else and this in the c file: /* Set TS to calendar time based in time base BASE. */ int __timespec_get64 (struct timespec *ts, int base) { switch (base) { int res; INTERNAL_SYSCALL_DECL (err); case TIME_UTC: #ifdef __ASSUME_TIME64_SYSCALLS # ifndef __NR_clock_gettime64 # define __NR_clock_gettime64 __NR_clock_gettime # endif res = INTERNAL_VSYSCALL (clock_gettime64, err, 2, CLOCK_REALTIME, ts); #else # ifdef __NR_clock_gettime64 res = INTERNAL_VSYSCALL (clock_gettime64, err, 2, CLOCK_REALTIME, ts); # endif /* __NR_clock_gettime64 */ struct timespec ts32; if (! in_time_t_range (ts->tv_sec)) { __set_errno (EOVERFLOW); return -1; } valid_timespec64_to_timespec (ts, &ts32); res = INTERNAL_VSYSCALL (clock_gettime, err, 2, CLOCK_REALTIME, &ts32); if (res == 0 || !INTERNAL_SYSCALL_ERROR_P (res, err)) { ts->tv_sec = ts32.tv_sec; ts->tv_nsec = ts32.tv_nsec; } #endif if (INTERNAL_SYSCALL_ERROR_P (res, err)) return 0; break; default: return 0; } return base; } #if __TIMESIZE != 64 int timespec_get (struct timespec *ts, int base) { struct __timespec64 ts64; ret = __timespec_get64 (ts64, base); if (res == 0 || !INTERNAL_SYSCALL_ERROR_P (res, err)) { ts->tv_sec = ts64.tv_sec; ts->tv_nsec = ts64.tv_nsec; } return ret; } #endif Alistair > > -- > Joseph S. Myers > joseph@codesourcery.com
On Thu, 15 Aug 2019, Alistair Francis wrote: > On Thu, Aug 15, 2019 at 2:19 PM Joseph Myers <joseph@codesourcery.com> wrote: > > > > On Thu, 15 Aug 2019, Alistair Francis wrote: > > > > > There is no internal header for timespec_get, would you prefer me to > > > create one or put the define in time/time.h? > > > > time/time.h is an installed header, so it mustn't go there. > > include/time.h would be fine (it has several such defines, for > > __localtime64 etc.). > > Ok, I have this in include/time.h: > > #if __TIMESIZE == 64 > #define timespec_get __timespec_get64 > #else That should be the other way round (defining __timespec_get64 to timespec_get so that timespec_get gets properly exported from libc).
On Thu, Aug 15, 2019 at 2:28 PM Joseph Myers <joseph@codesourcery.com> wrote: > > On Thu, 15 Aug 2019, Alistair Francis wrote: > > > On Thu, Aug 15, 2019 at 2:19 PM Joseph Myers <joseph@codesourcery.com> wrote: > > > > > > On Thu, 15 Aug 2019, Alistair Francis wrote: > > > > > > > There is no internal header for timespec_get, would you prefer me to > > > > create one or put the define in time/time.h? > > > > > > time/time.h is an installed header, so it mustn't go there. > > > include/time.h would be fine (it has several such defines, for > > > __localtime64 etc.). > > > > Ok, I have this in include/time.h: > > > > #if __TIMESIZE == 64 > > #define timespec_get __timespec_get64 > > #else > > That should be the other way round (defining __timespec_get64 to > timespec_get so that timespec_get gets properly exported from libc). Ok. Thanks for your help with this. I'll update the other patches with a similar style and look at sending a full patch series after running tests. Alistair > > -- > Joseph S. Myers > joseph@codesourcery.com
diff --git a/sysdeps/unix/sysv/linux/timespec_get.c b/sysdeps/unix/sysv/linux/timespec_get.c index 52080ddf08a..97ef9c5f799 100644 --- a/sysdeps/unix/sysv/linux/timespec_get.c +++ b/sysdeps/unix/sysv/linux/timespec_get.c @@ -24,6 +24,58 @@ #endif #include <sysdep-vdso.h> +int +__timespec_get (struct timespec *ts, int base) +{ +#ifdef __ASSUME_TIME64_SYSCALLS + return INTERNAL_VSYSCALL (clock_gettime64, err, 2, CLOCK_REALTIME, ts); +#else + long int ret; +# ifdef __NR_clock_gettime64 +# if __TIMESIZE == 64 + ret = INTERNAL_VSYSCALL (clock_gettime64, err, 2, CLOCK_REALTIME, ts); + + if (ret == 0 || errno != ENOSYS) + { + return ret; + } +# else + struct __timespec64 ts64; + + ret = INTERNAL_VSYSCALL (clock_gettime64, err, 2, CLOCK_REALTIME, &ts64); + + if (ret == 0 || errno != ENOSYS) + { + ts->tv_sec = ts64.tv_sec; + ts->tv_nsec = ts64.tv_nsec; + return ret; + } +# endif /* __TIMESIZE == 64 */ +# endif /* __NR_clock_gettime64 */ +# if __TIMESIZE == 64 + struct timespec ts32; + + if (! in_time_t_range (ts->tv_sec)) + { + __set_errno (EOVERFLOW); + return -1; + } + + valid_timespec64_to_timespec (ts, &ts32); + ret = INTERNAL_VSYSCALL (clock_gettime, err, 2, CLOCK_REALTIME, &ts32); + + if (ret == 0 || errno != ENOSYS) + { + ts->tv_sec = ts32.tv_sec; + ts->tv_nsec = ts32.tv_nsec; + } + return ret; +# else + return INTERNAL_VSYSCALL (clock_gettime, err, 2, CLOCK_REALTIME, ts); +# endif /* __TIMESIZE == 64 */ +#endif +} + /* Set TS to calendar time based in time base BASE. */ int timespec_get (struct timespec *ts, int base) @@ -33,9 +85,9 @@ timespec_get (struct timespec *ts, int base) int res; INTERNAL_SYSCALL_DECL (err); case TIME_UTC: - res = INTERNAL_VSYSCALL (clock_gettime, err, 2, CLOCK_REALTIME, ts); + res = __timespec_get (ts, base); if (INTERNAL_SYSCALL_ERROR_P (res, err)) - return 0; + return 0; break; default: