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

From-SVN: r209036

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

index 9bcd3f886261eed130f8fdcf8d9278f91bcff60f..516ab285b48c771e0bcd1b8713f7a7e6664e69c2 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.
+
 2013-12-12  Jakub Jelinek  <jakub@redhat.com>
 
        PR libgomp/59467
index fecaa9f58f9582eb1a41ae06516da7464fd7762a..9e1c1e471a61cdde51db677fca2b3bbb1a40c951 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;