summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--linuxthreads/ChangeLog4
-rw-r--r--linuxthreads/sysdeps/pthread/Makefile2
-rw-r--r--nptl/ChangeLog3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S50
4 files changed, 56 insertions, 3 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index ecd57bf81c..3376c13d5d 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,7 @@
+2003-03-19  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/pthread/Makefile: Fix cut&paste error.
+
 2003-03-18  Roland McGrath  <roland@redhat.com>
 
 	* Versions (libpthread: GLIBC_2.2): Remove
diff --git a/linuxthreads/sysdeps/pthread/Makefile b/linuxthreads/sysdeps/pthread/Makefile
index 6b92fbf47f..e9d57d58e4 100644
--- a/linuxthreads/sysdeps/pthread/Makefile
+++ b/linuxthreads/sysdeps/pthread/Makefile
@@ -9,5 +9,5 @@ endif
 endif
 
 ifeq ($(subdir),posix)
-CFLAGS-confstr.c += -DLIBPTHREAD_VERSION="\"$(shell sed 's/\(.*\) by .*/\1/' ../nptl/Banner)\""
+CFLAGS-confstr.c += -DLIBPTHREAD_VERSION="\"$(shell sed 's/\(.*\) by .*/\1/' ../linuxthreads/Banner)\""
 endif
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index a517311a0e..0ff78787a6 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,5 +1,8 @@
 2003-03-19  Ulrich Drepper  <drepper@redhat.com>
 
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Add
+	support for clock selection.
+
 	* sysdeps/pthread/pthread_cond_broadcast.c: Release lock before
 	signalling waiters.
 
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
index 97a642e65e..7a75e0d7d2 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
@@ -120,6 +120,27 @@ __pthread_cond_timedwait:
 	callq	__pthread_enable_asynccancel_2
 
 	/* Get the current time.  */
+#ifdef __NR_clock_gettime
+	/* Get the clock number.  Note that the field in the condvar
+	   structure stores the number minus 1.  */
+	movq	8(%rsp), %rdi
+	movl	cond_clock(%rdi), %edi
+	/* Only clocks 0 and 1 are allowed.  Both are handled in the
+	   kernel.  */
+	leaq	24(%rsp), %rsi
+	movq	$__NR_clock_gettime, %rax
+	syscall
+# ifndef __ASSUME_POSIX_TIMERS
+	cmpq	$-ENOSYS, %rax
+	je	19f
+# endif
+
+	/* Compute relative timeout.  */
+	movq	(%r13), %rcx
+	movq	8(%r13), %rdx
+	subq	24(%rsp), %rcx
+	subq	32(%rsp), %rdx
+#else
 	leaq	24(%rsp), %rdi
 	xorq	%rsi, %rsi
 	movq	$VSYSCALL_ADDR_vgettimeofday, %rax
@@ -133,17 +154,18 @@ __pthread_cond_timedwait:
 	movq	8(%r13), %rdx
 	subq	24(%rsp), %rcx
 	subq	%rax, %rdx
+#endif
 	jns	12f
 	addq	$1000000000, %rdx
 	decq	%rcx
 12:	testq	%rcx, %rcx
+	movq	8(%rsp), %rdi
 	js	13f
 
 	/* Store relative timeout.  */
-	movq	%rcx, 24(%rsp)
+21:	movq	%rcx, 24(%rsp)
 	movq	%rdx, 32(%rsp)
 
-	movq	8(%rsp), %rdi
 	leaq	24(%rsp), %r10
 	xorq	%rsi, %rsi	/* movq $FUTEX_WAIT, %rsi */
 	movq	%r12, %rdx
@@ -265,6 +287,30 @@ __pthread_cond_timedwait:
 
 17:	movq	(%rsp), %rax
 	jmp	18b
+
+#if defined __NR_clock_gettime && !defined __ASSUME_POSIX_TIMERS
+	/* clock_gettime not available.  */
+19:	leaq	24(%rsp), %rdi
+	xorq	%rsi, %rsi
+	movq	$VSYSCALL_ADDR_vgettimeofday, %rax
+	callq	*%rax
+
+	/* Compute relative timeout.  */
+	movq	32(%rsp), %rax
+	movq	$1000, %rdx
+	mul	%rdx		/* Milli seconds to nano seconds.  */
+	movq	(%r13), %rcx
+	movq	8(%r13), %rdx
+	subq	24(%rsp), %rcx
+	subq	%rax, %rdx
+	jns	20f
+	addq	$1000000000, %rdx
+	decq	%rcx
+20:	testq	%rcx, %rcx
+	movq	8(%rsp), %rdi
+	js	13b
+	jmp	21b
+#endif
 	.size	__pthread_cond_timedwait, .-__pthread_cond_timedwait
 versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
 		  GLIBC_2_3_2)