1From 3e8648104c628fb3f9d1c83717044c38c98bdf58 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 27 Jun 2021 13:19:47 -0700
4Subject: [PATCH] Musl does not provide pthread_getname_np
5
6Upstream-Status: Inappropriate
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8
9---
10 third_party/perfetto/include/perfetto/ext/base/thread_utils.h | 4 +++-
11 1 file changed, 3 insertions(+), 1 deletion(-)
12
13diff --git a/third_party/perfetto/include/perfetto/ext/base/thread_utils.h b/third_party/perfetto/include/perfetto/ext/base/thread_utils.h
14index 4a1f0b665e..b0fb6a4c49 100644
15--- a/third_party/perfetto/include/perfetto/ext/base/thread_utils.h
16+++ b/third_party/perfetto/include/perfetto/ext/base/thread_utils.h
17@@ -61,9 +61,11 @@ inline bool GetThreadName(std::string& out_result) {
18 #if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
19   if (prctl(PR_GET_NAME, buf) != 0)
20     return false;
21-#else
22+#elif defined(__GLIBC__)
23   if (pthread_getname_np(pthread_self(), buf, sizeof(buf)) != 0)
24     return false;
25+#else
26+  return false;
27 #endif
28   out_result = std::string(buf);
29   return true;
30