-Wl,-flat_namespace
endif HOST_MACOS
-LIBISC_CFLAGS = \
+if HAVE_JEMALLOC
+LIBISC_CFLAGS = $(JEMALLOC_CFLAGS)
+LIBISC_LIBS = $(JEMALLOC_LIBS)
+else
+LIBISC_CFLAGS =
+LIBISC_LIBS =
+endif
+
+LIBISC_CFLAGS += \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/isc/include \
-I$(top_builddir)/lib/isc/include
-LIBISC_LIBS = $(top_builddir)/lib/isc/libisc.la
+LIBISC_LIBS += $(top_builddir)/lib/isc/libisc.la
if HAVE_DTRACE
LIBISC_DTRACE = $(top_builddir)/lib/isc/probes.lo
endif
#include <isc/mutex.h>
#include <isc/overflow.h>
#include <isc/types.h>
+#include <isc/urcu.h>
ISC_LANG_BEGINDECLS
} while (0)
/*@{*/
+/*
+ * This is a little hack to help with dynamic link order,
+ * see https://github.com/jemalloc/jemalloc/issues/2566
+ * for more information.
+ */
+#if HAVE_JEMALLOC
+#include <jemalloc/jemalloc.h>
+
+extern volatile void *isc__mem_malloc;
+
+#define isc_mem_create(cp) \
+ { \
+ isc__mem_create((cp)_ISC_MEM_FILELINE); \
+ isc__mem_malloc = mallocx; \
+ ISC_INSIST(CMM_ACCESS_ONCE(isc__mem_malloc) != NULL); \
+ }
+#else
#define isc_mem_create(cp) isc__mem_create((cp)_ISC_MEM_FILELINE)
+#endif
void
isc__mem_create(isc_mem_t **_ISC_MEM_FLARG);
#define ISC_MEM_ILLEGAL_ARENA (UINT_MAX)
+volatile void *isc__mem_malloc = mallocx;
+
/*
* Constants.
*/
#include <time.h>
#include <unistd.h>
-#define UNIT_TESTING
-#include <cmocka.h>
-
#include <isc/buffer.h>
#include <isc/file.h>
#include <isc/hash.h>
memset(buf, 0, buflen);
isc_buffer_init(&target, buf, buflen);
result = isc_hex_totext((isc_region_t *)&source, 1, " ", &target);
- assert_int_equal(result, ISC_R_SUCCESS);
+ INSIST(result == ISC_R_SUCCESS);
return (buf);
}
isc_buffer_putmem(b, (const unsigned char *)namestr, length);
result = dns_name_fromtext(name, b, NULL, 0, NULL);
- assert_int_equal(result, ISC_R_SUCCESS);
+ INSIST(result == ISC_R_SUCCESS);
isc_buffer_free(&b);
}