xref: /freebsd/contrib/llvm-project/compiler-rt/include/sanitizer/scudo_interface.h (revision 19261079b74319502c6ffa1249920079f0f69a72)
1 //===-- sanitizer/scudo_interface.h -----------------------------*- C++ -*-===//
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 /// Public Scudo interface header.
10 //
11 //===----------------------------------------------------------------------===//
12 #ifndef SANITIZER_SCUDO_INTERFACE_H_
13 #define SANITIZER_SCUDO_INTERFACE_H_
14 
15 #include <sanitizer/common_interface_defs.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20   // This function may be optionally provided by a user and should return
21   // a string containing Scudo runtime options. See scudo_flags.h for details.
22   const char* __scudo_default_options(void);
23 
24   // This function allows to set the RSS limit at runtime. This can be either
25   // the hard limit (HardLimit=1) or the soft limit (HardLimit=0). The limit
26   // can be removed by setting LimitMb to 0. This function's parameters should
27   // be fully trusted to avoid security mishaps.
28   void __scudo_set_rss_limit(size_t LimitMb, int HardLimit);
29 
30   // This function outputs various allocator statistics for both the Primary
31   // and Secondary allocators, including memory usage, number of allocations
32   // and deallocations.
33   void __scudo_print_stats(void);
34 #ifdef __cplusplus
35 }  // extern "C"
36 #endif
37 
38 #endif  // SANITIZER_SCUDO_INTERFACE_H_
39