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
This commit is contained in:
Jakub Jelinek 2014-03-26 22:52:16 +01:00 committed by Jakub Jelinek
parent 816551fe37
commit 7cc51d643e
2 changed files with 11 additions and 1 deletions

View 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.

View File

@ -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;
}