[compiler-rt] r211417 - tsan: fix freebsd build
Dmitry Vyukov
dvyukov at google.com
Fri Jun 20 15:49:41 PDT 2014
Author: dvyukov
Date: Fri Jun 20 17:49:41 2014
New Revision: 211417
URL: http://llvm.org/viewvc/llvm-project?rev=211417&view=rev
Log:
tsan: fix freebsd build
freebsd does not have /proc/self/environ
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=211417&r1=211416&r2=211417&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Fri Jun 20 17:49:41 2014
@@ -48,6 +48,7 @@
#include <unistd.h>
#if SANITIZER_FREEBSD
+#include <stdlib.h> // for getenv
#include <sys/sysctl.h>
#include <machine/atomic.h>
extern "C" {
@@ -314,6 +315,7 @@ u64 NanoTime() {
return (u64)tv.tv_sec * 1000*1000*1000 + tv.tv_usec * 1000;
}
+#if SANITIZER_LINUX
// Like getenv, but reads env directly from /proc and does not use libc.
// This function should be called first inside __asan_init.
const char *GetEnv(const char *name) {
@@ -341,6 +343,11 @@ const char *GetEnv(const char *name) {
}
return 0; // Not found.
}
+#else
+const char *GetEnv(const char *name) {
+ return getenv(name);
+}
+#endif
extern "C" {
SANITIZER_WEAK_ATTRIBUTE extern void *__libc_stack_end;
More information about the llvm-commits
mailing list