1 //===-- wrappers_c.h --------------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef SCUDO_WRAPPERS_C_H_
10 #define SCUDO_WRAPPERS_C_H_
15 // Bionic's struct mallinfo consists of size_t (mallinfo(3) uses int).
17 typedef size_t __scudo_mallinfo_data_t;
19 typedef int __scudo_mallinfo_data_t;
22 struct __scudo_mallinfo {
23 __scudo_mallinfo_data_t arena;
24 __scudo_mallinfo_data_t ordblks;
25 __scudo_mallinfo_data_t smblks;
26 __scudo_mallinfo_data_t hblks;
27 __scudo_mallinfo_data_t hblkhd;
28 __scudo_mallinfo_data_t usmblks;
29 __scudo_mallinfo_data_t fsmblks;
30 __scudo_mallinfo_data_t uordblks;
31 __scudo_mallinfo_data_t fordblks;
32 __scudo_mallinfo_data_t keepcost;
35 // Android sometimes includes malloc.h no matter what, which yields to
36 // conflicting return types for mallinfo() if we use our own structure. So if
37 // struct mallinfo is declared (#define courtesy of malloc.h), use it directly.
38 #if STRUCT_MALLINFO_DECLARED
39 #define SCUDO_MALLINFO mallinfo
41 #define SCUDO_MALLINFO __scudo_mallinfo
45 #define M_DECAY_TIME -100
52 #endif // SCUDO_WRAPPERS_C_H_