aboutsummaryrefslogtreecommitdiff
path: root/www/chromium/files/patch-base_sampling__heap__profiler_sampling__heap__profiler.cc
blob: 44e3b0aae8ef69fd23d7e9fd735239f5358ea7e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--- base/sampling_heap_profiler/sampling_heap_profiler.cc.orig	2019-09-09 21:55:05 UTC
+++ base/sampling_heap_profiler/sampling_heap_profiler.cc
@@ -29,6 +29,10 @@
 #include <sys/prctl.h>
 #endif
 
+#if defined(OS_BSD)
+#include <pthread_np.h>
+#endif
+
 #if defined(OS_ANDROID) && BUILDFLAG(CAN_UNWIND_WITH_CFI_TABLE) && \
     defined(OFFICIAL_BUILD)
 #include "base/trace_event/cfi_backtrace_android.h"
@@ -64,6 +68,10 @@ const char* GetAndLeakThreadName() {
 #elif defined(OS_MACOSX)
   int err = pthread_getname_np(pthread_self(), name, kBufferLen);
   if (err == 0 && *name != '\0')
+    return strdup(name);
+#elif defined(OS_BSD) && __FreeBSD__ >= 12
+  pthread_get_name_np(pthread_self(), name, kBufferLen);
+  if (*name != '\0')
     return strdup(name);
 #endif  // defined(OS_LINUX) || defined(OS_ANDROID)