Separate out the configuration code from initialization

This commit is contained in:
Carl Shapiro 2026-03-02 13:02:46 -08:00 committed by Guangli Dai
parent a056c20d67
commit ad726adf75
5 changed files with 1261 additions and 1134 deletions

View file

@ -131,6 +131,7 @@ C_SRCS := $(srcroot)src/jemalloc.c \
$(srcroot)src/large.c \
$(srcroot)src/log.c \
$(srcroot)src/malloc_io.c \
$(srcroot)src/conf.c \
$(srcroot)src/mutex.c \
$(srcroot)src/nstime.c \
$(srcroot)src/pa.c \

View file

@ -0,0 +1,27 @@
#ifndef JEMALLOC_INTERNAL_CONF_H
#define JEMALLOC_INTERNAL_CONF_H
#include "jemalloc/internal/sc.h"
void malloc_conf_init(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS],
char readlink_buf[PATH_MAX + 1]);
void malloc_abort_invalid_conf(void);
#ifdef JEMALLOC_JET
extern bool had_conf_error;
bool conf_next(char const **opts_p, char const **k_p, size_t *klen_p,
char const **v_p, size_t *vlen_p);
void conf_error(const char *msg, const char *k, size_t klen,
const char *v, size_t vlen);
bool conf_handle_bool(const char *v, size_t vlen, bool *result);
bool conf_handle_unsigned(const char *v, size_t vlen,
uintmax_t min, uintmax_t max, bool check_min, bool check_max,
bool clip, uintmax_t *result);
bool conf_handle_signed(const char *v, size_t vlen,
intmax_t min, intmax_t max, bool check_min, bool check_max,
bool clip, intmax_t *result);
bool conf_handle_char_p(const char *v, size_t vlen,
char *dest, size_t dest_sz);
#endif
#endif /* JEMALLOC_INTERNAL_CONF_H */

View file

@ -3,6 +3,7 @@
#include "jemalloc/internal/arena_types.h"
#include "jemalloc/internal/atomic.h"
#include "jemalloc/internal/fxp.h"
#include "jemalloc/internal/hpa_opts.h"
#include "jemalloc/internal/nstime.h"
#include "jemalloc/internal/sec_opts.h"
@ -34,6 +35,7 @@ extern bool opt_experimental_infallible_new;
extern bool opt_experimental_tcache_gc;
extern bool opt_zero;
extern unsigned opt_narenas;
extern fxp_t opt_narenas_ratio;
extern zero_realloc_action_t opt_zero_realloc_action;
extern malloc_init_t malloc_init_state;
extern const char *const zero_realloc_mode_names[];

1228
src/conf.c Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff