summaryrefslogtreecommitdiff
path: root/sql/sys_vars.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-03-22 14:34:34 +0100
committerSergei Golubchik <serg@mariadb.org>2017-03-29 00:40:21 +0200
commitbf40e8069cd695228f3ea5d1bb25938a72bcf45f (patch)
treedb36d3c757f6f494dbe9d6850d3cd3c0b9cb0f01 /sql/sys_vars.cc
parent31a5d7212fcd40112cf357763d88c6d07d70271d (diff)
downloadmariadb-git-bf40e8069cd695228f3ea5d1bb25938a72bcf45f.tar.gz
MDEV-11059 don't build the server with jemalloc
don't build the server with jemalloc. only build tokudb with it. move tokudb into a separate package, because it brings a new dependency
Diffstat (limited to 'sql/sys_vars.cc')
-rw-r--r--sql/sys_vars.cc23
1 files changed, 22 insertions, 1 deletions
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index d6b1c76ea00..fd724bc7dd1 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -3489,11 +3489,32 @@ static Sys_var_charptr Sys_version_compile_os(
CMD_LINE_HELP_ONLY,
IN_SYSTEM_CHARSET, DEFAULT(SYSTEM_TYPE));
+static char *guess_malloc_library()
+{
+ if (strcmp(MALLOC_LIBRARY, "system") == 0)
+ {
+#ifdef HAVE_DLOPEN
+ typedef int (*mallctl_type)(const char*, void*, size_t*, void*, size_t);
+ mallctl_type mallctl_func;
+ mallctl_func= (mallctl_type)dlsym(RTLD_DEFAULT, "mallctl");
+ if (mallctl_func)
+ {
+ static char buf[128];
+ char *ver;
+ size_t len = sizeof(ver);
+ mallctl_func("version", &ver, &len, NULL, 0);
+ strxnmov(buf, sizeof(buf)-1, "jemalloc ", ver, NULL);
+ return buf;
+ }
+#endif
+ }
+ return const_cast<char*>(MALLOC_LIBRARY);
+}
static char *malloc_library;
static Sys_var_charptr Sys_malloc_library(
"version_malloc_library", "Version of the used malloc library",
READ_ONLY GLOBAL_VAR(malloc_library), CMD_LINE_HELP_ONLY,
- IN_SYSTEM_CHARSET, DEFAULT(MALLOC_LIBRARY));
+ IN_SYSTEM_CHARSET, DEFAULT(guess_malloc_library()));
#ifdef HAVE_YASSL
#include <openssl/ssl.h>