summaryrefslogtreecommitdiff
path: root/libitm
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-03-26 21:52:16 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-03-26 21:52:16 +0000
commit39771db5404b4ee9c1c8c3eaa99152df1321064d (patch)
treeb2cf395f4b74880e6de881a18b43051191eb3800 /libitm
parentbebb2c46af14699655970537d0338479bcd0fdfc (diff)
downloadgcc-39771db5404b4ee9c1c8c3eaa99152df1321064d.tar.gz
* config/linux/futex_bits.h: Include errno.h.
(sys_futex0): If syscall returns -1, return -errno rather than -1. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208855 138bc75d-0d04-0410-961f-82ee72b054a4
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;
}