about summary refs log tree commit diff
path: root/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S18
1 files changed, 17 insertions, 1 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
index 0291beb169..ca49cb89d0 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002,2003,2005,2007,2009,2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -77,6 +77,9 @@ sem_timedwait:
 	je	.Lreltmo
 #endif
 
+	cmpq	$0, (%rsi)
+	js	16f
+
 	/* This push is only needed to store the sem_t pointer for the
 	   exception handler.  */
 	pushq	%rdi
@@ -169,6 +172,19 @@ sem_timedwait:
 
 	retq
 
+16:
+#if USE___THREAD
+	movq	errno@gottpoff(%rip), %rdx
+	movl	$ETIMEDOUT, %fs:(%rdx)
+#else
+	callq	__errno_location@plt
+	movl	$ETIMEDOUT, (%rax)
+#endif
+
+	orl	$-1, %eax
+
+	retq
+
 #ifndef __ASSUME_FUTEX_CLOCK_REALTIME
 .Lreltmo:
 	pushq	%r12