aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos@systemhalted.org>2013-08-16 15:00:53 -0400
committerMike Frysinger <vapier@gentoo.org>2013-08-16 15:13:15 -0400
commit16d4191978ab9965856ea3a0572c53f1700b6263 (patch)
treef262140544d9d5cdc319b539492ebe79bacc60d6
parent18ff6fa20c4dbf616b8f1d0d6ebea84ab4fe38e2 (diff)
downloadglibc-16d4191978ab9965856ea3a0572c53f1700b6263.zip
glibc-16d4191978ab9965856ea3a0572c53f1700b6263.tar.gz
glibc-16d4191978ab9965856ea3a0572c53f1700b6263.tar.bz2
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 24fb052..bbf8d4e 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 da93c48..32ed35d 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 6b94d37..6dbd22b 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;