summaryrefslogtreecommitdiff
path: root/libitm
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-03-26 22:52:16 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2014-03-26 22:52:16 +0100
commit7cc51d643eb0b504396f77155d80eda2b081819c (patch)
treeb2cf395f4b74880e6de881a18b43051191eb3800 /libitm
parent816551fe37d92bdd0982d85fe9e833e81dd9a255 (diff)
downloadgcc-7cc51d643eb0b504396f77155d80eda2b081819c.tar.gz
futex_bits.h: Include errno.h.
* config/linux/futex_bits.h: Include errno.h. (sys_futex0): If syscall returns -1, return -errno rather than -1. From-SVN: r208855
Diffstat (limited to 'libitm')
-rw-r--r--libitm/ChangeLog6
-rw-r--r--libitm/config/linux/futex_bits.h6
2 files changed, 11 insertions, 1 deletions
diff --git a/libitm/ChangeLog b/libitm/ChangeLog
index 00db949bad9..1ce194ec934 100644
--- a/libitm/ChangeLog
+++ b/libitm/ChangeLog
@@ -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.
diff --git a/libitm/config/linux/futex_bits.h b/libitm/config/linux/futex_bits.h
index 62d83d18557..dc1eb1fa301 100644
--- a/libitm/config/linux/futex_bits.h
+++ b/libitm/config/linux/futex_bits.h
@@ -31,9 +31,13 @@
#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;
}