]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
MFV r319741: 8156 dbuf_evict_notify() does not need dbuf_evict_lock
[FreeBSD/FreeBSD.git] / contrib / compiler-rt / lib / sanitizer_common / sanitizer_allocator.h
1 //===-- sanitizer_allocator.h -----------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Specialized memory allocator for ThreadSanitizer, MemorySanitizer, etc.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef SANITIZER_ALLOCATOR_H
15 #define SANITIZER_ALLOCATOR_H
16
17 #include "sanitizer_internal_defs.h"
18 #include "sanitizer_common.h"
19 #include "sanitizer_libc.h"
20 #include "sanitizer_list.h"
21 #include "sanitizer_mutex.h"
22 #include "sanitizer_lfstack.h"
23 #include "sanitizer_procmaps.h"
24
25 namespace __sanitizer {
26
27 // Returns true if ReportAllocatorCannotReturnNull(true) was called.
28 // Can be use to avoid memory hungry operations.
29 bool IsReportingOOM();
30
31 // Prints error message and kills the program.
32 void NORETURN ReportAllocatorCannotReturnNull(bool out_of_memory);
33
34 // Allocators call these callbacks on mmap/munmap.
35 struct NoOpMapUnmapCallback {
36   void OnMap(uptr p, uptr size) const { }
37   void OnUnmap(uptr p, uptr size) const { }
38 };
39
40 // Callback type for iterating over chunks.
41 typedef void (*ForEachChunkCallback)(uptr chunk, void *arg);
42
43 // Returns true if calloc(size, n) should return 0 due to overflow in size*n.
44 bool CallocShouldReturnNullDueToOverflow(uptr size, uptr n);
45
46 #include "sanitizer_allocator_size_class_map.h"
47 #include "sanitizer_allocator_stats.h"
48 #include "sanitizer_allocator_primary64.h"
49 #include "sanitizer_allocator_bytemap.h"
50 #include "sanitizer_allocator_primary32.h"
51 #include "sanitizer_allocator_local_cache.h"
52 #include "sanitizer_allocator_secondary.h"
53 #include "sanitizer_allocator_combined.h"
54
55 } // namespace __sanitizer
56
57 #endif // SANITIZER_ALLOCATOR_H