diff options
author | Alexey Samsonov <samsonov@google.com> | 2012-06-14 14:07:21 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2012-06-14 14:07:21 +0000 |
commit | 3dbeabb3446f203156ae03d957de9bdf50933ae4 (patch) | |
tree | 62f772931d0805446205e34df6b077b19c4b0c63 /lib/asan/asan_linux.cc | |
parent | 327c1c17d9557ed8b197f732c8a070fd6ba821b5 (diff) | |
download | compiler-rt-3dbeabb3446f203156ae03d957de9bdf50933ae4.tar.gz compiler-rt-3dbeabb3446f203156ae03d957de9bdf50933ae4.tar.bz2 compiler-rt-3dbeabb3446f203156ae03d957de9bdf50933ae4.tar.xz |
[Sanitizer] move portable GetEnv to common sanitizer runtime
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@158451 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_linux.cc')
-rw-r--r-- | lib/asan/asan_linux.cc | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/lib/asan/asan_linux.cc b/lib/asan/asan_linux.cc index 984aa7e4..8af417fa 100644 --- a/lib/asan/asan_linux.cc +++ b/lib/asan/asan_linux.cc @@ -86,34 +86,6 @@ void *AsanMprotect(uptr fixed_addr, uptr size) { 0, 0); } -// Like getenv, but reads env directly from /proc and does not use libc. -// This function should be called first inside __asan_init. -const char* AsanGetEnv(const char* name) { - static char *environ; - static uptr len; - static bool inited; - if (!inited) { - inited = true; - uptr environ_size; - len = ReadFileToBuffer("/proc/self/environ", - &environ, &environ_size, 1 << 26); - } - if (!environ || len == 0) return 0; - uptr namelen = internal_strlen(name); - const char *p = environ; - while (*p != '\0') { // will happen at the \0\0 that terminates the buffer - // proc file has the format NAME=value\0NAME=value\0NAME=value\0... - const char* endp = - (char*)internal_memchr(p, '\0', len - (p - environ)); - if (endp == 0) // this entry isn't NUL terminated - return 0; - else if (!internal_memcmp(p, name, namelen) && p[namelen] == '=') // Match. - return p + namelen + 1; // point after = - p = endp + 1; - } - return 0; // Not found. -} - AsanLock::AsanLock(LinkerInitialized) { // We assume that pthread_mutex_t initialized to all zeroes is a valid // unlocked mutex. We can not use PTHREAD_MUTEX_INITIALIZER as it triggers |