]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
futex_bits.h: Include errno.h.
authorJakub Jelinek <jakub@redhat.com>
Wed, 26 Mar 2014 21:52:16 +0000 (22:52 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 26 Mar 2014 21:52:16 +0000 (22:52 +0100)
* config/linux/futex_bits.h: Include errno.h.
(sys_futex0): If syscall returns -1, return -errno rather than
-1.

From-SVN: r208855

libitm/ChangeLog
libitm/config/linux/futex_bits.h

index 00db949bad91101699447f41370e8f5f98c2cc4d..1ce194ec934100420081d066c9ee70065ad0601b 100644 (file)
@@ -1,3 +1,9 @@
+2014-03-26  Jakub Jelinek  <jakub@redhat.com>
+
+       * config/linux/futex_bits.h: Include errno.h.
+       (sys_futex0): If syscall returns -1, return -errno rather than
+       -1.
+
 2014-03-26  Joseph Myers  <joseph@codesourcery.com>
 
        * libitm.texi (Index): Rename to Library Index.
index 62d83d185570671c08d39d8f03f917eaeb6dc758..dc1eb1fa301dbf79918fd761c26c1563a871cc5b 100644 (file)
 
 #include <unistd.h>
 #include <sys/syscall.h>
+#include <errno.h>
 
 static inline long
 sys_futex0 (std::atomic<int> *addr, long op, long val)
 {
-  return syscall (SYS_futex, (int*) addr, op, val, 0);
+  long res = syscall (SYS_futex, (int*) addr, op, val, 0);
+  if (__builtin_expect (res == -1, 0))
+    return -errno;
+  return res;
 }