@@ -20,10 +20,11 @@
#include <time.h>
#include "sem_waitcommon.c"
+#include "semaphoreP.h"
int
-sem_clockwait (sem_t *sem, clockid_t clockid,
- const struct timespec *abstime)
+__sem_clockwait64 (sem_t *sem, clockid_t clockid,
+ const struct __timespec64 *abstime)
{
/* Check that supplied clockid is one we support, even if we don't end up
waiting. */
@@ -44,3 +45,19 @@ sem_clockwait (sem_t *sem, clockid_t clockid,
else
return __new_sem_wait_slow ((struct new_sem *) sem, clockid, abstime);
}
+
+#if __TIMESIZE != 64
+libc_hidden_def (__sem_timedwait64)
+
+int
+__sem_clockwait (sem_t *sem, clockid_t clockid,
+ const struct timespec *abstime)
+{
+ struct __timespec64 ts64;
+ if (abstime != NULL)
+ ts64 = valid_timespec_to_timespec64 (*abstime);
+
+ return __sem_clockwait64 (sem, clockid, abstime != NULL ? &ts64 : NULL);
+}
+#endif
+weak_alias (__sem_clockwait, sem_clockwait)
@@ -19,11 +19,12 @@
#include <time.h>
#include "sem_waitcommon.c"
+#include "semaphoreP.h"
/* This is in a separate file because because sem_timedwait is only provided
if __USE_XOPEN2K is defined. */
int
-sem_timedwait (sem_t *sem, const struct timespec *abstime)
+__sem_timedwait64 (sem_t *sem, const struct __timespec64 *abstime)
{
if (! valid_nanoseconds (abstime->tv_nsec))
{
@@ -40,3 +41,18 @@ sem_timedwait (sem_t *sem, const struct timespec *abstime)
return __new_sem_wait_slow ((struct new_sem *) sem,
CLOCK_REALTIME, abstime);
}
+
+#if __TIMESIZE != 64
+libc_hidden_def (__sem_timedwait64)
+
+int
+__sem_timedwait (sem_t *sem, const struct timespec *abstime)
+{
+ struct __timespec64 ts64;
+ if (abstime != NULL)
+ ts64 = valid_timespec_to_timespec64 (*abstime);
+
+ return __sem_timedwait64 (sem, abstime != NULL ? &ts64 : NULL);
+}
+#endif
+weak_alias (__sem_timedwait, sem_timedwait)
@@ -104,7 +104,7 @@ __sem_wait_cleanup (void *arg)
static int
__attribute__ ((noinline))
do_futex_wait (struct new_sem *sem, clockid_t clockid,
- const struct timespec *abstime)
+ const struct __timespec64 *abstime)
{
int err;
@@ -163,7 +163,7 @@ __new_sem_wait_fast (struct new_sem *sem, int definitive_result)
static int
__attribute__ ((noinline))
__new_sem_wait_slow (struct new_sem *sem, clockid_t clockid,
- const struct timespec *abstime)
+ const struct __timespec64 *abstime)
{
int err = 0;
@@ -17,6 +17,7 @@
<https://www.gnu.org/licenses/>. */
#include <semaphore.h>
+#include <struct___timespec64.h>
#include "pthreadP.h"
#define SEM_SHM_PREFIX "sem."
@@ -52,3 +53,14 @@ extern int __new_sem_wait (sem_t *sem);
extern int __old_sem_wait (sem_t *sem);
extern int __new_sem_trywait (sem_t *sem);
extern int __new_sem_getvalue (sem_t *sem, int *sval);
+
+#if __TIMESIZE == 64
+# define __sem_timedwait64 __sem_timedwait
+# define __sem_clockwait64 __sem_clockwait
+#else
+extern int __sem_timedwait64 (sem_t *sem, const struct __timespec64 *abstime);
+libc_hidden_proto (__sem_timedwait64)
+extern int __sem_clockwait64 (sem_t *sem, clockid_t clockid,
+ const struct __timespec64 *abstime);
+libc_hidden_proto (__sem_clockwait64)
+#endif