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:
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: assertions.c,v 1.12 2000/08/01 01:29:13 tale Exp $ */
|
||||
/* $Id: assertions.c,v 1.13 2000/12/06 00:29:55 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/assertions.h>
|
||||
#include <isc/msgs.h>
|
||||
|
||||
/*
|
||||
* Forward.
|
||||
@@ -49,6 +50,11 @@ const char *
|
||||
isc_assertion_typetotext(isc_assertiontype_t type) {
|
||||
const char *result;
|
||||
|
||||
/*
|
||||
* These strings have purposefully not been internationalized
|
||||
* because they are considered to essentially be keywords of
|
||||
* the ISC development environment.
|
||||
*/
|
||||
switch (type) {
|
||||
case isc_assertiontype_require:
|
||||
result = "REQUIRE";
|
||||
@@ -76,8 +82,10 @@ static void
|
||||
default_callback(const char *file, int line, isc_assertiontype_t type,
|
||||
const char *cond)
|
||||
{
|
||||
fprintf(stderr, "%s:%d: %s(%s) failed.\n",
|
||||
file, line, isc_assertion_typetotext(type), cond);
|
||||
fprintf(stderr, "%s:%d: %s(%s) %s.\n",
|
||||
file, line, isc_assertion_typetotext(type), cond,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
fflush(stderr);
|
||||
abort();
|
||||
/* NOTREACHED */
|
||||
|
@@ -48,7 +48,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* $Id: commandline.c,v 1.10 2000/08/01 01:29:19 tale Exp $ */
|
||||
/* $Id: commandline.c,v 1.11 2000/12/06 00:29:56 tale Exp $ */
|
||||
|
||||
/*
|
||||
* This file was adapted from the NetBSD project's source tree, RCS ID:
|
||||
@@ -68,6 +68,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
@@ -140,8 +141,12 @@ isc_commandline_parse(int argc, char * const *argv, const char *options) {
|
||||
isc_commandline_index++;
|
||||
|
||||
if (isc_commandline_errprint && *options != ':')
|
||||
fprintf(stderr, "%s: illegal option -- %c\n",
|
||||
fprintf(stderr, "%s: %s -- %c\n",
|
||||
isc_commandline_progname,
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_COMMANDLINE,
|
||||
ISC_MSG_ILLEGALOPT,
|
||||
"illegal option"),
|
||||
isc_commandline_option);
|
||||
|
||||
return (BADOPT);
|
||||
@@ -189,10 +194,14 @@ isc_commandline_parse(int argc, char * const *argv, const char *options) {
|
||||
return (BADARG);
|
||||
|
||||
if (isc_commandline_errprint)
|
||||
fprintf(stderr,
|
||||
"%s: option requires an argument -- %c\n",
|
||||
isc_commandline_progname,
|
||||
isc_commandline_option);
|
||||
fprintf(stderr, "%s: %s -- %c\n",
|
||||
isc_commandline_progname,
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_COMMANDLINE,
|
||||
ISC_MSG_OPTNEEDARG,
|
||||
"option requires"
|
||||
"an argument"),
|
||||
isc_commandline_option);
|
||||
|
||||
return (BADOPT);
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: error.c,v 1.13 2000/08/01 01:29:20 tale Exp $ */
|
||||
/* $Id: error.c,v 1.14 2000/12/06 00:29:57 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/error.h>
|
||||
#include <isc/msgs.h>
|
||||
|
||||
static void
|
||||
default_unexpected_callback(const char *, int, const char *, va_list);
|
||||
@@ -70,7 +71,9 @@ isc_error_fatal(const char *file, int line, const char *format, ...) {
|
||||
|
||||
void
|
||||
isc_error_runtimecheck(const char *file, int line, const char *expression) {
|
||||
isc_error_fatal(file, line, "RUNTIME_CHECK(%s) failed", expression);
|
||||
isc_error_fatal(file, line, "RUNTIME_CHECK(%s) %s", expression,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -87,7 +90,9 @@ static void
|
||||
default_fatal_callback(const char *file, int line, const char *format,
|
||||
va_list args)
|
||||
{
|
||||
fprintf(stderr, "%s:%d: fatal error: ", file, line);
|
||||
fprintf(stderr, "%s:%d: %s: ", file, line,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FATALERROR, "fatal error"));
|
||||
vfprintf(stderr, format, args);
|
||||
fprintf(stderr, "\n");
|
||||
fflush(stderr);
|
||||
|
@@ -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)
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: lex.c,v 1.52 2000/11/20 00:41:50 bwelling Exp $ */
|
||||
/* $Id: lex.c,v 1.53 2000/12/06 00:29:58 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <isc/file.h>
|
||||
#include <isc/lex.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/stdio.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/util.h>
|
||||
@@ -724,7 +725,10 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
|
||||
break;
|
||||
default:
|
||||
FATAL_ERROR(__FILE__, __LINE__,
|
||||
"Unexpected state %d", state);
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_LEX,
|
||||
ISC_MSG_UNEXPECTEDSTATE,
|
||||
"Unexpected state %d"),
|
||||
state);
|
||||
/* Does not return. */
|
||||
}
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: lib.c,v 1.6 2000/08/01 01:29:31 tale Exp $ */
|
||||
/* $Id: lib.c,v 1.7 2000/12/06 00:29:59 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/once.h>
|
||||
#include <isc/msgcat.h>
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/lib.h>
|
||||
|
||||
/***
|
||||
@@ -63,9 +63,15 @@ isc_lib_initmsgcat(void) {
|
||||
/*
|
||||
* Normally we'd use RUNTIME_CHECK() or FATAL_ERROR(), but
|
||||
* we can't do that here, since they might call us!
|
||||
* (Note that the catalog might be open anyway, so we might
|
||||
* as well try to provide an internationalized message.)
|
||||
*/
|
||||
fprintf(stderr, "%s:%d: fatal error: isc_once_do() failed.\n",
|
||||
__FILE__, __LINE__);
|
||||
fprintf(stderr, "%s:%d: %s: isc_once_do() %s.\n",
|
||||
__FILE__, __LINE__,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FATALERROR, "fatal error"),
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: log.c,v 1.49 2000/11/24 01:37:24 marka Exp $ */
|
||||
/* $Id: log.c,v 1.50 2000/12/06 00:30:01 tale Exp $ */
|
||||
|
||||
/* Principal Authors: DCL */
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <isc/log.h>
|
||||
#include <isc/magic.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/time.h>
|
||||
@@ -1364,14 +1365,22 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
|
||||
* "Should never happen."
|
||||
*/
|
||||
snprintf(time_string, sizeof(time_string),
|
||||
"Bad 00 99:99:99.999 ");
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_LOG,
|
||||
ISC_MSG_BADTIME,
|
||||
"Bad 00 99:99:99.999 "));
|
||||
|
||||
}
|
||||
|
||||
if ((channel->flags & ISC_LOG_PRINTLEVEL) != 0 &&
|
||||
level_string[0] == '\0') {
|
||||
if (level < ISC_LOG_CRITICAL)
|
||||
sprintf(level_string, "level %d: ", level);
|
||||
sprintf(level_string,
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_LOG,
|
||||
ISC_MSG_LEVEL,
|
||||
"level %d: "),
|
||||
level);
|
||||
else if (level > ISC_LOG_DYNAMIC)
|
||||
sprintf(level_string, "%s %d: ",
|
||||
log_level_strings[0], level);
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: mem.c,v 1.68 2000/12/01 00:52:38 gson Exp $ */
|
||||
/* $Id: mem.c,v 1.69 2000/12/06 00:30:02 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <limits.h>
|
||||
|
||||
#include <isc/mem.h>
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/ondestroy.h>
|
||||
#include <isc/string.h>
|
||||
|
||||
@@ -175,7 +176,10 @@ add_trace_entry(isc_mem_t *mctx, const void *ptr, unsigned int size
|
||||
unsigned int i;
|
||||
|
||||
if (MEM_TRACE)
|
||||
fprintf(stderr, "add %p size %u file %s line %u mctx %p\n",
|
||||
fprintf(stderr, isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
|
||||
ISC_MSG_ADDTRACE,
|
||||
"add %p size %u "
|
||||
"file %s line %u mctx %p\n"),
|
||||
ptr, size, file, line, mctx);
|
||||
|
||||
if (!MEM_RECORD)
|
||||
@@ -224,7 +228,10 @@ delete_trace_entry(isc_mem_t *mctx, const void *ptr, unsigned int size,
|
||||
unsigned int i;
|
||||
|
||||
if (MEM_TRACE)
|
||||
fprintf(stderr, "del %p size %u file %s line %u mctx %p\n",
|
||||
fprintf(stderr, isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
|
||||
ISC_MSG_DELTRACE,
|
||||
"del %p size %u "
|
||||
"file %s line %u mctx %p\n"),
|
||||
ptr, size, file, line, mctx);
|
||||
|
||||
if (!MEM_RECORD)
|
||||
@@ -664,7 +671,9 @@ isc_mem_createx(size_t init_max_size, size_t target_size,
|
||||
(memfree)(arg, ctx->freelists);
|
||||
(memfree)(arg, ctx);
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_mutex_init() failed");
|
||||
"isc_mutex_init() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
ctx->references = 1;
|
||||
@@ -907,8 +916,10 @@ isc__mem_get(isc_mem_t *ctx, size_t size FLARG) {
|
||||
|
||||
if (call_water) {
|
||||
/* XXX remove */
|
||||
fprintf(stderr, "calling water(%p,ISC_MEM_HIWATER)\n",
|
||||
ctx->water_arg);
|
||||
fprintf(stderr, "%s water(%p, ISC_MEM_HIWATER)\n",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_CALLING, "calling"),
|
||||
ctx->water_arg);
|
||||
(ctx->water)(ctx->water_arg, ISC_MEM_HIWATER);
|
||||
}
|
||||
|
||||
@@ -938,8 +949,10 @@ isc__mem_put(isc_mem_t *ctx, void *ptr, size_t size FLARG)
|
||||
|
||||
if (call_water) {
|
||||
/* XXX remove */
|
||||
fprintf(stderr, "calling water(%p,ISC_MEM_LOWATER)\n",
|
||||
ctx->water_arg);
|
||||
fprintf(stderr, "%s water(%p,ISC_MEM_LOWATER)\n",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_CALLING, "calling"),
|
||||
ctx->water_arg);
|
||||
(ctx->water)(ctx->water_arg, ISC_MEM_LOWATER);
|
||||
}
|
||||
}
|
||||
@@ -1005,10 +1018,27 @@ isc_mem_stats(isc_mem_t *ctx, FILE *out) {
|
||||
*/
|
||||
pool = ISC_LIST_HEAD(ctx->pools);
|
||||
if (pool != NULL) {
|
||||
fprintf(out, "[Pool statistics]\n");
|
||||
fprintf(out, isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
|
||||
ISC_MSG_POOLSTATS,
|
||||
"[Pool statistics]\n"));
|
||||
fprintf(out, "%15s %10s %10s %10s %10s %10s %10s %10s %1s\n",
|
||||
"name", "size", "maxalloc", "allocated", "freecount",
|
||||
"freemax", "fillcount", "gets", "L");
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
|
||||
ISC_MSG_POOLNAME, "name"),
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
|
||||
ISC_MSG_POOLSIZE, "size"),
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
|
||||
ISC_MSG_POOLMAXALLOC, "maxalloc"),
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
|
||||
ISC_MSG_POOLALLOCATED, "allocated"),
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
|
||||
ISC_MSG_POOLFREECOUNT, "freecount"),
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
|
||||
ISC_MSG_POOLFREEMAX, "freemax"),
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
|
||||
ISC_MSG_POOLFILLCOUNT, "fillcount"),
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
|
||||
ISC_MSG_POOLGETS, "gets"),
|
||||
"L");
|
||||
}
|
||||
while (pool != NULL) {
|
||||
fprintf(out, "%15s %10lu %10u %10u %10u %10u %10u %10u %s\n",
|
||||
@@ -1024,15 +1054,25 @@ isc_mem_stats(isc_mem_t *ctx, FILE *out) {
|
||||
debuglink_t *dl;
|
||||
unsigned int i;
|
||||
|
||||
fprintf(out, "DUMP OF ALL OUTSTANDING MEMORY ALLOCATIONS\n");
|
||||
fprintf(out, isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
|
||||
ISC_MSG_DUMPALLOC,
|
||||
"DUMP OF ALL OUTSTANDING "
|
||||
"MEMORY ALLOCATIONS\n");
|
||||
dl = ISC_LIST_HEAD(ctx->debuglist);
|
||||
if (dl == NULL)
|
||||
fprintf(out, "\tNone.\n");
|
||||
fprintf(out, isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM,
|
||||
ISC_MSG_NONE,
|
||||
"\tNone.\n"));
|
||||
while (dl != NULL) {
|
||||
for (i = 0 ; i < DEBUGLIST_COUNT ; i++)
|
||||
if (dl->ptr[i] != NULL)
|
||||
fprintf(out,
|
||||
"\tptr %p file %s line %u\n",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_MEM,
|
||||
ISC_MSG_PTRFILELINE,
|
||||
"\tptr %p "
|
||||
"file %s "
|
||||
"line %u\n"),
|
||||
dl->ptr[i], dl->file[i],
|
||||
dl->line[i]);
|
||||
dl = ISC_LIST_NEXT(dl, link);
|
||||
|
@@ -15,13 +15,14 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: netaddr.c,v 1.12 2000/08/01 01:29:37 tale Exp $ */
|
||||
/* $Id: netaddr.c,v 1.13 2000/12/06 00:30:05 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/sockaddr.h>
|
||||
@@ -151,7 +152,9 @@ isc_netaddr_format(isc_netaddr_t *na, char *array, unsigned int size) {
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
snprintf(array, size,
|
||||
"<unknown address, family %u>",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_NETADDR,
|
||||
ISC_MSG_UNKNOWNADDR,
|
||||
"<unknown address, family %u>"),
|
||||
na->family);
|
||||
array[size - 1] = '\0';
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: print.c,v 1.14 2000/11/14 23:42:29 tale Exp $ */
|
||||
/* $Id: print.c,v 1.15 2000/12/06 00:30:06 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/assertions.h>
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/platform.h>
|
||||
#include <isc/util.h>
|
||||
@@ -456,17 +457,29 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
|
||||
}
|
||||
break;
|
||||
case 'D': /*deprecated*/
|
||||
INSIST("use %ld instead of %D" == NULL);
|
||||
INSIST(isc_msgcat_get(isc_msgcat, ISC_MSGSET_PRINT,
|
||||
ISC_MSG_USELD,
|
||||
"use %ld instead of %D")
|
||||
== NULL);
|
||||
case 'O': /*deprecated*/
|
||||
INSIST("use %lo instead of %O" == NULL);
|
||||
INSIST(isc_msgcat_get(isc_msgcat, ISC_MSGSET_PRINT,
|
||||
ISC_MSG_USELO,
|
||||
"use %lo instead of %O")
|
||||
== NULL);
|
||||
case 'U': /*deprecated*/
|
||||
INSIST("use %lu instead of %U" == NULL);
|
||||
INSIST(isc_msgcat_get(isc_msgcat, ISC_MSGSET_PRINT,
|
||||
ISC_MSG_USELU,
|
||||
"use %lu instead of %U")
|
||||
== NULL);
|
||||
|
||||
case 'L':
|
||||
#ifdef HAVE_LONG_DOUBLE
|
||||
l = 1;
|
||||
#else
|
||||
INSIST("long doubles are not supported" == NULL);
|
||||
INSIST(isc_msgcat_get(isc_msgcat, ISC_MSGSET_PRINT,
|
||||
ISC_MSG_NOLONGDBL,
|
||||
"long doubles are not supported")
|
||||
== NULL);
|
||||
#endif
|
||||
/*FALLTHROUGH*/
|
||||
case 'e':
|
||||
|
@@ -15,13 +15,14 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: condition.c,v 1.24 2000/08/01 01:31:00 tale Exp $ */
|
||||
/* $Id: condition.c,v 1.25 2000/12/06 00:30:17 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <isc/condition.h>
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/time.h>
|
||||
#include <isc/util.h>
|
||||
@@ -56,7 +57,9 @@ isc_condition_waituntil(isc_condition_t *c, isc_mutex_t *m, isc_time_t *t) {
|
||||
} while (presult == EINTR);
|
||||
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"pthread_cond_timedwait() returned %s",
|
||||
"pthread_cond_timedwait() %s %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_RETURNED, "returned %s"),
|
||||
strerror(presult));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
|
@@ -15,14 +15,14 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: result.c,v 1.50 2000/11/18 02:56:45 gson Exp $ */
|
||||
/* $Id: result.c,v 1.51 2000/12/06 00:30:07 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/lib.h>
|
||||
#include <isc/msgcat.h>
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/mutex.h>
|
||||
#include <isc/once.h>
|
||||
#include <isc/resultclass.h>
|
||||
@@ -142,7 +142,10 @@ initialize_action(void) {
|
||||
isc_msgcat, ISC_RESULT_RESULTSET);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"register_table() failed: %u", result);
|
||||
"register_table() %s: %u",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"),
|
||||
result);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -15,13 +15,14 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: rwlock.c,v 1.25 2000/08/29 00:33:35 bwelling Exp $ */
|
||||
/* $Id: rwlock.c,v 1.26 2000/12/06 00:30:09 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <isc/magic.h>
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/platform.h>
|
||||
#include <isc/rwlock.h>
|
||||
#include <isc/util.h>
|
||||
@@ -46,10 +47,21 @@
|
||||
static void
|
||||
print_lock(const char *operation, isc_rwlock_t *rwl, isc_rwlocktype_t type) {
|
||||
fprintf(stderr,
|
||||
"rwlock %p thread %lu %s(%s): %s, %u active, %u granted, "
|
||||
"%u rwaiting, %u wwaiting\n", rwl, isc_thread_self(),
|
||||
operation, (type == isc_rwlocktype_read ? "read" : "write"),
|
||||
(rwl->type == isc_rwlocktype_read ? "reading" : "writing"),
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
|
||||
ISC_MSG_PRINTLOCK,
|
||||
"rwlock %p thread %lu %s(%s): %s, %u active, "
|
||||
"%u granted, %u rwaiting, %u wwaiting\n"),
|
||||
rwl, isc_thread_self(), operation,
|
||||
(type == isc_rwlocktype_read ?
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
|
||||
ISC_MSG_READ, "read") :
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
|
||||
ISC_MSG_WRITE, "write")),
|
||||
(rwl->type == isc_rwlocktype_read ?
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
|
||||
ISC_MSG_READING, "reading") :
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
|
||||
ISC_MSG_WRITING, "writing")),
|
||||
rwl->active, rwl->granted, rwl->readers_waiting,
|
||||
rwl->writers_waiting);
|
||||
}
|
||||
@@ -83,21 +95,27 @@ isc_rwlock_init(isc_rwlock_t *rwl, unsigned int read_quota,
|
||||
result = isc_mutex_init(&rwl->lock);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_mutex_init() failed: %s",
|
||||
"isc_mutex_init() %s: %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"),
|
||||
isc_result_totext(result));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
result = isc_condition_init(&rwl->readable);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_condition_init(readable) failed: %s",
|
||||
"isc_condition_init(readable) %s: %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"),
|
||||
isc_result_totext(result));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
result = isc_condition_init(&rwl->writeable);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_condition_init(writeable) failed: %s",
|
||||
"isc_condition_init(writeable) %s: %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"),
|
||||
isc_result_totext(result));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
@@ -117,7 +135,8 @@ isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
|
||||
LOCK(&rwl->lock);
|
||||
|
||||
#ifdef ISC_RWLOCK_TRACE
|
||||
print_lock("prelock", rwl, type);
|
||||
print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
|
||||
ISC_MSG_PRELOCK, "prelock"), rwl, type);
|
||||
#endif
|
||||
|
||||
if (type == isc_rwlocktype_read) {
|
||||
@@ -160,7 +179,8 @@ isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
|
||||
}
|
||||
|
||||
#ifdef ISC_RWLOCK_TRACE
|
||||
print_lock("postlock", rwl, type);
|
||||
print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
|
||||
ISC_MSG_POSTLOCK, "postlock"), rwl, type);
|
||||
#endif
|
||||
|
||||
UNLOCK(&rwl->lock);
|
||||
@@ -178,7 +198,8 @@ isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
|
||||
UNUSED(type);
|
||||
|
||||
#ifdef ISC_RWLOCK_TRACE
|
||||
print_lock("preunlock", rwl, type);
|
||||
print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
|
||||
ISC_MSG_PREUNLOCK, "preunlock"), rwl, type);
|
||||
#endif
|
||||
|
||||
INSIST(rwl->active > 0);
|
||||
@@ -213,7 +234,9 @@ isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
|
||||
}
|
||||
|
||||
#ifdef ISC_RWLOCK_TRACE
|
||||
print_lock("postunlock", rwl, type);
|
||||
print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
|
||||
ISC_MSG_POSTUNLOCK, "postunlock"),
|
||||
rwl, type);
|
||||
#endif
|
||||
|
||||
UNLOCK(&rwl->lock);
|
||||
|
@@ -15,13 +15,14 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: sockaddr.c,v 1.46 2000/08/09 19:09:08 gson Exp $ */
|
||||
/* $Id: sockaddr.c,v 1.47 2000/12/06 00:30:10 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/region.h>
|
||||
@@ -160,8 +161,13 @@ isc_sockaddr_format(isc_sockaddr_t *sa, char *array, unsigned int size) {
|
||||
isc_buffer_init(&buf, array, size);
|
||||
result = isc_sockaddr_totext(sa, &buf);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
/*
|
||||
* The message is the same as in netaddr.c.
|
||||
*/
|
||||
snprintf(array, size,
|
||||
"<unknown address, family %u>",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_NETADDR,
|
||||
ISC_MSG_UNKNOWNADDR,
|
||||
"<unknown address, family %u>"),
|
||||
sa->type.sa.sa_family);
|
||||
array[size - 1] = '\0';
|
||||
}
|
||||
@@ -187,7 +193,11 @@ isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only) {
|
||||
break;
|
||||
default:
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"unknown address family: %d",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_SOCKADDR,
|
||||
ISC_MSG_UNKNOWNFAMILY,
|
||||
"unknown "
|
||||
"address family: %d"),
|
||||
(int)sockaddr->type.sa.sa_family);
|
||||
s = (const unsigned char *)&sockaddr->type;
|
||||
length = sockaddr->length;
|
||||
@@ -317,7 +327,11 @@ isc_sockaddr_pf(const isc_sockaddr_t *sockaddr) {
|
||||
case AF_INET6:
|
||||
return (PF_INET6);
|
||||
default:
|
||||
FATAL_ERROR(__FILE__, __LINE__, "unknown address family");
|
||||
FATAL_ERROR(__FILE__, __LINE__,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKADDR,
|
||||
ISC_MSG_UNKNOWNFAMILY,
|
||||
"unknown address family: %d"),
|
||||
(int)sockaddr->type.sa.sa_family);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -361,7 +375,11 @@ isc_sockaddr_setport(isc_sockaddr_t *sockaddr, in_port_t port) {
|
||||
sockaddr->type.sin6.sin6_port = htons(port);
|
||||
break;
|
||||
default:
|
||||
FATAL_ERROR(__FILE__, __LINE__, "unknown address family");
|
||||
FATAL_ERROR(__FILE__, __LINE__,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKADDR,
|
||||
ISC_MSG_UNKNOWNFAMILY,
|
||||
"unknown address family: %d"),
|
||||
(int)sockaddr->type.sa.sa_family);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,7 +395,11 @@ isc_sockaddr_getport(isc_sockaddr_t *sockaddr) {
|
||||
port = ntohs(sockaddr->type.sin6.sin6_port);
|
||||
break;
|
||||
default:
|
||||
FATAL_ERROR(__FILE__, __LINE__, "unknown address family");
|
||||
FATAL_ERROR(__FILE__, __LINE__,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKADDR,
|
||||
ISC_MSG_UNKNOWNFAMILY,
|
||||
"unknown address family: %d"),
|
||||
(int)sockaddr->type.sa.sa_family);
|
||||
}
|
||||
|
||||
return (port);
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: task.c,v 1.75 2000/09/28 21:31:04 bwelling Exp $ */
|
||||
/* $Id: task.c,v 1.76 2000/12/06 00:30:11 tale Exp $ */
|
||||
|
||||
/*
|
||||
* Principal Author: Bob Halley
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <isc/condition.h>
|
||||
#include <isc/event.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/platform.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/task.h>
|
||||
@@ -177,12 +178,14 @@ isc_task_create(isc_taskmgr_t *manager, unsigned int quantum,
|
||||
task = isc_mem_get(manager->mctx, sizeof *task);
|
||||
if (task == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
XTRACE("create");
|
||||
XTRACE("isc_task_create");
|
||||
task->manager = manager;
|
||||
if (isc_mutex_init(&task->lock) != ISC_R_SUCCESS) {
|
||||
isc_mem_put(manager->mctx, task, sizeof *task);
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_mutex_init() failed");
|
||||
"isc_mutex_init() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
task->state = task_state_idle;
|
||||
@@ -230,7 +233,7 @@ isc_task_attach(isc_task_t *source, isc_task_t **targetp) {
|
||||
REQUIRE(VALID_TASK(source));
|
||||
REQUIRE(targetp != NULL && *targetp == NULL);
|
||||
|
||||
XTTRACE(source, "attach");
|
||||
XTTRACE(source, "isc_task_attach");
|
||||
|
||||
LOCK(&source->lock);
|
||||
source->references++;
|
||||
@@ -251,7 +254,8 @@ task_shutdown(isc_task_t *task) {
|
||||
XTRACE("task_shutdown");
|
||||
|
||||
if (! TASK_SHUTTINGDOWN(task)) {
|
||||
XTRACE("shutting down");
|
||||
XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_SHUTTINGDOWN, "shutting down"));
|
||||
task->flags |= TASK_F_SHUTTINGDOWN;
|
||||
if (task->state == task_state_idle) {
|
||||
INSIST(EMPTY(task->events));
|
||||
@@ -785,16 +789,21 @@ dispatch(isc_taskmgr_t *manager) {
|
||||
* task lock.
|
||||
*/
|
||||
while (EMPTY(manager->ready_tasks) && !FINISHED(manager)) {
|
||||
XTHREADTRACE("wait");
|
||||
XTHREADTRACE(isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_WAIT, "wait"));
|
||||
WAIT(&manager->work_available, &manager->lock);
|
||||
XTHREADTRACE("awake");
|
||||
XTHREADTRACE(isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_TASK,
|
||||
ISC_MSG_AWAKE, "awake"));
|
||||
}
|
||||
#else /* ISC_PLATFORM_USETHREADS */
|
||||
if (total_dispatch_count >= DEFAULT_TASKMGR_QUANTUM ||
|
||||
EMPTY(manager->ready_tasks))
|
||||
break;
|
||||
#endif /* ISC_PLATFORM_USETHREADS */
|
||||
XTHREADTRACE("working");
|
||||
XTHREADTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TASK,
|
||||
ISC_MSG_WORKING, "working"));
|
||||
|
||||
task = HEAD(manager->ready_tasks);
|
||||
if (task != NULL) {
|
||||
@@ -817,7 +826,8 @@ dispatch(isc_taskmgr_t *manager) {
|
||||
LOCK(&task->lock);
|
||||
INSIST(task->state == task_state_ready);
|
||||
task->state = task_state_running;
|
||||
XTRACE("running");
|
||||
XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_RUNNING, "running"));
|
||||
do {
|
||||
if (!EMPTY(task->events)) {
|
||||
event = HEAD(task->events);
|
||||
@@ -826,7 +836,10 @@ dispatch(isc_taskmgr_t *manager) {
|
||||
/*
|
||||
* Execute the event action.
|
||||
*/
|
||||
XTRACE("execute action");
|
||||
XTRACE(isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_TASK,
|
||||
ISC_MSG_EXECUTE,
|
||||
"execute action"));
|
||||
if (event->ev_action != NULL) {
|
||||
UNLOCK(&task->lock);
|
||||
(event->ev_action)(task,event);
|
||||
@@ -874,13 +887,20 @@ dispatch(isc_taskmgr_t *manager) {
|
||||
* Nothing else to do for this task
|
||||
* right now.
|
||||
*/
|
||||
XTRACE("empty");
|
||||
XTRACE(isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_TASK,
|
||||
ISC_MSG_EMPTY,
|
||||
"empty"));
|
||||
if (task->references == 0 &&
|
||||
TASK_SHUTTINGDOWN(task)) {
|
||||
/*
|
||||
* The task is done.
|
||||
*/
|
||||
XTRACE("done");
|
||||
XTRACE(isc_msgcat_get(
|
||||
isc_msgcat,
|
||||
ISC_MSGSET_TASK,
|
||||
ISC_MSG_DONE,
|
||||
"done"));
|
||||
finished = ISC_TRUE;
|
||||
task->state = task_state_done;
|
||||
} else
|
||||
@@ -897,7 +917,10 @@ dispatch(isc_taskmgr_t *manager) {
|
||||
* dispatching at least one event,
|
||||
* so the minimum quantum is one.
|
||||
*/
|
||||
XTRACE("quantum");
|
||||
XTRACE(isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_TASK,
|
||||
ISC_MSG_QUANTUM,
|
||||
"quantum"));
|
||||
task->state = task_state_ready;
|
||||
requeue = ISC_TRUE;
|
||||
done = ISC_TRUE;
|
||||
@@ -945,11 +968,13 @@ WINAPI
|
||||
run(void *uap) {
|
||||
isc_taskmgr_t *manager = uap;
|
||||
|
||||
XTHREADTRACE("start");
|
||||
XTHREADTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_STARTING, "starting"));
|
||||
|
||||
dispatch(manager);
|
||||
|
||||
XTHREADTRACE("exit");
|
||||
XTHREADTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_EXITING, "exiting"));
|
||||
|
||||
return ((isc_threadresult_t)0);
|
||||
}
|
||||
@@ -1005,7 +1030,9 @@ isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers,
|
||||
if (isc_mutex_init(&manager->lock) != ISC_R_SUCCESS) {
|
||||
isc_mem_put(mctx, manager, sizeof *manager);
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_mutex_init() failed");
|
||||
"isc_mutex_init() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
#ifdef ISC_PLATFORM_USETHREADS
|
||||
@@ -1021,7 +1048,9 @@ isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers,
|
||||
workers * sizeof (isc_thread_t));
|
||||
isc_mem_put(mctx, manager, sizeof *manager);
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_condition_init() failed");
|
||||
"isc_condition_init() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
#endif /* ISC_PLATFORM_USETHREADS */
|
||||
|
@@ -15,13 +15,14 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: timer.c,v 1.58 2000/10/20 02:21:58 marka Exp $ */
|
||||
/* $Id: timer.c,v 1.59 2000/12/06 00:30:13 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <isc/condition.h>
|
||||
#include <isc/heap.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/platform.h>
|
||||
#include <isc/task.h>
|
||||
#include <isc/thread.h>
|
||||
@@ -167,7 +168,8 @@ schedule(isc_timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) {
|
||||
manager->nscheduled++;
|
||||
}
|
||||
|
||||
XTRACETIMER("schedule", timer, due);
|
||||
XTRACETIMER(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TIMER,
|
||||
ISC_MSG_SCHEDULE, "schedule"), timer, due);
|
||||
|
||||
/*
|
||||
* If this timer is at the head of the queue, we need to ensure
|
||||
@@ -177,7 +179,9 @@ schedule(isc_timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) {
|
||||
*/
|
||||
#ifdef ISC_PLATFORM_USETHREADS
|
||||
if (timer->index == 1 && signal_ok) {
|
||||
XTRACE("signal (schedule)");
|
||||
XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TIMER,
|
||||
ISC_MSG_SIGNALSCHED,
|
||||
"signal (schedule)"));
|
||||
SIGNAL(&manager->wakeup);
|
||||
}
|
||||
#else /* ISC_PLATFORM_USETHREADS */
|
||||
@@ -208,7 +212,9 @@ deschedule(isc_timer_t *timer) {
|
||||
manager->nscheduled--;
|
||||
#ifdef ISC_PLATFORM_USETHREADS
|
||||
if (need_wakeup) {
|
||||
XTRACE("signal (deschedule)");
|
||||
XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TIMER,
|
||||
ISC_MSG_SIGNALDESCHED,
|
||||
"signal (deschedule)"));
|
||||
SIGNAL(&manager->wakeup);
|
||||
}
|
||||
#endif /* ISC_PLATFORM_USETHREADS */
|
||||
@@ -277,7 +283,11 @@ isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type,
|
||||
result = isc_time_now(&now);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_time_now() failed: %s",
|
||||
"isc_time_now() %s: %s",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED,
|
||||
"failed"),
|
||||
isc_result_totext(result));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
@@ -327,7 +337,9 @@ isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type,
|
||||
isc_task_detach(&timer->task);
|
||||
isc_mem_put(manager->mctx, timer, sizeof *timer);
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_mutex_init() failed");
|
||||
"isc_mutex_init() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
ISC_LINK_INIT(timer, link);
|
||||
@@ -394,7 +406,11 @@ isc_timer_reset(isc_timer_t *timer, isc_timertype_t type,
|
||||
result = isc_time_now(&now);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_time_now() failed: %s",
|
||||
"isc_time_now() %s: %s",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED,
|
||||
"failed"),
|
||||
isc_result_totext(result));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
@@ -467,7 +483,9 @@ isc_timer_touch(isc_timer_t *timer) {
|
||||
result = isc_time_now(&now);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_time_now() failed: %s",
|
||||
"isc_time_now() %s: %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"),
|
||||
isc_result_totext(result));
|
||||
result = ISC_R_UNEXPECTED;
|
||||
} else
|
||||
@@ -556,13 +574,20 @@ dispatch(isc_timermgr_t *manager, isc_time_t *now) {
|
||||
/*
|
||||
* Idle timer has been touched; reschedule.
|
||||
*/
|
||||
XTRACEID("idle reschedule", timer);
|
||||
XTRACEID(isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_TIMER,
|
||||
ISC_MSG_IDLERESCHED,
|
||||
"idle reschedule"),
|
||||
timer);
|
||||
post_event = ISC_FALSE;
|
||||
need_schedule = ISC_TRUE;
|
||||
}
|
||||
|
||||
if (post_event) {
|
||||
XTRACEID("posting", timer);
|
||||
XTRACEID(isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_TIMER,
|
||||
ISC_MSG_POSTING,
|
||||
"posting"), timer);
|
||||
/*
|
||||
* XXX We could preallocate this event.
|
||||
*/
|
||||
@@ -577,7 +602,11 @@ dispatch(isc_timermgr_t *manager, isc_time_t *now) {
|
||||
isc_task_send(timer->task, &event);
|
||||
else
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"couldn't allocate event");
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_TIMER,
|
||||
ISC_MSG_EVENTNOTALLOC,
|
||||
"couldn't "
|
||||
"allocate event"));
|
||||
}
|
||||
|
||||
timer->index = 0;
|
||||
@@ -588,7 +617,11 @@ dispatch(isc_timermgr_t *manager, isc_time_t *now) {
|
||||
result = schedule(timer, now, ISC_FALSE);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"couldn't schedule timer: %u",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_TIMER,
|
||||
ISC_MSG_SCHEDFAIL,
|
||||
"couldn't "
|
||||
"schedule timer: %u"),
|
||||
result);
|
||||
}
|
||||
} else {
|
||||
@@ -612,21 +645,29 @@ run(void *uap) {
|
||||
while (!manager->done) {
|
||||
RUNTIME_CHECK(isc_time_now(&now) == ISC_R_SUCCESS);
|
||||
|
||||
XTRACETIME("running", now);
|
||||
XTRACETIME(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_RUNNING,
|
||||
"running"), now);
|
||||
|
||||
dispatch(manager, &now);
|
||||
|
||||
if (manager->nscheduled > 0) {
|
||||
XTRACETIME("waituntil", manager->due);
|
||||
XTRACETIME(isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_WAITUNTIL,
|
||||
"waituntil"),
|
||||
manager->due);
|
||||
result = WAITUNTIL(&manager->wakeup, &manager->lock,
|
||||
&manager->due);
|
||||
INSIST(result == ISC_R_SUCCESS ||
|
||||
result == ISC_R_TIMEDOUT);
|
||||
} else {
|
||||
XTRACE("wait");
|
||||
XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_WAIT, "wait"));
|
||||
WAIT(&manager->wakeup, &manager->lock);
|
||||
}
|
||||
XTRACE("wakeup");
|
||||
XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TIMER,
|
||||
ISC_MSG_WAKEUP, "wakeup"));
|
||||
}
|
||||
UNLOCK(&manager->lock);
|
||||
|
||||
@@ -698,7 +739,9 @@ isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) {
|
||||
isc_heap_destroy(&manager->heap);
|
||||
isc_mem_put(mctx, manager, sizeof *manager);
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_mutex_init() failed");
|
||||
"isc_mutex_init() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
isc_mem_attach(mctx, &manager->mctx);
|
||||
@@ -709,7 +752,9 @@ isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) {
|
||||
isc_heap_destroy(&manager->heap);
|
||||
isc_mem_put(mctx, manager, sizeof *manager);
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_condition_init() failed");
|
||||
"isc_condition_init() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
if (isc_thread_create(run, manager, &manager->thread) !=
|
||||
@@ -720,7 +765,9 @@ isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) {
|
||||
isc_heap_destroy(&manager->heap);
|
||||
isc_mem_put(mctx, manager, sizeof *manager);
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_thread_create() failed");
|
||||
"isc_thread_create() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
#else /* ISC_PLATFORM_USETHREADS */
|
||||
@@ -763,7 +810,8 @@ isc_timermgr_destroy(isc_timermgr_t **managerp) {
|
||||
manager->done = ISC_TRUE;
|
||||
|
||||
#ifdef ISC_PLATFORM_USETHREADS
|
||||
XTRACE("signal (destroy)");
|
||||
XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TIMER,
|
||||
ISC_MSG_SIGNALDESTROY, "signal (destroy)"));
|
||||
SIGNAL(&manager->wakeup);
|
||||
#endif /* ISC_PLATFORM_USETHREADS */
|
||||
|
||||
@@ -775,7 +823,9 @@ isc_timermgr_destroy(isc_timermgr_t **managerp) {
|
||||
*/
|
||||
if (isc_thread_join(manager->thread, NULL) != ISC_R_SUCCESS)
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_thread_join() failed");
|
||||
"isc_thread_join() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
#endif /* ISC_PLATFORM_USETHREADS */
|
||||
|
||||
/*
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: app.c,v 1.33 2000/11/29 01:51:54 gson Exp $ */
|
||||
/* $Id: app.c,v 1.34 2000/12/06 00:30:19 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <isc/app.h>
|
||||
#include <isc/boolean.h>
|
||||
#include <isc/condition.h>
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/mutex.h>
|
||||
#include <isc/event.h>
|
||||
#include <isc/platform.h>
|
||||
@@ -102,8 +103,10 @@ handle_signal(int sig, void (*handler)(int)) {
|
||||
if (sigfillset(&sa.sa_mask) != 0 ||
|
||||
sigaction(sig, &sa, NULL) < 0) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"handle_signal() %d setup: %s", sig,
|
||||
strerror(errno));
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_APP,
|
||||
ISC_MSG_SIGNALSETUP,
|
||||
"handle_signal() %d setup: %s"),
|
||||
sig, strerror(errno));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: entropy.c,v 1.51 2000/11/23 01:04:00 bwelling Exp $ */
|
||||
/* $Id: entropy.c,v 1.52 2000/12/06 00:30:21 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <isc/list.h>
|
||||
#include <isc/magic.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/mutex.h>
|
||||
#include <isc/region.h>
|
||||
#include <isc/sha1.h>
|
||||
@@ -1354,9 +1355,11 @@ isc_entropy_putdata(isc_entropy_t *ent, void *data, unsigned int length,
|
||||
static void
|
||||
dumpstats(isc_entropy_t *ent, FILE *out) {
|
||||
fprintf(out,
|
||||
"Entropy pool %p: refcnt %u"
|
||||
" cursor %u, rotate %u entropy %u pseudo %u nsources %u"
|
||||
" nextsource %p initialized %u initcount %u\n",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_ENTROPY,
|
||||
ISC_MSG_ENTROPYSTATS,
|
||||
"Entropy pool %p: refcnt %u cursor %u,"
|
||||
" rotate %u entropy %u pseudo %u nsources %u"
|
||||
" nextsource %p initialized %u initcount %u\n"),
|
||||
ent, ent->refcnt,
|
||||
ent->pool.cursor, ent->pool.rotate,
|
||||
ent->pool.entropy, ent->pool.pseudo,
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: ifiter_ioctl.c,v 1.13 2000/08/01 01:31:19 tale Exp $ */
|
||||
/* $Id: ifiter_ioctl.c,v 1.14 2000/12/06 00:30:23 tale Exp $ */
|
||||
|
||||
/*
|
||||
* Obtain the list of network interfaces using the SIOCGLIFCONF ioctl.
|
||||
@@ -90,7 +90,11 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
|
||||
*/
|
||||
if ((iter->socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"making interface scan socket: %s",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_IFITERIOCTL,
|
||||
ISC_MSG_MAKESCANSOCKET,
|
||||
"making interface "
|
||||
"scan socket: %s"),
|
||||
strerror(errno));
|
||||
result = ISC_R_UNEXPECTED;
|
||||
goto socket_failure;
|
||||
@@ -127,7 +131,11 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
|
||||
== -1) {
|
||||
if (errno != EINVAL) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"get interface configuration: %s",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_IFITERIOCTL,
|
||||
ISC_MSG_GETIFCONFIG,
|
||||
"get interface "
|
||||
"configuration: %s"),
|
||||
strerror(errno));
|
||||
result = ISC_R_UNEXPECTED;
|
||||
goto ioctl_failure;
|
||||
@@ -151,8 +159,11 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
|
||||
}
|
||||
if (iter->bufsize >= IFCONF_BUFSIZE_MAX) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"get interface configuration: "
|
||||
"maximum buffer size exceeded");
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_IFITERIOCTL,
|
||||
ISC_MSG_BUFFERMAX,
|
||||
"get interface configuration: "
|
||||
"maximum buffer size exceeded");
|
||||
result = ISC_R_UNEXPECTED;
|
||||
goto ioctl_failure;
|
||||
}
|
||||
@@ -258,7 +269,11 @@ internal_current(isc_interfaceiter_t *iter) {
|
||||
if (ioctl(iter->socket, SIOCGLIFDSTADDR, (char *)&lifreq)
|
||||
< 0) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"%s: getting destination address: %s",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_IFITERIOCTL,
|
||||
ISC_MSG_GETDESTADDR,
|
||||
"%s: getting "
|
||||
"destination address: %s"),
|
||||
lifreq.lifr_name,
|
||||
strerror(errno));
|
||||
return (ISC_R_IGNORE);
|
||||
@@ -282,7 +297,10 @@ internal_current(isc_interfaceiter_t *iter) {
|
||||
if (ioctl(iter->socket, SIOCGLIFNETMASK, (char *)&lifreq)
|
||||
< 0) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"%s: getting netmask: %s",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_IFITERIOCTL,
|
||||
ISC_MSG_GETNETMASK,
|
||||
"%s: getting netmask: %s"),
|
||||
lifreq.lifr_name,
|
||||
strerror(errno));
|
||||
return (ISC_R_IGNORE);
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: ifiter_sysctl.c,v 1.10 2000/08/01 01:31:20 tale Exp $ */
|
||||
/* $Id: ifiter_sysctl.c,v 1.11 2000/12/06 00:30:25 tale Exp $ */
|
||||
|
||||
/*
|
||||
* Obtain the list of network interfaces using sysctl.
|
||||
@@ -86,7 +86,11 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
|
||||
bufsize = 0;
|
||||
if (sysctl(mib, 6, NULL, &bufsize, NULL, (size_t) 0) < 0) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"getting interface list size: sysctl: %s",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_IFITERSYSCTL,
|
||||
ISC_MSG_GETIFLISTSIZE,
|
||||
"getting interface "
|
||||
"list size: sysctl: %s"),
|
||||
strerror(errno));
|
||||
result = ISC_R_UNEXPECTED;
|
||||
goto failure;
|
||||
@@ -102,7 +106,11 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
|
||||
bufused = bufsize;
|
||||
if (sysctl(mib, 6, iter->buf, &bufused, NULL, (size_t) 0) < 0) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"getting interface list: sysctl: %s",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_IFITERSYSCTL,
|
||||
ISC_MSG_GETIFLIST,
|
||||
"getting interface list: "
|
||||
"sysctl: %s"),
|
||||
strerror(errno));
|
||||
result = ISC_R_UNEXPECTED;
|
||||
goto failure;
|
||||
@@ -241,7 +249,10 @@ internal_current(isc_interfaceiter_t *iter) {
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
} else {
|
||||
printf("warning: unexpected interface list message type\n");
|
||||
printf(isc_msgcat_get(isc_msgcat, ISC_MSGSET_IFITERSYSCTL,
|
||||
ISC_MSG_UNEXPECTEDTYPE,
|
||||
"warning: unexpected interface list "
|
||||
"message type\n"));
|
||||
return (ISC_R_IGNORE);
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: interfaceiter.c,v 1.19 2000/08/01 01:31:21 tale Exp $ */
|
||||
/* $Id: interfaceiter.c,v 1.20 2000/12/06 00:30:28 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <isc/mem.h>
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/net.h>
|
||||
#include <isc/result.h>
|
||||
#include <isc/string.h>
|
||||
|
@@ -15,13 +15,14 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: net.c,v 1.13 2000/09/15 20:52:27 bwelling Exp $ */
|
||||
/* $Id: net.c,v 1.14 2000/12/06 00:30:30 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/net.h>
|
||||
#include <isc/once.h>
|
||||
#include <isc/string.h>
|
||||
@@ -54,7 +55,11 @@ try_proto(int domain) {
|
||||
return (ISC_R_NOTFOUND);
|
||||
default:
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"socket() failed: %s",
|
||||
"socket() %s: %s",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED,
|
||||
"failed"),
|
||||
strerror(errno));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: socket.c,v 1.172 2000/11/22 23:48:14 gson Exp $ */
|
||||
/* $Id: socket.c,v 1.173 2000/12/06 00:30:32 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <isc/list.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/msgs.h>
|
||||
#include <isc/mutex.h>
|
||||
#include <isc/net.h>
|
||||
#include <isc/platform.h>
|
||||
@@ -344,7 +345,10 @@ select_poke(isc_socketmgr_t *mgr, int msg) {
|
||||
|
||||
if (cc < 0)
|
||||
FATAL_ERROR(__FILE__, __LINE__,
|
||||
"write() failed during watcher poke: %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_WRITEFAILED,
|
||||
"write() failed "
|
||||
"during watcher poke: %s"),
|
||||
strerror(errno));
|
||||
|
||||
INSIST(cc == sizeof(int));
|
||||
@@ -364,7 +368,10 @@ select_readmsg(isc_socketmgr_t *mgr) {
|
||||
return (SELECT_POKE_NOTHING);
|
||||
|
||||
FATAL_ERROR(__FILE__, __LINE__,
|
||||
"read() failed during watcher poke: %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_READFAILED,
|
||||
"read() failed "
|
||||
"during watcher poke: %s"),
|
||||
strerror(errno));
|
||||
|
||||
return (SELECT_POKE_NOTHING);
|
||||
@@ -470,7 +477,10 @@ process_cmsg(isc_socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
|
||||
|
||||
cmsgp = CMSG_FIRSTHDR(msg);
|
||||
while (cmsgp != NULL) {
|
||||
socket_log(sock, NULL, TRACE, "processing cmsg %p", cmsgp);
|
||||
socket_log(sock, NULL, TRACE,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_PROCESSCMSG,
|
||||
"processing cmsg %p"), cmsgp);
|
||||
|
||||
#ifdef ISC_PLATFORM_HAVEIPV6
|
||||
if (cmsgp->cmsg_level == IPPROTO_IPV6
|
||||
@@ -481,7 +491,11 @@ process_cmsg(isc_socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
|
||||
sizeof(struct in6_pktinfo));
|
||||
dev->attributes |= ISC_SOCKEVENTATTR_PKTINFO;
|
||||
socket_log(sock, NULL, TRACE,
|
||||
"interface received on ifindex %u",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_IFRECEIVED,
|
||||
"interface received "
|
||||
"on ifindex %u"),
|
||||
dev->pktinfo.ipi6_ifindex);
|
||||
goto next;
|
||||
}
|
||||
@@ -601,7 +615,9 @@ build_msghdr_send(isc_socket_t *sock, isc_socketevent_t *dev,
|
||||
struct in6_pktinfo *pktinfop;
|
||||
|
||||
socket_log(sock, NULL, TRACE,
|
||||
"sendto pktinfo data, ifindex %u",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_SENDTODATA,
|
||||
"sendto pktinfo data, ifindex %u"),
|
||||
dev->pktinfo.ipi6_ifindex);
|
||||
|
||||
msg->msg_controllen = CMSG_SPACE(sizeof(struct in6_pktinfo));
|
||||
@@ -826,7 +842,11 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
|
||||
|
||||
if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL))
|
||||
socket_log(sock, NULL, IOEVENT,
|
||||
"doio_recv: recvmsg(%d) %d bytes, err %d/%s",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_DOIORECV,
|
||||
"doio_recv: recvmsg(%d) "
|
||||
"%d bytes, err %d/%s"),
|
||||
sock->fd, cc, errno, strerror(errno));
|
||||
|
||||
#define SOFT_OR_HARD(_system, _isc) \
|
||||
@@ -866,7 +886,10 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
|
||||
if (sock->type == isc_sockettype_udp)
|
||||
dev->address.length = msghdr.msg_namelen;
|
||||
|
||||
socket_log(sock, &dev->address, IOEVENT, "packet received correctly");
|
||||
socket_log(sock, &dev->address, IOEVENT,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_PKTRECV,
|
||||
"packet received correctly"));
|
||||
|
||||
/*
|
||||
* Overflow bit detection. If we received MORE bytes than we should,
|
||||
@@ -1005,7 +1028,9 @@ doio_send(isc_socket_t *sock, isc_socketevent_t *dev) {
|
||||
|
||||
if (cc == 0)
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"internal_send: send() returned 0");
|
||||
"internal_send: send() %s 0",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_RETURNED, "returned"));
|
||||
|
||||
/*
|
||||
* If we write less than we expected, update counters, poke.
|
||||
@@ -1033,7 +1058,9 @@ destroy(isc_socket_t **sockp) {
|
||||
isc_socket_t *sock = *sockp;
|
||||
isc_socketmgr_t *manager = sock->manager;
|
||||
|
||||
socket_log(sock, NULL, CREATION, "destroying");
|
||||
socket_log(sock, NULL, CREATION,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_DESTROYING, "destroying"));
|
||||
|
||||
INSIST(ISC_LIST_EMPTY(sock->accept_list));
|
||||
INSIST(ISC_LIST_EMPTY(sock->recv_list));
|
||||
@@ -1124,7 +1151,9 @@ allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type,
|
||||
if (isc_mutex_init(&sock->lock) != ISC_R_SUCCESS) {
|
||||
sock->magic = 0;
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_mutex_init() failed");
|
||||
"isc_mutex_init() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
ret = ISC_R_UNEXPECTED;
|
||||
goto err2;
|
||||
}
|
||||
@@ -1239,7 +1268,11 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
|
||||
default:
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"socket() failed: %s",
|
||||
"socket() %s: %s",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED,
|
||||
"failed"),
|
||||
strerror(errno));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
@@ -1254,8 +1287,11 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
if (setsockopt(sock->fd, SOL_SOCKET, SO_BSDCOMPAT,
|
||||
(void *)&on, sizeof on) < 0) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"setsockopt(%d, SO_BSDCOMPAT) failed: %s",
|
||||
sock->fd, strerror(errno));
|
||||
"setsockopt(%d, SO_BSDCOMPAT) %s: %s",
|
||||
sock->fd,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"),
|
||||
strerror(errno));
|
||||
/* Press on... */
|
||||
}
|
||||
#endif
|
||||
@@ -1268,9 +1304,13 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
(void *)&on, sizeof on) < 0
|
||||
&& errno != ENOPROTOOPT) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"setsockopt(%d, SO_TIMESTAMP) "
|
||||
"failed: %s",
|
||||
sock->fd, strerror(errno));
|
||||
"setsockopt(%d, SO_TIMESTAMP) %s: %s",
|
||||
sock->fd,
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED,
|
||||
"failed"),
|
||||
strerror(errno));
|
||||
/* Press on... */
|
||||
}
|
||||
#endif /* SO_TIMESTAMP */
|
||||
@@ -1283,8 +1323,12 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
(void *)&on, sizeof (on)) < 0)) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"setsockopt(%d, IPV6_RECVPKTINFO) "
|
||||
"failed: %s",
|
||||
sock->fd, strerror(errno));
|
||||
"%s: %s", sock->fd,
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED,
|
||||
"failed"),
|
||||
strerror(errno));
|
||||
}
|
||||
#else
|
||||
/* 2292 */
|
||||
@@ -1292,9 +1336,13 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
&& (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_PKTINFO,
|
||||
(void *)&on, sizeof (on)) < 0)) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"setsockopt(%d, IPV6_PKTINFO) "
|
||||
"failed: %s",
|
||||
sock->fd, strerror(errno));
|
||||
"setsockopt(%d, IPV6_PKTINFO) %s: %s",
|
||||
sock->fd,
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED,
|
||||
"failed"),
|
||||
strerror(errno));
|
||||
}
|
||||
#endif /* IPV6_RECVPKTINFO */
|
||||
#ifdef IPV6_USE_MIN_MTU /*2292bis, not too common yet*/
|
||||
@@ -1328,7 +1376,9 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
|
||||
UNLOCK(&manager->lock);
|
||||
|
||||
socket_log(sock, NULL, CREATION, "created");
|
||||
socket_log(sock, NULL, CREATION,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_CREATED, "created"));
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
@@ -1566,7 +1616,10 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
|
||||
INSIST(VALID_SOCKET(sock));
|
||||
|
||||
LOCK(&sock->lock);
|
||||
socket_log(sock, NULL, TRACE, "internal_accept called, locked socket");
|
||||
socket_log(sock, NULL, TRACE,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_ACCEPTLOCK,
|
||||
"internal_accept called, locked socket"));
|
||||
|
||||
manager = sock->manager;
|
||||
INSIST(VALID_MANAGER(manager));
|
||||
@@ -1615,13 +1668,19 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
|
||||
*/
|
||||
if (isc_log_wouldlog(isc_lctx, TRACE_LEVEL))
|
||||
socket_log(sock, NULL, TRACE,
|
||||
"accept() returned %d/%s", errno,
|
||||
strerror(errno));
|
||||
"accept() %s %d/%s",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_RETURNED,
|
||||
"returned"),
|
||||
errno, strerror(errno));
|
||||
|
||||
fd = -1;
|
||||
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"internal_accept: accept() failed: %s",
|
||||
"internal_accept: accept() %s: %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"),
|
||||
strerror(errno));
|
||||
|
||||
result = ISC_R_UNEXPECTED;
|
||||
@@ -1645,7 +1704,9 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
|
||||
fd = -1;
|
||||
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"internal_accept: make_nonblock() failed: %s",
|
||||
"internal_accept: make_nonblock() %s: %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"),
|
||||
strerror(errno));
|
||||
|
||||
result = ISC_R_UNEXPECTED;
|
||||
@@ -1673,7 +1734,9 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
|
||||
manager->maxfd = fd;
|
||||
|
||||
socket_log(sock, &dev->newsocket->address, CREATION,
|
||||
"accepted connection, new socket %p",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_ACCEPTEDCXN,
|
||||
"accepted connection, new socket %p"),
|
||||
dev->newsocket);
|
||||
}
|
||||
|
||||
@@ -1701,7 +1764,10 @@ internal_recv(isc_task_t *me, isc_event_t *ev) {
|
||||
|
||||
LOCK(&sock->lock);
|
||||
socket_log(sock, NULL, IOEVENT,
|
||||
"internal_recv: task %p got event %p", me, ev, sock);
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_INTERNALRECV,
|
||||
"internal_recv: task %p got event %p"),
|
||||
me, ev, sock);
|
||||
|
||||
INSIST(sock->pending_recv == 1);
|
||||
sock->pending_recv = 0;
|
||||
@@ -1780,7 +1846,10 @@ internal_send(isc_task_t *me, isc_event_t *ev) {
|
||||
|
||||
LOCK(&sock->lock);
|
||||
socket_log(sock, NULL, IOEVENT,
|
||||
"internal_send: task %p got event %p", me, ev, sock);
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_INTERNALSEND,
|
||||
"internal_send: task %p got event %p"),
|
||||
me, ev, sock);
|
||||
|
||||
INSIST(sock->pending_send == 1);
|
||||
sock->pending_send = 0;
|
||||
@@ -1936,7 +2005,11 @@ watcher(void *uap) {
|
||||
if (cc < 0) {
|
||||
if (!SOFT_ERROR(errno))
|
||||
FATAL_ERROR(__FILE__, __LINE__,
|
||||
"select failed: %s",
|
||||
"select() %s: %s",
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED,
|
||||
"failed"),
|
||||
strerror(errno));
|
||||
}
|
||||
|
||||
@@ -1952,7 +2025,11 @@ watcher(void *uap) {
|
||||
msg = select_readmsg(manager);
|
||||
|
||||
manager_log(manager, IOEVENT,
|
||||
"watcher got message %d", msg);
|
||||
isc_msgcat_get(isc_msgcat,
|
||||
ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_WATCHERMSG,
|
||||
"watcher got message %d"),
|
||||
msg);
|
||||
|
||||
/*
|
||||
* Nothing to read?
|
||||
@@ -1986,7 +2063,9 @@ watcher(void *uap) {
|
||||
process_fds(manager, maxfd, &readfds, &writefds);
|
||||
}
|
||||
|
||||
manager_log(manager, TRACE, "watcher exiting");
|
||||
manager_log(manager, TRACE,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_EXITING, "watcher exiting"));
|
||||
|
||||
UNLOCK(&manager->lock);
|
||||
return ((isc_threadresult_t)0);
|
||||
@@ -2021,7 +2100,9 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
||||
if (isc_mutex_init(&manager->lock) != ISC_R_SUCCESS) {
|
||||
isc_mem_put(mctx, manager, sizeof *manager);
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_mutex_init() failed");
|
||||
"isc_mutex_init() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
#ifdef ISC_PLATFORM_USETHREADS
|
||||
@@ -2029,7 +2110,9 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
||||
DESTROYLOCK(&manager->lock);
|
||||
isc_mem_put(mctx, manager, sizeof *manager);
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_condition_init() failed");
|
||||
"isc_condition_init() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
|
||||
@@ -2041,7 +2124,9 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
||||
DESTROYLOCK(&manager->lock);
|
||||
isc_mem_put(mctx, manager, sizeof *manager);
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"pipe() failed: %s",
|
||||
"pipe() %s: %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"),
|
||||
strerror(errno));
|
||||
|
||||
return (ISC_R_UNEXPECTED);
|
||||
@@ -2077,7 +2162,9 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
||||
DESTROYLOCK(&manager->lock);
|
||||
isc_mem_put(mctx, manager, sizeof *manager);
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_thread_create() failed");
|
||||
"isc_thread_create() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
close(manager->pipe_fds[0]);
|
||||
close(manager->pipe_fds[1]);
|
||||
return (ISC_R_UNEXPECTED);
|
||||
@@ -2122,7 +2209,10 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
|
||||
* Wait for all sockets to be destroyed.
|
||||
*/
|
||||
while (!ISC_LIST_EMPTY(manager->socklist)) {
|
||||
manager_log(manager, CREATION, "sockets exist");
|
||||
manager_log(manager, CREATION,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_SOCKETSREMAIN,
|
||||
"sockets exist"));
|
||||
WAIT(&manager->shutdown_ok, &manager->lock);
|
||||
}
|
||||
#else /* ISC_PLATFORM_USETHREADS */
|
||||
@@ -2130,7 +2220,10 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
|
||||
* Hope all sockets have been destroyed.
|
||||
*/
|
||||
if (!ISC_LIST_EMPTY(manager->socklist)) {
|
||||
manager_log(manager, CREATION, "sockets exist");
|
||||
manager_log(manager, CREATION,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_SOCKETSREMAIN,
|
||||
"sockets exist"));
|
||||
INSIST(0);
|
||||
}
|
||||
#endif /* ISC_PLATFORM_USETHREADS */
|
||||
@@ -2150,7 +2243,9 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
|
||||
*/
|
||||
if (isc_thread_join(manager->watcher, NULL) != ISC_R_SUCCESS)
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_thread_join() failed");
|
||||
"isc_thread_join() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
#endif /* ISC_PLATFORM_USETHREADS */
|
||||
|
||||
/*
|
||||
@@ -2425,7 +2520,10 @@ isc_socket_sendto(isc_socket_t *sock, isc_region_t *region,
|
||||
set_dev_address(address, sock, dev);
|
||||
if (pktinfo != NULL) {
|
||||
socket_log(sock, NULL, TRACE,
|
||||
"pktinfo structure provided, ifindex %u (set to 0)",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_PKTINFOPROVIDED,
|
||||
"pktinfo structure provided, "
|
||||
"ifindex %u (set to 0)"),
|
||||
pktinfo->ipi6_ifindex);
|
||||
|
||||
dev->attributes |= ISC_SOCKEVENTATTR_PKTINFO;
|
||||
@@ -2595,8 +2693,10 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) {
|
||||
}
|
||||
if (setsockopt(sock->fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on,
|
||||
sizeof on) < 0) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d) failed",
|
||||
sock->fd);
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"setsockopt(%d) %s", sock->fd,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
/* Press on... */
|
||||
}
|
||||
if (bind(sock->fd, &sockaddr->type.sa, sockaddr->length) < 0) {
|
||||
@@ -2617,7 +2717,9 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) {
|
||||
}
|
||||
}
|
||||
|
||||
socket_log(sock, sockaddr, TRACE, "bound");
|
||||
socket_log(sock, sockaddr, TRACE,
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
|
||||
ISC_MSG_BOUND, "bound"));
|
||||
sock->bound = 1;
|
||||
|
||||
UNLOCK(&sock->lock);
|
||||
|
Reference in New Issue
Block a user