Rizin
unix-like reverse engineering framework and cli tools
ctl.h
Go to the documentation of this file.
1 /******************************************************************************/
2 #ifdef JEMALLOC_H_TYPES
3 
4 typedef struct ctl_node_s ctl_node_t;
5 typedef struct ctl_named_node_s ctl_named_node_t;
6 typedef struct ctl_indexed_node_s ctl_indexed_node_t;
7 typedef struct ctl_arena_stats_s ctl_arena_stats_t;
8 typedef struct ctl_stats_s ctl_stats_t;
9 
10 #endif /* JEMALLOC_H_TYPES */
11 /******************************************************************************/
12 #ifdef JEMALLOC_H_STRUCTS
13 
14 struct ctl_node_s {
15  bool named;
16 };
17 
18 struct ctl_named_node_s {
19  struct ctl_node_s node;
20  const char *name;
21  /* If (nchildren == 0), this is a terminal node. */
22  unsigned nchildren;
23  const ctl_node_t *children;
24  int (*ctl)(tsd_t *, const size_t *, size_t, void *,
25  size_t *, void *, size_t);
26 };
27 
28 struct ctl_indexed_node_s {
29  struct ctl_node_s node;
30  const ctl_named_node_t *(*index)(tsdn_t *, const size_t *, size_t,
31  size_t);
32 };
33 
34 struct ctl_arena_stats_s {
35  bool initialized;
36  unsigned nthreads;
37  const char *dss;
38  ssize_t lg_dirty_mult;
39  ssize_t decay_time;
40  size_t pactive;
41  size_t pdirty;
42 
43  /* The remainder are only populated if config_stats is true. */
44 
45  arena_stats_t astats;
46 
47  /* Aggregate stats for small size classes, based on bin stats. */
48  size_t allocated_small;
49  uint64_t nmalloc_small;
50  uint64_t ndalloc_small;
51  uint64_t nrequests_small;
52 
53  malloc_bin_stats_t bstats[JM_NBINS];
54  malloc_large_stats_t *lstats; /* nlclasses elements. */
55  malloc_huge_stats_t *hstats; /* nhclasses elements. */
56 };
57 
58 struct ctl_stats_s {
59  size_t allocated;
60  size_t active;
61  size_t metadata;
62  size_t resident;
63  size_t mapped;
64  size_t retained;
65  unsigned narenas;
66  ctl_arena_stats_t *arenas; /* (narenas + 1) elements. */
67 };
68 
69 #endif /* JEMALLOC_H_STRUCTS */
70 /******************************************************************************/
71 #ifdef JEMALLOC_H_EXTERNS
72 
73 int ctl_byname(tsd_t *tsd, const char *name, void *oldp, size_t *oldlenp,
74  void *newp, size_t newlen);
75 int ctl_nametomib(tsdn_t *tsdn, const char *name, size_t *mibp,
76  size_t *miblenp);
77 
78 int ctl_bymib(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
79  size_t *oldlenp, void *newp, size_t newlen);
80 bool ctl_boot(void);
81 void ctl_prefork(tsdn_t *tsdn);
82 void ctl_postfork_parent(tsdn_t *tsdn);
83 void ctl_postfork_child(tsdn_t *tsdn);
84 
85 #define xmallctl(name, oldp, oldlenp, newp, newlen) do { \
86  if (je_mallctl(name, oldp, oldlenp, newp, newlen) \
87  != 0) { \
88  malloc_printf( \
89  "<jemalloc>: Failure in xmallctl(\"%s\", ...)\n", \
90  name); \
91  abort(); \
92  } \
93 } while (0)
94 
95 #define xmallctlnametomib(name, mibp, miblenp) do { \
96  if (je_mallctlnametomib(name, mibp, miblenp) != 0) { \
97  malloc_printf("<jemalloc>: Failure in " \
98  "xmallctlnametomib(\"%s\", ...)\n", name); \
99  abort(); \
100  } \
101 } while (0)
102 
103 #define xmallctlbymib(mib, miblen, oldp, oldlenp, newp, newlen) do { \
104  if (je_mallctlbymib(mib, miblen, oldp, oldlenp, newp, \
105  newlen) != 0) { \
106  malloc_write( \
107  "<jemalloc>: Failure in xmallctlbymib()\n"); \
108  abort(); \
109  } \
110 } while (0)
111 
112 #endif /* JEMALLOC_H_EXTERNS */
113 /******************************************************************************/
114 #ifdef JEMALLOC_H_INLINES
115 
116 #endif /* JEMALLOC_H_INLINES */
117 /******************************************************************************/
118 
arena_t ** arenas
const char * name
Definition: op.c:541
#define ctl_nametomib
#define ctl_postfork_parent
#define ctl_byname
#define ctl_bymib
#define ctl_prefork
#define ctl_boot
#define ctl_postfork_child
static int
Definition: sfsocketcall.h:114
int size_t
Definition: sftypes.h:40
unsigned long uint64_t
Definition: sftypes.h:28
int ssize_t
Definition: sftypes.h:39
Definition: z80asm.h:102
static unsigned int nthreads
Definition: threadpool.c:37
static int initialized
Definition: tricore-dis.c:96