From 21e44c45d994798d50df9fa77c905465a38a4675 Mon Sep 17 00:00:00 2001 From: Yinan Zhang Date: Tue, 17 Mar 2020 19:57:06 -0700 Subject: [PATCH] Make maps file opening replaceable in test --- include/jemalloc/internal/prof_externs.h | 2 ++ src/prof_data.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/jemalloc/internal/prof_externs.h b/include/jemalloc/internal/prof_externs.h index 2f9f2c95..e5d6ff7b 100644 --- a/include/jemalloc/internal/prof_externs.h +++ b/include/jemalloc/internal/prof_externs.h @@ -98,6 +98,8 @@ typedef int (prof_dump_open_file_t)(const char *, int); extern prof_dump_open_file_t *JET_MUTABLE prof_dump_open_file; typedef bool (prof_dump_header_t)(tsdn_t *, bool, const prof_cnt_t *); extern prof_dump_header_t *JET_MUTABLE prof_dump_header; +typedef int (prof_dump_open_maps_t)(); +extern prof_dump_open_maps_t *JET_MUTABLE prof_dump_open_maps; void prof_cnt_all(uint64_t *curobjs, uint64_t *curbytes, uint64_t *accumobjs, uint64_t *accumbytes); diff --git a/src/prof_data.c b/src/prof_data.c index 62b650ca..b9b211d4 100644 --- a/src/prof_data.c +++ b/src/prof_data.c @@ -942,7 +942,7 @@ prof_open_maps_internal(const char *format, ...) { #endif static int -prof_dump_open_maps() { +prof_dump_open_maps_impl() { int mfd; cassert(config_prof); @@ -960,6 +960,8 @@ prof_dump_open_maps() { #endif return mfd; } +prof_dump_open_maps_t *JET_MUTABLE prof_dump_open_maps = + prof_dump_open_maps_impl; static bool prof_dump_maps(bool propagate_err) {