[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:36:05 PDT 2024
https://github.com/devnexen updated https://github.com/llvm/llvm-project/pull/106902
>From 505a09a3487403b7253f7fb3bfb07b7e26cd73f0 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 Mingwin
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