From patchwork Fri Sep 8 17:49:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Albert ARIBAUD (3ADEV)" X-Patchwork-Id: 811753 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-84396-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="SC4rRK2C"; 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 3xplFT5VJyz9s8J for ; Sat, 9 Sep 2017 03:49:33 +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; q=dns; s=default; b=h+ATf/HMnmPLLwfWUl9bHraImtDWylh EKwtyn1DGORH3ljdndjSXh+Uo7OVt2HRoZHVJly6dYUpKerduFO/W2mPMVgcj+Gy nNf6nvd0m8L69JjaGHe6oOydTYekLfQYq4gN/VlCUq1BS42Sss4lJ03KaaP0J+Ph 05cLK6KWzVIg= 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; s=default; bh=kPru+F3cf8efXzDlDqB7239eqys=; b=SC4rR K2CxiuLtvpPfFzpxtGhAcketkNM3zCSRA9dOkTyDDpZqr4bXKDsf3ptMyBWzer75 W0nXbmB57+BHcJFlQw3SQIHGr9SF/zZfzlA+y5MOsfcOTdOv2OWzYer+NNA+Dj+l PQuoQGNKTJ4k3YkV/N977IGP27hQs7vznUpfh8= Received: (qmail 120349 invoked by alias); 8 Sep 2017 17:49:28 -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 120331 invoked by uid 89); 8 Sep 2017 17:49:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy= X-HELO: smtp6-g21.free.fr From: "Albert ARIBAUD (3ADEV)" To: libc-alpha@sourceware.org Cc: "Albert ARIBAUD (3ADEV)" Subject: [RFC PATCH 50/52] Y2038: add function select Date: Fri, 8 Sep 2017 19:49:07 +0200 Message-Id: <20170908174909.28192-1-albert.aribaud@3adev.fr> In-Reply-To: <20170907224219.12483-50-albert.aribaud@3adev.fr> References: <20170907224219.12483-50-albert.aribaud@3adev.fr> Signed-off-by: Albert ARIBAUD (3ADEV) --- include/sys/select.h | 5 +++ sysdeps/unix/sysv/linux/select.c | 66 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/include/sys/select.h b/include/sys/select.h index 3eb76faf9d..df10085e72 100644 --- a/include/sys/select.h +++ b/include/sys/select.h @@ -24,5 +24,10 @@ extern int __pselect_t64 (int __nfds, fd_set *__readfds, const struct __timespec64 *__timeout, const __sigset_t *__sigmask); +extern int __select_t64 (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct __timeval64 *__restrict __timeout); + #endif #endif diff --git a/sysdeps/unix/sysv/linux/select.c b/sysdeps/unix/sysv/linux/select.c index be4a456a51..3e6140621c 100644 --- a/sysdeps/unix/sysv/linux/select.c +++ b/sysdeps/unix/sysv/linux/select.c @@ -33,6 +33,8 @@ # define __NR_select __NR__newselect #endif +extern int __y2038_linux_support; + int __select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) @@ -69,3 +71,67 @@ libc_hidden_def (__select) weak_alias (__select, select) weak_alias (__select, __libc_select) + +/* 64-bit time version */ + +extern int __y2038_linux_support; + +int +__select_t64 (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, + struct __timeval64 *timeout) +{ + struct timeval tval32, *timeout32 = NULL; +#ifndef __NR_select + int result; + struct timespec ts32, *tsp32 = NULL; +#endif + + if (__y2038_linux_support) + { + /* TODO: implement using Linux kernel system call */ + } + + if (timeout != NULL) + { + if (timeout->tv_sec > INT_MAX) + { + errno = EOVERFLOW; + return -1; + } + tval32.tv_sec = timeout->tv_sec; + tval32.tv_usec = timeout->tv_usec; + timeout32 = &tval32; + } + +#ifdef __NR_select + return SYSCALL_CANCEL (select, nfds, readfds, writefds, exceptfds, + timeout32); +#else + if (timeout) + { + if (timeout->tv_sec > INT_MAX) + { + errno = EOVERFLOW; + return -1; + } + ts32.tv_sec = timeout->tv_sec; + ts32.tv_nsec = timeout->tv_usec * 1000; + tsp32 = &ts32; + } + + result = SYSCALL_CANCEL (pselect6, nfds, readfds, writefds, exceptfds, tsp32, + NULL); + + if (timeout) + { + /* Linux by default will update the timeout after a pselect6 syscall + (though the pselect() glibc call suppresses this behavior). + Since select() on Linux has the same behavior as the pselect6 + syscall, we update the timeout here. */ + timeout->tv_sec = ts32.tv_sec; + timeout->tv_usec = ts32.tv_nsec / 1000; + } + + return result; +#endif +} From patchwork Fri Sep 8 17:49:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Albert ARIBAUD (3ADEV)" X-Patchwork-Id: 811754 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-84397-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="iUce3I4+"; 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 3xplFn4J9Hz9s8J for ; Sat, 9 Sep 2017 03:49:49 +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; q=dns; s=default; b=KkGdCM8WWgF4+oXRqPAK+JujHew1pfA 5xILC8a6oLl/DIkI9P5YaE+neOC3XhKT1li/ZBTx519GqSirzepfABsPKAsLV2dL FR/T6qCEmaGQTMLUfHZQqPDRC4xYGzrRXmGSjPmAR/FsKY6XphNl1eGHy2FNf8is l3DYVzsByy3E= 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; s=default; bh=E9akbluVU/Xz0XDhpLCTQyQey4Y=; b=iUce3 I4+bliwkNWLyrzuk+7eJJO19lyDeoxNZ9waVMRHSPWFcJWjkEsBg0/NC7PcdFux7 y0psRW5/claOSMzWCw+PO6orw0maSqMlHPmHJlxz7ndbog+6AwkBdwBuQxRN5o2G d4J4kxDw7Y6YpgFZZB2wS0WxHP/jus3pFNHHFs= Received: (qmail 121422 invoked by alias); 8 Sep 2017 17:49:41 -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 121310 invoked by uid 89); 8 Sep 2017 17:49:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy= X-HELO: smtp6-g21.free.fr From: "Albert ARIBAUD (3ADEV)" To: libc-alpha@sourceware.org Cc: "Albert ARIBAUD (3ADEV)" Subject: [RFC PATCH 51/52] Y2038: add RPC functions Date: Fri, 8 Sep 2017 19:49:08 +0200 Message-Id: <20170908174909.28192-2-albert.aribaud@3adev.fr> In-Reply-To: <20170908174909.28192-1-albert.aribaud@3adev.fr> References: <20170907224219.12483-50-albert.aribaud@3adev.fr> <20170908174909.28192-1-albert.aribaud@3adev.fr> Three functions in RPC have a struct timeval in their arguments: pmap_rmtcall, clntudp_create, and clntudp_bufcreate. Since these struct timeval arguments contain relative timeouts, and since RPC timeouts can reasonably be expected to be small enough to still fit in 32-bit representations, the implementations of these functions just verify that the 64-bit timeout they received can fit in 32 bits, convert it to 32 bit, and pass it to their 32-bit-time counterparts. Signed-off-by: Albert ARIBAUD (3ADEV) --- sunrpc/clnt_udp.c | 27 +++++++++++++++++++++++++++ sunrpc/pmap_rmt.c | 23 +++++++++++++++++++++++ sunrpc/rpc/clnt.h | 24 ++++++++++++++++++++++++ sunrpc/rpc/pmap_clnt.h | 15 +++++++++++++++ 4 files changed, 89 insertions(+) diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c index df21e28f64..b02b80e2c4 100644 --- a/sunrpc/clnt_udp.c +++ b/sunrpc/clnt_udp.c @@ -644,3 +644,30 @@ clntudp_destroy (CLIENT *cl) mem_free ((caddr_t) cu, (sizeof (*cu) + cu->cu_sendsz + cu->cu_recvsz)); mem_free ((caddr_t) cl, sizeof (CLIENT)); } + +/* 64-bit time versions */ + +CLIENT * +__clntudp_create64 (struct sockaddr_in *raddr, u_long program, u_long version, + struct __timeval64 wait, int *sockp) +{ + struct timeval wait32; + if (wait.tv_sec > INT_MAX) + { + return NULL; + } + return clntudp_create (raddr, program, version, wait32, sockp); +} + +CLIENT * +__clntudp_bufcreate64 (struct sockaddr_in *raddr, u_long program, u_long version, + struct __timeval64 wait, int *sockp, u_int sendsz, + u_int recvsz) +{ + struct timeval wait32; + if (wait.tv_sec > INT_MAX) + { + return NULL; + } + return clntudp_bufcreate (raddr, program, version, wait32, sockp, sendsz, recvsz); +} diff --git a/sunrpc/pmap_rmt.c b/sunrpc/pmap_rmt.c index 6d4ed7206c..6dd360edcd 100644 --- a/sunrpc/pmap_rmt.c +++ b/sunrpc/pmap_rmt.c @@ -391,3 +391,26 @@ done_broad: return stat; } libc_hidden_nolink_sunrpc (clnt_broadcast, GLIBC_2_0) + +/* 64-bit-time version */ + +/* The 64-bit-time version of pmap_rmtcall. + * Only handles 64-bit-time timeouts smaller than 2^^31 seconds. + */ +enum clnt_stat +__pmap_rmtcall_t64 (struct sockaddr_in *addr, u_long prog, u_long vers, + u_long proc, xdrproc_t xdrargs, caddr_t argsp, + xdrproc_t xdrres, caddr_t resp, + struct __timeval64 tout, u_long *port_ptr) +{ + struct timeval tout32; + if (tout.tv_sec > INT_MAX) + { + return RPC_SYSTEMERROR; + } + tout32.tv_sec = tout.tv_sec; + tout32.tv_usec = tout.tv_usec; + + return pmap_rmtcall (addr, prog, vers, proc, xdrargs, argsp, xdrres, + resp, tout32, port_ptr); +} diff --git a/sunrpc/rpc/clnt.h b/sunrpc/rpc/clnt.h index f4d4a941c7..e559242eeb 100644 --- a/sunrpc/rpc/clnt.h +++ b/sunrpc/rpc/clnt.h @@ -329,9 +329,33 @@ extern CLIENT *clnttcp_create (struct sockaddr_in *__raddr, u_long __prog, * u_int sendsz; * u_int recvsz; */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern CLIENT * __REDIRECT (clntudp_create,(struct sockaddr_in *__raddr, + u_long __program, + u_long __version, + struct timeval __wait_resend, + int *__sockp), + __clntudp_create_t64) __THROW; +# else +# define clntudp_create __clntudp_create_t64 +# endif +#endif extern CLIENT *clntudp_create (struct sockaddr_in *__raddr, u_long __program, u_long __version, struct timeval __wait_resend, int *__sockp) __THROW; +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern CLIENT * __REDIRECT (clntudp_bufcreate,(struct sockaddr_in *__raddr, + u_long __program, u_long __version, + struct __timeval64 __wait_resend, + int *__sockp, u_int __sendsz, + u_int __recvsz), + __clntudp_bufcreate_t64) __THROW; +# else +# define clntudp_bufcreate __clntudp_bufcreate_t64 +# endif +#endif extern CLIENT *clntudp_bufcreate (struct sockaddr_in *__raddr, u_long __program, u_long __version, struct timeval __wait_resend, int *__sockp, diff --git a/sunrpc/rpc/pmap_clnt.h b/sunrpc/rpc/pmap_clnt.h index 1cc94b8fee..70ec89b723 100644 --- a/sunrpc/rpc/pmap_clnt.h +++ b/sunrpc/rpc/pmap_clnt.h @@ -71,6 +71,21 @@ extern bool_t pmap_set (const u_long __program, const u_long __vers, extern bool_t pmap_unset (const u_long __program, const u_long __vers) __THROW; extern struct pmaplist *pmap_getmaps (struct sockaddr_in *__address) __THROW; +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern enum clnt_stat __REDIRECT (pmap_rmtcall, (struct sockaddr_in *__addr, + const u_long __prog, + const u_long __vers, + const u_long __proc, + xdrproc_t __xdrargs, + caddr_t __argsp, xdrproc_t __xdrres, + caddr_t __resp, struct timeval __tout, + u_long *__port_ptr), + __pmap_rmtcall_t64) __THROW; +# else +# define pmap_rmtcall __pmap_rmtcall_t64 +# endif +#endif extern enum clnt_stat pmap_rmtcall (struct sockaddr_in *__addr, const u_long __prog, const u_long __vers, From patchwork Fri Sep 8 17:49:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Albert ARIBAUD (3ADEV)" X-Patchwork-Id: 811755 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-84398-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="CEUI6bp+"; 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 3xplG04jStz9s8J for ; Sat, 9 Sep 2017 03:50: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; q=dns; s=default; b=u8sqM24NYlzehJuoC71w1CrBtli5tt+ qzPnvm9hypFjJM1RjitX0g+j2lqihozbN4MpzDnJaCcqYtIJVbnAjHC8jd/fApn4 IZlEqtqXjzNRlOWbIrX+/mUbUHreGk6hj9Zk+2T+lDsK+lAh1cqmSdL7mWllBRLd Ym9Nx2ABje44= 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; s=default; bh=DtiPASP8mNXQBA6MdZSssBzyKmQ=; b=CEUI6 bp+g1yvI3PQ92YBPqOfm9aWnp/hM+AjGcw1CHPeiHSD4LxfxKOJorXSkUixSRSAv /PaXaAj6S8wLzs5KS0npU8HXnYPYAGGJtjPc7F0xMQLOm6mlRFlKTBWxHxIjo/n7 olTT3t8rIaPPLNAy/YhhADoQNNyrkZIS/8IUhE= Received: (qmail 121860 invoked by alias); 8 Sep 2017 17:49:46 -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 121811 invoked by uid 89); 8 Sep 2017 17:49:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=calendar X-HELO: smtp6-g21.free.fr From: "Albert ARIBAUD (3ADEV)" To: libc-alpha@sourceware.org Cc: "Albert ARIBAUD (3ADEV)" Subject: [RFC PATCH 52/52] Y2038: add _TIME_BITS==64 support Date: Fri, 8 Sep 2017 19:49:09 +0200 Message-Id: <20170908174909.28192-3-albert.aribaud@3adev.fr> In-Reply-To: <20170908174909.28192-2-albert.aribaud@3adev.fr> References: <20170907224219.12483-50-albert.aribaud@3adev.fr> <20170908174909.28192-1-albert.aribaud@3adev.fr> <20170908174909.28192-2-albert.aribaud@3adev.fr> This makes all previously defined Y2038-proof API types, functions and implementations the default when _TIME_BITS==64. Note: it is assumed that the API is consistent, i.e. for each API type which is enabled here, all API functions which depend on this type are enabled and mapped to Y2038-proof implementations. Signed-off-by: Albert ARIBAUD (3ADEV) --- include/features.h | 4 + io/sys/stat.h | 75 ++++++++++++++-- io/utime.h | 15 +++- misc/sys/select.h | 25 ++++++ posix/sched.h | 9 ++ resource/sys/resource.h | 9 ++ rt/mqueue.h | 22 +++++ signal/signal.h | 10 +++ sysdeps/nptl/pthread.h | 41 +++++++++ sysdeps/pthread/semaphore.h | 10 +++ sysdeps/unix/sysv/linux/bits/stat.h | 6 +- sysdeps/unix/sysv/linux/sys/timerfd.h | 19 ++++ sysdeps/unix/sysv/linux/sys/timex.h | 32 ++++++- sysvipc/sys/msg.h | 9 ++ time/bits/types/struct_timespec.h | 17 ++++ time/bits/types/struct_timeval.h | 9 ++ time/bits/types/time_t.h | 4 + time/sys/time.h | 74 ++++++++++++++++ time/time.h | 161 +++++++++++++++++++++++++++++++++- 19 files changed, 536 insertions(+), 15 deletions(-) diff --git a/include/features.h b/include/features.h index c063b33b49..bee0bbbd5e 100644 --- a/include/features.h +++ b/include/features.h @@ -359,6 +359,10 @@ # define __USE_FILE_OFFSET64 1 #endif +#if defined _TIME_BITS && _TIME_BITS == 64 +# define __USE_TIME_BITS64 1 +#endif + #if defined _DEFAULT_SOURCE # define __USE_MISC 1 #endif diff --git a/io/sys/stat.h b/io/sys/stat.h index ac7ef1f572..8e6f9b62c1 100644 --- a/io/sys/stat.h +++ b/io/sys/stat.h @@ -210,14 +210,27 @@ extern int stat (const char *__restrict __file, extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2)); #else # ifdef __REDIRECT_NTH +# ifdef __USE_TIME_BITS64 +extern int __REDIRECT_NTH (stat, (const char *__restrict __file, + struct stat *__restrict __buf), __stat64_t64) + __nonnull ((1, 2)); +extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), __fstat64_t64) + __nonnull ((2)); +# else extern int __REDIRECT_NTH (stat, (const char *__restrict __file, struct stat *__restrict __buf), stat64) __nonnull ((1, 2)); extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64) __nonnull ((2)); +# endif # else -# define stat stat64 -# define fstat fstat64 +# ifdef __USE_TIME_BITS64 +# define stat stat64_t64 +# define fstat fstat64_t64 +# else +# define stat stat64 +# define fstat fstat64 +# endif # endif #endif #ifdef __USE_LARGEFILE64 @@ -260,12 +273,23 @@ extern int lstat (const char *__restrict __file, struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); # else # ifdef __REDIRECT_NTH +# ifdef __USE_TIME_BITS64 +extern int __REDIRECT_NTH (lstat, + (const char *__restrict __file, + struct stat *__restrict __buf), __lstat64_t64) + __nonnull ((1, 2)); +# else extern int __REDIRECT_NTH (lstat, (const char *__restrict __file, struct stat *__restrict __buf), lstat64) __nonnull ((1, 2)); +# endif # else -# define lstat lstat64 +# ifdef __USE_TIME_BITS64 +# define lstat __lstat64_t64 +# else +# define lstat lstat64 +# endif # endif # endif # ifdef __USE_LARGEFILE64 @@ -357,6 +381,15 @@ extern int mkfifoat (int __fd, const char *__path, __mode_t __mode) #ifdef __USE_ATFILE /* Set file access and modification times relative to directory file descriptor. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (utimensat, (int __fd, const char *__path, + const struct timespec __times[2], int __flags), + __utimensat64) __THROW __nonnull((2)); +# else +# define utimensat __utimensat64 +# endif +#endif extern int utimensat (int __fd, const char *__path, const struct timespec __times[2], int __flags) @@ -365,6 +398,14 @@ extern int utimensat (int __fd, const char *__path, #ifdef __USE_XOPEN2K8 /* Set file access and modification times of the file associated with FD. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (futimens, (int __fd, const struct timespec __times[2]), + __futimens64) __THROW; +# else +# define futimens __futimens64 +# endif +#endif extern int futimens (int __fd, const struct timespec __times[2]) __THROW; #endif @@ -403,6 +444,21 @@ extern int __fxstatat (int __ver, int __fildes, const char *__filename, __THROW __nonnull ((3, 4)); #else # ifdef __REDIRECT_NTH +# ifdef __USE_TIME_BITS64 +extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes, + struct stat *__stat_buf), __fxstat64_t64) + __nonnull ((3)); +extern int __REDIRECT_NTH (__xstat, (int __ver, const char *__filename, + struct stat *__stat_buf), __xstat64_t64) + __nonnull ((2, 3)); +extern int __REDIRECT_NTH (__lxstat, (int __ver, const char *__filename, + struct stat *__stat_buf), __lxstat64_t64) + __nonnull ((2, 3)); +extern int __REDIRECT_NTH (__fxstatat, (int __ver, int __fildes, + const char *__filename, + struct stat *__stat_buf, int __flag), + __fxstatat64_t64) __nonnull ((3, 4)); +# else extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes, struct stat *__stat_buf), __fxstat64) __nonnull ((3)); @@ -416,11 +472,18 @@ extern int __REDIRECT_NTH (__fxstatat, (int __ver, int __fildes, const char *__filename, struct stat *__stat_buf, int __flag), __fxstatat64) __nonnull ((3, 4)); +# endif # else -# define __fxstat __fxstat64 -# define __xstat __xstat64 -# define __lxstat __lxstat64 +# ifdef __USE_TIME_BITS64 +# define __fxstat __fxstat64_t64 +# define __xstat __xstat64_t64 +# define __lxstat __lxstat64_t64 +# else +# define __fxstat __fxstat64 +# define __xstat __xstat64 +# define __lxstat __lxstat64 +# endif # endif #endif diff --git a/io/utime.h b/io/utime.h index 44a4e9cddd..3222b12e91 100644 --- a/io/utime.h +++ b/io/utime.h @@ -32,15 +32,24 @@ __BEGIN_DECLS # include #endif -/* Structure describing file times. */ +/* Structure describing file times, 32- or 64-bit time. */ struct utimbuf { - __time_t actime; /* Access time. */ - __time_t modtime; /* Modification time. */ + time_t actime; /* Access time. */ + time_t modtime; /* Modification time. */ }; /* Set the access and modification times of FILE to those given in *FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (utime, (const char *__file, + const struct utimbuf *__file_times), + __utime_t64) __THROW __nonnull ((1)); +# else +# define utime __utime_t64 +# endif +#endif extern int utime (const char *__file, const struct utimbuf *__file_times) __THROW __nonnull ((1)); diff --git a/misc/sys/select.h b/misc/sys/select.h index 06dd31b476..aa0348a116 100644 --- a/misc/sys/select.h +++ b/misc/sys/select.h @@ -98,6 +98,18 @@ __BEGIN_DECLS This function is a cancellation point and therefore not marked with __THROW. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (select, (int __nfds, + fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout), + __select_t64); +# else +# define select __select_t64 +# endif +#endif extern int select (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, @@ -110,6 +122,19 @@ extern int select (int __nfds, fd_set *__restrict __readfds, This function is a cancellation point and therefore not marked with __THROW. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (pselect, (int __nfds, + fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask), + __pselect_t64); +# else +# define pselect __pselect_t64 +# endif +#endif extern int pselect (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, diff --git a/posix/sched.h b/posix/sched.h index d5cdac37b0..5a15094f44 100644 --- a/posix/sched.h +++ b/posix/sched.h @@ -74,6 +74,15 @@ extern int sched_get_priority_max (int __algorithm) __THROW; extern int sched_get_priority_min (int __algorithm) __THROW; /* Get the SCHED_RR interval for the named process. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (sched_rr_get_interval, + (__pid_t __pid, struct timespec *__t), + __sched_rr_get_interval_t64) __THROW; +# else +# define sched_rr_get_interval __sched_rr_get_interval_t64 +# endif +#endif extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW; diff --git a/resource/sys/resource.h b/resource/sys/resource.h index 423ac62a34..642fe791c5 100644 --- a/resource/sys/resource.h +++ b/resource/sys/resource.h @@ -84,6 +84,15 @@ extern int setrlimit64 (__rlimit_resource_t __resource, /* Return resource usage information on process indicated by WHO and put it in *USAGE. Returns 0 for success, -1 for failure. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern double __REDIRECT (getrusage, (__rusage_who_t __who, + struct rusage *__usage), + __getrusage_t64) __THROW; +# else +# define getrusage __getrusage_t64 +# endif +#endif extern int getrusage (__rusage_who_t __who, struct rusage *__usage) __THROW; /* Return the highest priority of any process specified by WHICH and WHO diff --git a/rt/mqueue.h b/rt/mqueue.h index c79aa53b94..f7e251ab79 100644 --- a/rt/mqueue.h +++ b/rt/mqueue.h @@ -73,6 +73,17 @@ extern int mq_send (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len, #ifdef __USE_XOPEN2K /* Receive the oldest from highest priority messages in message queue MQDES, stop waiting if ABS_TIMEOUT expires. */ +# ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern ssize_t __REDIRECT (mq_timedreceive, (mqd_t __mqdes, + char *__restrict __msg_ptr, size_t __msg_len, + unsigned int *__restrict __msg_prio, + const struct timespec *__restrict __abs_timeout), + __mq_timedreceive_t64) __nonnull((2, 5)); +# else +# define mq_timedreceive __mq_timedreceive_t64 +# endif +# endif extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr, size_t __msg_len, unsigned int *__restrict __msg_prio, @@ -81,6 +92,17 @@ extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr, /* Add message pointed by MSG_PTR to message queue MQDES, stop blocking on full message queue if ABS_TIMEOUT expires. */ +# ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (mq_timedsend, (mqd_t __mqdes, + const char *__msg_ptr, size_t __msg_len, + unsigned int __msg_prio, + const struct timespec *__abs_timeout), + __mq_timedsend_t64) __nonnull((2, 5)); +# else +# define mq_timedsend __mq_timedsend_t64 +# endif +# endif extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len, unsigned int __msg_prio, const struct timespec *__abs_timeout) diff --git a/signal/signal.h b/signal/signal.h index c8f6100ac4..5e76ea6161 100644 --- a/signal/signal.h +++ b/signal/signal.h @@ -262,6 +262,16 @@ extern int sigwaitinfo (const sigset_t *__restrict __set, This function is a cancellation point and therefore not marked with __THROW. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (sigtimedwait, (const sigset_t *__restrict __set, + siginfo_t *__restrict __info, + const struct timespec *__restrict __timeout), + __sigtimedwait64) __nonnull ((1)); +# else +# define sigtimedwait __sigtimedwait64 +# endif +#endif extern int sigtimedwait (const sigset_t *__restrict __set, siginfo_t *__restrict __info, const struct timespec *__restrict __timeout) diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h index 632ea7bc36..4289d990b5 100644 --- a/sysdeps/nptl/pthread.h +++ b/sysdeps/nptl/pthread.h @@ -765,6 +765,16 @@ extern int pthread_mutex_lock (pthread_mutex_t *__mutex) #ifdef __USE_XOPEN2K /* Wait until lock becomes available, or specified time passes. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern struct tm * __REDIRECT (pthread_mutex_timedlock, + (pthread_mutex_t *__restrict __mutex, + const struct timespec *__restrict __abstime), + __pthread_mutex_timedlock_t64) __THROWNL __nonnull ((1, 2)); +# else +# define pthread_mutex_timedlock __pthread_mutex_timedlock_t64 +# endif +#endif extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); @@ -904,6 +914,16 @@ extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) # ifdef __USE_XOPEN2K /* Try to acquire read lock for RWLOCK or return after specfied time. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern struct tm * __REDIRECT (pthread_rwlock_timedrdlock, + (pthread_rwlock_t *__restrict __rwlock, + struct timespec *__restrict __abstime), + __pthread_rwlock_timedrdlock_t64) __THROWNL __nonnull ((1, 2)); +# else +# define pthread_rwlock_timedrdlock __pthread_rwlock_timedrdlock_t64 +# endif +#endif extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); @@ -919,6 +939,16 @@ extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) # ifdef __USE_XOPEN2K /* Try to acquire write lock for RWLOCK or return after specfied time. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern struct tm * __REDIRECT (pthread_rwlock_timedwrlock, + (pthread_rwlock_t *__restrict __rwlock, + struct timespec *__restrict __abstime), + __pthread_rwlock_timedwrlock_t64) __THROWNL __nonnull ((1, 2)); +# else +# define pthread_rwlock_timedwrlock __pthread_rwlock_timedwrlock_t64 +# endif +#endif extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); @@ -998,6 +1028,17 @@ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond, This function is a cancellation point and therefore not marked with __THROW. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern struct tm * __REDIRECT (pthread_cond_timedwait, + (pthread_cond_t *__restrict __cond, + pthread_mutex_t *__restrict __mutex, + const struct timespec *__restrict __abstime), + __pthread_cond_timedwait_t64) __nonnull ((1, 2, 3)); +# else +# define pthread_cond_timedwait __pthread_cond_timedwait_t64 +# endif +#endif extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex, const struct timespec *__restrict __abstime) diff --git a/sysdeps/pthread/semaphore.h b/sysdeps/pthread/semaphore.h index 0b095a8891..f1dd8d265e 100644 --- a/sysdeps/pthread/semaphore.h +++ b/sysdeps/pthread/semaphore.h @@ -57,6 +57,16 @@ extern int sem_wait (sem_t *__sem); This function is a cancellation point and therefore not marked with __THROW. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern struct tm * __REDIRECT (sem_timedwait, + (sem_t *__restrict __sem, + const struct timespec *__restrict __abstime), + __sem_timedwait_t64); +# else +# define sem_timedwait __sem_timedwait_t64 +# endif +#endif extern int sem_timedwait (sem_t *__restrict __sem, const struct timespec *__restrict __abstime); #endif diff --git a/sysdeps/unix/sysv/linux/bits/stat.h b/sysdeps/unix/sysv/linux/bits/stat.h index 187590e51e..28522c4479 100644 --- a/sysdeps/unix/sysv/linux/bits/stat.h +++ b/sysdeps/unix/sysv/linux/bits/stat.h @@ -119,11 +119,11 @@ struct stat64 struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ # else - __time_t st_atime; /* Time of last access. */ + time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ + time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ + time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ # endif __ino64_t st_ino; /* File serial number. */ diff --git a/sysdeps/unix/sysv/linux/sys/timerfd.h b/sysdeps/unix/sysv/linux/sys/timerfd.h index 9811afe0fa..958065df1c 100644 --- a/sysdeps/unix/sysv/linux/sys/timerfd.h +++ b/sysdeps/unix/sysv/linux/sys/timerfd.h @@ -43,11 +43,30 @@ extern int timerfd_create (__clockid_t __clock_id, int __flags) __THROW; /* Set next expiration time of interval timer source UFD to UTMR. If FLAGS has the TFD_TIMER_ABSTIME flag set the timeout value is absolute. Optionally return the old expiration time in OTMR. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (timerfd_settime, (int __ufd, int __flags, + const struct itimerspec *__utmr, + struct itimerspec *__otmr),__timerfd_settime64) + __THROW; +# else +# define timerfd_settime __timerfd_settime64 +# endif +#endif extern int timerfd_settime (int __ufd, int __flags, const struct itimerspec *__utmr, struct itimerspec *__otmr) __THROW; /* Return the next expiration time of UFD. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (timerfd_gettime, (int __ufd, + struct itimerspec *__otmr),__timerfd_gettime64) + __THROW; +# else +# define timerfd_gettime __timerfd_gettime64 +# endif +#endif extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr) __THROW; __END_DECLS diff --git a/sysdeps/unix/sysv/linux/sys/timex.h b/sysdeps/unix/sysv/linux/sys/timex.h index 3f1b013afd..e10c9870f0 100644 --- a/sysdeps/unix/sysv/linux/sys/timex.h +++ b/sysdeps/unix/sysv/linux/sys/timex.h @@ -55,15 +55,43 @@ struct ntptimeval __BEGIN_DECLS extern int __adjtimex (struct timex *__ntx) __THROW; + +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern time_t __REDIRECT (adjtimex, (struct timex *__ntx), + __adjtimex_t64) __THROW; +# else +# define adjtimex __adjtimex_t64 +# endif +#endif extern int adjtimex (struct timex *__ntx) __THROW; -#ifdef __REDIRECT_NTH +#ifndef __USE_TIME_BITS64 +# ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv), ntp_gettimex); -#else +# else extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW; +# define ntp_gettime ntp_gettimex +# endif +#else +# if defined(__REDIRECT) +extern time_t __REDIRECT (ntp_gettimex, (struct ntptimeval *__ntv), + __ntp_gettimex_t64) __THROW; +# else +# define ntp_gettimex __ntp_gettimex_t64 +# endif # define ntp_gettime ntp_gettimex #endif + +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (ntp_adjtime, (struct timex *__tntx), + __ntp_adjtime_t64) __THROW; +# else +# define ntp_adjtime __ntp_adjtime_t64 +# endif +#endif extern int ntp_adjtime (struct timex *__tntx) __THROW; __END_DECLS diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h index 3610050014..4a6a94705b 100644 --- a/sysvipc/sys/msg.h +++ b/sysvipc/sys/msg.h @@ -58,6 +58,15 @@ struct msgbuf __BEGIN_DECLS /* Message queue control operation. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (msgctl, (int __msqid, int __cmd, + struct msqid_ds *__buf), + __msgctl_t64) __THROW; +# else +# define msgctl __msgctl_t64 +# endif +#endif extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW; /* Get messages queue. */ diff --git a/time/bits/types/struct_timespec.h b/time/bits/types/struct_timespec.h index 644db9fdb6..9f75a6d7e6 100644 --- a/time/bits/types/struct_timespec.h +++ b/time/bits/types/struct_timespec.h @@ -2,13 +2,30 @@ #define __timespec_defined 1 #include +#include /* POSIX.1b structure for a time value. This is like a `struct timeval' but has nanoseconds instead of microseconds. */ +# ifndef __USE_TIME_BITS64 struct timespec { __time_t tv_sec; /* Seconds. */ __syscall_slong_t tv_nsec; /* Nanoseconds. */ }; +# elif BYTE_ORDER == BIG_ENDIAN +struct timespec +{ + __time64_t tv_sec; /* Seconds. */ + int: 32; /* Hidden padding */ + __syscall_slong_t tv_nsec; /* Nanoseconds. */ +}; +# else +struct timespec +{ + __time64_t tv_sec; /* Seconds. */ + __syscall_slong_t tv_nsec; /* Nanoseconds. */ + int: 32; /* Hidden padding */ +}; +# endif #endif diff --git a/time/bits/types/struct_timeval.h b/time/bits/types/struct_timeval.h index 70394ce886..85e0cb5996 100644 --- a/time/bits/types/struct_timeval.h +++ b/time/bits/types/struct_timeval.h @@ -5,9 +5,18 @@ /* A time value that is accurate to the nearest microsecond but also has a range of years. */ +#ifdef __USE_TIME_BITS64 +struct timeval +{ + __time64_t tv_sec; /* Seconds. */ + __uint64_t tv_usec; /* Microseconds. */ +}; +#else struct timeval { __time_t tv_sec; /* Seconds. */ __suseconds_t tv_usec; /* Microseconds. */ }; #endif + +#endif diff --git a/time/bits/types/time_t.h b/time/bits/types/time_t.h index ab8287c6fe..84d67f6ac3 100644 --- a/time/bits/types/time_t.h +++ b/time/bits/types/time_t.h @@ -4,6 +4,10 @@ #include /* Returned by `time'. */ +#ifdef __USE_TIME_BITS64 +typedef __time64_t time_t; +#else typedef __time_t time_t; +#endif #endif diff --git a/time/sys/time.h b/time/sys/time.h index 165296ac59..614ff32a1f 100644 --- a/time/sys/time.h +++ b/time/sys/time.h @@ -65,12 +65,31 @@ typedef void *__restrict __timezone_ptr_t; Returns 0 on success, -1 on errors. NOTE: This form of timezone information is obsolete. Use the functions and variables declared in instead. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (gettimeofday, (struct timeval *__restrict __tv, + __timezone_ptr_t __tz), + __gettimeofday_t64) __THROW __nonnull((1)); +# else +# define gettimeofday __gettimeofday_t64 +# endif +#endif extern int gettimeofday (struct timeval *__restrict __tv, __timezone_ptr_t __tz) __THROW __nonnull ((1)); #ifdef __USE_MISC /* Set the current time of day and timezone information. This call is restricted to the super-user. */ +# ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (settimeofday, + (const struct timeval *__tv, + const struct timezone *__tz), + __settimeofday_t64) __THROW; +# else +# define settimeofday __settimeofday_t64 +# endif +# endif extern int settimeofday (const struct timeval *__tv, const struct timezone *__tz) __THROW; @@ -79,6 +98,16 @@ extern int settimeofday (const struct timeval *__tv, If OLDDELTA is not NULL, it is filled in with the amount of time adjustment remaining to be done from the last `adjtime' call. This call is restricted to the super-user. */ +# ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (adjtime, + (const struct timeval *__delta, + struct timeval *__olddelta), + __adjtime_t64) __THROW; +# else +# define adjtime __adjtime_t64 +# endif +# endif extern int adjtime (const struct timeval *__delta, struct timeval *__olddelta) __THROW; #endif @@ -119,12 +148,31 @@ typedef int __itimer_which_t; /* Set *VALUE to the current setting of timer WHICH. Return 0 on success, -1 on errors. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (getitimer, (__itimer_which_t __which, + struct itimerval *__value), __getitimer_t64) + __THROW; +# else +# define getitimer __getitimer_t64 +# endif +#endif extern int getitimer (__itimer_which_t __which, struct itimerval *__value) __THROW; /* Set the timer WHICH to *NEW. If OLD is not NULL, set *OLD to the old value of timer WHICH. Returns 0 on success, -1 on errors. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (setitimer, (__itimer_which_t __which, + const struct itimerval *__restrict __new, + struct itimerval *__restrict __old), __setitimer_t64) + __THROW; +# else +# define setitimer __setitimer_t64 +# endif +#endif extern int setitimer (__itimer_which_t __which, const struct itimerval *__restrict __new, struct itimerval *__restrict __old) __THROW; @@ -132,15 +180,41 @@ extern int setitimer (__itimer_which_t __which, /* Change the access time of FILE to TVP[0] and the modification time of FILE to TVP[1]. If TVP is a null pointer, use the current time instead. Returns 0 on success, -1 on errors. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (utimes, (const char *__file, + const struct timeval __tvp[2]), __utimes64) + __THROW __nonnull ((1)); +# else +# define utimes __utimes64 +# endif +#endif extern int utimes (const char *__file, const struct timeval __tvp[2]) __THROW __nonnull ((1)); #ifdef __USE_MISC /* Same as `utimes', but does not follow symbolic links. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (lutimes, (const char *__file, + const struct timeval __tvp[2]), __lutimes64) + __THROW __nonnull ((1)); +# else +# define lutimes __lutimes64 +# endif +#endif extern int lutimes (const char *__file, const struct timeval __tvp[2]) __THROW __nonnull ((1)); /* Same as `utimes', but takes an open file descriptor instead of a name. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (futimes, (int __fd, const struct timeval __tvp[2]), + __futimes64) __THROW; +# else +# define futimes __futimes64 +# endif +#endif extern int futimes (int __fd, const struct timeval __tvp[2]) __THROW; #endif diff --git a/time/time.h b/time/time.h index f12a4613fc..ca0152b003 100644 --- a/time/time.h +++ b/time/time.h @@ -72,16 +72,38 @@ __BEGIN_DECLS extern clock_t clock (void) __THROW; /* Return the current time and put it in *TIMER if TIMER is not NULL. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern time_t __REDIRECT (time, (time_t * __timer), + __time_t64) __THROW; +# else +# define time __time_t64 +# endif +#endif extern time_t time (time_t *__timer) __THROW; /* Return the difference between TIME1 and TIME0. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern double __REDIRECT (difftime, (time_t __time1, time_t __time0), + __difftime64) __THROW; +# else +# define difftime __difftime64 +# endif +#endif extern double difftime (time_t __time1, time_t __time0) __THROW __attribute__ ((__const__)); /* Return the `time_t' representation of TP and normalize TP. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern time_t __REDIRECT (mktime, (struct tm *__tp), __mktime64) __THROW; +# else +# define mktime __mktime64 +# endif +#endif extern time_t mktime (struct tm *__tp) __THROW; - /* Format TP into S according to FORMAT. Write no more than MAXSIZE characters and return the number of characters written, or 0 if it would exceed MAXSIZE. */ @@ -116,20 +138,52 @@ extern char *strptime_l (const char *__restrict __s, /* Return the `struct tm' representation of *TIMER in Universal Coordinated Time (aka Greenwich Mean Time). */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern struct tm * __REDIRECT (gmtime, (const time_t *__timer), + __gmtime64) __THROW; +# else +# define gmtime __gmtime64 +# endif +#endif extern struct tm *gmtime (const time_t *__timer) __THROW; /* Return the `struct tm' representation of *TIMER in the local timezone. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern struct tm * __REDIRECT (localtime, (const time_t *__timer), + __localtime64) __THROW; +# else +# define localtime __localtime64 +# endif +#endif extern struct tm *localtime (const time_t *__timer) __THROW; #ifdef __USE_POSIX /* Return the `struct tm' representation of *TIMER in UTC, using *TP to store the result. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern struct tm * __REDIRECT (gmtime_r, (const time_t *__restrict + __timer, struct tm *__restrict __tp), __gmtime64_r) __THROW; +# else +# define gmtime_r __gmtime64_r +# endif +#endif extern struct tm *gmtime_r (const time_t *__restrict __timer, struct tm *__restrict __tp) __THROW; /* Return the `struct tm' representation of *TIMER in local time, using *TP to store the result. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern struct tm * __REDIRECT (localtime_r, (const time_t *__restrict + __timer, struct tm *__restrict __tp), __localtime64_r) __THROW; +# else +# define localtime_r __localtime64_r +# endif +#endif extern struct tm *localtime_r (const time_t *__restrict __timer, struct tm *__restrict __tp) __THROW; #endif /* POSIX */ @@ -139,6 +193,14 @@ extern struct tm *localtime_r (const time_t *__restrict __timer, extern char *asctime (const struct tm *__tp) __THROW; /* Equivalent to `asctime (localtime (timer))'. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern char * __REDIRECT (ctime, (const time_t *__timer), + __ctime64) __THROW; +# else +# define ctime __ctime64 +# endif +#endif extern char *ctime (const time_t *__timer) __THROW; #ifdef __USE_POSIX @@ -150,6 +212,14 @@ extern char *asctime_r (const struct tm *__restrict __tp, char *__restrict __buf) __THROW; /* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern char * __REDIRECT (ctime_r, (const time_t *__restrict __timer, + char *__restrict __buf), __ctime64_r) __THROW; +# else +# define ctime_r __ctime64_r +# endif +#endif extern char *ctime_r (const time_t *__restrict __timer, char *__restrict __buf) __THROW; #endif /* POSIX */ @@ -178,6 +248,14 @@ extern long int timezone; #ifdef __USE_MISC /* Set the system time to *WHEN. This call is restricted to the superuser. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (stime, (const time_t *__when), __stime_t64) + __THROW; +# else +# define stime __stime_t64 +# endif +#endif extern int stime (const time_t *__when) __THROW; #endif @@ -193,9 +271,23 @@ extern int stime (const time_t *__when) __THROW; localtime package. These are included only for compatibility. */ /* Like `mktime', but for TP represents Universal Time, not local time. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern time_t __REDIRECT (timegm, (struct tm *__tp), __timegm64) __THROW; +# else +# define timegm __timegm64 +# endif +#endif extern time_t timegm (struct tm *__tp) __THROW; /* Another name for `mktime'. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern time_t __REDIRECT (timelocal, (struct tm *__tp), __timelocal64) __THROW; +# else +# define timelocal __timelocal64 +# endif +#endif extern time_t timelocal (struct tm *__tp) __THROW; /* Return the number of days in YEAR. */ @@ -208,17 +300,49 @@ extern int dysize (int __year) __THROW __attribute__ ((__const__)); This function is a cancellation point and therefore not marked with __THROW. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (nanosleep, (const struct timespec *__requested_time, + struct timespec *__remaining), __nanosleep_t64); +# else +# define nanosleep __nanosleep_t64 +# endif +#endif extern int nanosleep (const struct timespec *__requested_time, struct timespec *__remaining); /* Get resolution of clock CLOCK_ID. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (clock_getres, (clockid_t __clock_id, struct + timespec *__res), __clock_getres64) __THROW; +# else +# define clock_getres __clock_getres64 +# endif +#endif extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __THROW; /* Get current value of clock CLOCK_ID and store it in TP. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (clock_gettime, (clockid_t __clock_id, struct + timespec *__tp), __clock_gettime64) __THROW; +# else +# define clock_gettime __clock_gettime64 +# endif +#endif extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __THROW; /* Set clock CLOCK_ID to value TP. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (clock_settime, (clockid_t __clock_id, const struct + timespec *__tp), __clock_settime64) __THROW; +# else +# define clock_settime __clock_settime64 +# endif +#endif extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) __THROW; @@ -227,6 +351,15 @@ extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) This function is a cancellation point and therefore not marked with __THROW. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (clock_nanosleep, (clockid_t __clock_id, int __flags, + const struct timespec *__req, struct timespec *__rem), + __clock_nanosleep64) __THROW; +# else +# define clock_nanosleep __clock_nanosleep64 +# endif +#endif extern int clock_nanosleep (clockid_t __clock_id, int __flags, const struct timespec *__req, struct timespec *__rem); @@ -245,11 +378,29 @@ extern int timer_create (clockid_t __clock_id, extern int timer_delete (timer_t __timerid) __THROW; /* Set timer TIMERID to VALUE, returning old value in OVALUE. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (timer_settime, (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue), + __timer_settime64) __THROW; +# else +# define timer_settime __timer_settime64 +# endif +#endif extern int timer_settime (timer_t __timerid, int __flags, const struct itimerspec *__restrict __value, struct itimerspec *__restrict __ovalue) __THROW; /* Get current value of timer TIMERID and store it in VALUE. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (timer_gettime, (timer_t __timerid, struct + itimerspec *__value), __timer_gettime64) __THROW __nonnull ((1)); +# else +# define timer_gettime __timer_gettime64 +# endif +#endif extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) __THROW; @@ -260,6 +411,14 @@ extern int timer_getoverrun (timer_t __timerid) __THROW; #ifdef __USE_ISOC11 /* Set TS to calendar time based in time base BASE. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (timespec_get, (struct timespec *__ts, int __base), + __timespec_get64) __THROW __nonnull ((1)); +# else +# define timespec_get __timespec_get64 +# endif +#endif extern int timespec_get (struct timespec *__ts, int __base) __THROW __nonnull ((1)); #endif