168d75effSDimitry Andric //=-- lsan_linux.cpp ------------------------------------------------------===// 268d75effSDimitry Andric // 368d75effSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 468d75effSDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 568d75effSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 668d75effSDimitry Andric // 768d75effSDimitry Andric //===----------------------------------------------------------------------===// 868d75effSDimitry Andric // 95ffd83dbSDimitry Andric // This file is a part of LeakSanitizer. Linux/NetBSD/Fuchsia-specific code. 1068d75effSDimitry Andric // 1168d75effSDimitry Andric //===----------------------------------------------------------------------===// 1268d75effSDimitry Andric 1368d75effSDimitry Andric #include "sanitizer_common/sanitizer_platform.h" 1468d75effSDimitry Andric 155ffd83dbSDimitry Andric #if SANITIZER_LINUX || SANITIZER_NETBSD || SANITIZER_FUCHSIA 1668d75effSDimitry Andric 1768d75effSDimitry Andric # include "lsan_allocator.h" 18*06c3fb27SDimitry Andric # include "lsan_thread.h" 1968d75effSDimitry Andric 2068d75effSDimitry Andric namespace __lsan { 2168d75effSDimitry Andric 22*06c3fb27SDimitry Andric static THREADLOCAL ThreadContextLsanBase *current_thread = nullptr; GetCurrentThread()23*06c3fb27SDimitry AndricThreadContextLsanBase *GetCurrentThread() { return current_thread; } SetCurrentThread(ThreadContextLsanBase * tctx)24*06c3fb27SDimitry Andricvoid SetCurrentThread(ThreadContextLsanBase *tctx) { current_thread = tctx; } 2568d75effSDimitry Andric 2668d75effSDimitry Andric static THREADLOCAL AllocatorCache allocator_cache; GetAllocatorCache()2768d75effSDimitry AndricAllocatorCache *GetAllocatorCache() { return &allocator_cache; } 2868d75effSDimitry Andric ReplaceSystemMalloc()2968d75effSDimitry Andricvoid ReplaceSystemMalloc() {} 3068d75effSDimitry Andric 3168d75effSDimitry Andric } // namespace __lsan 3268d75effSDimitry Andric 335ffd83dbSDimitry Andric #endif // SANITIZER_LINUX || SANITIZER_NETBSD || SANITIZER_FUCHSIA 34