]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
nptl: handle EAGAIN with some futex operations
authorCarlos O'Donell <carlos@systemhalted.org>
Fri, 16 Aug 2013 19:00:53 +0000 (15:00 -0400)
committerMike Frysinger <vapier@gentoo.org>
Fri, 16 Aug 2013 19:00:53 +0000 (15:00 -0400)
https://bugs.gentoo.org/452184

nptl/pthread_mutex_trylock.c
nptl/sem_timedwait.c
nptl/sem_wait.c
sunrpc/clnt_udp.c
sysdeps/nptl/aio_misc.h
sysdeps/nptl/gai_misc.h

index 0867b065331ffaefce8d6def60101de7175a2b51..f10ca582e2aa170bd036e7bb4225cd472a700758 100644 (file)
@@ -261,7 +261,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);
 
index 7dfe51dd8bea871a81c4aa353563e6d19f5d7b5e..f96f6251e214845a0aafa2f4775a46d8e8141a24 100644 (file)
@@ -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;
index b12babb5961209c189ba5a5a8e686c2a39290b08..4b9856c846949b60b3a9499bd656dfff7105fcee 100644 (file)
@@ -68,7 +68,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;
@@ -113,7 +113,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;
index 6ffa5f259009f44914767b1677085450d4b9d7cc..b6638bb8e8a53843ac8c60ec998e5d1b741043de 100644 (file)
@@ -463,7 +463,7 @@ send_again:
       while (inlen < 0 && errno == EINTR);
       if (inlen < 0)
        {
-         if (errno == EWOULDBLOCK)
+         if (errno == EWOULDBLOCK || errno == EAGAIN)
            continue;
          cu->cu_error.re_errno = errno;
          return (cu->cu_error.re_status = RPC_CANTRECV);
index c3de84b1ace0d45e553eab7c8b60f9351364893c..a419ee041f3469d220788b1ec329ef1d38d2cf2e 100644 (file)
@@ -50,7 +50,7 @@
          {                                                                   \
            status = lll_futex_timed_wait (futexaddr, oldval, timeout,        \
                                           LLL_PRIVATE);                      \
-           if (status != -EWOULDBLOCK)                                       \
+           if (status != -EWOULDBLOCK && status != -EAGAIN)                  \
              break;                                                          \
                                                                              \
            oldval = *futexaddr;                                              \
@@ -65,7 +65,7 @@
        else if (status == -ETIMEDOUT)                                        \
          result = EAGAIN;                                                    \
        else                                                                  \
-         assert (status == 0 || status == -EWOULDBLOCK);                     \
+         assert (status == 0 || status == -EWOULDBLOCK || status == -EAGAIN);\
                                                                              \
        pthread_mutex_lock (&__aio_requests_mutex);                           \
       }                                                                              \
index 942f2b1b7e9f5824ce0cd2edf9a7235137bb4eba..fc66256e300a42907e1b41e75a228067df001e14 100644 (file)
@@ -51,7 +51,7 @@
          {                                                                   \
            status = lll_futex_timed_wait (futexaddr, oldval, timeout,        \
                                           LLL_PRIVATE);                      \
-           if (status != -EWOULDBLOCK)                                       \
+           if (status != -EWOULDBLOCK && status != -EAGAIN)                  \
              break;                                                          \
                                                                              \
            oldval = *futexaddr;                                              \
@@ -66,7 +66,7 @@
        else if (status == -ETIMEDOUT)                                        \
          result = EAGAIN;                                                    \
        else                                                                  \
-         assert (status == 0 || status == -EWOULDBLOCK);                     \
+         assert (status == 0 || status == -EWOULDBLOCK || status == -EAGAIN);\
                                                                              \
        pthread_mutex_lock (&__gai_requests_mutex);                           \
       }                                                                              \