about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
Diffstat (limited to 'nptl')
-rw-r--r--nptl/Makefile4
-rw-r--r--nptl/pthread-errnos.sym11
-rw-r--r--nptl/sysdeps/i386/i486/pthread_spin_trylock.S2
-rw-r--r--nptl/sysdeps/sh/pthread_spin_trylock.S4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S9
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S9
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/sem_post.S7
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S7
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S7
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelmutex.S5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S3
-rw-r--r--nptl/sysdeps/x86_64/pthread_spin_trylock.S2
34 files changed, 55 insertions, 107 deletions
diff --git a/nptl/Makefile b/nptl/Makefile
index 628eebc1cf..b59ffd86bb 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -144,7 +144,7 @@ tests = tst-attr1 tst-attr2 \
 	tst-eintr1 \
 	tst-tsd1 tst-tsd2 \
 	tst-tls1 tst-tls2 \
-	tst-fork1 tst-fork2 tst-fork3 \
+	tst-fork1 tst-fork2 tst-fork3 tst-fork4 \
 	tst-atfork1 \
 	tst-cancel1 tst-cancel2 tst-cancel3 tst-cancel4 tst-cancel5 \
 	tst-cancel6 tst-cancel7 tst-cancel8 tst-cancel9 tst-cancel10 \
@@ -166,6 +166,8 @@ tests = tst-attr1 tst-attr2 \
 
 distribute = eintr.c
 
+gen-as-const-headers = pthread-errnos.sym
+
 LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
 
 
diff --git a/nptl/pthread-errnos.sym b/nptl/pthread-errnos.sym
new file mode 100644
index 0000000000..a3289c6dcc
--- /dev/null
+++ b/nptl/pthread-errnos.sym
@@ -0,0 +1,11 @@
+#include <errno.h>
+
+-- These errno codes are used by some assembly code.
+
+EAGAIN		EAGAIN
+EBUSY		EBUSY
+EDEADLK		EDEADLK
+EINTR		EINTR
+EINVAL		EINVAL
+ETIMEDOUT	ETIMEDOUT
+EWOULDBLOCK	EWOULDBLOCK
diff --git a/nptl/sysdeps/i386/i486/pthread_spin_trylock.S b/nptl/sysdeps/i386/i486/pthread_spin_trylock.S
index 0a27312c72..e30072c3d5 100644
--- a/nptl/sysdeps/i386/i486/pthread_spin_trylock.S
+++ b/nptl/sysdeps/i386/i486/pthread_spin_trylock.S
@@ -17,7 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#define EBUSY	16
+#include <pthread-errnos.h>
 
 
 #ifdef UP
diff --git a/nptl/sysdeps/sh/pthread_spin_trylock.S b/nptl/sysdeps/sh/pthread_spin_trylock.S
index 63ae4d36af..18112ba230 100644
--- a/nptl/sysdeps/sh/pthread_spin_trylock.S
+++ b/nptl/sysdeps/sh/pthread_spin_trylock.S
@@ -16,7 +16,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#define EBUSY	16
+#include <pthread-errnos.h>
 
 	.globl	pthread_spin_trylock
 	.type	pthread_spin_trylock,@function
@@ -24,7 +24,7 @@
 pthread_spin_trylock:
 	tas.b	@r4
 	bf/s	1f
-	 mov	#EBUSY, r0
+	mov	#EBUSY, r0
 	mov	#0, r0
 1:
 	rts
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
index adb18e6e33..f27fe2bc1f 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <pthread-errnos.h>
 
 	.text
 
@@ -34,8 +35,6 @@
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define ETIMEDOUT               110
-
 
 	.globl	__lll_lock_wait
 	.type	__lll_lock_wait,@function
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S
index f5aa5a48e3..d4fb50ac5b 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <pthread-errnos.h>
 
 	.text
 
@@ -34,10 +35,6 @@
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define EWOULDBLOCK		11
-#define EINVAL			22
-#define ETIMEDOUT		110
-
 
 	.globl	__lll_mutex_lock_wait
 	.type	__lll_mutex_lock_wait,@function
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
index 811741b06d..9082fd5f4f 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
@@ -20,6 +20,7 @@
 #include <sysdep.h>
 #include <shlib-compat.h>
 #include <lowlevelcond.h>
+#include <pthread-errnos.h>
 
 #ifdef UP
 # define LOCK
@@ -32,8 +33,6 @@
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define ETIMEDOUT		110
-
 
 	.text
 
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S
index 43d00a2300..064d30dc34 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S
@@ -19,15 +19,13 @@
 
 #include <sysdep.h>
 #include <lowlevelrwlock.h>
