@@ -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);
@@ -16,14 +16,32 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#include <time.h>
#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)
@@ -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);
@@ -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;
@@ -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)
@@ -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)
@@ -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)
@@ -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
@@ -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)
@@ -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)
@@ -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)