Differential D38165 Diff 118368 www/qt5-webengine/files/patch-src_3rdparty_chromium_base_profiler_stack__copier__signal.cc
Changeset View
Changeset View
Standalone View
Standalone View
www/qt5-webengine/files/patch-src_3rdparty_chromium_base_profiler_stack__copier__signal.cc
--- src/3rdparty/chromium/base/profiler/stack_copier_signal.cc.orig 2020-11-07 01:22:36 UTC | --- src/3rdparty/chromium/base/profiler/stack_copier_signal.cc.orig 2021-12-15 16:12:54 UTC | ||||
+++ src/3rdparty/chromium/base/profiler/stack_copier_signal.cc | +++ src/3rdparty/chromium/base/profiler/stack_copier_signal.cc | ||||
@@ -4,7 +4,14 @@ | @@ -4,7 +4,14 @@ | ||||
#include "base/profiler/stack_copier_signal.h" | #include "base/profiler/stack_copier_signal.h" | ||||
+#if defined(OS_LINUX) | +#if defined(OS_LINUX) | ||||
#include <linux/futex.h> | #include <linux/futex.h> | ||||
+#include <syscall.h> | +#include <syscall.h> | ||||
+#elif defined(OS_FREEBSD) | +#elif defined(OS_FREEBSD) | ||||
+#include <sys/types.h> | +#include <sys/types.h> | ||||
+#include <sys/thr.h> | +#include <sys/thr.h> | ||||
+#include <sys/umtx.h> | +#include <sys/umtx.h> | ||||
+#endif | +#endif | ||||
#include <signal.h> | #include <signal.h> | ||||
#include <sys/ucontext.h> | #include <sys/ucontext.h> | ||||
#include <syscall.h> | #include <syscall.h> | ||||
@@ -33,8 +40,13 @@ class AsyncSafeWaitableEvent { | @@ -34,8 +41,13 @@ class AsyncSafeWaitableEvent { | ||||
// for a pthread mutex. So, also check the condition. | // for a pthread mutex. So, also check the condition. | ||||
while (true) { | while (true) { | ||||
int res = | int res = | ||||
+#if defined(OS_LINUX) | +#if defined(OS_LINUX) | ||||
syscall(SYS_futex, futex_int_ptr(), FUTEX_WAIT | FUTEX_PRIVATE_FLAG, | syscall(SYS_futex, futex_int_ptr(), FUTEX_WAIT | FUTEX_PRIVATE_FLAG, | ||||
0, nullptr, nullptr, 0); | 0, nullptr, nullptr, 0); | ||||
+#elif defined(OS_FREEBSD) | +#elif defined(OS_FREEBSD) | ||||
+ _umtx_op(futex_int_ptr(), UMTX_OP_WAIT_UINT_PRIVATE, 0, nullptr, | + _umtx_op(futex_int_ptr(), UMTX_OP_WAIT_UINT_PRIVATE, 0, nullptr, | ||||
+ nullptr); | + nullptr); | ||||
+#endif | +#endif | ||||
if (futex_.load(std::memory_order_acquire) != 0) | if (futex_.load(std::memory_order_acquire) != 0) | ||||
return true; | return true; | ||||
if (res != 0) | if (res != 0) | ||||
@@ -44,8 +56,12 @@ class AsyncSafeWaitableEvent { | @@ -45,8 +57,12 @@ class AsyncSafeWaitableEvent { | ||||
void Signal() { | void Signal() { | ||||
futex_.store(1, std::memory_order_release); | futex_.store(1, std::memory_order_release); | ||||
+#if defined(OS_LINUX) | +#if defined(OS_LINUX) | ||||
syscall(SYS_futex, futex_int_ptr(), FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1, | syscall(SYS_futex, futex_int_ptr(), FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1, | ||||
nullptr, nullptr, 0); | nullptr, nullptr, 0); | ||||
+#elif defined(OS_FREEBSD) | +#elif defined(OS_FREEBSD) | ||||
+ _umtx_op(futex_int_ptr(), UMTX_OP_WAKE_PRIVATE, 1, nullptr, nullptr); | + _umtx_op(futex_int_ptr(), UMTX_OP_WAKE_PRIVATE, 1, nullptr, nullptr); | ||||
+#endif | +#endif | ||||
} | } | ||||
private: | private: | ||||
@@ -215,11 +231,18 @@ bool StackCopierSignal::CopyStack(StackBuffer* stack_b | @@ -216,11 +232,18 @@ bool StackCopierSignal::CopyStack(StackBuffer* stack_b | ||||
if (!scoped_sigaction.succeeded()) | if (!scoped_sigaction.succeeded()) | ||||
return false; | return false; | ||||
+#if defined(OS_LINUX) | +#if defined(OS_LINUX) | ||||
if (syscall(SYS_tgkill, getpid(), thread_delegate_->GetThreadId(), | if (syscall(SYS_tgkill, getpid(), thread_delegate_->GetThreadId(), | ||||
SIGURG) != 0) { | SIGURG) != 0) { | ||||
NOTREACHED(); | NOTREACHED(); | ||||
return false; | return false; | ||||
Show All 10 Lines |