void-packages/srcpkgs/mongodb/patches/issue-693-enable-futex-usag...

69 lines
2.8 KiB
Diff

From 00c5a75b1dd59f27c18fa04ad911b56b9c6ac17e Mon Sep 17 00:00:00 2001
From: Aliaksey Kandratsenka <alk@tut.by>
Date: Sat, 13 Jun 2015 21:35:06 -0700
Subject: [PATCH 3/5] issue-693: enable futex usage on arm
This patch was contributed by user spotrh.
---
.../gperftools-2.2/src/base/linux_syscall_support.h | 1 -
.../gperftools-2.2/src/base/spinlock_linux-inl.h | 15 ++++++---------
2 files changed, 6 insertions(+), 10 deletions(-)
diff --git src/third_party/gperftools-2.2/src/base/linux_syscall_support.h src/third_party/gperftools-2.2/src/base/linux_syscall_support.h
index c8f8f59..56b8fac 100644
--- src/third_party/gperftools-2.2/src/base/linux_syscall_support.h
+++ src/third_party/gperftools-2.2/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 src/third_party/gperftools-2.2/src/base/spinlock_linux-inl.h src/third_party/gperftools-2.2/src/base/spinlock_linux-inl.h
index 86d4d04..aadf62a 100644
--- src/third_party/gperftools-2.2/src/base/spinlock_linux-inl.h
+++ src/third_party/gperftools-2.2/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);
}
}
--
2.6.4