aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos@systemhalted.org>2013-08-16 15:00:53 -0400
committerMike Frysinger <vapier@gentoo.org>2014-02-08 09:21:15 -0500
commit8f1bdcb971a624a08796dae3ad01a9eb7552ba24 (patch)
tree32e7cc56560cbe683c4b2c38ef214c90851b8491
parent2a6098d40483e825eebc18f74203b0b1d1c6e6c8 (diff)
downloadglibc-8f1bdcb971a624a08796dae3ad01a9eb7552ba24.tar
glibc-8f1bdcb971a624a08796dae3ad01a9eb7552ba24.tar.gz
glibc-8f1bdcb971a624a08796dae3ad01a9eb7552ba24.tar.bz2
glibc-8f1bdcb971a624a08796dae3ad01a9eb7552ba24.zip
nptl: handle EAGAIN with some futex operations
https://bugs.gentoo.org/452184
-rw-r--r--nptl/pthread_mutex_trylock.c3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sem_timedwait.c2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sem_wait.c4
3 files changed, 5 insertions, 4 deletions
diff --git a/nptl/pthread_mutex_trylock.c b/nptl/pthread_mutex_trylock.c
index 4d5f75d24f..4bf19ec9cc 100644
--- a/nptl/pthread_mutex_trylock.c
+++ b/nptl/pthread_mutex_trylock.c
@@ -260,7 +260,8 @@ __pthread_mutex_trylock (mutex)
private), 0, 0);
if (INTERNAL_SYSCALL_ERROR_P (e, __err)
- && INTERNAL_SYSCALL_ERRNO (e, __err) == EWOULDBLOCK)
+ && ((INTERNAL_SYSCALL_ERRNO (e, __err) == EWOULDBLOCK)
+ || (INTERNAL_SYSCALL_ERRNO (e, __err) == EAGAIN)))
{
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
diff --git a/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c b/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c
index 7dfe51dd8b..f96f6251e2 100644
--- a/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c
+++ b/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c
@@ -94,7 +94,7 @@ sem_timedwait (sem_t *sem, const struct timespec *abstime)
rt.tv_sec = sec;
rt.tv_nsec = nsec;
err = do_futex_timed_wait(isem, &rt);
- if (err != 0 && err != -EWOULDBLOCK)
+ if (err != 0 && err != -EWOULDBLOCK && err != -EAGAIN)
{
__set_errno (-err);
err = -1;
diff --git a/nptl/sysdeps/unix/sysv/linux/sem_wait.c b/nptl/sysdeps/unix/sysv/linux/sem_wait.c
index 7d586cf186..6f2a89fd16 100644
--- a/nptl/sysdeps/unix/sysv/linux/sem_wait.c
+++ b/nptl/sysdeps/unix/sysv/linux/sem_wait.c
@@ -67,7 +67,7 @@ __new_sem_wait (sem_t *sem)
while (1)
{
err = do_futex_wait(isem);
- if (err != 0 && err != -EWOULDBLOCK)
+ if (err != 0 && err != -EWOULDBLOCK && err != -EAGAIN)
{
__set_errno (-err);
err = -1;
@@ -112,7 +112,7 @@ __old_sem_wait (sem_t *sem)
/* Disable asynchronous cancellation. */
__pthread_disable_asynccancel (oldtype);
}
- while (err == 0 || err == -EWOULDBLOCK);
+ while (err == 0 || err == -EWOULDBLOCK || err == -EAGAIN);
__set_errno (-err);
return -1;