]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Print the used jemalloc version in autoconf and named -V output
authorOndřej Surý <ondrej@isc.org>
Tue, 5 Sep 2023 12:58:15 +0000 (14:58 +0200)
committerOndřej Surý <ondrej@isc.org>
Tue, 5 Sep 2023 16:47:21 +0000 (18:47 +0200)
The autoconf and named -V now prints used version of jemalloc.  This
doesn't work with system supplied jemalloc, so in it prints `system`
instead in the autoconf and nothing in named -V output.

bin/named/main.c
configure.ac
m4/ax_jemalloc.m4

index 4a38f69fd7dc9402db69d2624f2b27f86c0ea5f0..de431903930eb0733af09a69b5e82fae2f80857f 100644 (file)
 #include <nghttp2/nghttp2.h>
 #endif
 
+/* On DragonFly BSD the header does not provide jemalloc API */
+#if defined(HAVE_MALLOC_NP_H) && !defined(__DragonFly__)
+#include <malloc_np.h>
+#include <sys/malloc.h> /* For M_VERSION */
+#elif defined(HAVE_JEMALLOC)
+#include <jemalloc/jemalloc.h>
+#endif
+
 /*
  * Include header files for database drivers here.
  */
@@ -596,6 +604,13 @@ printversion(bool verbose) {
               UV_VERSION_MINOR, UV_VERSION_PATCH);
        printf("linked to libuv version: %s\n", uv_version_string());
        printf("compiled with %s version: %s\n", RCU_FLAVOR, RCU_VERSION);
+#if defined(JEMALLOC_VERSION)
+       printf("compiled with jemalloc version: %u.%u.%u\n",
+              JEMALLOC_VERSION_MAJOR, JEMALLOC_VERSION_MINOR,
+              JEMALLOC_VERSION_BUGFIX);
+#elif defined(M_VERSION)
+       printf("compiled with system jemalloc version: %u\n", M_VERSION);
+#endif
 #if HAVE_LIBNGHTTP2
        nghttp2_info *nginfo = NULL;
        printf("compiled with libnghttp2 version: %s\n", NGHTTP2_VERSION);
@@ -1181,6 +1196,17 @@ setup(void) {
        isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
                      NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
                      "linked to libuv version: %s", uv_version_string());
+#if defined(JEMALLOC_VERSION)
+       isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
+                     NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
+                     "compiled with jemalloc version: %u.%u.%u",
+                     JEMALLOC_VERSION_MAJOR, JEMALLOC_VERSION_MINOR,
+                     JEMALLOC_VERSION_BUGFIX);
+#elif defined(M_VERSION)
+       isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
+                     NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
+                     "compiled with system jemalloc version: %u", M_VERSION);
+#endif
 #ifdef HAVE_LIBXML2
        isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
                      NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
index d14b2b3cbfeaebf39931f539decbaab1c13ee484..496ec8fff81a146f55e7f4745bd791f125af14f3 100644 (file)
@@ -1763,6 +1763,9 @@ report() {
     echo "      OpenSSL:               $OPENSSL_VERSION"
     echo "      libuv:         $LIBUV_VERSION"
     echo "      Userspace-RCU: $RCU_VERSION"
+    if test "no" != "$with_jemalloc"; then
+      echo "      jemalloc:            $JEMALLOC_VERSION"
+    fi
     echo "-------------------------------------------------------------------------------"
 
     echo "Features disabled or unavailable on this platform:"
index a15ae68a2d2744ce0614c4dd251768402ac4ffa1..bde7678bc722ef8df4cb94bb506fbc8ffe164b4d 100644 (file)
@@ -29,6 +29,7 @@ AC_DEFUN([AX_CHECK_JEMALLOC], [
      PKG_CHECK_MODULES(
        [JEMALLOC], [jemalloc],
        [
+           PKG_CHECK_VERSION([JEMALLOC_VERSION], [jemalloc])
            found=true
        ], [
            AC_CHECK_HEADERS([malloc_np.h jemalloc/jemalloc.h],
@@ -39,6 +40,7 @@ AC_DEFUN([AX_CHECK_JEMALLOC], [
                    AC_SEARCH_LIBS([sdallocx], [jemalloc],
                        [
                            found=true
+                           JEMALLOC_VERSION=system
                            AS_IF([test "$ac_cv_search_mallocx" != "none required"],
                                [JEMALLOC_LIBS="$ac_cv_search_mallocx"])
                        ])