[llvm-commits] [compiler-rt] r172523 - /compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
Kostya Serebryany
kcc at google.com
Tue Jan 15 01:03:23 PST 2013
Author: kcc
Date: Tue Jan 15 03:03:23 2013
New Revision: 172523
URL: http://llvm.org/viewvc/llvm-project?rev=172523&view=rev
Log:
[sanitizer] hide PR_SET_NAME under an ifdef (for older kernels)
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=172523&r1=172522&r2=172523&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Tue Jan 15 03:03:23 2013
@@ -369,16 +369,24 @@
}
bool SanitizerSetThreadName(const char *name) {
+#ifdef PR_SET_NAME
return 0 == prctl(PR_SET_NAME, (unsigned long)name, 0, 0, 0); // NOLINT
+#else
+ return false;
+#endif
}
bool SanitizerGetThreadName(char *name, int max_len) {
+#ifdef PR_GET_NAME
char buff[17];
if (prctl(PR_GET_NAME, (unsigned long)buff, 0, 0, 0)) // NOLINT
return false;
internal_strncpy(name, buff, max_len);
name[max_len] = 0;
return true;
+#else
+ return false;
+#endif
}
#ifndef SANITIZER_GO
More information about the llvm-commits
mailing list