Merge branch 'artem-fix-building-on-dragonflybsd' into 'main'
Fix building BIND on DragonFly BSD Closes #3796 See merge request isc-projects/bind9!7379
This commit is contained in:
@@ -41,7 +41,15 @@ sallocx(void *ptr, int flags) {
|
||||
|
||||
#elif HAVE_MALLOC_USABLE_SIZE
|
||||
|
||||
#ifdef __DragonFly__
|
||||
/*
|
||||
* On DragonFly BSD 'man 3 malloc' advises us to include the following
|
||||
* header to have access to malloc_usable_size().
|
||||
*/
|
||||
#include <malloc_np.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
static inline size_t
|
||||
sallocx(void *ptr, int flags) {
|
||||
|
||||
+6
-3
@@ -45,10 +45,13 @@
|
||||
#include <json_object.h>
|
||||
#endif /* HAVE_JSON_C */
|
||||
|
||||
#if defined(HAVE_MALLOC_NP_H)
|
||||
/* On DragonFly BSD the header does not provide jemalloc API */
|
||||
#if defined(HAVE_MALLOC_NP_H) && !defined(__DragonFly__)
|
||||
#include <malloc_np.h>
|
||||
#define JEMALLOC_API_SUPPORTED 1
|
||||
#elif defined(HAVE_JEMALLOC)
|
||||
#include <jemalloc/jemalloc.h>
|
||||
#define JEMALLOC_API_SUPPORTED 1
|
||||
|
||||
#if JEMALLOC_VERSION_MAJOR < 4
|
||||
#define sdallocx(ptr, size, flags) dallocx(ptr, flags)
|
||||
@@ -437,12 +440,12 @@ mem_initialize(void) {
|
||||
/*
|
||||
* Check if the values copied from jemalloc still match
|
||||
*/
|
||||
#if defined(HAVE_MALLOC_NP_H) || defined(HAVE_JEMALLOC)
|
||||
#ifdef JEMALLOC_API_SUPPORTED
|
||||
RUNTIME_CHECK(ISC_MEM_ZERO == MALLOCX_ZERO);
|
||||
RUNTIME_CHECK(ISC_MEM_ALIGN(0) == MALLOCX_ALIGN(0));
|
||||
RUNTIME_CHECK(ISC_MEM_ALIGN(sizeof(void *)) ==
|
||||
MALLOCX_ALIGN(sizeof(void *)));
|
||||
#endif /* defined(HAVE_MALLOC_NP_H) || defined(HAVE_JEMALLOC) */
|
||||
#endif /* JEMALLOC_API_SUPPORTED */
|
||||
|
||||
isc_mutex_init(&contextslock);
|
||||
ISC_LIST_INIT(contexts);
|
||||
|
||||
Reference in New Issue
Block a user