xref: /freebsd/contrib/llvm-project/compiler-rt/lib/lsan/lsan_linux.cpp (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1 //=-- lsan_linux.cpp ------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file is a part of LeakSanitizer. Linux/NetBSD/Fuchsia-specific code.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "sanitizer_common/sanitizer_platform.h"
14 
15 #if SANITIZER_LINUX || SANITIZER_NETBSD || SANITIZER_FUCHSIA
16 
17 #include "lsan_allocator.h"
18 
19 namespace __lsan {
20 
21 static THREADLOCAL u32 current_thread_tid = kInvalidTid;
22 u32 GetCurrentThread() { return current_thread_tid; }
23 void SetCurrentThread(u32 tid) { current_thread_tid = tid; }
24 
25 static THREADLOCAL AllocatorCache allocator_cache;
26 AllocatorCache *GetAllocatorCache() { return &allocator_cache; }
27 
28 void ReplaceSystemMalloc() {}
29 
30 } // namespace __lsan
31 
32 #endif  // SANITIZER_LINUX || SANITIZER_NETBSD || SANITIZER_FUCHSIA
33