Make opt_narenas unsigned rather than size_t.
This commit is contained in:
parent
603b3bd413
commit
8f683b94a7
@ -941,7 +941,7 @@ for (i = 0; i < nbins; i++) {
|
||||
<varlistentry id="opt.narenas">
|
||||
<term>
|
||||
<mallctl>opt.narenas</mallctl>
|
||||
(<type>size_t</type>)
|
||||
(<type>unsigned</type>)
|
||||
<literal>r-</literal>
|
||||
</term>
|
||||
<listitem><para>Maximum number of arenas to use for automatic
|
||||
|
@ -433,7 +433,7 @@ extern bool opt_redzone;
|
||||
extern bool opt_utrace;
|
||||
extern bool opt_xmalloc;
|
||||
extern bool opt_zero;
|
||||
extern size_t opt_narenas;
|
||||
extern unsigned opt_narenas;
|
||||
|
||||
extern bool in_valgrind;
|
||||
|
||||
|
@ -1277,7 +1277,7 @@ CTL_RO_CONFIG_GEN(config_xmalloc, bool)
|
||||
CTL_RO_NL_GEN(opt_abort, opt_abort, bool)
|
||||
CTL_RO_NL_GEN(opt_dss, opt_dss, const char *)
|
||||
CTL_RO_NL_GEN(opt_lg_chunk, opt_lg_chunk, size_t)
|
||||
CTL_RO_NL_GEN(opt_narenas, opt_narenas, size_t)
|
||||
CTL_RO_NL_GEN(opt_narenas, opt_narenas, unsigned)
|
||||
CTL_RO_NL_GEN(opt_purge, purge_mode_names[opt_purge], const char *)
|
||||
CTL_RO_NL_GEN(opt_lg_dirty_mult, opt_lg_dirty_mult, ssize_t)
|
||||
CTL_RO_NL_GEN(opt_decay_time, opt_decay_time, ssize_t)
|
||||
|
@ -40,7 +40,7 @@ bool opt_redzone = false;
|
||||
bool opt_utrace = false;
|
||||
bool opt_xmalloc = false;
|
||||
bool opt_zero = false;
|
||||
size_t opt_narenas = 0;
|
||||
unsigned opt_narenas = 0;
|
||||
|
||||
/* Initialized to true if the process is running inside Valgrind. */
|
||||
bool in_valgrind;
|
||||
@ -1031,7 +1031,7 @@ malloc_conf_init(void)
|
||||
if (cont) \
|
||||
continue; \
|
||||
}
|
||||
#define CONF_HANDLE_SIZE_T(o, n, min, max, clip) \
|
||||
#define CONF_HANDLE_T_U(t, o, n, min, max, clip) \
|
||||
if (CONF_MATCH(n)) { \
|
||||
uintmax_t um; \
|
||||
char *end; \
|
||||
@ -1045,11 +1045,11 @@ malloc_conf_init(void)
|
||||
k, klen, v, vlen); \
|
||||
} else if (clip) { \
|
||||
if ((min) != 0 && um < (min)) \
|
||||
o = (min); \
|
||||
o = (t)(min); \
|
||||
else if (um > (max)) \
|
||||
o = (max); \
|
||||
o = (t)(max); \
|
||||
else \
|
||||
o = um; \
|
||||
o = (t)um; \
|
||||
} else { \
|
||||
if (((min) != 0 && um < (min)) \
|
||||
|| um > (max)) { \
|
||||
@ -1058,10 +1058,14 @@ malloc_conf_init(void)
|
||||
"conf value", \
|
||||
k, klen, v, vlen); \
|
||||
} else \
|
||||
o = um; \
|
||||
o = (t)um; \
|
||||
} \
|
||||
continue; \
|
||||
}
|
||||
#define CONF_HANDLE_UNSIGNED(o, n, min, max, clip) \
|
||||
CONF_HANDLE_T_U(unsigned, o, n, min, max, clip)
|
||||
#define CONF_HANDLE_SIZE_T(o, n, min, max, clip) \
|
||||
CONF_HANDLE_T_U(size_t, o, n, min, max, clip)
|
||||
#define CONF_HANDLE_SSIZE_T(o, n, min, max) \
|
||||
if (CONF_MATCH(n)) { \
|
||||
long l; \
|
||||
@ -1129,8 +1133,8 @@ malloc_conf_init(void)
|
||||
}
|
||||
continue;
|
||||
}
|
||||
CONF_HANDLE_SIZE_T(opt_narenas, "narenas", 1,
|
||||
SIZE_T_MAX, false)
|
||||
CONF_HANDLE_UNSIGNED(opt_narenas, "narenas", 1,
|
||||
UINT_MAX, false)
|
||||
if (strncmp("purge", k, klen) == 0) {
|
||||
int i;
|
||||
bool match = false;
|
||||
|
10
src/stats.c
10
src/stats.c
@ -435,9 +435,10 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
||||
bool bv;
|
||||
unsigned uv;
|
||||
ssize_t ssv;
|
||||
size_t sv, bsz, ssz, sssz, cpsz;
|
||||
size_t sv, bsz, usz, ssz, sssz, cpsz;
|
||||
|
||||
bsz = sizeof(bool);
|
||||
usz = sizeof(unsigned);
|
||||
ssz = sizeof(size_t);
|
||||
sssz = sizeof(ssize_t);
|
||||
cpsz = sizeof(const char *);
|
||||
@ -464,6 +465,11 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
||||
: "false", bv2 ? "true" : "false"); \
|
||||
} \
|
||||
}
|
||||
#define OPT_WRITE_UNSIGNED(n) \
|
||||
if (je_mallctl("opt."#n, &uv, &usz, NULL, 0) == 0) { \
|
||||
malloc_cprintf(write_cb, cbopaque, \
|
||||
" opt."#n": %zu\n", sv); \
|
||||
}
|
||||
#define OPT_WRITE_SIZE_T(n) \
|
||||
if (je_mallctl("opt."#n, &sv, &ssz, NULL, 0) == 0) { \
|
||||
malloc_cprintf(write_cb, cbopaque, \
|
||||
@ -494,7 +500,7 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
||||
OPT_WRITE_BOOL(abort)
|
||||
OPT_WRITE_SIZE_T(lg_chunk)
|
||||
OPT_WRITE_CHAR_P(dss)
|
||||
OPT_WRITE_SIZE_T(narenas)
|
||||
OPT_WRITE_UNSIGNED(narenas)
|
||||
OPT_WRITE_CHAR_P(purge)
|
||||
if (opt_purge == purge_mode_ratio) {
|
||||
OPT_WRITE_SSIZE_T_MUTABLE(lg_dirty_mult,
|
||||
|
@ -163,7 +163,7 @@ TEST_BEGIN(test_mallctl_opt)
|
||||
TEST_MALLCTL_OPT(bool, abort, always);
|
||||
TEST_MALLCTL_OPT(size_t, lg_chunk, always);
|
||||
TEST_MALLCTL_OPT(const char *, dss, always);
|
||||
TEST_MALLCTL_OPT(size_t, narenas, always);
|
||||
TEST_MALLCTL_OPT(unsigned, narenas, always);
|
||||
TEST_MALLCTL_OPT(const char *, purge, always);
|
||||
TEST_MALLCTL_OPT(ssize_t, lg_dirty_mult, always);
|
||||
TEST_MALLCTL_OPT(ssize_t, decay_time, always);
|
||||
|
Loading…
Reference in New Issue
Block a user