From patchwork Tue Jul 7 15:08:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 39939 X-Patchwork-Delegate: l.majewski@majess.pl Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F3C03386190B; Tue, 7 Jul 2020 15:08:59 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by sourceware.org (Postfix) with ESMTPS id D31FF3861899 for ; Tue, 7 Jul 2020 15:08:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D31FF3861899 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4B1QnL6qmsz1qskc; Tue, 7 Jul 2020 17:08:54 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4B1QnL5kxlz1r573; Tue, 7 Jul 2020 17:08:54 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id U36dFG6TRHp7; Tue, 7 Jul 2020 17:08:51 +0200 (CEST) X-Auth-Info: 7W3TF87l8UI9BwwZmN15zaerxWMCGun9J/FPtoSxNBQ= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Tue, 7 Jul 2020 17:08:51 +0200 (CEST) From: Lukasz Majewski To: Joseph Myers , Paul Eggert , Adhemerval Zanella Subject: [RFC 05/10] y2038: Convert pthread_* functions to support 64 bit time Date: Tue, 7 Jul 2020 17:08:22 +0200 Message-Id: <20200707150827.20899-6-lukma@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200707150827.20899-1-lukma@denx.de> References: <20200707150827.20899-1-lukma@denx.de> MIME-Version: 1.0 X-Spam-Status: No, score=-20.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Weimer , GNU C Library , Andreas Schwab , Stepan Golosunov , Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Following function are converted to support 64 bit abstime parameter on archs with __TIMESIZE != 64 and __WORDSIZE == 32: pthread_cond_timedwait pthread_cond_clockwait pthread_mutex_clocklock pthread_mutex_timedlock pthread_clockjoin_np pthread_timedjoin_np pthread_rwlock_clockrdlock pthread_rwlock_clockwrlock pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock --- nptl/pthreadP.h | 53 ++++++++++++++++++++++++++++++- nptl/pthread_clockjoin.c | 22 +++++++++++-- nptl/pthread_cond_wait.c | 46 +++++++++++++++++++++++---- nptl/pthread_join_common.c | 11 ++++--- nptl/pthread_mutex_timedlock.c | 39 ++++++++++++++++++----- nptl/pthread_rwlock_clockrdlock.c | 21 ++++++++++-- nptl/pthread_rwlock_clockwrlock.c | 21 ++++++++++-- nptl/pthread_rwlock_common.c | 4 +-- nptl/pthread_rwlock_timedrdlock.c | 21 ++++++++++-- nptl/pthread_rwlock_timedwrlock.c | 21 ++++++++++-- nptl/pthread_timedjoin.c | 20 ++++++++++-- 11 files changed, 245 insertions(+), 34 deletions(-) diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h index 6f94d6be31..cab4adf4a1 100644 --- a/nptl/pthreadP.h +++ b/nptl/pthreadP.h @@ -458,6 +458,57 @@ extern int __pthread_cond_init (pthread_cond_t *cond, libc_hidden_proto (__pthread_cond_init) extern int __pthread_cond_signal (pthread_cond_t *cond); extern int __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex); + +#if __TIMESIZE == 64 +# define __pthread_cond_timedwait64 __pthread_cond_timedwait +# define __pthread_cond_clockwait64 __pthread_cond_clockwait +# define __pthread_mutex_clocklock64 __pthread_mutex_clocklock +# define __pthread_mutex_timedlock64 __pthread_mutex_timedlock +# define __pthread_clockjoin_np64 __pthread_clockjoin_np +# define __pthread_timedjoin_np64 __pthread_timedjoin_np +# define __pthread_rwlock_clockrdlock64 __pthread_rwlock_clockrdlock +# define __pthread_rwlock_clockwrlock64 __pthread_rwlock_clockwrlock +# define __pthread_rwlock_timedrdlock64 __pthread_rwlock_timedrdlock +# define __pthread_rwlock_timedwrlock64 __pthread_rwlock_timedwrlock +#else +extern int __pthread_cond_timedwait64 (pthread_cond_t *cond, + pthread_mutex_t *mutex, + const struct __timespec64 *abstime); +libc_hidden_proto (__pthread_cond_timedwait64) +extern int __pthread_cond_clockwait64 (pthread_cond_t *cond, + pthread_mutex_t *mutex, + clockid_t clockid, + const struct __timespec64 *abstime); +libc_hidden_proto (__pthread_cond_clockwait64) +extern int __pthread_mutex_clocklock64 (pthread_mutex_t *mutex, + clockid_t clockid, + const struct __timespec64 *abstime); +libc_hidden_proto (__pthread_mutex_clocklock64) +extern int __pthread_mutex_timedlock64 (pthread_mutex_t *mutex, + const struct __timespec64 *abstime); +libc_hidden_proto (__pthread_mutex_timedlock64) +extern int __pthread_clockjoin_np64 (pthread_t threadid, void **thread_return, + clockid_t clockid, + const struct __timespec64 *abstime); +libc_hidden_proto (__pthread_clockjoin_np64) +extern int __pthread_timedjoin_np64 (pthread_t threadid, void **thread_return, + const struct __timespec64 *abstime); +libc_hidden_proto (__pthread_timedjoin_np64) +extern int __pthread_rwlock_clockrdlock64 (pthread_rwlock_t *rwlock, + clockid_t clockid, + const struct __timespec64 *abstime); +libc_hidden_proto (__pthread_rwlock_clockrdlock64) +extern int __pthread_rwlock_clockwrlock64 (pthread_rwlock_t *rwlock, + clockid_t clockid, + const struct __timespec64 *abstime); +libc_hidden_proto (__pthread_rwlock_clockwrlock64) +extern int __pthread_rwlock_timedrdlock64 (pthread_rwlock_t *rwlock, + const struct __timespec64 *abstime); +libc_hidden_proto (__pthread_rwlock_timedrdlock64) +extern int __pthread_rwlock_timedwrlock64 (pthread_rwlock_t *rwlock, + const struct __timespec64 *abstime); +libc_hidden_proto (__pthread_rwlock_timedwrlock64) +#endif extern int __pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime); @@ -488,7 +539,7 @@ extern int __pthread_enable_asynccancel (void) attribute_hidden; extern void __pthread_disable_asynccancel (int oldtype) attribute_hidden; extern void __pthread_testcancel (void); extern int __pthread_clockjoin_ex (pthread_t, void **, clockid_t, - const struct timespec *, bool) + const struct __timespec64 *, bool) attribute_hidden; extern int __pthread_sigmask (int, const sigset_t *, sigset_t *); libc_hidden_proto (__pthread_sigmask); diff --git a/nptl/pthread_clockjoin.c b/nptl/pthread_clockjoin.c index a3e7f37e3b..c3a92e5e0b 100644 --- a/nptl/pthread_clockjoin.c +++ b/nptl/pthread_clockjoin.c @@ -16,14 +16,32 @@ License along with the GNU C Library; if not, see . */ +#include #include "pthreadP.h" +int +__pthread_clockjoin_np64 (pthread_t threadid, void **thread_return, + clockid_t clockid, + const struct __timespec64 *abstime) +{ + return __pthread_clockjoin_ex (threadid, thread_return, + clockid, abstime, true); +} + +#if __TIMESIZE != 64 +libc_hidden_def (__pthread_clockjoin_np64) + int __pthread_clockjoin_np (pthread_t threadid, void **thread_return, clockid_t clockid, const struct timespec *abstime) { - return __pthread_clockjoin_ex (threadid, thread_return, - clockid, abstime, true); + struct __timespec64 ts64; + if (abstime != NULL) + ts64 = valid_timespec_to_timespec64 (*abstime); + + return __pthread_clockjoin_np64 (threadid, thread_return, + clockid, abstime != NULL ? &ts64 : NULL); } +#endif weak_alias (__pthread_clockjoin_np, pthread_clockjoin_np) diff --git a/nptl/pthread_cond_wait.c b/nptl/pthread_cond_wait.c index 85ddbc1011..69b18b1316 100644 --- a/nptl/pthread_cond_wait.c +++ b/nptl/pthread_cond_wait.c @@ -379,7 +379,7 @@ __condvar_cleanup_waiting (void *arg) static __always_inline int __pthread_cond_wait_common (pthread_cond_t *cond, pthread_mutex_t *mutex, clockid_t clockid, - const struct timespec *abstime) + const struct __timespec64 *abstime) { const int maxspin = 0; int err; @@ -640,8 +640,8 @@ __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) /* See __pthread_cond_wait_common. */ int -__pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime) +__pthread_cond_timedwait64 (pthread_cond_t *cond, pthread_mutex_t *mutex, + const struct __timespec64 *abstime) { /* Check parameter validity. This should also tell the compiler that it can assume that abstime is not NULL. */ @@ -655,6 +655,23 @@ __pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, ? CLOCK_MONOTONIC : CLOCK_REALTIME; return __pthread_cond_wait_common (cond, mutex, clockid, abstime); } + +#if __TIMESIZE != 64 +libc_hidden_def (__pthread_cond_timedwait64) + +int +__pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, + const struct timespec *abstime) +{ + struct __timespec64 ts64; + if (abstime != NULL) + ts64 = valid_timespec_to_timespec64 (*abstime); + + return __pthread_cond_timedwait64 (cond, mutex, + abstime != NULL ? &ts64 : NULL); +} +#endif + versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait, GLIBC_2_3_2); versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait, @@ -662,9 +679,9 @@ versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait, /* See __pthread_cond_wait_common. */ int -__pthread_cond_clockwait (pthread_cond_t *cond, pthread_mutex_t *mutex, - clockid_t clockid, - const struct timespec *abstime) +__pthread_cond_clockwait64 (pthread_cond_t *cond, pthread_mutex_t *mutex, + clockid_t clockid, + const struct __timespec64 *abstime) { /* Check parameter validity. This should also tell the compiler that it can assume that abstime is not NULL. */ @@ -676,4 +693,21 @@ __pthread_cond_clockwait (pthread_cond_t *cond, pthread_mutex_t *mutex, return __pthread_cond_wait_common (cond, mutex, clockid, abstime); } + +#if __TIMESIZE != 64 +libc_hidden_def (__pthread_cond_clockwait64) + +int +__pthread_cond_clockwait (pthread_cond_t *cond, pthread_mutex_t *mutex, + clockid_t clockid, + const struct timespec *abstime) +{ + struct __timespec64 ts64; + if (abstime != NULL) + ts64 = valid_timespec_to_timespec64 (*abstime); + + return __pthread_cond_clockwait64(cond, mutex, clockid, + abstime != NULL ? &ts64 : NULL); +} +#endif weak_alias (__pthread_cond_clockwait, pthread_cond_clockwait); diff --git a/nptl/pthread_join_common.c b/nptl/pthread_join_common.c index a96ceafde4..38a078fd23 100644 --- a/nptl/pthread_join_common.c +++ b/nptl/pthread_join_common.c @@ -37,7 +37,8 @@ cleanup (void *arg) afterwards. The kernel up to version 3.16.3 does not use the private futex operations for futex wake-up when the clone terminates. */ static int -clockwait_tid (pid_t *tidp, clockid_t clockid, const struct timespec *abstime) +clockwait_tid (pid_t *tidp, clockid_t clockid, + const struct __timespec64 *abstime) { pid_t tid; @@ -47,11 +48,11 @@ clockwait_tid (pid_t *tidp, clockid_t clockid, const struct timespec *abstime) /* Repeat until thread terminated. */ while ((tid = *tidp) != 0) { - struct timespec rt; + struct __timespec64 rt; /* Get the current time. This can only fail if clockid is invalid. */ - if (__glibc_unlikely (__clock_gettime (clockid, &rt))) + if (__glibc_unlikely (__clock_gettime64 (clockid, &rt))) return EINVAL; /* Compute relative timeout. */ @@ -80,8 +81,8 @@ clockwait_tid (pid_t *tidp, clockid_t clockid, const struct timespec *abstime) int __pthread_clockjoin_ex (pthread_t threadid, void **thread_return, - clockid_t clockid, - const struct timespec *abstime, bool block) + clockid_t clockid, + const struct __timespec64 *abstime, bool block) { struct pthread *pd = (struct pthread *) threadid; diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c index 8ae814b984..2438c61aa4 100644 --- a/nptl/pthread_mutex_timedlock.c +++ b/nptl/pthread_mutex_timedlock.c @@ -45,7 +45,7 @@ int __pthread_mutex_clocklock_common (pthread_mutex_t *mutex, clockid_t clockid, - const struct timespec *abstime) + const struct __timespec64 *abstime) { int oldval; pid_t id = THREAD_GETMEM (THREAD_SELF, tid); @@ -543,10 +543,10 @@ __pthread_mutex_clocklock_common (pthread_mutex_t *mutex, goto failpp; } - struct timespec rt; + struct __timespec64 rt; /* Get the current time. */ - __clock_gettime (CLOCK_REALTIME, &rt); + __clock_gettime64 (CLOCK_REALTIME, &rt); /* Compute relative timeout. */ rt.tv_sec = abstime->tv_sec - rt.tv_sec; @@ -599,9 +599,9 @@ __pthread_mutex_clocklock_common (pthread_mutex_t *mutex, } int -__pthread_mutex_clocklock (pthread_mutex_t *mutex, - clockid_t clockid, - const struct timespec *abstime) +__pthread_mutex_clocklock64 (pthread_mutex_t *mutex, + clockid_t clockid, + const struct __timespec64 *abstime) { if (__glibc_unlikely (!lll_futex_supported_clockid (clockid))) return EINVAL; @@ -609,13 +609,36 @@ __pthread_mutex_clocklock (pthread_mutex_t *mutex, LIBC_PROBE (mutex_clocklock_entry, 3, mutex, clockid, abstime); return __pthread_mutex_clocklock_common (mutex, clockid, abstime); } + +#if __TIMESIZE != 64 +libc_hidden_def (__pthread_mutex_clocklock64) +int +__pthread_mutex_clocklock (pthread_mutex_t *mutex, + clockid_t clockid, + const struct timespec *abstime) +{ + struct __timespec64 ts64 = valid_timespec_to_timespec64 (*abstime); + return __pthread_mutex_clocklock64 (mutex, clockid, &ts64); +} +#endif weak_alias (__pthread_mutex_clocklock, pthread_mutex_clocklock) int -__pthread_mutex_timedlock (pthread_mutex_t *mutex, - const struct timespec *abstime) +__pthread_mutex_timedlock64 (pthread_mutex_t *mutex, + const struct __timespec64 *abstime) { LIBC_PROBE (mutex_timedlock_entry, 2, mutex, abstime); return __pthread_mutex_clocklock_common (mutex, CLOCK_REALTIME, abstime); } + +#if __TIMESIZE != 64 +libc_hidden_def (__pthread_mutex_timedlock64) +int +__pthread_mutex_timedlock (pthread_mutex_t *mutex, + const struct timespec *abstime) +{ + struct __timespec64 ts64 = valid_timespec_to_timespec64 (*abstime); + return __pthread_mutex_timedlock64 (mutex, &ts64); +} +#endif weak_alias (__pthread_mutex_timedlock, pthread_mutex_timedlock) diff --git a/nptl/pthread_rwlock_clockrdlock.c b/nptl/pthread_rwlock_clockrdlock.c index 4cedfd1dcd..bb0a0b0d16 100644 --- a/nptl/pthread_rwlock_clockrdlock.c +++ b/nptl/pthread_rwlock_clockrdlock.c @@ -21,8 +21,25 @@ /* See pthread_rwlock_common.c. */ int -pthread_rwlock_clockrdlock (pthread_rwlock_t *rwlock, clockid_t clockid, - const struct timespec *abstime) +__pthread_rwlock_clockrdlock64 (pthread_rwlock_t *rwlock, clockid_t clockid, + const struct __timespec64 *abstime) { return __pthread_rwlock_rdlock_full (rwlock, clockid, abstime); } + +#if __TIMESIZE != 64 +libc_hidden_def (__pthread_rwlock_clockrdlock64) + +int +__pthread_rwlock_clockrdlock (pthread_rwlock_t *rwlock, clockid_t clockid, + const struct timespec *abstime) +{ + struct __timespec64 ts64; + if (abstime != NULL) + ts64 = valid_timespec_to_timespec64 (*abstime); + + return __pthread_rwlock_clockrdlock64 (rwlock, clockid, + abstime != NULL ? &ts64 : NULL); +} +#endif +weak_alias (__pthread_rwlock_clockrdlock, pthread_rwlock_clockrdlock) diff --git a/nptl/pthread_rwlock_clockwrlock.c b/nptl/pthread_rwlock_clockwrlock.c index 7a954cf529..742fa04dbc 100644 --- a/nptl/pthread_rwlock_clockwrlock.c +++ b/nptl/pthread_rwlock_clockwrlock.c @@ -21,8 +21,25 @@ /* See pthread_rwlock_common.c. */ int -pthread_rwlock_clockwrlock (pthread_rwlock_t *rwlock, clockid_t clockid, - const struct timespec *abstime) +__pthread_rwlock_clockwrlock64 (pthread_rwlock_t *rwlock, clockid_t clockid, + const struct __timespec64 *abstime) { return __pthread_rwlock_wrlock_full (rwlock, clockid, abstime); } + +#if __TIMESIZE != 64 +libc_hidden_def (__pthread_rwlock_clockwrlock64) + +int +__pthread_rwlock_clockwrlock (pthread_rwlock_t *rwlock, clockid_t clockid, + const struct timespec *abstime) +{ + struct __timespec64 ts64; + if (abstime != NULL) + ts64 = valid_timespec_to_timespec64 (*abstime); + + return __pthread_rwlock_clockwrlock64 (rwlock, clockid, + abstime != NULL ? &ts64 : NULL); +} +#endif +weak_alias (__pthread_rwlock_clockwrlock, pthread_rwlock_clockwrlock) diff --git a/nptl/pthread_rwlock_common.c b/nptl/pthread_rwlock_common.c index 3fbc66ded2..438cf2f74c 100644 --- a/nptl/pthread_rwlock_common.c +++ b/nptl/pthread_rwlock_common.c @@ -280,7 +280,7 @@ __pthread_rwlock_rdunlock (pthread_rwlock_t *rwlock) static __always_inline int __pthread_rwlock_rdlock_full (pthread_rwlock_t *rwlock, clockid_t clockid, - const struct timespec *abstime) + const struct __timespec64 *abstime) { unsigned int r; @@ -587,7 +587,7 @@ __pthread_rwlock_wrunlock (pthread_rwlock_t *rwlock) static __always_inline int __pthread_rwlock_wrlock_full (pthread_rwlock_t *rwlock, clockid_t clockid, - const struct timespec *abstime) + const struct __timespec64 *abstime) { /* Make sure any passed in clockid and timeout value are valid. Note that the previous implementation assumed that this check *must* not be diff --git a/nptl/pthread_rwlock_timedrdlock.c b/nptl/pthread_rwlock_timedrdlock.c index c5d8aee909..7e808439a6 100644 --- a/nptl/pthread_rwlock_timedrdlock.c +++ b/nptl/pthread_rwlock_timedrdlock.c @@ -20,8 +20,25 @@ /* See pthread_rwlock_common.c. */ int -pthread_rwlock_timedrdlock (pthread_rwlock_t *rwlock, - const struct timespec *abstime) +__pthread_rwlock_timedrdlock64 (pthread_rwlock_t *rwlock, + const struct __timespec64 *abstime) { return __pthread_rwlock_rdlock_full (rwlock, CLOCK_REALTIME, abstime); } + +#if __TIMESIZE != 64 +libc_hidden_def (__pthread_rwlock_timedrdlock64) + +int +__pthread_rwlock_timedrdlock (pthread_rwlock_t *rwlock, + const struct timespec *abstime) +{ + struct __timespec64 ts64; + if (abstime != NULL) + ts64 = valid_timespec_to_timespec64 (*abstime); + + return __pthread_rwlock_timedrdlock64 (rwlock, + abstime != NULL ? &ts64 : NULL); +} +#endif +weak_alias (__pthread_rwlock_timedrdlock, pthread_rwlock_timedrdlock) diff --git a/nptl/pthread_rwlock_timedwrlock.c b/nptl/pthread_rwlock_timedwrlock.c index ccee8b77d9..8160c18819 100644 --- a/nptl/pthread_rwlock_timedwrlock.c +++ b/nptl/pthread_rwlock_timedwrlock.c @@ -20,8 +20,25 @@ /* See pthread_rwlock_common.c. */ int -pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock, - const struct timespec *abstime) +__pthread_rwlock_timedwrlock64 (pthread_rwlock_t *rwlock, + const struct __timespec64 *abstime) { return __pthread_rwlock_wrlock_full (rwlock, CLOCK_REALTIME, abstime); } + +#if __TIMESIZE != 64 +libc_hidden_def (__pthread_rwlock_timedwrlock64) + +int +__pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock, + const struct timespec *abstime) +{ + struct __timespec64 ts64; + if (abstime != NULL) + ts64 = valid_timespec_to_timespec64 (*abstime); + + return __pthread_rwlock_timedwrlock64 (rwlock, + abstime != NULL ? &ts64 : NULL); +} +#endif +weak_alias (__pthread_rwlock_timedwrlock, pthread_rwlock_timedwrlock) diff --git a/nptl/pthread_timedjoin.c b/nptl/pthread_timedjoin.c index dd7038dcf7..a6c2bbae53 100644 --- a/nptl/pthread_timedjoin.c +++ b/nptl/pthread_timedjoin.c @@ -19,10 +19,26 @@ #include "pthreadP.h" int -__pthread_timedjoin_np (pthread_t threadid, void **thread_return, - const struct timespec *abstime) +__pthread_timedjoin_np64 (pthread_t threadid, void **thread_return, + const struct __timespec64 *abstime) { return __pthread_clockjoin_ex (threadid, thread_return, CLOCK_REALTIME, abstime, true); } + +#if __TIMESIZE != 64 +libc_hidden_def (__pthread_timedjoin_np64) + +int +__pthread_timedjoin_np (pthread_t threadid, void **thread_return, + const struct timespec *abstime) +{ + struct __timespec64 ts64; + if (abstime != NULL) + ts64 = valid_timespec_to_timespec64 (*abstime); + + return __pthread_timedjoin_np64 (threadid, thread_return, + abstime != NULL ? &ts64 : NULL); +} +#endif weak_alias (__pthread_timedjoin_np, pthread_timedjoin_np)