+#include <pthread-errnos.h>
 
 
 #define SYS_futex		240
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define EAGAIN		11
-#define EDEADLK		35
-
 #ifndef UP
 # define LOCK lock
 #else
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S
index a0b2734280..1fd04f815d 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S
@@ -19,6 +19,7 @@
 
 #include <sysdep.h>
 #include <lowlevelrwlock.h>
+#include <pthread-errnos.h>
 
 
 #define SYS_gettimeofday	__NR_gettimeofday
@@ -26,11 +27,6 @@
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define EAGAIN		11
-#define EINVAL		22
-#define EDEADLK		35
-#define ETIMEDOUT	110
-
 #ifndef UP
 # define LOCK lock
 #else
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S
index 8c6245afb7..ee9e6fa00e 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S
@@ -19,6 +19,7 @@
 
 #include <sysdep.h>
 #include <lowlevelrwlock.h>
+#include <pthread-errnos.h>
 
 
 #define SYS_gettimeofday	__NR_gettimeofday
@@ -26,11 +27,6 @@
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define EAGAIN		11
-#define EINVAL		22
-#define EDEADLK		35
-#define ETIMEDOUT	110
-
 #ifndef UP
 # define LOCK lock
 #else
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S
index 0455372343..6c8b9e6d56 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S
@@ -19,15 +19,13 @@
 
 #include <sysdep.h>
 #include <lowlevelrwlock.h>
+#include <pthread-errnos.h>
 
 
 #define SYS_futex		240
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define EAGAIN		11
-#define EDEADLK		35
-
 #ifndef UP
 # define LOCK lock
 #else
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S
index 984cb72007..439004a55b 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S
@@ -19,6 +19,7 @@
 
 #include <sysdep.h>
 #include <shlib-compat.h>
+#include <pthread-errnos.h>
 
 #ifndef UP
 # define LOCK lock
@@ -29,8 +30,6 @@
 #define SYS_futex		240
 #define FUTEX_WAKE		1
 
-#define EINVAL			22
-
 
 	.text
 
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S
index e39a6dde8e..aa3d74593d 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S
@@ -19,6 +19,7 @@
 
 #include <sysdep.h>
 #include <shlib-compat.h>
+#include <pthread-errnos.h>
 
 #ifndef UP
 # define LOCK lock
@@ -30,10 +31,6 @@
 #define SYS_futex		240
 #define FUTEX_WAKE		1
 
-#define EWOULDBLOCK		11
-#define EINVAL			22
-#define ETIMEDOUT		110
-
 
 	.text
 
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S
index 4e93ae537c..8dfbe9c12e 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S
@@ -19,6 +19,7 @@
 
 #include <sysdep.h>
 #include <shlib-compat.h>
+#include <pthread-errnos.h>
 
 #ifndef UP
 # define LOCK lock
@@ -29,8 +30,6 @@
 #define SYS_futex		240
 #define FUTEX_WAKE		1
 
-#define EAGAIN			11
-
 
 	.text
 
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S
index 46e6f8095d..ba5f5cf427 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S
@@ -19,6 +19,7 @@
 
 #include <sysdep.h>
 #include <shlib-compat.h>
+#include <pthread-errnos.h>
 
 #ifndef UP
 # define LOCK lock
@@ -29,8 +30,6 @@
 #define SYS_futex		240
 #define FUTEX_WAKE		1
 
-#define EWOULDBLOCK		11
-
 
 	.text
 
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
index 3a157a0583..ecb0059036 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
@@ -17,6 +17,7 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <pthread-errnos.h>
 #include "lowlevel-atomic.h"
 
 	.text
@@ -26,8 +27,6 @@
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define ETIMEDOUT               110
-
 
 	.globl	__lll_lock_wait
 	.type	__lll_lock_wait,@function
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
index f0be38a797..59aeff70fb 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
@@ -19,6 +19,7 @@
 #include <sysdep.h>
 #include <shlib-compat.h>
 #include <lowlevelcond.h>
+#include <pthread-errnos.h>
 #include "lowlevel-atomic.h"
 
 #define SYS_gettimeofday	__NR_gettimeofday
@@ -26,8 +27,6 @@
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define ETIMEDOUT		110
-
 
 	.text
 
@@ -164,7 +163,7 @@ __pthread_cond_timedwait:
 	mov.l	.Ldisable1, r1
 	bsrf	r1
 	 mov.l	@r15, r4
-.Ldisable1b:	
+.Ldisable1b:
 
 	/* Lock.  */
 	mov	#1, r3
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S
index 2c6adf81c2..1aa1c72bbf 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S
@@ -19,15 +19,13 @@
 #include <sysdep.h>
 #include <lowlevelrwlock.h>
 #include <tcb-offsets.h>
+#include <pthread-errnos.h>
 #include "lowlevel-atomic.h"
 
 #define SYS_futex		240
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define EAGAIN		11
-#define EDEADLK		35
-
 
 	.text
 
