musl: third_party/perfetto: Support old Musl with missing pthread_getname_np

Following base/sampling_heap_profiler/sampling_heap_profiler.cc,
Linux can use prctl for this directly.
This commit is contained in:
klzgrad
2025-08-08 00:44:50 +08:00
parent e849e3fef3
commit fdad0da60c

View File

@ -31,7 +31,7 @@
#include <algorithm>
#endif
#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX)
#include <sys/prctl.h>
#endif
@ -59,7 +59,7 @@ inline bool MaybeSetThreadName(const std::string& name) {
inline bool GetThreadName(std::string& out_result) {
char buf[16] = {};
#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX)
if (prctl(PR_GET_NAME, buf) != 0)
return false;
#else