Merge "Rename iterate to malloc_iterate internally."
This commit is contained in:
commit
c686ab54c2
15 changed files with 29 additions and 27 deletions
|
@ -29,7 +29,7 @@
|
|||
__BEGIN_DECLS
|
||||
|
||||
void* je_aligned_alloc_wrapper(size_t, size_t);
|
||||
int je_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*);
|
||||
int je_malloc_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*);
|
||||
int je_mallctl(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen) __attribute__((nothrow));
|
||||
struct mallinfo je_mallinfo();
|
||||
void je_malloc_disable();
|
||||
|
|
|
@ -215,9 +215,9 @@ extern "C" int malloc_iterate(uintptr_t base, size_t size,
|
|||
void (*callback)(uintptr_t base, size_t size, void* arg), void* arg) {
|
||||
auto dispatch_table = GetDispatchTable();
|
||||
if (__predict_false(dispatch_table != nullptr)) {
|
||||
return dispatch_table->iterate(base, size, callback, arg);
|
||||
return dispatch_table->malloc_iterate(base, size, callback, arg);
|
||||
}
|
||||
return Malloc(iterate)(base, size, callback, arg);
|
||||
return Malloc(malloc_iterate)(base, size, callback, arg);
|
||||
}
|
||||
|
||||
// Disable calls to malloc so malloc_iterate gets a consistent view of
|
||||
|
@ -247,8 +247,9 @@ extern "C" ssize_t malloc_backtrace(void*, uintptr_t*, size_t) {
|
|||
|
||||
#if __has_feature(hwaddress_sanitizer)
|
||||
// FIXME: implement these in HWASan allocator.
|
||||
extern "C" int __sanitizer_iterate(uintptr_t base __unused, size_t size __unused,
|
||||
void (*callback)(uintptr_t base, size_t size, void* arg) __unused,
|
||||
extern "C" int __sanitizer_malloc_iterate(uintptr_t base __unused, size_t size __unused,
|
||||
void (*callback)(uintptr_t base, size_t size, void* arg)
|
||||
__unused,
|
||||
void* arg __unused) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
__BEGIN_DECLS
|
||||
|
||||
// FIXME: implement these in HWASan allocator.
|
||||
int __sanitizer_iterate(uintptr_t base, size_t size,
|
||||
int __sanitizer_malloc_iterate(uintptr_t base, size_t size,
|
||||
void (*callback)(uintptr_t base, size_t size, void* arg),
|
||||
void* arg);
|
||||
void __sanitizer_malloc_disable();
|
||||
|
|
|
@ -95,7 +95,7 @@ static constexpr MallocDispatch __libc_malloc_default_dispatch
|
|||
#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
|
||||
Malloc(valloc),
|
||||
#endif
|
||||
Malloc(iterate),
|
||||
Malloc(malloc_iterate),
|
||||
Malloc(malloc_disable),
|
||||
Malloc(malloc_enable),
|
||||
Malloc(mallopt),
|
||||
|
@ -184,7 +184,8 @@ static bool InitMallocFunctions(void* impl_handler, MallocDispatch* table, const
|
|||
if (!InitMallocFunction<MallocRealloc>(impl_handler, &table->realloc, prefix, "realloc")) {
|
||||
return false;
|
||||
}
|
||||
if (!InitMallocFunction<MallocIterate>(impl_handler, &table->iterate, prefix, "iterate")) {
|
||||
if (!InitMallocFunction<MallocIterate>(impl_handler, &table->malloc_iterate, prefix,
|
||||
"malloc_iterate")) {
|
||||
return false;
|
||||
}
|
||||
if (!InitMallocFunction<MallocMallocDisable>(impl_handler, &table->malloc_disable, prefix,
|
||||
|
|
|
@ -104,7 +104,7 @@ static constexpr MallocDispatch __heapprofd_init_dispatch
|
|||
#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
|
||||
Malloc(valloc),
|
||||
#endif
|
||||
Malloc(iterate),
|
||||
Malloc(malloc_iterate),
|
||||
Malloc(malloc_disable),
|
||||
Malloc(malloc_enable),
|
||||
Malloc(mallopt),
|
||||
|
|
|
@ -350,9 +350,9 @@ static struct mallinfo LimitMallinfo() {
|
|||
static int LimitIterate(uintptr_t base, size_t size, void (*callback)(uintptr_t, size_t, void*), void* arg) {
|
||||
auto dispatch_table = GetDefaultDispatchTable();
|
||||
if (__predict_false(dispatch_table != nullptr)) {
|
||||
return dispatch_table->iterate(base, size, callback, arg);
|
||||
return dispatch_table->malloc_iterate(base, size, callback, arg);
|
||||
}
|
||||
return Malloc(iterate)(base, size, callback, arg);
|
||||
return Malloc(malloc_iterate)(base, size, callback, arg);
|
||||
}
|
||||
|
||||
static void LimitMallocDisable() {
|
||||
|
|
|
@ -52,7 +52,7 @@ void* scudo_pvalloc(size_t);
|
|||
void* scudo_valloc(size_t);
|
||||
#endif
|
||||
|
||||
int scudo_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*);
|
||||
int scudo_malloc_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*);
|
||||
void scudo_malloc_disable();
|
||||
void scudo_malloc_enable();
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ int scudo_malloc_info(int /*options*/, FILE* /*fp*/) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
int scudo_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*) {
|
||||
int scudo_malloc_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,13 +8,13 @@ LIBC_MALLOC_DEBUG {
|
|||
debug_free_malloc_leak_info;
|
||||
debug_get_malloc_leak_info;
|
||||
debug_initialize;
|
||||
debug_iterate;
|
||||
debug_mallinfo;
|
||||
debug_malloc;
|
||||
debug_malloc_backtrace;
|
||||
debug_malloc_disable;
|
||||
debug_malloc_enable;
|
||||
debug_malloc_info;
|
||||
debug_malloc_iterate;
|
||||
debug_malloc_usable_size;
|
||||
debug_mallopt;
|
||||
debug_memalign;
|
||||
|
|
|
@ -8,13 +8,13 @@ LIBC_MALLOC_DEBUG {
|
|||
debug_free_malloc_leak_info;
|
||||
debug_get_malloc_leak_info;
|
||||
debug_initialize;
|
||||
debug_iterate;
|
||||
debug_mallinfo;
|
||||
debug_malloc;
|
||||
debug_malloc_backtrace;
|
||||
debug_malloc_disable;
|
||||
debug_malloc_enable;
|
||||
debug_malloc_info;
|
||||
debug_malloc_iterate;
|
||||
debug_malloc_usable_size;
|
||||
debug_mallopt;
|
||||
debug_memalign;
|
||||
|
|
|
@ -91,7 +91,7 @@ struct mallinfo debug_mallinfo();
|
|||
int debug_mallopt(int param, int value);
|
||||
int debug_malloc_info(int options, FILE* fp);
|
||||
int debug_posix_memalign(void** memptr, size_t alignment, size_t size);
|
||||
int debug_iterate(uintptr_t base, size_t size,
|
||||
int debug_malloc_iterate(uintptr_t base, size_t size,
|
||||
void (*callback)(uintptr_t base, size_t size, void* arg), void* arg);
|
||||
void debug_malloc_disable();
|
||||
void debug_malloc_enable();
|
||||
|
@ -841,7 +841,7 @@ int debug_posix_memalign(void** memptr, size_t alignment, size_t size) {
|
|||
return (*memptr != nullptr) ? 0 : ENOMEM;
|
||||
}
|
||||
|
||||
int debug_iterate(uintptr_t base, size_t size, void (*callback)(uintptr_t, size_t, void*),
|
||||
int debug_malloc_iterate(uintptr_t base, size_t size, void (*callback)(uintptr_t, size_t, void*),
|
||||
void* arg) {
|
||||
ScopedConcurrentLock lock;
|
||||
if (g_debug->TrackPointers()) {
|
||||
|
@ -854,7 +854,7 @@ int debug_iterate(uintptr_t base, size_t size, void (*callback)(uintptr_t, size_
|
|||
|
||||
// An option that adds a header will add pointer tracking, so no need to
|
||||
// check if headers are enabled.
|
||||
return g_dispatch->iterate(base, size, callback, arg);
|
||||
return g_dispatch->malloc_iterate(base, size, callback, arg);
|
||||
}
|
||||
|
||||
void debug_malloc_disable() {
|
||||
|
|
|
@ -7,13 +7,13 @@ LIBC_MALLOC_HOOKS {
|
|||
hooks_free_malloc_leak_info;
|
||||
hooks_get_malloc_leak_info;
|
||||
hooks_initialize;
|
||||
hooks_iterate;
|
||||
hooks_mallinfo;
|
||||
hooks_malloc;
|
||||
hooks_malloc_backtrace;
|
||||
hooks_malloc_disable;
|
||||
hooks_malloc_enable;
|
||||
hooks_malloc_info;
|
||||
hooks_malloc_iterate;
|
||||
hooks_malloc_usable_size;
|
||||
hooks_mallopt;
|
||||
hooks_memalign;
|
||||
|
|
|
@ -7,13 +7,13 @@ LIBC_MALLOC_HOOKS {
|
|||
hooks_free_malloc_leak_info;
|
||||
hooks_get_malloc_leak_info;
|
||||
hooks_initialize;
|
||||
hooks_iterate;
|
||||
hooks_mallinfo;
|
||||
hooks_malloc;
|
||||
hooks_malloc_backtrace;
|
||||
hooks_malloc_disable;
|
||||
hooks_malloc_enable;
|
||||
hooks_malloc_info;
|
||||
hooks_malloc_iterate;
|
||||
hooks_malloc_usable_size;
|
||||
hooks_mallopt;
|
||||
hooks_memalign;
|
||||
|
|
|
@ -67,7 +67,7 @@ void* hooks_calloc(size_t nmemb, size_t bytes);
|
|||
struct mallinfo hooks_mallinfo();
|
||||
int hooks_mallopt(int param, int value);
|
||||
int hooks_posix_memalign(void** memptr, size_t alignment, size_t size);
|
||||
int hooks_iterate(uintptr_t base, size_t size,
|
||||
int hooks_malloc_iterate(uintptr_t base, size_t size,
|
||||
void (*callback)(uintptr_t base, size_t size, void* arg), void* arg);
|
||||
void hooks_malloc_disable();
|
||||
void hooks_malloc_enable();
|
||||
|
@ -209,7 +209,7 @@ int hooks_posix_memalign(void** memptr, size_t alignment, size_t size) {
|
|||
return g_dispatch->posix_memalign(memptr, alignment, size);
|
||||
}
|
||||
|
||||
int hooks_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*) {
|
||||
int hooks_malloc_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ struct MallocDispatch {
|
|||
#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
|
||||
MallocValloc valloc;
|
||||
#endif
|
||||
MallocIterate iterate;
|
||||
MallocIterate malloc_iterate;
|
||||
MallocMallocDisable malloc_disable;
|
||||
MallocMallocEnable malloc_enable;
|
||||
MallocMallopt mallopt;
|
||||
|
|
Loading…
Reference in a new issue