xref: /openbsd-src/gnu/llvm/compiler-rt/include/sanitizer/scudo_interface.h (revision 3cab2bb3f667058bece8e38b12449a63a9d73c4b)
1*3cab2bb3Spatrick //===-- sanitizer/scudo_interface.h -----------------------------*- C++ -*-===//
2*3cab2bb3Spatrick //
3*3cab2bb3Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*3cab2bb3Spatrick // See https://llvm.org/LICENSE.txt for license information.
5*3cab2bb3Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*3cab2bb3Spatrick //
7*3cab2bb3Spatrick //===----------------------------------------------------------------------===//
8*3cab2bb3Spatrick //
9*3cab2bb3Spatrick /// Public Scudo interface header.
10*3cab2bb3Spatrick //
11*3cab2bb3Spatrick //===----------------------------------------------------------------------===//
12*3cab2bb3Spatrick #ifndef SANITIZER_SCUDO_INTERFACE_H_
13*3cab2bb3Spatrick #define SANITIZER_SCUDO_INTERFACE_H_
14*3cab2bb3Spatrick 
15*3cab2bb3Spatrick #include <sanitizer/common_interface_defs.h>
16*3cab2bb3Spatrick 
17*3cab2bb3Spatrick #ifdef __cplusplus
18*3cab2bb3Spatrick extern "C" {
19*3cab2bb3Spatrick #endif
20*3cab2bb3Spatrick   // This function may be optionally provided by a user and should return
21*3cab2bb3Spatrick   // a string containing Scudo runtime options. See scudo_flags.h for details.
22*3cab2bb3Spatrick   const char* __scudo_default_options(void);
23*3cab2bb3Spatrick 
24*3cab2bb3Spatrick   // This function allows to set the RSS limit at runtime. This can be either
25*3cab2bb3Spatrick   // the hard limit (HardLimit=1) or the soft limit (HardLimit=0). The limit
26*3cab2bb3Spatrick   // can be removed by setting LimitMb to 0. This function's parameters should
27*3cab2bb3Spatrick   // be fully trusted to avoid security mishaps.
28*3cab2bb3Spatrick   void __scudo_set_rss_limit(size_t LimitMb, int HardLimit);
29*3cab2bb3Spatrick 
30*3cab2bb3Spatrick   // This function outputs various allocator statistics for both the Primary
31*3cab2bb3Spatrick   // and Secondary allocators, including memory usage, number of allocations
32*3cab2bb3Spatrick   // and deallocations.
33*3cab2bb3Spatrick   void __scudo_print_stats(void);
34*3cab2bb3Spatrick #ifdef __cplusplus
35*3cab2bb3Spatrick }  // extern "C"
36*3cab2bb3Spatrick #endif
37*3cab2bb3Spatrick 
38*3cab2bb3Spatrick #endif  // SANITIZER_SCUDO_INTERFACE_H_
39