mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 22:45:39 +00:00
4774. [bug] <isc/util.h> was incorrectly included in several
header files. [RT #46311]
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,3 +1,6 @@
|
|||||||
|
4774. [bug] <isc/util.h> was incorrectly included in several
|
||||||
|
header files. [RT #46311]
|
||||||
|
|
||||||
4773. [doc] Fixed generating Doxygen documentation for functions
|
4773. [doc] Fixed generating Doxygen documentation for functions
|
||||||
annotated using certain macros. Miscellaneous
|
annotated using certain macros. Miscellaneous
|
||||||
Doxygen-related cleanups. [RT #46276]
|
Doxygen-related cleanups. [RT #46276]
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
#include <isc/stdio.h>
|
#include <isc/stdio.h>
|
||||||
#include <isc/string.h>
|
#include <isc/string.h>
|
||||||
#include <isc/syslog.h>
|
#include <isc/syslog.h>
|
||||||
|
#include <isc/util.h>
|
||||||
|
|
||||||
#include <isccfg/cfg.h>
|
#include <isccfg/cfg.h>
|
||||||
#include <isccfg/log.h>
|
#include <isccfg/log.h>
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include <isc/stats.h>
|
#include <isc/stats.h>
|
||||||
#include <isc/string.h>
|
#include <isc/string.h>
|
||||||
#include <isc/task.h>
|
#include <isc/task.h>
|
||||||
|
#include <isc/util.h>
|
||||||
|
|
||||||
#include <dns/cache.h>
|
#include <dns/cache.h>
|
||||||
#include <dns/db.h>
|
#include <dns/db.h>
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
#include <isc/buffer.h>
|
#include <isc/buffer.h>
|
||||||
#include <isc/mem.h>
|
#include <isc/mem.h>
|
||||||
#include <isc/string.h>
|
#include <isc/string.h>
|
||||||
|
#include <isc/util.h>
|
||||||
|
|
||||||
#include <isccfg/cfg.h>
|
#include <isccfg/cfg.h>
|
||||||
|
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <isc/string.h>
|
#include <isc/string.h>
|
||||||
|
#include <isc/util.h>
|
||||||
|
|
||||||
#include <dns/db.h>
|
#include <dns/db.h>
|
||||||
#include <dns/diff.h>
|
#include <dns/diff.h>
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#include <isc/eventclass.h>
|
#include <isc/eventclass.h>
|
||||||
#include <isc/netaddr.h>
|
#include <isc/netaddr.h>
|
||||||
#include <isc/task.h>
|
#include <isc/task.h>
|
||||||
|
#include <isc/util.h>
|
||||||
|
|
||||||
#include <dns/byaddr.h>
|
#include <dns/byaddr.h>
|
||||||
#include <dns/db.h>
|
#include <dns/db.h>
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
#include <isc/result.h>
|
#include <isc/result.h>
|
||||||
#include <isc/sha2.h>
|
#include <isc/sha2.h>
|
||||||
#include <isc/task.h>
|
#include <isc/task.h>
|
||||||
|
#include <isc/util.h>
|
||||||
|
|
||||||
#include <dns/catz.h>
|
#include <dns/catz.h>
|
||||||
#include <dns/dbiterator.h>
|
#include <dns/dbiterator.h>
|
||||||
|
@@ -45,6 +45,7 @@
|
|||||||
***** Imports
|
***** Imports
|
||||||
*****/
|
*****/
|
||||||
|
|
||||||
|
#include <isc/deprecated.h>
|
||||||
#include <isc/lang.h>
|
#include <isc/lang.h>
|
||||||
#include <isc/magic.h>
|
#include <isc/magic.h>
|
||||||
#include <isc/ondestroy.h>
|
#include <isc/ondestroy.h>
|
||||||
|
@@ -10,12 +10,13 @@
|
|||||||
#ifndef DNS_RPZ_H
|
#ifndef DNS_RPZ_H
|
||||||
#define DNS_RPZ_H 1
|
#define DNS_RPZ_H 1
|
||||||
|
|
||||||
|
#include <isc/deprecated.h>
|
||||||
|
#include <isc/event.h>
|
||||||
|
#include <isc/ht.h>
|
||||||
#include <isc/lang.h>
|
#include <isc/lang.h>
|
||||||
#include <isc/refcount.h>
|
#include <isc/refcount.h>
|
||||||
#include <isc/rwlock.h>
|
#include <isc/rwlock.h>
|
||||||
#include <isc/ht.h>
|
|
||||||
#include <isc/time.h>
|
#include <isc/time.h>
|
||||||
#include <isc/event.h>
|
|
||||||
#include <isc/timer.h>
|
#include <isc/timer.h>
|
||||||
|
|
||||||
#include <dns/fixedname.h>
|
#include <dns/fixedname.h>
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <isc/mem.h>
|
#include <isc/mem.h>
|
||||||
#include <isc/radix.h>
|
#include <isc/radix.h>
|
||||||
|
#include <isc/util.h>
|
||||||
|
|
||||||
#include <dns/acl.h>
|
#include <dns/acl.h>
|
||||||
|
|
||||||
|
@@ -6,8 +6,6 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <isc/base64.h>
|
#include <isc/base64.h>
|
||||||
@@ -15,6 +13,7 @@
|
|||||||
#include <isc/result.h>
|
#include <isc/result.h>
|
||||||
#include <isc/string.h>
|
#include <isc/string.h>
|
||||||
#include <isc/types.h>
|
#include <isc/types.h>
|
||||||
|
#include <isc/util.h>
|
||||||
|
|
||||||
#include <dns/nsec3.h>
|
#include <dns/nsec3.h>
|
||||||
#include <dns/private.h>
|
#include <dns/private.h>
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
#include <isc/net.h>
|
#include <isc/net.h>
|
||||||
#include <isc/netaddr.h>
|
#include <isc/netaddr.h>
|
||||||
#include <isc/print.h>
|
#include <isc/print.h>
|
||||||
|
#include <isc/util.h>
|
||||||
|
|
||||||
#include <dns/result.h>
|
#include <dns/result.h>
|
||||||
#include <dns/rcode.h>
|
#include <dns/rcode.h>
|
||||||
|
@@ -6,11 +6,10 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: tsec.c,v 1.7 2010/12/09 00:54:34 marka Exp $ */
|
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <isc/mem.h>
|
#include <isc/mem.h>
|
||||||
|
#include <isc/util.h>
|
||||||
|
|
||||||
#include <pk11/site.h>
|
#include <pk11/site.h>
|
||||||
|
|
||||||
|
@@ -17,12 +17,12 @@ VERSION=@BIND9_VERSION@
|
|||||||
#
|
#
|
||||||
HEADERS = aes.h app.h assertions.h backtrace.h base32.h base64.h \
|
HEADERS = aes.h app.h assertions.h backtrace.h base32.h base64.h \
|
||||||
bind9.h boolean.h buffer.h bufferlist.h \
|
bind9.h boolean.h buffer.h bufferlist.h \
|
||||||
commandline.h counter.h crc64.h \
|
commandline.h counter.h crc64.h deprecated.h \
|
||||||
entropy.h errno.h error.h event.h eventclass.h \
|
entropy.h errno.h error.h event.h eventclass.h \
|
||||||
file.h formatcheck.h fsaccess.h fuzz.h \
|
file.h formatcheck.h fsaccess.h fuzz.h \
|
||||||
hash.h heap.h hex.h hmacmd5.h hmacsha.h ht.h httpd.h \
|
hash.h heap.h hex.h hmacmd5.h hmacsha.h ht.h httpd.h \
|
||||||
interfaceiter.h @ISC_IPV6_H@ iterated_hash.h \
|
interfaceiter.h @ISC_IPV6_H@ iterated_hash.h \
|
||||||
json.h lang.h lex.h lfsr.h lib.h list.h log.h \
|
json.h lang.h lex.h lfsr.h lib.h likely.h list.h log.h \
|
||||||
magic.h md5.h mem.h meminfo.h msgcat.h msgs.h mutexblock.h \
|
magic.h md5.h mem.h meminfo.h msgcat.h msgs.h mutexblock.h \
|
||||||
netaddr.h netscope.h ondestroy.h os.h parseint.h \
|
netaddr.h netscope.h ondestroy.h os.h parseint.h \
|
||||||
pool.h portset.h print.h queue.h quota.h \
|
pool.h portset.h print.h queue.h quota.h \
|
||||||
|
@@ -96,6 +96,7 @@
|
|||||||
*** Imports
|
*** Imports
|
||||||
***/
|
***/
|
||||||
|
|
||||||
|
#include <isc/formatcheck.h>
|
||||||
#include <isc/lang.h>
|
#include <isc/lang.h>
|
||||||
#include <isc/magic.h>
|
#include <isc/magic.h>
|
||||||
#include <isc/types.h>
|
#include <isc/types.h>
|
||||||
|
19
lib/isc/include/isc/deprecated.h
Normal file
19
lib/isc/include/isc/deprecated.h
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC")
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef ISC_DEPRECATED_H
|
||||||
|
#define ISC_DEPRECATED_H
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define ISC_DEPRECATED __attribute__((deprecated))
|
||||||
|
#else
|
||||||
|
#define ISC_DEPRECATED /* none */
|
||||||
|
#endif /* __GNUC __ */
|
||||||
|
|
||||||
|
#endif
|
@@ -9,8 +9,8 @@
|
|||||||
#ifndef ISC_HASH_H
|
#ifndef ISC_HASH_H
|
||||||
#define ISC_HASH_H 1
|
#define ISC_HASH_H 1
|
||||||
|
|
||||||
|
#include <isc/deprecated.h>
|
||||||
#include <isc/types.h>
|
#include <isc/types.h>
|
||||||
#include <isc/util.h>
|
|
||||||
|
|
||||||
/*****
|
/*****
|
||||||
***** Module Info
|
***** Module Info
|
||||||
|
23
lib/isc/include/isc/likely.h
Normal file
23
lib/isc/include/isc/likely.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC")
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ISC_LIKELY_H
|
||||||
|
#define ISC_LIKELY_H 1
|
||||||
|
|
||||||
|
/*%
|
||||||
|
* Performance
|
||||||
|
*/
|
||||||
|
#ifdef HAVE_BUILTIN_EXPECT
|
||||||
|
#define ISC_LIKELY(x) __builtin_expect(!!(x), 1)
|
||||||
|
#define ISC_UNLIKELY(x) __builtin_expect(!!(x), 0)
|
||||||
|
#else
|
||||||
|
#define ISC_LIKELY(x) (x)
|
||||||
|
#define ISC_UNLIKELY(x) (x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* ISC_LIKELY_H */
|
@@ -11,7 +11,7 @@
|
|||||||
#ifndef ISC_MAGIC_H
|
#ifndef ISC_MAGIC_H
|
||||||
#define ISC_MAGIC_H 1
|
#define ISC_MAGIC_H 1
|
||||||
|
|
||||||
#include <isc/util.h>
|
#include <isc/likely.h>
|
||||||
|
|
||||||
/*! \file isc/magic.h */
|
/*! \file isc/magic.h */
|
||||||
|
|
||||||
|
@@ -11,12 +11,13 @@
|
|||||||
#ifndef ISC_REFCOUNT_H
|
#ifndef ISC_REFCOUNT_H
|
||||||
#define ISC_REFCOUNT_H 1
|
#define ISC_REFCOUNT_H 1
|
||||||
|
|
||||||
|
#include <isc/assertions.h>
|
||||||
#include <isc/atomic.h>
|
#include <isc/atomic.h>
|
||||||
|
#include <isc/error.h>
|
||||||
#include <isc/lang.h>
|
#include <isc/lang.h>
|
||||||
#include <isc/mutex.h>
|
#include <isc/mutex.h>
|
||||||
#include <isc/platform.h>
|
#include <isc/platform.h>
|
||||||
#include <isc/types.h>
|
#include <isc/types.h>
|
||||||
#include <isc/util.h>
|
|
||||||
|
|
||||||
#if defined(ISC_PLATFORM_HAVESTDATOMIC)
|
#if defined(ISC_PLATFORM_HAVESTDATOMIC)
|
||||||
#include <stdatomic.h>
|
#include <stdatomic.h>
|
||||||
@@ -109,7 +110,7 @@ typedef struct isc_refcount {
|
|||||||
#define isc_refcount_current(rp) \
|
#define isc_refcount_current(rp) \
|
||||||
((unsigned int)(atomic_load_explicit(&(rp)->refs, \
|
((unsigned int)(atomic_load_explicit(&(rp)->refs, \
|
||||||
memory_order_relaxed)))
|
memory_order_relaxed)))
|
||||||
#define isc_refcount_destroy(rp) REQUIRE(isc_refcount_current(rp) == 0)
|
#define isc_refcount_destroy(rp) ISC_REQUIRE(isc_refcount_current(rp) == 0)
|
||||||
|
|
||||||
#define isc_refcount_increment0(rp, tp) \
|
#define isc_refcount_increment0(rp, tp) \
|
||||||
do { \
|
do { \
|
||||||
@@ -127,7 +128,7 @@ typedef struct isc_refcount {
|
|||||||
isc_int32_t prev; \
|
isc_int32_t prev; \
|
||||||
prev = atomic_fetch_add_explicit \
|
prev = atomic_fetch_add_explicit \
|
||||||
(&(rp)->refs, 1, memory_order_relaxed); \
|
(&(rp)->refs, 1, memory_order_relaxed); \
|
||||||
REQUIRE(prev > 0); \
|
ISC_REQUIRE(prev > 0); \
|
||||||
if (_tmp != NULL) \
|
if (_tmp != NULL) \
|
||||||
*_tmp = prev + 1; \
|
*_tmp = prev + 1; \
|
||||||
} while (0)
|
} while (0)
|
||||||
@@ -138,7 +139,7 @@ typedef struct isc_refcount {
|
|||||||
isc_int32_t prev; \
|
isc_int32_t prev; \
|
||||||
prev = atomic_fetch_sub_explicit \
|
prev = atomic_fetch_sub_explicit \
|
||||||
(&(rp)->refs, 1, memory_order_relaxed); \
|
(&(rp)->refs, 1, memory_order_relaxed); \
|
||||||
REQUIRE(prev > 0); \
|
ISC_REQUIRE(prev > 0); \
|
||||||
if (_tmp != NULL) \
|
if (_tmp != NULL) \
|
||||||
*_tmp = prev - 1; \
|
*_tmp = prev - 1; \
|
||||||
} while (0)
|
} while (0)
|
||||||
@@ -147,7 +148,7 @@ typedef struct isc_refcount {
|
|||||||
|
|
||||||
#define isc_refcount_current(rp) \
|
#define isc_refcount_current(rp) \
|
||||||
((unsigned int)(isc_atomic_xadd(&(rp)->refs, 0)))
|
((unsigned int)(isc_atomic_xadd(&(rp)->refs, 0)))
|
||||||
#define isc_refcount_destroy(rp) REQUIRE(isc_refcount_current(rp) == 0)
|
#define isc_refcount_destroy(rp) ISC_REQUIRE(isc_refcount_current(rp) == 0)
|
||||||
|
|
||||||
#define isc_refcount_increment0(rp, tp) \
|
#define isc_refcount_increment0(rp, tp) \
|
||||||
do { \
|
do { \
|
||||||
@@ -163,7 +164,7 @@ typedef struct isc_refcount {
|
|||||||
unsigned int *_tmp = (unsigned int *)(tp); \
|
unsigned int *_tmp = (unsigned int *)(tp); \
|
||||||
isc_int32_t prev; \
|
isc_int32_t prev; \
|
||||||
prev = isc_atomic_xadd(&(rp)->refs, 1); \
|
prev = isc_atomic_xadd(&(rp)->refs, 1); \
|
||||||
REQUIRE(prev > 0); \
|
ISC_REQUIRE(prev > 0); \
|
||||||
if (_tmp != NULL) \
|
if (_tmp != NULL) \
|
||||||
*_tmp = prev + 1; \
|
*_tmp = prev + 1; \
|
||||||
} while (0)
|
} while (0)
|
||||||
@@ -173,7 +174,7 @@ typedef struct isc_refcount {
|
|||||||
unsigned int *_tmp = (unsigned int *)(tp); \
|
unsigned int *_tmp = (unsigned int *)(tp); \
|
||||||
isc_int32_t prev; \
|
isc_int32_t prev; \
|
||||||
prev = isc_atomic_xadd(&(rp)->refs, -1); \
|
prev = isc_atomic_xadd(&(rp)->refs, -1); \
|
||||||
REQUIRE(prev > 0); \
|
ISC_REQUIRE(prev > 0); \
|
||||||
if (_tmp != NULL) \
|
if (_tmp != NULL) \
|
||||||
*_tmp = prev - 1; \
|
*_tmp = prev - 1; \
|
||||||
} while (0)
|
} while (0)
|
||||||
@@ -188,46 +189,63 @@ typedef struct isc_refcount {
|
|||||||
} isc_refcount_t;
|
} isc_refcount_t;
|
||||||
|
|
||||||
/*% Destroys a reference counter. */
|
/*% Destroys a reference counter. */
|
||||||
#define isc_refcount_destroy(rp) \
|
#define isc_refcount_destroy(rp) \
|
||||||
do { \
|
do { \
|
||||||
REQUIRE((rp)->refs == 0); \
|
isc_result_t _result; \
|
||||||
DESTROYLOCK(&(rp)->lock); \
|
ISC_REQUIRE((rp)->refs == 0); \
|
||||||
|
_result = isc_mutex_destroy(&(rp)->lock); \
|
||||||
|
ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define isc_refcount_current(rp) ((unsigned int)((rp)->refs))
|
#define isc_refcount_current(rp) ((unsigned int)((rp)->refs))
|
||||||
|
|
||||||
/*% Increments the reference count, returning the new value in targetp if it's not NULL. */
|
/*%
|
||||||
#define isc_refcount_increment0(rp, tp) \
|
* Increments the reference count, returning the new value in
|
||||||
do { \
|
* 'tp' if it's not NULL.
|
||||||
unsigned int *_tmp = (unsigned int *)(tp); \
|
*/
|
||||||
LOCK(&(rp)->lock); \
|
#define isc_refcount_increment0(rp, tp) \
|
||||||
++((rp)->refs); \
|
do { \
|
||||||
if (_tmp != NULL) \
|
isc_result_t _result; \
|
||||||
*_tmp = ((rp)->refs); \
|
unsigned int *_tmp = (unsigned int *)(tp); \
|
||||||
UNLOCK(&(rp)->lock); \
|
_result = isc_mutex_lock(&(rp)->lock); \
|
||||||
|
ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \
|
||||||
|
++((rp)->refs); \
|
||||||
|
if (_tmp != NULL) \
|
||||||
|
*_tmp = ((rp)->refs); \
|
||||||
|
_result = isc_mutex_unlock(&(rp)->lock); \
|
||||||
|
ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define isc_refcount_increment(rp, tp) \
|
#define isc_refcount_increment(rp, tp) \
|
||||||
do { \
|
do { \
|
||||||
unsigned int *_tmp = (unsigned int *)(tp); \
|
isc_result_t _result; \
|
||||||
LOCK(&(rp)->lock); \
|
unsigned int *_tmp = (unsigned int *)(tp); \
|
||||||
REQUIRE((rp)->refs > 0); \
|
_result = isc_mutex_lock(&(rp)->lock); \
|
||||||
++((rp)->refs); \
|
ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \
|
||||||
if (_tmp != NULL) \
|
ISC_REQUIRE((rp)->refs > 0); \
|
||||||
*_tmp = ((rp)->refs); \
|
++((rp)->refs); \
|
||||||
UNLOCK(&(rp)->lock); \
|
if (_tmp != NULL) \
|
||||||
|
*_tmp = ((rp)->refs); \
|
||||||
|
_result = isc_mutex_unlock(&(rp)->lock); \
|
||||||
|
ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/*% Decrements the reference count, returning the new value in targetp if it's not NULL. */
|
/*%
|
||||||
#define isc_refcount_decrement(rp, tp) \
|
* Decrements the reference count, returning the new value in 'tp'
|
||||||
do { \
|
* if it's not NULL.
|
||||||
unsigned int *_tmp = (unsigned int *)(tp); \
|
*/
|
||||||
LOCK(&(rp)->lock); \
|
#define isc_refcount_decrement(rp, tp) \
|
||||||
REQUIRE((rp)->refs > 0); \
|
do { \
|
||||||
--((rp)->refs); \
|
isc_result_t _result; \
|
||||||
if (_tmp != NULL) \
|
unsigned int *_tmp = (unsigned int *)(tp); \
|
||||||
*_tmp = ((rp)->refs); \
|
_result = isc_mutex_lock(&(rp)->lock); \
|
||||||
UNLOCK(&(rp)->lock); \
|
ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \
|
||||||
|
ISC_REQUIRE((rp)->refs > 0); \
|
||||||
|
--((rp)->refs); \
|
||||||
|
if (_tmp != NULL) \
|
||||||
|
*_tmp = ((rp)->refs); \
|
||||||
|
_result = isc_mutex_unlock(&(rp)->lock); \
|
||||||
|
ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#endif /* (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) || defined(ISC_PLATFORM_HAVEXADD) */
|
#endif /* (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) || defined(ISC_PLATFORM_HAVEXADD) */
|
||||||
@@ -237,7 +255,7 @@ typedef struct isc_refcount {
|
|||||||
int refs;
|
int refs;
|
||||||
} isc_refcount_t;
|
} isc_refcount_t;
|
||||||
|
|
||||||
#define isc_refcount_destroy(rp) REQUIRE((rp)->refs == 0)
|
#define isc_refcount_destroy(rp) ISC_REQUIRE((rp)->refs == 0)
|
||||||
#define isc_refcount_current(rp) ((unsigned int)((rp)->refs))
|
#define isc_refcount_current(rp) ((unsigned int)((rp)->refs))
|
||||||
|
|
||||||
#define isc_refcount_increment0(rp, tp) \
|
#define isc_refcount_increment0(rp, tp) \
|
||||||
@@ -252,7 +270,7 @@ typedef struct isc_refcount {
|
|||||||
do { \
|
do { \
|
||||||
unsigned int *_tmp = (unsigned int *)(tp); \
|
unsigned int *_tmp = (unsigned int *)(tp); \
|
||||||
int _n; \
|
int _n; \
|
||||||
REQUIRE((rp)->refs > 0); \
|
ISC_REQUIRE((rp)->refs > 0); \
|
||||||
_n = ++(rp)->refs; \
|
_n = ++(rp)->refs; \
|
||||||
if (_tmp != NULL) \
|
if (_tmp != NULL) \
|
||||||
*_tmp = _n; \
|
*_tmp = _n; \
|
||||||
@@ -262,7 +280,7 @@ typedef struct isc_refcount {
|
|||||||
do { \
|
do { \
|
||||||
unsigned int *_tmp = (unsigned int *)(tp); \
|
unsigned int *_tmp = (unsigned int *)(tp); \
|
||||||
int _n; \
|
int _n; \
|
||||||
REQUIRE((rp)->refs > 0); \
|
ISC_REQUIRE((rp)->refs > 0); \
|
||||||
_n = --(rp)->refs; \
|
_n = --(rp)->refs; \
|
||||||
if (_tmp != NULL) \
|
if (_tmp != NULL) \
|
||||||
*_tmp = _n; \
|
*_tmp = _n; \
|
||||||
|
@@ -6,8 +6,6 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
#ifndef ISC_UTIL_H
|
#ifndef ISC_UTIL_H
|
||||||
#define ISC_UTIL_H 1
|
#define ISC_UTIL_H 1
|
||||||
|
|
||||||
@@ -200,13 +198,7 @@
|
|||||||
/*%
|
/*%
|
||||||
* Performance
|
* Performance
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_BUILTIN_EXPECT
|
#include <isc/likely.h>
|
||||||
#define ISC_LIKELY(x) __builtin_expect(!!(x), 1)
|
|
||||||
#define ISC_UNLIKELY(x) __builtin_expect(!!(x), 0)
|
|
||||||
#else
|
|
||||||
#define ISC_LIKELY(x) (x)
|
|
||||||
#define ISC_UNLIKELY(x) (x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assertions
|
* Assertions
|
||||||
@@ -240,12 +232,8 @@
|
|||||||
#define TIME_NOW(tp) RUNTIME_CHECK(isc_time_now((tp)) == ISC_R_SUCCESS)
|
#define TIME_NOW(tp) RUNTIME_CHECK(isc_time_now((tp)) == ISC_R_SUCCESS)
|
||||||
|
|
||||||
/*%
|
/*%
|
||||||
* Misc.
|
* Misc
|
||||||
*/
|
*/
|
||||||
#ifdef __GNUC__
|
#include <isc/deprecated.h>
|
||||||
#define ISC_DEPRECATED __attribute__((deprecated))
|
|
||||||
#else
|
|
||||||
#define ISC_DEPRECATED /* none */
|
|
||||||
#endif /* __GNUC __ */
|
|
||||||
|
|
||||||
#endif /* ISC_UTIL_H */
|
#endif /* ISC_UTIL_H */
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
#include <isc/mutex.h>
|
#include <isc/mutex.h>
|
||||||
#include <isc/refcount.h>
|
#include <isc/refcount.h>
|
||||||
#include <isc/result.h>
|
#include <isc/result.h>
|
||||||
|
#include <isc/util.h>
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
isc_refcount_init(isc_refcount_t *ref, unsigned int n) {
|
isc_refcount_init(isc_refcount_t *ref, unsigned int n) {
|
||||||
|
@@ -122,12 +122,10 @@ isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) {
|
|||||||
* positions of the stack frame, which would not actually point to the
|
* positions of the stack frame, which would not actually point to the
|
||||||
* intended address in the embedded mnemonic.
|
* intended address in the embedded mnemonic.
|
||||||
*/
|
*/
|
||||||
#include <isc/util.h> /* for 'UNUSED' macro */
|
|
||||||
|
|
||||||
static isc_int32_t
|
static isc_int32_t
|
||||||
isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) {
|
isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) {
|
||||||
UNUSED(p);
|
(void)(p);
|
||||||
UNUSED(val);
|
(void)(val);
|
||||||
|
|
||||||
__asm (
|
__asm (
|
||||||
"movl 8(%ebp), %ecx\n"
|
"movl 8(%ebp), %ecx\n"
|
||||||
@@ -148,8 +146,8 @@ isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
isc_atomic_store(isc_int32_t *p, isc_int32_t val) {
|
isc_atomic_store(isc_int32_t *p, isc_int32_t val) {
|
||||||
UNUSED(p);
|
(void)(p);
|
||||||
UNUSED(val);
|
(void)(val);
|
||||||
|
|
||||||
__asm (
|
__asm (
|
||||||
"movl 8(%ebp), %ecx\n"
|
"movl 8(%ebp), %ecx\n"
|
||||||
@@ -163,9 +161,9 @@ isc_atomic_store(isc_int32_t *p, isc_int32_t val) {
|
|||||||
|
|
||||||
static isc_int32_t
|
static isc_int32_t
|
||||||
isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) {
|
isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) {
|
||||||
UNUSED(p);
|
(void)(p);
|
||||||
UNUSED(cmpval);
|
(void)(cmpval);
|
||||||
UNUSED(val);
|
(void)(val);
|
||||||
|
|
||||||
__asm (
|
__asm (
|
||||||
"movl 8(%ebp), %ecx\n"
|
"movl 8(%ebp), %ecx\n"
|
||||||
|
@@ -27,12 +27,11 @@
|
|||||||
* registers for arguments, which would not actually correspond to the
|
* registers for arguments, which would not actually correspond to the
|
||||||
* intended address or value in the embedded mnemonic.
|
* intended address or value in the embedded mnemonic.
|
||||||
*/
|
*/
|
||||||
#include <isc/util.h> /* for 'UNUSED' macro */
|
|
||||||
|
|
||||||
static isc_int32_t
|
static isc_int32_t
|
||||||
isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) {
|
isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) {
|
||||||
UNUSED(p);
|
(void)(p);
|
||||||
UNUSED(val);
|
(void)(val);
|
||||||
|
|
||||||
__asm (
|
__asm (
|
||||||
"movq %rdi, %rdx\n"
|
"movq %rdi, %rdx\n"
|
||||||
@@ -50,8 +49,8 @@ isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) {
|
|||||||
#ifdef ISC_PLATFORM_HAVEXADDQ
|
#ifdef ISC_PLATFORM_HAVEXADDQ
|
||||||
static isc_int64_t
|
static isc_int64_t
|
||||||
isc_atomic_xaddq(isc_int64_t *p, isc_int64_t val) {
|
isc_atomic_xaddq(isc_int64_t *p, isc_int64_t val) {
|
||||||
UNUSED(p);
|
(void)(p);
|
||||||
UNUSED(val);
|
(void)(val);
|
||||||
|
|
||||||
__asm (
|
__asm (
|
||||||
"movq %rdi, %rdx\n"
|
"movq %rdi, %rdx\n"
|
||||||
@@ -69,8 +68,8 @@ isc_atomic_xaddq(isc_int64_t *p, isc_int64_t val) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
isc_atomic_store(isc_int32_t *p, isc_int32_t val) {
|
isc_atomic_store(isc_int32_t *p, isc_int32_t val) {
|
||||||
UNUSED(p);
|
(void)(p);
|
||||||
UNUSED(val);
|
(void)(val);
|
||||||
|
|
||||||
__asm (
|
__asm (
|
||||||
"movq %rdi, %rax\n"
|
"movq %rdi, %rax\n"
|
||||||
@@ -85,8 +84,8 @@ isc_atomic_store(isc_int32_t *p, isc_int32_t val) {
|
|||||||
#ifdef ISC_PLATFORM_HAVEATOMICSTOREQ
|
#ifdef ISC_PLATFORM_HAVEATOMICSTOREQ
|
||||||
static void
|
static void
|
||||||
isc_atomic_storeq(isc_int64_t *p, isc_int64_t val) {
|
isc_atomic_storeq(isc_int64_t *p, isc_int64_t val) {
|
||||||
UNUSED(p);
|
(void)(p);
|
||||||
UNUSED(val);
|
(void)(val);
|
||||||
|
|
||||||
__asm (
|
__asm (
|
||||||
"movq %rdi, %rax\n"
|
"movq %rdi, %rax\n"
|
||||||
@@ -101,9 +100,9 @@ isc_atomic_storeq(isc_int64_t *p, isc_int64_t val) {
|
|||||||
|
|
||||||
static isc_int32_t
|
static isc_int32_t
|
||||||
isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) {
|
isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) {
|
||||||
UNUSED(p);
|
(void)(p);
|
||||||
UNUSED(cmpval);
|
(void)(cmpval);
|
||||||
UNUSED(val);
|
(void)(val);
|
||||||
|
|
||||||
__asm (
|
__asm (
|
||||||
/*
|
/*
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <isc/mem.h>
|
#include <isc/mem.h>
|
||||||
#include <isc/stats.h>
|
#include <isc/stats.h>
|
||||||
|
#include <isc/util.h>
|
||||||
|
|
||||||
#include <dns/tkey.h>
|
#include <dns/tkey.h>
|
||||||
#include <dns/stats.h>
|
#include <dns/stats.h>
|
||||||
|
Reference in New Issue
Block a user