From: Carlos O'Donell Date: Fri, 16 Aug 2013 19:00:53 +0000 (-0400) Subject: nptl: handle EAGAIN with some futex operations X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f1bdcb971a624a08796dae3ad01a9eb7552ba24;p=thirdparty%2Fglibc.git nptl: handle EAGAIN with some futex operations https://bugs.gentoo.org/452184 --- diff --git a/nptl/pthread_mutex_trylock.c b/nptl/pthread_mutex_trylock.c index 4d5f75d24f8..4bf19ec9cc5 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 7dfe51dd8be..f96f6251e21 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 7d586cf186f..6f2a89fd16a 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;