diff --git a/lib/isc/jemalloc_shim.h b/lib/isc/jemalloc_shim.h index 8d99c7b776..37e984ae1a 100644 --- a/lib/isc/jemalloc_shim.h +++ b/lib/isc/jemalloc_shim.h @@ -64,7 +64,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 +#else #include +#endif static inline size_t sallocx(void *ptr, int flags) { diff --git a/lib/isc/mem.c b/lib/isc/mem.c index 61b7222491..df75f6eab6 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -44,7 +44,8 @@ #include #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 #elif defined(HAVE_JEMALLOC) #include