[compiler-rt] [compiler-rt][Fuzzer] SetThreadName fuchsia version. (PR #77227)

David CARLIER via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 6 23:04:21 PST 2024


https://github.com/devnexen created https://github.com/llvm/llvm-project/pull/77227

None

>From 9e1d974eeca6ec32a7477b15bd1bd18db0473e08 Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen at gmail.com>
Date: Sun, 7 Jan 2024 07:03:25 +0000
Subject: [PATCH] [compiler-rt][Fuzzer] SetThreadName fuchsia version.

---
 compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp
index cfb81cd3f780bb..373f750b8a32d3 100644
--- a/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp
@@ -20,6 +20,7 @@
 #include <fcntl.h>
 #include <lib/fdio/fdio.h>
 #include <lib/fdio/spawn.h>
+#include <pthread.h>
 #include <string>
 #include <sys/select.h>
 #include <thread>
@@ -606,7 +607,7 @@ size_t PageSize() {
 }
 
 void SetThreadName(std::thread &thread, const std::string &name) {
-  // TODO ?
+  (void)pthread_setname_np(thread.native_handle(), name.c_str());
 }
 
 } // namespace fuzzer



More information about the llvm-commits mailing list