@@ -207,7 +205,7 @@ __pthread_rwlock_rdlock:
 	.long	__lll_mutex_lock_wait-.Lwait0b
 .Lwake0:
 	.long	__lll_mutex_unlock_wake-.Lwake0b
-.Lwait1:	
+.Lwait1:
 	.long	__lll_mutex_lock_wait-.Lwait1b
 .Lwake1:
 	.long	__lll_mutex_unlock_wake-.Lwake1b
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S
index b287dd434b..84b5cdda3b 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S
@@ -19,6 +19,7 @@
 #include <sysdep.h>
 #include <lowlevelrwlock.h>
 #include <tcb-offsets.h>
+#include <pthread-errnos.h>
 #include "lowlevel-atomic.h"
 
 #define SYS_gettimeofday	__NR_gettimeofday
@@ -26,10 +27,6 @@
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define EAGAIN		11
-#define EDEADLK		35
-#define ETIMEDOUT	110
-
 
 	.text
 
@@ -263,11 +260,11 @@ pthread_rwlock_timedrdlock:
 .Ltcboff:
 	.word	TLS_PRE_TCB_SIZE
 	.align	2
-.Lwait2:	
+.Lwait2:
 	.long	__lll_mutex_lock_wait-.Lwait2b
 .Lwake2:
 	.long	__lll_mutex_unlock_wake-.Lwake2b
-.Lwait3:	
+.Lwait3:
 	.long	__lll_mutex_lock_wait-.Lwait3b
 .Lwake3:
 	.long	__lll_mutex_unlock_wake-.Lwake3b
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S
index 2e9bf05b00..60ff48f90a 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S
@@ -19,6 +19,7 @@
 #include <sysdep.h>
 #include <lowlevelrwlock.h>
 #include <tcb-offsets.h>
+#include <pthread-errnos.h>
 #include "lowlevel-atomic.h"
 
 #define SYS_gettimeofday	__NR_gettimeofday
@@ -26,10 +27,6 @@
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define EAGAIN		11
-#define EDEADLK		35
-#define ETIMEDOUT	110
-
 
 	.text
 
@@ -248,11 +245,11 @@ pthread_rwlock_timedwrlock:
 .Ltcboff:
 	.word	TLS_PRE_TCB_SIZE
 	.align	2
-.Lwait6:	
+.Lwait6:
 	.long	__lll_mutex_lock_wait-.Lwait6b
 .Lwake6:
 	.long	__lll_mutex_unlock_wake-.Lwake6b
-.Lwait7:	
+.Lwait7:
 	.long	__lll_mutex_lock_wait-.Lwait7b
 .Lwake7:
 	.long	__lll_mutex_unlock_wake-.Lwake7b
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S
index 20c84235ce..06d56e04cb 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S
@@ -19,15 +19,13 @@
 #include <sysdep.h>
 #include <lowlevelrwlock.h>
 #include <tcb-offsets.h>
+#include <pthread-errnos.h>
 #include "lowlevel-atomic.h"
 
 #define SYS_futex		240
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define EAGAIN		11
-#define EDEADLK		35
-
 
 	.text
 
@@ -187,11 +185,11 @@ __pthread_rwlock_wrlock:
 .Ltcboff:
 	.word	TLS_PRE_TCB_SIZE
 	.align	2
-.Lwait4:	
+.Lwait4:
 	.long	__lll_mutex_lock_wait-.Lwait4b
 .Lwake4:
 	.long	__lll_mutex_unlock_wake-.Lwake4b
-.Lwait5:	
+.Lwait5:
 	.long	__lll_mutex_lock_wait-.Lwait5b
 .Lwake5:
 	.long	__lll_mutex_unlock_wake-.Lwake5b
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S b/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S
index 9f33847339..90e63ed184 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S
@@ -18,6 +18,7 @@
 
 #include <sysdep.h>
 #include <shlib-compat.h>
+#include <pthread-errnos.h>
 #include "lowlevel-atomic.h"
 
 
@@ -26,12 +27,6 @@
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define EINTR			4
-#define EAGAIN			11
-#define EWOULDBLOCK		EAGAIN
-#define EINVAL			22
-#define ETIMEDOUT		110
-
 	.text
 
 	.globl	__new_sem_post
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S
index 741d66383f..b6d4d4c886 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S
@@ -18,6 +18,7 @@
 
 #include <sysdep.h>
 #include <shlib-compat.h>
+#include <pthread-errnos.h>
 #include "lowlevel-atomic.h"
 
 
@@ -26,12 +27,6 @@
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define EINTR			4
-#define EAGAIN			11
-#define EWOULDBLOCK		EAGAIN
-#define EINVAL			22
-#define ETIMEDOUT		110
-
 	.text
 
 	.globl	sem_timedwait
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S b/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S
index 130536234d..c80839ef30 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S
@@ -18,6 +18,7 @@
 
 #include <sysdep.h>
 #include <shlib-compat.h>
