[compiler-rt] [compiler-rt][fuzzer] SetThreadName build fix for Cygwin attempt (PR #106902)
David CARLIER via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 1 04:35:11 PDT 2024
https://github.com/devnexen updated https://github.com/llvm/llvm-project/pull/106902
>From dd34d55ba7c25c775752f7bda7619a87f4d9dcc8 Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen at gmail.com>
Date: Sun, 1 Sep 2024 12:32:43 +0100
Subject: [PATCH] [compiler-rt][fuzzer] SetThreadName build fix for Minwin
attempt
---
compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
index e0210aa0ac3651..7252d99dd375df 100644
--- a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
@@ -239,6 +239,7 @@ size_t PageSize() {
}
void SetThreadName(std::thread &thread, const std::string &name) {
+#if !defined(__MINGW32__)
typedef HRESULT(WINAPI * proc)(HANDLE, PCWSTR);
HMODULE kbase = GetModuleHandleA("KernelBase.dll");
proc ThreadNameProc = reinterpret_cast<proc>(
@@ -253,6 +254,9 @@ void SetThreadName(std::thread &thread, const std::string &name) {
}
}
}
+#else
+ (void)pthread_setname_np(thread.native_handle(), name.c_str());
+#endif
}
} // namespace fuzzer
More information about the llvm-commits
mailing list