Make maps file opening replaceable in test

This commit is contained in:
Yinan Zhang 2020-03-17 19:57:06 -07:00
parent 4bb4037dbe
commit 21e44c45d9
2 changed files with 5 additions and 1 deletions

View File

@ -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; 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 *); typedef bool (prof_dump_header_t)(tsdn_t *, bool, const prof_cnt_t *);
extern prof_dump_header_t *JET_MUTABLE prof_dump_header; 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, void prof_cnt_all(uint64_t *curobjs, uint64_t *curbytes, uint64_t *accumobjs,
uint64_t *accumbytes); uint64_t *accumbytes);

View File

@ -942,7 +942,7 @@ prof_open_maps_internal(const char *format, ...) {
#endif #endif
static int static int
prof_dump_open_maps() { prof_dump_open_maps_impl() {
int mfd; int mfd;
cassert(config_prof); cassert(config_prof);
@ -960,6 +960,8 @@ prof_dump_open_maps() {
#endif #endif
return mfd; return mfd;
} }
prof_dump_open_maps_t *JET_MUTABLE prof_dump_open_maps =
prof_dump_open_maps_impl;
static bool static bool
prof_dump_maps(bool propagate_err) { prof_dump_maps(bool propagate_err) {