+#include <pthread-errnos.h>
 #include "lowlevel-atomic.h"
 
 
@@ -26,12 +27,6 @@
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define EINTR			4
-#define EAGAIN			11
-#define EWOULDBLOCK		EAGAIN
-#define EINVAL			22
-#define ETIMEDOUT		110
-
 	.text
 
 	.globl	__new_sem_trywait
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
index 39215280d5..9068f3ba46 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <pthread-errnos.h>
 
 	.text
 
@@ -34,8 +35,6 @@
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define ETIMEDOUT               110
-
 
 	/* Modified: %rax, %rsi.  */
 	.globl	__lll_lock_wait
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelmutex.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelmutex.S
index 2e36b9a72d..4612ba6ccf 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelmutex.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelmutex.S
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <pthread-errnos.h>
 
 	.text
 
@@ -34,10 +35,6 @@
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define EWOULDBLOCK		11
-#define EINVAL			22
-#define ETIMEDOUT		110
-
 
 	.globl	__lll_mutex_lock_wait
 	.type	__lll_mutex_lock_wait,@function
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 d059e64945..a293c52a9d 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
@@ -20,6 +20,7 @@
 #include <sysdep.h>
 #include <shlib-compat.h>
 #include <lowlevelcond.h>
+#include <pthread-errnos.h>
 
 #ifdef UP
 # define LOCK
@@ -32,8 +33,6 @@
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define ETIMEDOUT		110
-
 
 	.text
 
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
index 6ef605cde1..2e8e2979a3 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
@@ -19,15 +19,13 @@
 
 #include <sysdep.h>
 #include <lowlevelrwlock.h>
+#include <pthread-errnos.h>
 
 
 #define SYS_futex		202
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define EAGAIN		11
-#define EDEADLK		35
-
 #ifndef UP
 # define LOCK lock
 #else
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
index 3de464afc4..585c186917 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
@@ -19,15 +19,13 @@
 
 #include <sysdep.h>
 #include <lowlevelrwlock.h>
+#include <pthread-errnos.h>
 
 
 #define SYS_futex		202
 #define FUTEX_WAIT		0
 #define FUTEX_WAKE		1
 
-#define EAGAIN		11
-#define EDEADLK		35
-
 #ifndef UP
 # define LOCK lock
 #else
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
index 6189a9ac6e..43e73e2152 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
@@ -19,6 +19,7 @@
 
 #include <sysdep.h>
 #include <shlib-compat.h>
+#include <pthread-errnos.h>
 
 #ifndef UP
 # define LOCK lock
@@ -29,8 +30,6 @@
 #define SYS_futex		202
 #define FUTEX_WAKE		1
 
-#define EINVAL			22
-
 
 	.text
 
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 8f73d6a208..af52f2a670 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
@@ -19,6 +19,7 @@
 
 #include <sysdep.h>
 #include <shlib-compat.h>
+#include <pthread-errnos.h>
 
 #ifndef UP
 # define LOCK lock
@@ -29,10 +30,6 @@
 #define SYS_gettimeofday	__NR_gettimeofday
 #define SYS_futex		202
 
-#define EWOULDBLOCK		11
-#define EINVAL			22
-#define ETIMEDOUT		110
-
 
 	.text
 
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S
index 5785acff5a..8c93dcaa07 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S
@@ -19,6 +19,7 @@
 
 #include <sysdep.h>
 #include <shlib-compat.h>
+#include <pthread-errnos.h>
 
 #ifndef UP
 # define LOCK lock
@@ -29,8 +30,6 @@
 #define SYS_futex		202
 #define FUTEX_WAKE		1
 
-#define EAGAIN			11
-
 
 	.text
 
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
index 69e6658d67..2d13a95da5 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
@@ -19,6 +19,7 @@
 
 #include <sysdep.h>
 #include <shlib-compat.h>
+#include <pthread-errnos.h>
 
 #ifndef UP
 # define LOCK lock
@@ -28,8 +29,6 @@
 
 #define SYS_futex		202
 
-#define EWOULDBLOCK		11
-
 
 	.text
 
diff --git a/nptl/sysdeps/x86_64/pthread_spin_trylock.S b/nptl/sysdeps/x86_64/pthread_spin_trylock.S
index 175714d6b0..9b51335830 100644
--- a/nptl/sysdeps/x86_64/pthread_spin_trylock.S
+++ b/nptl/sysdeps/x86_64/pthread_spin_trylock.S
@@ -17,7 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#define EBUSY	16
+#include <pthread-errnos.h>
 
 
 #ifdef UP