gperftools/gperftools-arm-has-futex.patch

67 lines
2.8 KiB
Diff
Raw Normal View History

2015-06-09 21:43:35 +00:00
diff -ru gperftools-2.4/src/base/linux_syscall_support.h gperftools-2.4-fixed/src/base/linux_syscall_support.h
--- gperftools-2.4/src/base/linux_syscall_support.h 2014-12-06 23:51:40.000000000 +0100
+++ gperftools-2.4-fixed/src/base/linux_syscall_support.h 2015-06-01 16:51:03.725616215 +0200
@@ -83,7 +83,6 @@
* sys_fcntl(
* sys_fstat(
* sys_futex(
- * sys_futex1(
* sys_getcpu(
* sys_getdents64(
* sys_getppid(
@@ -2094,9 +2093,11 @@
int, c, long, a)
LSS_INLINE _syscall2(int, fstat, int, f,
struct kernel_stat*, b)
- LSS_INLINE _syscall4(int, futex, int*, a,
+ LSS_INLINE _syscall6(int, futex, int*, a,
int, o, int, v,
- struct kernel_timespec*, t)
+ struct kernel_timespec*, t,
+ int*, a2,
+ int, v3)
#ifdef __NR_getdents64
LSS_INLINE _syscall3(int, getdents64, int, f,
struct kernel_dirent64*, d, int, c)
diff -ru gperftools-2.4/src/base/spinlock_linux-inl.h gperftools-2.4-fixed/src/base/spinlock_linux-inl.h
--- gperftools-2.4/src/base/spinlock_linux-inl.h 2014-12-06 23:51:40.000000000 +0100
+++ gperftools-2.4-fixed/src/base/spinlock_linux-inl.h 2015-06-01 16:51:03.725616215 +0200
@@ -51,15 +51,10 @@
2015-06-01 19:49:16 +00:00
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) &&
2015-06-09 21:43:35 +00:00
- sys_futex(&x, FUTEX_WAKE, 1, 0) >= 0);
2015-06-01 19:49:16 +00:00
-#endif
2015-06-09 21:43:35 +00:00
+ sys_futex(&x, FUTEX_WAKE, 1, NULL, NULL, 0) >= 0);
2015-06-01 19:49:16 +00:00
if (have_futex &&
2015-06-09 21:43:35 +00:00
- sys_futex(&x, FUTEX_WAKE | futex_private_flag, 1, 0) < 0) {
+ sys_futex(&x, FUTEX_WAKE | futex_private_flag, 1, NULL, NULL, 0) < 0) {
2015-06-01 19:49:16 +00:00
futex_private_flag = 0;
2015-06-09 21:43:35 +00:00
}
}
@@ -85,7 +85,8 @@
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 +97,8 @@
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);
}
}