summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAliaksey Kandratsenka <alk@tut.by>2015-06-13 21:35:06 -0700
committerAliaksey Kandratsenka <alk@tut.by>2015-06-27 21:17:48 -0700
commit7df7f14c949d89d9c3f5c7c339bbdda81fb8abc7 (patch)
treea49d0694aea16d85382255ff0af419a24bc2ffc5
parentcb998e56d763cfe901cf30a692d4cfd4f85259ae (diff)
downloadgperftools-7df7f14c949d89d9c3f5c7c339bbdda81fb8abc7.tar.gz
issue-693: enable futex usage on arm
This patch was contributed by user spotrh.
-rw-r--r--src/base/linux_syscall_support.h1
-rw-r--r--src/base/spinlock_linux-inl.h15
2 files changed, 6 insertions, 10 deletions
diff --git a/src/base/linux_syscall_support.h b/src/base/linux_syscall_support.h
index c8f8f59..56b8fac 100644
--- a/src/base/linux_syscall_support.h
+++ b/src/base/linux_syscall_support.h
@@ -83,7 +83,6 @@
* sys_fcntl(
* sys_fstat(
* sys_futex(
- * sys_futex1(
* sys_getcpu(
* sys_getdents64(
* sys_getppid(
diff --git a/src/base/spinlock_linux-inl.h b/src/base/spinlock_linux-inl.h
index 86d4d04..aadf62a 100644
--- a/src/base/spinlock_linux-inl.h
+++ b/src/base/spinlock_linux-inl.h
@@ -51,15 +51,10 @@ static struct InitModule {
int x = 0;
// futexes are ints, so we can use them only when
// that's the same size as the lockword_ in SpinLock.
-#ifdef __arm__
- // ARM linux doesn't support sys_futex1(void*, int, int, struct timespec*);
- have_futex = 0;
-#else
have_futex = (sizeof (Atomic32) == sizeof (int) &&
- sys_futex(&x, FUTEX_WAKE, 1, 0) >= 0);
-#endif
+ sys_futex(&x, FUTEX_WAKE, 1, NULL, NULL, 0) >= 0);
if (have_futex &&
- sys_futex(&x, FUTEX_WAKE | futex_private_flag, 1, 0) < 0) {
+ sys_futex(&x, FUTEX_WAKE | futex_private_flag, 1, NULL, NULL, 0) < 0) {
futex_private_flag = 0;
}
}
@@ -85,7 +80,8 @@ void SpinLockDelay(volatile Atomic32 *w, int32 value, int loop) {
tm.tv_nsec *= 16; // increase the delay; we expect explicit wakeups
sys_futex(reinterpret_cast<int *>(const_cast<Atomic32 *>(w)),
FUTEX_WAIT | futex_private_flag,
- value, reinterpret_cast<struct kernel_timespec *>(&tm));
+ value, reinterpret_cast<struct kernel_timespec *>(&tm),
+ NULL, 0);
} else {
nanosleep(&tm, NULL);
}
@@ -96,7 +92,8 @@ void SpinLockDelay(volatile Atomic32 *w, int32 value, int loop) {
void SpinLockWake(volatile Atomic32 *w, bool all) {
if (have_futex) {
sys_futex(reinterpret_cast<int *>(const_cast<Atomic32 *>(w)),
- FUTEX_WAKE | futex_private_flag, all? INT_MAX : 1, 0);
+ FUTEX_WAKE | futex_private_flag, all? INT_MAX : 1,
+ NULL, NULL, 0);
}
}