diff options
author | Jakub Jelinek <jakub@redhat.com> | 2014-03-26 22:52:16 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2014-03-26 22:52:16 +0100 |
commit | 7cc51d643eb0b504396f77155d80eda2b081819c (patch) | |
tree | b2cf395f4b74880e6de881a18b43051191eb3800 /libitm/config | |
parent | 816551fe37d92bdd0982d85fe9e833e81dd9a255 (diff) | |
download | gcc-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/config')
-rw-r--r-- | libitm/config/linux/futex_bits.h | 6 |
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; } |