aboutsummaryrefslogtreecommitdiff
path: root/libitm/config
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/config
parent816551fe37d92bdd0982d85fe9e833e81dd9a255 (diff)
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/config')
-rw-r--r--libitm/config/linux/futex_bits.h6
1 files changed, 5 insertions, 1 deletions
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;
}