fixup! make feature probe macros consistent
This commit is contained in:
@@ -128,10 +128,10 @@ struct dns_rdata {
|
||||
#else /* ifdef DNS_RDATA_CHECKINITIALIZED */
|
||||
#ifdef ISC_LIST_CHECKINIT
|
||||
#define DNS_RDATA_INITIALIZED(rdata) (!ISC_LINK_LINKED((rdata), link))
|
||||
#else /* ifdef ISC_LIST_CHECKINIT */
|
||||
#else /* ISC_LIST_CHECKINIT */
|
||||
#define DNS_RDATA_INITIALIZED(rdata) true
|
||||
#endif /* ifdef ISC_LIST_CHECKINIT */
|
||||
#endif /* ifdef DNS_RDATA_CHECKINITIALIZED */
|
||||
#endif /* ISC_LIST_CHECKINIT */
|
||||
#endif /* DNS_RDATA_CHECKINITIALIZED */
|
||||
|
||||
#define DNS_RDATA_UPDATE 0x0001 /*%< update pseudo record. */
|
||||
#define DNS_RDATA_OFFLINE 0x0002 /*%< RRSIG has a offline key. */
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ const EVP_MD *isc__crypto_sha512 = NULL;
|
||||
* https://cvsweb.openbsd.org/src/lib/libcrypto/Attic/mem.c
|
||||
*/
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
/*
|
||||
* We use the internal isc__mem API here, so we can pass the file and line
|
||||
* arguments passed from OpenSSL >= 1.1.0 to our memory functions for better
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
#define ISC_NORETURN _Noreturn
|
||||
#endif
|
||||
|
||||
#if HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL
|
||||
#ifdef HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL
|
||||
#define ISC_ATTR_RETURNS_NONNULL __attribute__((returns_nonnull))
|
||||
#else
|
||||
#else /* HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL */
|
||||
#define ISC_ATTR_RETURNS_NONNULL
|
||||
#endif
|
||||
#endif /* HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL */
|
||||
|
||||
#ifdef HAVE_FUNC_ATTRIBUTE_MALLOC
|
||||
/*
|
||||
@@ -40,7 +40,7 @@
|
||||
* pointer valid when the function returns.
|
||||
*/
|
||||
#define ISC_ATTR_MALLOC __attribute__((malloc))
|
||||
#if HAVE_MALLOC_EXT_ATTR
|
||||
#ifdef HAVE_MALLOC_EXT_ATTR
|
||||
/*
|
||||
* Associates deallocator as a suitable deallocation function
|
||||
* for pointers returned from the function marked with the attribute.
|
||||
@@ -65,7 +65,7 @@
|
||||
*/
|
||||
#define ISC_ATTR_MALLOC_DEALLOCATOR_IDX(deallocator, idx) \
|
||||
__attribute__((malloc, malloc(deallocator, idx)))
|
||||
#else /* #ifdef HAVE_MALLOC_EXT_ATTR */
|
||||
#else /* HAVE_MALLOC_EXT_ATTR */
|
||||
/*
|
||||
* There is support for malloc attribute but not for
|
||||
* extended attributes, so macros that combine attribute malloc
|
||||
@@ -75,8 +75,8 @@
|
||||
#define ISC_ATTR_DEALLOCATOR_IDX(deallocator, idx)
|
||||
#define ISC_ATTR_MALLOC_DEALLOCATOR(deallocator) ISC_ATTR_MALLOC
|
||||
#define ISC_ATTR_MALLOC_DEALLOCATOR_IDX(deallocator, idx) ISC_ATTR_MALLOC
|
||||
#endif
|
||||
#else /* #ifdef HAVE_FUNC_ATTRIBUTE_MALLOC */
|
||||
#endif /* HAVE_MALLOC_EXT_ATTR */
|
||||
#else /* HAVE_FUNC_ATTRIBUTE_MALLOC */
|
||||
/*
|
||||
* There is no support for malloc attribute.
|
||||
*/
|
||||
|
||||
@@ -24,14 +24,6 @@
|
||||
#include <isc/types.h>
|
||||
#include <isc/urcu.h>
|
||||
|
||||
/*%
|
||||
* Define ISC_MEM_TRACKLINES=1 to turn on detailed tracing of memory
|
||||
* allocation and freeing by file and line number.
|
||||
*/
|
||||
#ifndef ISC_MEM_TRACKLINES
|
||||
#define ISC_MEM_TRACKLINES 0
|
||||
#endif /* ifndef ISC_MEM_TRACKLINES */
|
||||
|
||||
extern unsigned int isc_mem_debugging;
|
||||
extern unsigned int isc_mem_defaultflags;
|
||||
|
||||
@@ -61,13 +53,13 @@ extern unsigned int isc_mem_defaultflags;
|
||||
*/
|
||||
/*@}*/
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
#define _ISC_MEM_FILELINE , __FILE__, __LINE__
|
||||
#define _ISC_MEM_FLARG , const char *, unsigned int
|
||||
#else /* if ISC_MEM_TRACKLINES */
|
||||
#else /* ISC_MEM_TRACKLINES */
|
||||
#define _ISC_MEM_FILELINE
|
||||
#define _ISC_MEM_FLARG
|
||||
#endif /* if ISC_MEM_TRACKLINES */
|
||||
#endif /* ISC_MEM_TRACKLINES */
|
||||
|
||||
/*
|
||||
* Flags for isc_mem_create() calls.
|
||||
@@ -81,11 +73,11 @@ extern unsigned int isc_mem_defaultflags;
|
||||
* Define ISC_MEM_DEFAULTFILL=1 to turn filling the memory with pattern
|
||||
* after alloc and free.
|
||||
*/
|
||||
#if ISC_MEM_DEFAULTFILL
|
||||
#ifdef ISC_MEM_DEFAULTFILL
|
||||
#define ISC_MEMFLAG_DEFAULT ISC_MEMFLAG_FILL
|
||||
#else /* if !ISC_MEM_USE_INTERNAL_MALLOC */
|
||||
#else /* ISC_MEM_USE_INTERNAL_MALLOC */
|
||||
#define ISC_MEMFLAG_DEFAULT 0
|
||||
#endif /* if !ISC_MEM_USE_INTERNAL_MALLOC */
|
||||
#endif /* ISC_MEM_USE_INTERNAL_MALLOC */
|
||||
|
||||
/*%
|
||||
* isc_mem_putanddetach() is a convenience function for use where you
|
||||
|
||||
@@ -61,7 +61,8 @@
|
||||
#define ISC_NONSTRING
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#if HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR && HAVE_FUNC_ATTRIBUTE_DESTRUCTOR
|
||||
#if defined(HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR) && \
|
||||
defined(HAVE_FUNC_ATTRIBUTE_DESTRUCTOR)
|
||||
#define ISC_CONSTRUCTOR __attribute__((constructor))
|
||||
#define ISC_DESTRUCTOR __attribute__((destructor))
|
||||
#else
|
||||
|
||||
+33
-33
@@ -81,7 +81,7 @@ volatile void *isc__mem_malloc = mallocx;
|
||||
/*
|
||||
* Types.
|
||||
*/
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
typedef struct debuglink debuglink_t;
|
||||
struct debuglink {
|
||||
ISC_LINK(debuglink_t) link;
|
||||
@@ -95,10 +95,10 @@ typedef ISC_LIST(debuglink_t) debuglist_t;
|
||||
|
||||
#define FLARG_PASS , file, line
|
||||
#define FLARG , const char *file, unsigned int line
|
||||
#else /* if ISC_MEM_TRACKLINES */
|
||||
#else /* ISC_MEM_TRACKLINES */
|
||||
#define FLARG_PASS
|
||||
#define FLARG
|
||||
#endif /* if ISC_MEM_TRACKLINES */
|
||||
#endif /* ISC_MEM_TRACKLINES */
|
||||
|
||||
typedef struct element element;
|
||||
struct element {
|
||||
@@ -134,10 +134,10 @@ struct isc_mem {
|
||||
ISC_LIST(isc_mempool_t) pools;
|
||||
unsigned int poolcnt;
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
debuglist_t *debuglist;
|
||||
size_t debuglistcnt;
|
||||
#endif /* if ISC_MEM_TRACKLINES */
|
||||
#endif /* ISC_MEM_TRACKLINES */
|
||||
|
||||
ISC_LINK(isc_mem_t) link;
|
||||
};
|
||||
@@ -166,11 +166,11 @@ struct isc_mempool {
|
||||
* Private Inline-able.
|
||||
*/
|
||||
|
||||
#if !ISC_MEM_TRACKLINES
|
||||
#ifndef ISC_MEM_TRACKLINES
|
||||
#define ADD_TRACE(mctx, ptr, size, file, line)
|
||||
#define DELETE_TRACE(mctx, ptr, size, file, line)
|
||||
#define ISC_MEMFUNC_SCOPE
|
||||
#else /* if !ISC_MEM_TRACKLINES */
|
||||
#else /* !ISC_MEM_TRACKLINES */
|
||||
#define TRACE_OR_RECORD (ISC_MEM_DEBUGTRACE | ISC_MEM_DEBUGRECORD)
|
||||
|
||||
#define SHOULD_TRACE_OR_RECORD(mctx, ptr) \
|
||||
@@ -188,9 +188,9 @@ struct isc_mempool {
|
||||
|
||||
static void
|
||||
print_active(isc_mem_t *ctx, FILE *out);
|
||||
#endif /* ISC_MEM_TRACKLINES */
|
||||
#endif /* !ISC_MEM_TRACKLINES */
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
/*!
|
||||
* mctx must not be locked.
|
||||
*/
|
||||
@@ -481,7 +481,7 @@ mem_create(isc_mem_t **ctxp, unsigned int debugging, unsigned int flags,
|
||||
|
||||
ISC_LIST_INIT(ctx->pools);
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
if ((ctx->debugging & ISC_MEM_DEBUGRECORD) != 0) {
|
||||
unsigned int i;
|
||||
|
||||
@@ -494,7 +494,7 @@ mem_create(isc_mem_t **ctxp, unsigned int debugging, unsigned int flags,
|
||||
ISC_LIST_INIT(ctx->debuglist[i]);
|
||||
}
|
||||
}
|
||||
#endif /* if ISC_MEM_TRACKLINES */
|
||||
#endif /* ISC_MEM_TRACKLINES */
|
||||
|
||||
LOCK(&contextslock);
|
||||
ISC_LIST_INITANDAPPEND(contexts, ctx, link);
|
||||
@@ -520,7 +520,7 @@ destroy(isc_mem_t *ctx) {
|
||||
|
||||
INSIST(ISC_LIST_EMPTY(ctx->pools));
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
if (ctx->debuglist != NULL) {
|
||||
debuglink_t *dl;
|
||||
for (size_t i = 0; i < DEBUG_TABLE_COUNT; i++) {
|
||||
@@ -542,7 +542,7 @@ destroy(isc_mem_t *ctx) {
|
||||
ISC_CHECKED_MUL(DEBUG_TABLE_COUNT, sizeof(debuglist_t)),
|
||||
ctx->jemalloc_flags);
|
||||
}
|
||||
#endif /* if ISC_MEM_TRACKLINES */
|
||||
#endif /* ISC_MEM_TRACKLINES */
|
||||
|
||||
isc_mutex_destroy(&ctx->lock);
|
||||
|
||||
@@ -577,12 +577,12 @@ isc__mem_detach(isc_mem_t **ctxp FLARG) {
|
||||
|
||||
if (isc_refcount_decrement(&ctx->references) == 1) {
|
||||
isc_refcount_destroy(&ctx->references);
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
if ((ctx->debugging & ISC_MEM_DEBUGTRACE) != 0) {
|
||||
fprintf(stderr, "destroy mctx %p file %s line %u\n",
|
||||
ctx, file, line);
|
||||
}
|
||||
#endif
|
||||
#endif /* ISC_MEM_TRACKLINES */
|
||||
destroy(ctx);
|
||||
}
|
||||
}
|
||||
@@ -627,7 +627,7 @@ isc__mem_destroy(isc_mem_t **ctxp FLARG) {
|
||||
|
||||
rcu_barrier();
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
if ((ctx->debugging & ISC_MEM_DEBUGTRACE) != 0) {
|
||||
fprintf(stderr, "destroy mctx %p file %s line %u\n", ctx, file,
|
||||
line);
|
||||
@@ -636,9 +636,9 @@ isc__mem_destroy(isc_mem_t **ctxp FLARG) {
|
||||
if (isc_refcount_decrement(&ctx->references) > 1) {
|
||||
print_active(ctx, stderr);
|
||||
}
|
||||
#else /* if ISC_MEM_TRACKLINES */
|
||||
#else /* ISC_MEM_TRACKLINES */
|
||||
isc_refcount_decrementz(&ctx->references);
|
||||
#endif /* if ISC_MEM_TRACKLINES */
|
||||
#endif /* ISC_MEM_TRACKLINES */
|
||||
isc_refcount_destroy(&ctx->references);
|
||||
destroy(ctx);
|
||||
|
||||
@@ -669,7 +669,7 @@ isc__mem_put(isc_mem_t *ctx, void *ptr, size_t size, int flags FLARG) {
|
||||
mem_put(ctx, ptr, size, flags);
|
||||
}
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
static void
|
||||
print_active(isc_mem_t *mctx, FILE *out) {
|
||||
if (mctx->debuglist != NULL) {
|
||||
@@ -705,7 +705,7 @@ print_active(isc_mem_t *mctx, FILE *out) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* if ISC_MEM_TRACKLINES */
|
||||
#endif /* ISC_MEM_TRACKLINES */
|
||||
|
||||
/*
|
||||
* Print the stats[] on the stream "out" with suitable formatting.
|
||||
@@ -741,9 +741,9 @@ isc_mem_stats(isc_mem_t *ctx, FILE *out) {
|
||||
pool = ISC_LIST_NEXT(pool, link);
|
||||
}
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
print_active(ctx, out);
|
||||
#endif /* if ISC_MEM_TRACKLINES */
|
||||
#endif /* ISC_MEM_TRACKLINES */
|
||||
|
||||
MCTXUNLOCK(ctx);
|
||||
}
|
||||
@@ -1021,7 +1021,7 @@ isc__mempool_create(isc_mem_t *restrict mctx, const size_t element_size,
|
||||
.fillcount = 1,
|
||||
};
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
if ((mctx->debugging & ISC_MEM_DEBUGTRACE) != 0) {
|
||||
fprintf(stderr, "create pool %p file %s line %u mctx %p\n",
|
||||
mpctx, file, line, mctx);
|
||||
@@ -1061,12 +1061,12 @@ isc__mempool_destroy(isc_mempool_t **restrict mpctxp FLARG) {
|
||||
|
||||
mctx = mpctx->mctx;
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
if ((mctx->debugging & ISC_MEM_DEBUGTRACE) != 0) {
|
||||
fprintf(stderr, "destroy pool %p file %s line %u mctx %p\n",
|
||||
mpctx, file, line, mctx);
|
||||
}
|
||||
#endif
|
||||
#endif /* ISC_MEM_TRACKLINES */
|
||||
|
||||
if (mpctx->allocated > 0) {
|
||||
UNEXPECTED_ERROR("mempool %s leaked memory", mpctx->name);
|
||||
@@ -1231,7 +1231,7 @@ isc_mempool_getfillcount(isc_mempool_t *restrict mpctx) {
|
||||
/*
|
||||
* Requires contextslock to be held by caller.
|
||||
*/
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
static void
|
||||
print_contexts(FILE *file) {
|
||||
isc_mem_t *ctx;
|
||||
@@ -1265,11 +1265,11 @@ isc__mem_checkdestroyed(void) {
|
||||
|
||||
LOCK(&contextslock);
|
||||
if (!ISC_LIST_EMPTY(contexts)) {
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
if ((isc_mem_debugging & TRACE_OR_RECORD) != 0) {
|
||||
print_contexts(file);
|
||||
}
|
||||
#endif /* if ISC_MEM_TRACKLINES */
|
||||
#endif /* ISC_MEM_TRACKLINES */
|
||||
UNREACHABLE();
|
||||
}
|
||||
UNLOCK(&contextslock);
|
||||
@@ -1493,7 +1493,7 @@ error:
|
||||
void
|
||||
isc__mem_create(isc_mem_t **mctxp FLARG) {
|
||||
mem_create(mctxp, isc_mem_debugging, isc_mem_defaultflags, 0);
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
if ((isc_mem_debugging & ISC_MEM_DEBUGTRACE) != 0) {
|
||||
fprintf(stderr, "create mctx %p file %s line %u\n", *mctxp,
|
||||
file, line);
|
||||
@@ -1519,7 +1519,7 @@ isc__mem_create_arena(isc_mem_t **mctxp FLARG) {
|
||||
? 0
|
||||
: MALLOCX_ARENA(arena_no) | MALLOCX_TCACHE_NONE);
|
||||
(*mctxp)->jemalloc_arena = arena_no;
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
if ((isc_mem_debugging & ISC_MEM_DEBUGTRACE) != 0) {
|
||||
fprintf(stderr,
|
||||
"create mctx %p file %s line %u for jemalloc arena "
|
||||
@@ -1580,13 +1580,13 @@ isc_mem_arena_set_dirty_decay_ms(isc_mem_t *mctx, const ssize_t decay_ms) {
|
||||
|
||||
void
|
||||
isc__mem_printactive(isc_mem_t *ctx, FILE *file) {
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
REQUIRE(file != NULL);
|
||||
|
||||
print_active(ctx, file);
|
||||
#else /* if ISC_MEM_TRACKLINES */
|
||||
#else /* ISC_MEM_TRACKLINES */
|
||||
UNUSED(ctx);
|
||||
UNUSED(file);
|
||||
#endif /* if ISC_MEM_TRACKLINES */
|
||||
#endif /* ISC_MEM_TRACKLINES */
|
||||
}
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ void
|
||||
isc_stats_decrement(isc_stats_t *stats, isc_statscounter_t counter) {
|
||||
REQUIRE(ISC_STATS_VALID(stats));
|
||||
REQUIRE(counter < stats->ncounters);
|
||||
#if ISC_STATS_CHECKUNDERFLOW
|
||||
#ifdef ISC_STATS_CHECKUNDERFLOW
|
||||
REQUIRE(atomic_fetch_sub_release(&stats->counters[counter], 1) > 0);
|
||||
#else
|
||||
atomic_fetch_sub_release(&stats->counters[counter], 1);
|
||||
|
||||
@@ -325,7 +325,7 @@ ISC_RUN_TEST_IMPL(isc_mem_overmem) {
|
||||
isc_mem_destroy(&omctx);
|
||||
}
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
|
||||
/* test mem with no flags */
|
||||
ISC_RUN_TEST_IMPL(isc_mem_noflags) {
|
||||
@@ -450,7 +450,7 @@ ISC_RUN_TEST_IMPL(isc_mem_traceflag) {
|
||||
assert_non_null(p);
|
||||
assert_memory_equal(p + 1, "del ", 4);
|
||||
}
|
||||
#endif /* if ISC_MEM_TRACKLINES */
|
||||
#endif /* ISC_MEM_TRACKLINES */
|
||||
|
||||
#if !defined(__SANITIZE_THREAD__)
|
||||
|
||||
@@ -522,7 +522,7 @@ ISC_TEST_ENTRY(isc_mem_reget)
|
||||
ISC_TEST_ENTRY(isc_mem_reallocate)
|
||||
ISC_TEST_ENTRY(isc_mem_overmem)
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#ifdef ISC_MEM_TRACKLINES
|
||||
ISC_TEST_ENTRY(isc_mem_noflags)
|
||||
ISC_TEST_ENTRY(isc_mem_recordflag)
|
||||
/*
|
||||
@@ -531,7 +531,7 @@ ISC_TEST_ENTRY(isc_mem_recordflag)
|
||||
* This test has to be the last one to avoid problems.
|
||||
*/
|
||||
ISC_TEST_ENTRY(isc_mem_traceflag)
|
||||
#endif /* if ISC_MEM_TRACKLINES */
|
||||
#endif /* ISC_MEM_TRACKLINES */
|
||||
#if !defined(__SANITIZE_THREAD__)
|
||||
ISC_TEST_ENTRY(isc_mem_benchmark)
|
||||
#endif /* __SANITIZE_THREAD__ */
|
||||
|
||||
Reference in New Issue
Block a user