Internalize malloc_conf_2_conf_harder ctl

This commit is contained in:
Slobodan Predolac 2026-05-21 14:11:40 -07:00
parent 533ffb67e3
commit 366a2cd9c0
4 changed files with 5 additions and 18 deletions

View file

@ -46,6 +46,7 @@ extern bool opt_disable_large_size_classes;
extern const char *opt_malloc_conf_symlink;
extern const char *opt_malloc_conf_env_var;
extern const char *je_malloc_conf_2_conf_harder;
/* Escape free-fastpath when ptr & mask == 0 (for sanitization purpose). */
extern uintptr_t san_cache_bin_nonfast_mask;

View file

@ -173,7 +173,6 @@ CTL_PROTO(opt_process_madvise_max_batch)
CTL_PROTO(opt_malloc_conf_symlink)
CTL_PROTO(opt_malloc_conf_env_var)
CTL_PROTO(opt_malloc_conf_global_var)
CTL_PROTO(opt_malloc_conf_global_var_2_conf_harder)
CTL_PROTO(tcache_create)
CTL_PROTO(tcache_flush)
CTL_PROTO(tcache_destroy)
@ -468,9 +467,7 @@ static const ctl_named_node_t config_node[] = {
static const ctl_named_node_t opt_malloc_conf_node[] = {
{NAME("symlink"), CTL(opt_malloc_conf_symlink)},
{NAME("env_var"), CTL(opt_malloc_conf_env_var)},
{NAME("global_var"), CTL(opt_malloc_conf_global_var)},
{NAME("global_var_2_conf_harder"),
CTL(opt_malloc_conf_global_var_2_conf_harder)}};
{NAME("global_var"), CTL(opt_malloc_conf_global_var)}};
static const ctl_named_node_t opt_node[] = {{NAME("abort"), CTL(opt_abort)},
{NAME("abort_conf"), CTL(opt_abort_conf)},
@ -2304,9 +2301,6 @@ CTL_RO_NL_CGEN(opt_malloc_conf_env_var, opt_malloc_conf_env_var,
opt_malloc_conf_env_var, const char *)
CTL_RO_NL_CGEN(
je_malloc_conf, opt_malloc_conf_global_var, je_malloc_conf, const char *)
CTL_RO_NL_CGEN(je_malloc_conf_2_conf_harder,
opt_malloc_conf_global_var_2_conf_harder, je_malloc_conf_2_conf_harder,
const char *)
/******************************************************************************/

View file

@ -1708,10 +1708,9 @@ stats_general_print(emitter_t *emitter) {
MALLOC_CONF_WRITE("global_var", "Global variable malloc_conf");
MALLOC_CONF_WRITE("symlink", "Symbolic link malloc.conf");
MALLOC_CONF_WRITE("env_var", "Environment variable MALLOC_CONF");
/* As this config is unofficial, skip the output if it's NULL */
if (je_mallctl("opt.malloc_conf.global_var_2_conf_harder", (void *)&cpv,
&cpsz, NULL, 0)
== 0) {
/* As this config is unofficial, skip the output if it's NULL. */
if (je_malloc_conf_2_conf_harder != NULL) {
cpv = je_malloc_conf_2_conf_harder;
emitter_kv(emitter, "global_var_2_conf_harder",
"Global "
"variable malloc_conf_2_conf_harder",

View file

@ -39,13 +39,6 @@ TEST_BEGIN(test_mallctl_global_var) {
expect_str_eq(mc, malloc_conf,
"Unexpected value for the global variable "
"malloc_conf");
expect_d_eq(mallctl("opt.malloc_conf.global_var_2_conf_harder",
(void *)&mc, &sz, NULL, 0),
0, "Unexpected mallctl() failure");
expect_str_eq(mc, malloc_conf_2_conf_harder,
"Unexpected value for the "
"global variable malloc_conf_2_conf_harder");
}
TEST_END