MCPcopy Create free account
hub / github.com/beefytech/Beef / malloc_conf_init_helper

Function malloc_conf_init_helper

BeefRT/JEMalloc/src/jemalloc.c:1065–1730  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1063}
1064
1065static void
1066malloc_conf_init_helper(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS],
1067 bool initial_call, const char *opts_cache[MALLOC_CONF_NSOURCES],
1068 char buf[PATH_MAX + 1]) {
1069 static const char *opts_explain[MALLOC_CONF_NSOURCES] = {
1070 "string specified via --with-malloc-conf",
1071 "string pointed to by the global variable malloc_conf",
1072 "\"name\" of the file referenced by the symbolic link named "
1073 "/etc/malloc.conf",
1074 "value of the environment variable MALLOC_CONF",
1075 "string pointed to by the global variable "
1076 "malloc_conf_2_conf_harder",
1077 };
1078 unsigned i;
1079 const char *opts, *k, *v;
1080 size_t klen, vlen;
1081
1082 for (i = 0; i < MALLOC_CONF_NSOURCES; i++) {
1083 /* Get runtime configuration. */
1084 if (initial_call) {
1085 opts_cache[i] = obtain_malloc_conf(i, buf);
1086 }
1087 opts = opts_cache[i];
1088 if (!initial_call && opt_confirm_conf) {
1089 malloc_printf(
1090 "<jemalloc>: malloc_conf #%u (%s): \"%s\"\n",
1091 i + 1, opts_explain[i], opts != NULL ? opts : "");
1092 }
1093 if (opts == NULL) {
1094 continue;
1095 }
1096
1097 while (*opts != '\0' && !malloc_conf_next(&opts, &k, &klen, &v,
1098 &vlen)) {
1099
1100#define CONF_ERROR(msg, k, klen, v, vlen) \
1101 if (!initial_call) { \
1102 malloc_conf_error( \
1103 msg, k, klen, v, vlen); \
1104 cur_opt_valid = false; \
1105 }
1106#define CONF_CONTINUE { \
1107 if (!initial_call && opt_confirm_conf \
1108 && cur_opt_valid) { \
1109 malloc_printf("<jemalloc>: -- " \
1110 "Set conf value: %.*s:%.*s" \
1111 "\n", (int)klen, k, \
1112 (int)vlen, v); \
1113 } \
1114 continue; \
1115 }
1116#define CONF_MATCH(n) \
1117 (sizeof(n)-1 == klen && strncmp(n, k, klen) == 0)
1118#define CONF_MATCH_VALUE(n) \
1119 (sizeof(n)-1 == vlen && strncmp(n, v, vlen) == 0)
1120#define CONF_HANDLE_BOOL(o, n) \
1121 if (CONF_MATCH(n)) { \
1122 if (CONF_MATCH_VALUE("true")) { \

Callers 1

malloc_conf_initFunction · 0.85

Calls 12

obtain_malloc_confFunction · 0.85
malloc_printfFunction · 0.85
malloc_conf_nextFunction · 0.85
extent_dss_prec_setFunction · 0.85
fxp_parseFunction · 0.85
bin_update_shard_sizeFunction · 0.85
init_opt_stats_optsFunction · 0.85
fxp_mul_fracFunction · 0.85
sc_data_initFunction · 0.85
sc_data_update_slab_sizeFunction · 0.85

Tested by

no test coverage detected