2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

first pass at using isc_msgcat_get for message strings in libisc

This commit is contained in:
David Lawrence
2000-12-06 00:30:32 +00:00
parent 5f515f43b0
commit 9cd6d409b7
23 changed files with 580 additions and 183 deletions

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: util.h,v 1.19 2000/08/28 19:49:38 bwelling Exp $ */
/* $Id: util.h,v 1.20 2000/12/06 00:30:15 tale Exp $ */
#ifndef ISC_UTIL_H
#define ISC_UTIL_H 1
@@ -75,6 +75,7 @@
#ifdef ISC_UTIL_TRACEON
#define ISC_UTIL_TRACE(a) a
#include <stdio.h> /* Required for fprintf/stderr when tracing. */
#include <isc/msgs.h> /* Required for isc_msgcat when tracing. */
#else
#define ISC_UTIL_TRACE(a)
#endif
@@ -82,15 +83,21 @@
#include <isc/result.h> /* Contractual promise. */
#define LOCK(lp) do { \
ISC_UTIL_TRACE(fprintf(stderr, "LOCKING %p %s %d\n", \
ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \
isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
ISC_MSG_LOCKING, "LOCKING"), \
(lp), __FILE__, __LINE__)); \
RUNTIME_CHECK(isc_mutex_lock((lp)) == ISC_R_SUCCESS); \
ISC_UTIL_TRACE(fprintf(stderr, "LOCKED %p %s %d\n", (lp), \
__FILE__, __LINE__)); \
ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \
isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
ISC_MSG_LOCKED, "LOCKED"), \
(lp), __FILE__, __LINE__)); \
} while (0)
#define UNLOCK(lp) do { \
RUNTIME_CHECK(isc_mutex_unlock((lp)) == ISC_R_SUCCESS); \
ISC_UTIL_TRACE(fprintf(stderr, "UNLOCKED %p %s %d\n", \
ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \
isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
ISC_MSG_UNLOCKED, "UNLOCKED"), \
(lp), __FILE__, __LINE__)); \
} while (0)
#define ISLOCKED(lp) (1)
@@ -99,21 +106,35 @@
#define BROADCAST(cvp) do { \
ISC_UTIL_TRACE(fprintf(stderr, "BROADCAST %p %s %d\n", \
ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \
isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
ISC_MSG_BROADCAST, "BROADCAST"),\
(cvp), __FILE__, __LINE__)); \
RUNTIME_CHECK(isc_condition_broadcast((cvp)) == ISC_R_SUCCESS); \
} while (0)
#define SIGNAL(cvp) do { \
ISC_UTIL_TRACE(fprintf(stderr, "SIGNAL %p %s %d\n", \
ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \
isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
ISC_MSG_SIGNAL, "SIGNAL"), \
(cvp), __FILE__, __LINE__)); \
RUNTIME_CHECK(isc_condition_signal((cvp)) == ISC_R_SUCCESS); \
} while (0)
#define WAIT(cvp, lp) do { \
ISC_UTIL_TRACE(fprintf(stderr, "WAIT %p LOCK %p %s %d\n", \
(cvp), (lp), __FILE__, __LINE__)); \
ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %p %s %d\n", \
isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
ISC_MSG_UTILWAIT, "WAIT"), \
(cvp), \
isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
ISC_MSG_LOCK, "LOCK"), \
(lp), __FILE__, __LINE__)); \
RUNTIME_CHECK(isc_condition_wait((cvp), (lp)) == ISC_R_SUCCESS); \
ISC_UTIL_TRACE(fprintf(stderr, "WAITED %p LOCKED %p %s %d\n", \
(cvp), (lp), __FILE__, __LINE__)); \
ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %p %s %d\n", \
isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
ISC_MSG_WAITED, "WAITED"), \
(cvp), \
isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
ISC_MSG_LOCKED, "LOCKED"), \
(lp), __FILE__, __LINE__)); \
} while (0)
/*
@@ -127,14 +148,20 @@
isc_condition_waituntil((cvp), (lp), (tp))
#define RWLOCK(lp, t) do { \
ISC_UTIL_TRACE(fprintf(stderr, "RWLOCK %p, %d %s %d\n", \
ISC_UTIL_TRACE(fprintf(stderr, "%s %p, %d %s %d\n", \
isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
ISC_MSG_RWLOCK, "RWLOCK"), \
(lp), (t), __FILE__, __LINE__)); \
RUNTIME_CHECK(isc_rwlock_lock((lp), (t)) == ISC_R_SUCCESS); \
ISC_UTIL_TRACE(fprintf(stderr, "RWLOCKED %p, %d %s %d\n", \
ISC_UTIL_TRACE(fprintf(stderr, "%s %p, %d %s %d\n", \
isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
ISC_MSG_RWLOCKED, "RWLOCKED"), \
(lp), (t), __FILE__, __LINE__)); \
} while (0)
#define RWUNLOCK(lp, t) do { \
ISC_UTIL_TRACE(fprintf(stderr, "RWUNLOCK %p, %d %s %d\n", \
ISC_UTIL_TRACE(fprintf(stderr, "%s %p, %d %s %d\n", \
isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \
ISC_MSG_RWUNLOCK, "RWUNLOCK"), \
(lp), (t), __FILE__, __LINE__)); \
RUNTIME_CHECK(isc_rwlock_unlock((lp), (t)) == ISC_R_SUCCESS); \
} while (0)