]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgomp: Fix default futex vs errno
authorRichard Henderson <rth@redhat.com>
Wed, 2 Apr 2014 20:27:29 +0000 (13:27 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 2 Apr 2014 20:27:29 +0000 (13:27 -0700)
* config/linux/futex.h (futex_wait): Get error value from errno.
(futex_wake): Likewise.

From-SVN: r209035

libgomp/ChangeLog
libgomp/config/linux/futex.h

index d3cda25384d3fba7f9bae2cd970870e4b3b6f0cc..c0f093ff4581da792ead00b0f245e6d4765f55a3 100644 (file)
@@ -1,3 +1,8 @@
+2014-04-02  Richard Henderson  <rth@redhat.com>
+
+       * config/linux/futex.h (futex_wait): Get error value from errno.
+       (futex_wake): Likewise.
+
 2014-03-25  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/60331
index 802abfd24e2241dbc4c98b09d79b5d8b311f27df..63334c7c916303022ba428b3d4f2b965d16cbd47 100644 (file)
@@ -41,8 +41,8 @@
 static inline void
 futex_wait (int *addr, int val)
 {
-  long err = syscall (SYS_futex, addr, gomp_futex_wait, val, NULL);
-  if (__builtin_expect (err == -ENOSYS, 0))
+  int err = syscall (SYS_futex, addr, gomp_futex_wait, val, NULL);
+  if (__builtin_expect (err < 0 && errno == ENOSYS, 0))
     {
       gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
       gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
@@ -53,8 +53,8 @@ futex_wait (int *addr, int val)
 static inline void
 futex_wake (int *addr, int count)
 {
-  long err = syscall (SYS_futex, addr, gomp_futex_wake, count);
-  if (__builtin_expect (err == -ENOSYS, 0))
+  int err = syscall (SYS_futex, addr, gomp_futex_wake, count);
+  if (__builtin_expect (err < 0 && errno == ENOSYS, 0))
     {
       gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
       gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;