static int arena_i_purge_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) { int ret; READONLY(); WRITEONLY(); malloc_mutex_lock(&ctl_mtx); arena_purge(mib[1]); malloc_mutex_unlock(&ctl_mtx); ret = 0; label_return: return (ret); }
static int thread_tcache_flush_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) { int ret; if (config_tcache == false) return (ENOENT); READONLY(); WRITEONLY(); tcache_flush(); ret = 0; label_return: return (ret); }
static int prof_dump_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) { int ret; const char *filename = NULL; WRITEONLY(); WRITE(filename, const char *); if (prof_mdump(filename)) { ret = EFAULT; goto RETURN; } ret = 0; RETURN: return (ret); }
static int prof_dump_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) { int ret; const char *filename = NULL; if (config_prof == false) return (ENOENT); WRITEONLY(); WRITE(filename, const char *); if (prof_mdump(filename)) { ret = EFAULT; goto label_return; } ret = 0; label_return: return (ret); }
static int arenas_purge_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) { int ret; unsigned arena; WRITEONLY(); arena = UINT_MAX; WRITE(arena, unsigned); if (newp != NULL && arena >= narenas) { ret = EFAULT; goto label_return; } else { VARIABLE_ARRAY(arena_t *, tarenas, narenas); malloc_mutex_lock(&arenas_lock); memcpy(tarenas, arenas, sizeof(arena_t *) * narenas); malloc_mutex_unlock(&arenas_lock); if (arena == UINT_MAX) { unsigned i; for (i = 0; i < narenas; i++) { if (tarenas[i] != NULL) arena_purge_all(tarenas[i]); } } else { assert(arena < narenas); if (tarenas[arena] != NULL) arena_purge_all(tarenas[arena]); } } ret = 0; label_return: return (ret); }
static int arenas_purge_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) { int ret; unsigned arena_ind; malloc_mutex_lock(&ctl_mtx); WRITEONLY(); arena_ind = UINT_MAX; WRITE(arena_ind, unsigned); if (newp != NULL && arena_ind >= ctl_stats.narenas) ret = EFAULT; else { if (arena_ind == UINT_MAX) arena_ind = ctl_stats.narenas; arena_purge(arena_ind); ret = 0; } label_return: malloc_mutex_unlock(&ctl_mtx); return (ret); }