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">
|
<varlistentry id="opt.narenas">
|
||||||
<term>
|
<term>
|
||||||
<mallctl>opt.narenas</mallctl>
|
<mallctl>opt.narenas</mallctl>
|
||||||
(<type>size_t</type>)
|
(<type>unsigned</type>)
|
||||||
<literal>r-</literal>
|
<literal>r-</literal>
|
||||||
</term>
|
</term>
|
||||||
<listitem><para>Maximum number of arenas to use for automatic
|
<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_utrace;
|
||||||
extern bool opt_xmalloc;
|
extern bool opt_xmalloc;
|
||||||
extern bool opt_zero;
|
extern bool opt_zero;
|
||||||
extern size_t opt_narenas;
|
extern unsigned opt_narenas;
|
||||||
|
|
||||||
extern bool in_valgrind;
|
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_abort, opt_abort, bool)
|
||||||
CTL_RO_NL_GEN(opt_dss, opt_dss, const char *)
|
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_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_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_lg_dirty_mult, opt_lg_dirty_mult, ssize_t)
|
||||||
CTL_RO_NL_GEN(opt_decay_time, opt_decay_time, 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_utrace = false;
|
||||||
bool opt_xmalloc = false;
|
bool opt_xmalloc = false;
|
||||||
bool opt_zero = false;
|
bool opt_zero = false;
|
||||||
size_t opt_narenas = 0;
|
unsigned opt_narenas = 0;
|
||||||
|
|
||||||
/* Initialized to true if the process is running inside Valgrind. */
|
/* Initialized to true if the process is running inside Valgrind. */
|
||||||
bool in_valgrind;
|
bool in_valgrind;
|
||||||
@ -1031,7 +1031,7 @@ malloc_conf_init(void)
|
|||||||
if (cont) \
|
if (cont) \
|
||||||
continue; \
|
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)) { \
|
if (CONF_MATCH(n)) { \
|
||||||
uintmax_t um; \
|
uintmax_t um; \
|
||||||
char *end; \
|
char *end; \
|
||||||
@ -1045,11 +1045,11 @@ malloc_conf_init(void)
|
|||||||
k, klen, v, vlen); \
|
k, klen, v, vlen); \
|
||||||
} else if (clip) { \
|
} else if (clip) { \
|
||||||
if ((min) != 0 && um < (min)) \
|
if ((min) != 0 && um < (min)) \
|
||||||
o = (min); \
|
o = (t)(min); \
|
||||||
else if (um > (max)) \
|
else if (um > (max)) \
|
||||||
o = (max); \
|
o = (t)(max); \
|
||||||
else \
|
else \
|
||||||
o = um; \
|
o = (t)um; \
|
||||||
} else { \
|
} else { \
|
||||||
if (((min) != 0 && um < (min)) \
|
if (((min) != 0 && um < (min)) \
|
||||||
|| um > (max)) { \
|
|| um > (max)) { \
|
||||||
@ -1058,10 +1058,14 @@ malloc_conf_init(void)
|
|||||||
"conf value", \
|
"conf value", \
|
||||||
k, klen, v, vlen); \
|
k, klen, v, vlen); \
|
||||||
} else \
|
} else \
|
||||||
o = um; \
|
o = (t)um; \
|
||||||
} \
|
} \
|
||||||
continue; \
|
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) \
|
#define CONF_HANDLE_SSIZE_T(o, n, min, max) \
|
||||||
if (CONF_MATCH(n)) { \
|
if (CONF_MATCH(n)) { \
|
||||||
long l; \
|
long l; \
|
||||||
@ -1129,8 +1133,8 @@ malloc_conf_init(void)
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CONF_HANDLE_SIZE_T(opt_narenas, "narenas", 1,
|
CONF_HANDLE_UNSIGNED(opt_narenas, "narenas", 1,
|
||||||
SIZE_T_MAX, false)
|
UINT_MAX, false)
|
||||||
if (strncmp("purge", k, klen) == 0) {
|
if (strncmp("purge", k, klen) == 0) {
|
||||||
int i;
|
int i;
|
||||||
bool match = false;
|
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;
|
bool bv;
|
||||||
unsigned uv;
|
unsigned uv;
|
||||||
ssize_t ssv;
|
ssize_t ssv;
|
||||||
size_t sv, bsz, ssz, sssz, cpsz;
|
size_t sv, bsz, usz, ssz, sssz, cpsz;
|
||||||
|
|
||||||
bsz = sizeof(bool);
|
bsz = sizeof(bool);
|
||||||
|
usz = sizeof(unsigned);
|
||||||
ssz = sizeof(size_t);
|
ssz = sizeof(size_t);
|
||||||
sssz = sizeof(ssize_t);
|
sssz = sizeof(ssize_t);
|
||||||
cpsz = sizeof(const char *);
|
cpsz = sizeof(const char *);
|
||||||
@ -464,6 +465,11 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
: "false", bv2 ? "true" : "false"); \
|
: "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) \
|
#define OPT_WRITE_SIZE_T(n) \
|
||||||
if (je_mallctl("opt."#n, &sv, &ssz, NULL, 0) == 0) { \
|
if (je_mallctl("opt."#n, &sv, &ssz, NULL, 0) == 0) { \
|
||||||
malloc_cprintf(write_cb, cbopaque, \
|
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_BOOL(abort)
|
||||||
OPT_WRITE_SIZE_T(lg_chunk)
|
OPT_WRITE_SIZE_T(lg_chunk)
|
||||||
OPT_WRITE_CHAR_P(dss)
|
OPT_WRITE_CHAR_P(dss)
|
||||||
OPT_WRITE_SIZE_T(narenas)
|
OPT_WRITE_UNSIGNED(narenas)
|
||||||
OPT_WRITE_CHAR_P(purge)
|
OPT_WRITE_CHAR_P(purge)
|
||||||
if (opt_purge == purge_mode_ratio) {
|
if (opt_purge == purge_mode_ratio) {
|
||||||
OPT_WRITE_SSIZE_T_MUTABLE(lg_dirty_mult,
|
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(bool, abort, always);
|
||||||
TEST_MALLCTL_OPT(size_t, lg_chunk, always);
|
TEST_MALLCTL_OPT(size_t, lg_chunk, always);
|
||||||
TEST_MALLCTL_OPT(const char *, dss, 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(const char *, purge, always);
|
||||||
TEST_MALLCTL_OPT(ssize_t, lg_dirty_mult, always);
|
TEST_MALLCTL_OPT(ssize_t, lg_dirty_mult, always);
|
||||||
TEST_MALLCTL_OPT(ssize_t, decay_time, always);
|
TEST_MALLCTL_OPT(ssize_t, decay_time, always);
|
||||||
|
Loading…
Reference in New Issue
Block a user