MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / arena_i_dss_ctl

Function arena_i_dss_ctl

deps/jemalloc/src/ctl.c:2247–2306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2245}
2246
2247static int
2248arena_i_dss_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
2249 size_t *oldlenp, void *newp, size_t newlen) {
2250 int ret;
2251 const char *dss = NULL;
2252 unsigned arena_ind;
2253 dss_prec_t dss_prec_old = dss_prec_limit;
2254 dss_prec_t dss_prec = dss_prec_limit;
2255
2256 malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx);
2257 WRITE(dss, const char *);
2258 MIB_UNSIGNED(arena_ind, 1);
2259 if (dss != NULL) {
2260 int i;
2261 bool match = false;
2262
2263 for (i = 0; i < dss_prec_limit; i++) {
2264 if (strcmp(dss_prec_names[i], dss) == 0) {
2265 dss_prec = i;
2266 match = true;
2267 break;
2268 }
2269 }
2270
2271 if (!match) {
2272 ret = EINVAL;
2273 goto label_return;
2274 }
2275 }
2276
2277 /*
2278 * Access via index narenas is deprecated, and scheduled for removal in
2279 * 6.0.0.
2280 */
2281 if (arena_ind == MALLCTL_ARENAS_ALL || arena_ind ==
2282 ctl_arenas->narenas) {
2283 if (dss_prec != dss_prec_limit &&
2284 extent_dss_prec_set(dss_prec)) {
2285 ret = EFAULT;
2286 goto label_return;
2287 }
2288 dss_prec_old = extent_dss_prec_get();
2289 } else {
2290 arena_t *arena = arena_get(tsd_tsdn(tsd), arena_ind, false);
2291 if (arena == NULL || (dss_prec != dss_prec_limit &&
2292 arena_dss_prec_set(arena, dss_prec))) {
2293 ret = EFAULT;
2294 goto label_return;
2295 }
2296 dss_prec_old = arena_dss_prec_get(arena);
2297 }
2298
2299 dss = dss_prec_names[dss_prec_old];
2300 READ(dss, const char *);
2301
2302 ret = 0;
2303label_return:
2304 malloc_mutex_unlock(tsd_tsdn(tsd), &ctl_mtx);

Callers

nothing calls this directly

Calls 8

extent_dss_prec_setFunction · 0.70
extent_dss_prec_getFunction · 0.70
arena_dss_prec_setFunction · 0.70
arena_dss_prec_getFunction · 0.70
malloc_mutex_lockFunction · 0.50
tsd_tsdnFunction · 0.50
arena_getFunction · 0.50
malloc_mutex_unlockFunction · 0.50

Tested by

no test coverage detected