Rizin
unix-like reverse engineering framework and cli tools
chunk.h
Go to the documentation of this file.
1 /******************************************************************************/
2 #ifdef JEMALLOC_H_TYPES
3 
4 /*
5  * Size and alignment of memory chunks that are allocated by the OS's virtual
6  * memory system.
7  */
8 #define LG_CHUNK_DEFAULT 21
9 
10 /* Return the chunk address for allocation address a. */
11 #define CHUNK_ADDR2BASE(a) \
12  ((void *)((uintptr_t)(a) & ~chunksize_mask))
13 
14 /* Return the chunk offset of address a. */
15 #define CHUNK_ADDR2OFFSET(a) \
16  ((size_t)((uintptr_t)(a) & chunksize_mask))
17 
18 /* Return the smallest chunk multiple that is >= s. */
19 #define CHUNK_CEILING(s) \
20  (((s) + chunksize_mask) & ~chunksize_mask)
21 
22 #define CHUNK_HOOKS_INITIALIZER { \
23  NULL, \
24  NULL, \
25  NULL, \
26  NULL, \
27  NULL, \
28  NULL, \
29  NULL \
30 }
31 
32 #endif /* JEMALLOC_H_TYPES */
33 /******************************************************************************/
34 #ifdef JEMALLOC_H_STRUCTS
35 
36 #endif /* JEMALLOC_H_STRUCTS */
37 /******************************************************************************/
38 #ifdef JEMALLOC_H_EXTERNS
39 
40 extern size_t opt_lg_chunk;
41 extern const char *opt_dss;
42 
43 extern rtree_t chunks_rtree;
44 
45 extern size_t chunksize;
46 extern size_t chunksize_mask; /* (chunksize - 1). */
47 extern size_t chunk_npages;
48 
50 
51 chunk_hooks_t chunk_hooks_get(tsdn_t *tsdn, arena_t *arena);
52 chunk_hooks_t chunk_hooks_set(tsdn_t *tsdn, arena_t *arena,
53  const chunk_hooks_t *chunk_hooks);
54 
55 bool chunk_register(const void *chunk, const extent_node_t *node,
56  bool *gdump);
57 void chunk_deregister(const void *chunk, const extent_node_t *node);
58 void *chunk_alloc_base(size_t size);
59 void *chunk_alloc_cache(tsdn_t *tsdn, arena_t *arena,
60  chunk_hooks_t *chunk_hooks, void *new_addr, size_t size, size_t alignment,
61  size_t *sn, bool *zero, bool *commit, bool dalloc_node);
62 void *chunk_alloc_wrapper(tsdn_t *tsdn, arena_t *arena,
63  chunk_hooks_t *chunk_hooks, void *new_addr, size_t size, size_t alignment,
64  size_t *sn, bool *zero, bool *commit);
65 void chunk_dalloc_cache(tsdn_t *tsdn, arena_t *arena,
66  chunk_hooks_t *chunk_hooks, void *chunk, size_t size, size_t sn,
67  bool committed);
68 void chunk_dalloc_wrapper(tsdn_t *tsdn, arena_t *arena,
69  chunk_hooks_t *chunk_hooks, void *chunk, size_t size, size_t sn,
70  bool zeroed, bool committed);
71 bool chunk_purge_wrapper(tsdn_t *tsdn, arena_t *arena,
72  chunk_hooks_t *chunk_hooks, void *chunk, size_t size, size_t offset,
73  size_t length);
74 bool chunk_boot(void);
75 
76 #endif /* JEMALLOC_H_EXTERNS */
77 /******************************************************************************/
78 #ifdef JEMALLOC_H_INLINES
79 
80 #ifndef JEMALLOC_ENABLE_INLINE
81 extent_node_t *chunk_lookup(const void *chunk, bool dependent);
82 #endif
83 
84 #if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_CHUNK_C_))
85 JEMALLOC_INLINE extent_node_t *
86 chunk_lookup(const void *ptr, bool dependent)
87 {
88 
89  return (rtree_get(&chunks_rtree, (uintptr_t)ptr, dependent));
90 }
91 #endif
92 
93 #endif /* JEMALLOC_H_INLINES */
94 /******************************************************************************/
95 
96 #include "chunk_dss.h"
97 #include "chunk_mmap.h"
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
Definition: sflib.h:133
voidpf void uLong size
Definition: ioapi.h:138
voidpf uLong offset
Definition: ioapi.h:144
#define JEMALLOC_INLINE
#define chunk_hooks_get
#define chunk_alloc_cache
#define chunk_npages
#define chunksize
#define chunk_deregister
#define opt_lg_chunk
#define chunk_register
#define chunksize_mask
#define chunks_rtree
#define chunk_purge_wrapper
#define chunk_lookup
#define chunk_alloc_wrapper
#define chunk_boot
#define chunk_dalloc_wrapper
#define chunk_alloc_base
#define chunk_dalloc_cache
#define rtree_get
#define chunk_hooks_default
#define opt_dss
#define chunk_hooks_set
_W64 unsigned int uintptr_t
Definition: malloc.c:21