diff options
35 files changed, 121 insertions, 1007 deletions
diff --git a/usr.sbin/bind/configure b/usr.sbin/bind/configure index c768dc9478c..32aafe157ba 100644 --- a/usr.sbin/bind/configure +++ b/usr.sbin/bind/configure @@ -20350,7 +20350,7 @@ DNS_CRYPTO_LIBS="$NEWFLAGS" # elsewhere if there's a good reason for doing so. # -ac_config_files="$ac_config_files make/Makefile make/mkdep Makefile bin/Makefile bin/dig/Makefile lib/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/isc/nothreads/Makefile lib/isc/nothreads/include/Makefile lib/isc/nothreads/include/isc/Makefile lib/isc/Makefile lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h lib/isc/nls/Makefile lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile lib/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/lwres/Makefile" +ac_config_files="$ac_config_files make/Makefile make/mkdep Makefile bin/Makefile bin/dig/Makefile lib/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/isc/nothreads/Makefile lib/isc/nothreads/include/Makefile lib/isc/nothreads/include/isc/Makefile lib/isc/Makefile lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile lib/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/lwres/Makefile" # @@ -21359,7 +21359,6 @@ do "lib/isc/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/include/Makefile" ;; "lib/isc/include/isc/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/include/isc/Makefile" ;; "lib/isc/include/isc/platform.h") CONFIG_FILES="$CONFIG_FILES lib/isc/include/isc/platform.h" ;; - "lib/isc/nls/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/nls/Makefile" ;; "lib/isc/unix/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/unix/Makefile" ;; "lib/isc/unix/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/unix/include/Makefile" ;; "lib/isc/unix/include/isc/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/unix/include/isc/Makefile" ;; diff --git a/usr.sbin/bind/configure.in b/usr.sbin/bind/configure.in index f74cfdf8bad..3fbb9fff839 100644 --- a/usr.sbin/bind/configure.in +++ b/usr.sbin/bind/configure.in @@ -4565,7 +4565,6 @@ AC_CONFIG_FILES([ lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h - lib/isc/nls/Makefile lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile diff --git a/usr.sbin/bind/lib/dns/Makefile.in b/usr.sbin/bind/lib/dns/Makefile.in index a29c5a1ce93..49216b41c73 100644 --- a/usr.sbin/bind/lib/dns/Makefile.in +++ b/usr.sbin/bind/lib/dns/Makefile.in @@ -52,7 +52,7 @@ OPENSSLLINKOBJS = openssl_link.@O@ openssldh_link.@O@ openssldsa_link.@O@ \ @OPENSSLGOSTLINKOBJS@ opensslrsa_link.@O@ DSTOBJS = @DST_EXTRA_OBJS@ @OPENSSLLINKOBJS@ \ - dst_api.@O@ dst_lib.@O@ dst_parse.@O@ dst_result.@O@ \ + dst_api.@O@ dst_parse.@O@ dst_result.@O@ \ hmac_link.@O@ key.@O@ # Alphabetically @@ -83,7 +83,7 @@ OPENSSLLINKSRCS = openssl_link.c openssldh_link.c openssldsa_link.c \ @OPENSSLGOSTLINKSRCS@ opensslrsa_link.c DSTSRCS = @DST_EXTRA_SRCS@ @OPENSSLLINKSRCS@ \ - dst_api.c dst_lib.c dst_parse.c \ + dst_api.c dst_parse.c \ dst_result.c \ hmac_link.c key.c diff --git a/usr.sbin/bind/lib/dns/dst_lib.c b/usr.sbin/bind/lib/dns/dst_lib.c deleted file mode 100644 index 46c37f6167e..00000000000 --- a/usr.sbin/bind/lib/dns/dst_lib.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * Principal Author: Brian Wellington - * $Id: dst_lib.c,v 1.4 2020/01/09 14:18:29 florian Exp $ - */ - -/*! \file */ - -#include <config.h> - -#include <stddef.h> - -#include <isc/once.h> -#include <isc/msgcat.h> -#include <isc/util.h> - -#include <dst/lib.h> - -/*** - *** Globals - ***/ - -isc_msgcat_t * dst_msgcat = NULL; - - -/*** - *** Private - ***/ - -static isc_once_t msgcat_once = ISC_ONCE_INIT; - - -/*** - *** Functions - ***/ - -static void -open_msgcat(void) { - isc_msgcat_open("libdst.cat", &dst_msgcat); -} - -void -dst_lib_initmsgcat(void) { - - /* - * Initialize the DST library's message catalog, dst_msgcat, if it - * has not already been initialized. - */ - - RUNTIME_CHECK(isc_once_do(&msgcat_once, open_msgcat) == ISC_R_SUCCESS); -} diff --git a/usr.sbin/bind/lib/dns/dst_result.c b/usr.sbin/bind/lib/dns/dst_result.c index af4a83643bb..2c6ae42f0c3 100644 --- a/usr.sbin/bind/lib/dns/dst_result.c +++ b/usr.sbin/bind/lib/dns/dst_result.c @@ -16,7 +16,7 @@ /*% * Principal Author: Brian Wellington - * $Id: dst_result.c,v 1.3 2019/12/17 01:46:31 sthen Exp $ + * $Id: dst_result.c,v 1.4 2020/01/20 18:46:57 florian Exp $ */ #include <config.h> @@ -25,7 +25,6 @@ #include <isc/util.h> #include <dst/result.h> -#include <dst/lib.h> static const char *text[DST_R_NRESULTS] = { "algorithm is unsupported", /*%< 0 */ @@ -62,7 +61,7 @@ initialize_action(void) { isc_result_t result; result = isc_result_register(ISC_RESULTCLASS_DST, DST_R_NRESULTS, - text, dst_msgcat, DST_RESULT_RESULTSET); + text, DST_RESULT_RESULTSET); if (result != ISC_R_SUCCESS) UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_result_register() failed: %u", result); @@ -70,7 +69,6 @@ initialize_action(void) { static void initialize(void) { - dst_lib_initmsgcat(); RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS); } diff --git a/usr.sbin/bind/lib/dns/include/dns/lib.h b/usr.sbin/bind/lib/dns/include/dns/lib.h index 7d523b40dcf..94c326480ad 100644 --- a/usr.sbin/bind/lib/dns/include/dns/lib.h +++ b/usr.sbin/bind/lib/dns/include/dns/lib.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lib.h,v 1.4 2020/01/09 14:18:29 florian Exp $ */ +/* $Id: lib.h,v 1.5 2020/01/20 18:46:57 florian Exp $ */ #ifndef DNS_LIB_H #define DNS_LIB_H 1 @@ -30,14 +30,6 @@ ISC_LANG_BEGINDECLS * Tuning: external query load in packets per seconds. */ extern unsigned int dns_pps; -extern isc_msgcat_t *dns_msgcat; - -void -dns_lib_initmsgcat(void); -/*%< - * Initialize the DNS library's message catalog, dns_msgcat, if it - * has not already been initialized. - */ isc_result_t dns_lib_init(void); diff --git a/usr.sbin/bind/lib/dns/include/dst/lib.h b/usr.sbin/bind/lib/dns/include/dst/lib.h deleted file mode 100644 index 96b3609e9c3..00000000000 --- a/usr.sbin/bind/lib/dns/include/dst/lib.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: lib.h,v 1.4 2020/01/09 14:18:30 florian Exp $ */ - -#ifndef DST_LIB_H -#define DST_LIB_H 1 - -/*! \file dst/lib.h */ - -#include <isc/types.h> -#include <isc/lang.h> - -ISC_LANG_BEGINDECLS - -extern isc_msgcat_t *dst_msgcat; - -void -dst_lib_initmsgcat(void); -/* - * Initialize the DST library's message catalog, dst_msgcat, if it - * has not already been initialized. - */ - -ISC_LANG_ENDDECLS - -#endif /* DST_LIB_H */ diff --git a/usr.sbin/bind/lib/dns/lib.c b/usr.sbin/bind/lib/dns/lib.c index 310aaa0d7d0..2ab22428155 100644 --- a/usr.sbin/bind/lib/dns/lib.c +++ b/usr.sbin/bind/lib/dns/lib.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lib.c,v 1.6 2020/01/18 16:55:00 florian Exp $ */ +/* $Id: lib.c,v 1.7 2020/01/20 18:46:57 florian Exp $ */ /*! \file */ @@ -24,7 +24,7 @@ #include <isc/hash.h> #include <isc/mem.h> -#include <isc/msgcat.h> + #include <isc/mutex.h> #include <isc/once.h> #include <isc/util.h> @@ -42,36 +42,11 @@ ***/ unsigned int dns_pps = 0U; -isc_msgcat_t * dns_msgcat = NULL; - - -/*** - *** Private - ***/ - -static isc_once_t msgcat_once = ISC_ONCE_INIT; - /*** *** Functions ***/ -static void -open_msgcat(void) { - isc_msgcat_open("libdns.cat", &dns_msgcat); -} - -void -dns_lib_initmsgcat(void) { - - /* - * Initialize the DNS library's message catalog, dns_msgcat, if it - * has not already been initialized. - */ - - RUNTIME_CHECK(isc_once_do(&msgcat_once, open_msgcat) == ISC_R_SUCCESS); -} - static isc_once_t init_once = ISC_ONCE_INIT; static isc_mem_t *dns_g_mctx = NULL; static isc_boolean_t initialize_done = ISC_FALSE; diff --git a/usr.sbin/bind/lib/dns/result.c b/usr.sbin/bind/lib/dns/result.c index 2406668d490..8c9d5ae6851 100644 --- a/usr.sbin/bind/lib/dns/result.c +++ b/usr.sbin/bind/lib/dns/result.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: result.c,v 1.6 2019/12/17 01:46:32 sthen Exp $ */ +/* $Id: result.c,v 1.7 2020/01/20 18:46:57 florian Exp $ */ /*! \file */ @@ -207,11 +207,11 @@ initialize_action(void) { isc_result_t result; result = isc_result_register(ISC_RESULTCLASS_DNS, DNS_R_NRESULTS, - text, dns_msgcat, DNS_RESULT_RESULTSET); + text, DNS_RESULT_RESULTSET); if (result == ISC_R_SUCCESS) result = isc_result_register(ISC_RESULTCLASS_DNSRCODE, DNS_R_NRCODERESULTS, - rcode_text, dns_msgcat, + rcode_text, DNS_RESULT_RCODERESULTSET); if (result != ISC_R_SUCCESS) UNEXPECTED_ERROR(__FILE__, __LINE__, @@ -220,7 +220,6 @@ initialize_action(void) { static void initialize(void) { - dns_lib_initmsgcat(); RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS); } diff --git a/usr.sbin/bind/lib/isc/Makefile.in b/usr.sbin/bind/lib/isc/Makefile.in index 0b6cbe3bf3c..3bd863e0925 100644 --- a/usr.sbin/bind/lib/isc/Makefile.in +++ b/usr.sbin/bind/lib/isc/Makefile.in @@ -37,8 +37,6 @@ UNIXOBJS = @ISC_ISCIPV6_O@ @ISC_ISCPK11_API_O@ \ unix/socket.@O@ unix/stdio.@O@ \ unix/stdtime.@O@ unix/strerror.@O@ unix/syslog.@O@ unix/time.@O@ -NLSOBJS = nls/msgcat.@O@ - THREADOPTOBJS = nothreads/condition.@O@ nothreads/mutex.@O@ THREADOBJS = nothreads/thread.@O@ @@ -59,7 +57,7 @@ OBJS = @ISC_EXTRA_OBJS@ @ISC_PK11_O@ @ISC_PK11_RESULT_O@ \ safe.@O@ serial.@O@ sha1.@O@ sha2.@O@ sockaddr.@O@ \ string.@O@ symtab.@O@ task.@O@ taskpool.@O@ \ timer.@O@ version.@O@ \ - ${UNIXOBJS} ${NLSOBJS} ${THREADOBJS} + ${UNIXOBJS} ${THREADOBJS} # Alphabetically SRCS = @ISC_EXTRA_SRCS@ @ISC_PK11_C@ @ISC_PK11_RESULT_C@ \ @@ -82,7 +80,7 @@ LIBS = @ISC_OPENSSL_LIBS@ @LIBS@ # Attempt to disable parallel processing. .NOTPARALLEL: .NO_PARALLEL: -SUBDIRS = include unix nls nothreads +SUBDIRS = include unix nothreads TARGETS = timestamp TESTDIRS = @UNITTESTS@ diff --git a/usr.sbin/bind/lib/isc/assertions.c b/usr.sbin/bind/lib/isc/assertions.c index e2a5f765b1a..9c787db705e 100644 --- a/usr.sbin/bind/lib/isc/assertions.c +++ b/usr.sbin/bind/lib/isc/assertions.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: assertions.c,v 1.5 2020/01/09 13:47:13 florian Exp $ */ +/* $Id: assertions.c,v 1.6 2020/01/20 18:46:57 florian Exp $ */ /*! \file */ @@ -98,8 +98,6 @@ default_callback(const char *file, int line, isc_assertiontype_t type, const char *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")); + file, line, isc_assertion_typetotext(type), cond, "failed"); fflush(stderr); } diff --git a/usr.sbin/bind/lib/isc/commandline.c b/usr.sbin/bind/lib/isc/commandline.c index 9e6a18d6bec..36a08744f8b 100644 --- a/usr.sbin/bind/lib/isc/commandline.c +++ b/usr.sbin/bind/lib/isc/commandline.c @@ -43,7 +43,7 @@ * SUCH DAMAGE. */ -/* $Id: commandline.c,v 1.9 2020/01/09 14:18:30 florian Exp $ */ +/* $Id: commandline.c,v 1.10 2020/01/20 18:46:57 florian Exp $ */ /*! \file * This file was adapted from the NetBSD project's source tree, RCS ID: @@ -145,11 +145,7 @@ isc_commandline_parse(int argc, char * const *argv, const char *options) { if (isc_commandline_errprint && *options != ':') fprintf(stderr, "%s: %s -- %c\n", - isc_commandline_progname, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_COMMANDLINE, - ISC_MSG_ILLEGALOPT, - "illegal option"), + isc_commandline_progname, "illegal option", isc_commandline_option); return (BADOPT); @@ -199,11 +195,7 @@ isc_commandline_parse(int argc, char * const *argv, const char *options) { if (isc_commandline_errprint) fprintf(stderr, "%s: %s -- %c\n", isc_commandline_progname, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_COMMANDLINE, - ISC_MSG_OPTNEEDARG, - "option requires " - "an argument"), + "option requires an argument", isc_commandline_option); return (BADOPT); diff --git a/usr.sbin/bind/lib/isc/error.c b/usr.sbin/bind/lib/isc/error.c index e71c6bab9ee..5149767e846 100644 --- a/usr.sbin/bind/lib/isc/error.c +++ b/usr.sbin/bind/lib/isc/error.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: error.c,v 1.4 2020/01/09 13:47:13 florian Exp $ */ +/* $Id: error.c,v 1.5 2020/01/20 18:46:57 florian Exp $ */ /*! \file */ @@ -79,8 +79,7 @@ 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) %s", expression, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed")); + "failed"); } static void @@ -97,9 +96,7 @@ static void default_fatal_callback(const char *file, int line, const char *format, va_list args) { - fprintf(stderr, "%s:%d: %s: ", file, line, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FATALERROR, "fatal error")); + fprintf(stderr, "%s:%d: %s: ", file, line, "fatal error"); vfprintf(stderr, format, args); fprintf(stderr, "\n"); fflush(stderr); diff --git a/usr.sbin/bind/lib/isc/include/isc/Makefile.in b/usr.sbin/bind/lib/isc/include/isc/Makefile.in index b888fa96132..e4eb65f9187 100644 --- a/usr.sbin/bind/lib/isc/include/isc/Makefile.in +++ b/usr.sbin/bind/lib/isc/include/isc/Makefile.in @@ -30,7 +30,7 @@ HEADERS = aes.h app.h assertions.h base32.h base64.h \ hash.h heap.h hex.h hmacmd5.h hmacsha.h \ @ISC_IPV6_H@ iterated_hash.h \ lang.h lex.h lfsr.h lib.h likely.h list.h log.h \ - magic.h md5.h mem.h msgcat.h msgs.h mutexblock.h \ + magic.h md5.h mem.h msgs.h mutexblock.h \ netaddr.h netscope.h ondestroy.h parseint.h \ pool.h portset.h print.h queue.h quota.h \ radix.h ratelimiter.h refcount.h regex.h \ diff --git a/usr.sbin/bind/lib/isc/include/isc/lib.h b/usr.sbin/bind/lib/isc/include/isc/lib.h index 30f4469d856..d41c0bdaab7 100644 --- a/usr.sbin/bind/lib/isc/include/isc/lib.h +++ b/usr.sbin/bind/lib/isc/include/isc/lib.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lib.h,v 1.4 2020/01/09 14:18:30 florian Exp $ */ +/* $Id: lib.h,v 1.5 2020/01/20 18:46:57 florian Exp $ */ #ifndef ISC_LIB_H #define ISC_LIB_H 1 @@ -26,15 +26,6 @@ ISC_LANG_BEGINDECLS -extern isc_msgcat_t *isc_msgcat; - -void -isc_lib_initmsgcat(void); -/*!< - * \brief Initialize the ISC library's message catalog, isc_msgcat, if it - * has not already been initialized. - */ - void isc_lib_register(void); /*!< diff --git a/usr.sbin/bind/lib/isc/include/isc/log.h b/usr.sbin/bind/lib/isc/include/isc/log.h index 7b148212da4..5464f531c53 100644 --- a/usr.sbin/bind/lib/isc/include/isc/log.h +++ b/usr.sbin/bind/lib/isc/include/isc/log.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: log.h,v 1.7 2020/01/09 14:18:30 florian Exp $ */ +/* $Id: log.h,v 1.8 2020/01/20 18:46:57 florian Exp $ */ #ifndef ISC_LOG_H #define ISC_LOG_H 1 @@ -634,50 +634,6 @@ isc_log_vwrite1(isc_log_t *lctx, isc_logcategory_t *category, ISC_FORMAT_PRINTF(5, 0); -/*% - * These are four internationalized versions of the isc_log_[v]write[1] - * functions. - * - * The only difference is that they take arguments for a message - * catalog, message set, and message number, all immediately preceding the - * format argument. The format argument becomes the default text, a la - * isc_msgcat_get. If the message catalog is NULL, no lookup is attempted - * for a message -- which makes the message set and message number irrelevant, - * and the non-internationalized call should have probably been used instead. - * - * Yes, that means there are now *eight* interfaces to logging a message. - * Sheesh. Make the madness stop! - */ -/*@{*/ -void -isc_log_iwrite(isc_log_t *lctx, isc_logcategory_t *category, - isc_logmodule_t *module, int level, - isc_msgcat_t *msgcat, int msgset, int message, - const char *format, ...) -ISC_FORMAT_PRINTF(8, 9); - -void -isc_log_ivwrite(isc_log_t *lctx, isc_logcategory_t *category, - isc_logmodule_t *module, int level, - isc_msgcat_t *msgcat, int msgset, int message, - const char *format, va_list args) -ISC_FORMAT_PRINTF(8, 0); - -void -isc_log_iwrite1(isc_log_t *lctx, isc_logcategory_t *category, - isc_logmodule_t *module, int level, - isc_msgcat_t *msgcat, int msgset, int message, - const char *format, ...) -ISC_FORMAT_PRINTF(8, 9); - -void -isc_log_ivwrite1(isc_log_t *lctx, isc_logcategory_t *category, - isc_logmodule_t *module, int level, - isc_msgcat_t *msgcat, int msgset, int message, - const char *format, va_list args) -ISC_FORMAT_PRINTF(8, 0); -/*@}*/ - void isc_log_setdebuglevel(isc_log_t *lctx, unsigned int level); /*%< diff --git a/usr.sbin/bind/lib/isc/include/isc/msgcat.h b/usr.sbin/bind/lib/isc/include/isc/msgcat.h deleted file mode 100644 index e1bac9f372d..00000000000 --- a/usr.sbin/bind/lib/isc/include/isc/msgcat.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: msgcat.h,v 1.3 2019/12/17 01:46:35 sthen Exp $ */ - -#ifndef ISC_MSGCAT_H -#define ISC_MSGCAT_H 1 - -/***** - ***** Module Info - *****/ - -/*! \file isc/msgcat.h - * \brief The ISC Message Catalog - * aids internationalization of applications by allowing - * messages to be retrieved from locale-specific files instead of - * hardwiring them into the application. This allows translations of - * messages appropriate to the locale to be supplied without recompiling - * the application. - * - * Notes: - *\li It's very important that message catalogs work, even if only the - * default_text can be used. - * - * MP: - *\li The caller must ensure appropriate synchronization of - * isc_msgcat_open() and isc_msgcat_close(). isc_msgcat_get() - * ensures appropriate synchronization. - * - * Reliability: - *\li No anticipated impact. - * - * Resources: - *\li TBS - * - * \li Security: - * No anticipated impact. - * - * \li Standards: - * None. - */ - -/***** - ***** Imports - *****/ - -#include <isc/lang.h> -#include <isc/types.h> - -ISC_LANG_BEGINDECLS - -/***** - ***** Methods - *****/ - -void -isc_msgcat_open(const char *name, isc_msgcat_t **msgcatp); -/*%< - * Open a message catalog. - * - * Notes: - * - *\li If memory cannot be allocated or other failures occur, *msgcatp - * will be set to NULL. If a NULL msgcat is given to isc_msgcat_get(), - * the default_text will be returned, ensuring that some message text - * will be available, no matter what's going wrong. - * - * Requires: - * - *\li 'name' is a valid string. - * - *\li msgcatp != NULL && *msgcatp == NULL - */ - -void -isc_msgcat_close(isc_msgcat_t **msgcatp); -/*%< - * Close a message catalog. - * - * Notes: - * - *\li Any string pointers returned by prior calls to isc_msgcat_get() are - * invalid after isc_msgcat_close() has been called and must not be - * used. - * - * Requires: - * - *\li *msgcatp is a valid message catalog or is NULL. - * - * Ensures: - * - *\li All resources associated with the message catalog are released. - * - *\li *msgcatp == NULL - */ - -const char * -isc_msgcat_get(isc_msgcat_t *msgcat, int set, int message, - const char *default_text); -/*%< - * Get message 'message' from message set 'set' in 'msgcat'. If it - * is not available, use 'default_text'. - * - * Requires: - * - *\li 'msgcat' is a valid message catalog or is NULL. - * - *\li set > 0 - * - *\li message > 0 - * - *\li 'default_text' is a valid string. - */ - -ISC_LANG_ENDDECLS - -#endif /* ISC_MSGCAT_H */ diff --git a/usr.sbin/bind/lib/isc/include/isc/msgs.h b/usr.sbin/bind/lib/isc/include/isc/msgs.h index 84b5bdc3d80..0319540c219 100644 --- a/usr.sbin/bind/lib/isc/include/isc/msgs.h +++ b/usr.sbin/bind/lib/isc/include/isc/msgs.h @@ -14,15 +14,14 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: msgs.h,v 1.3 2019/12/17 01:46:35 sthen Exp $ */ +/* $Id: msgs.h,v 1.4 2020/01/20 18:46:57 florian Exp $ */ #ifndef ISC_MSGS_H #define ISC_MSGS_H 1 /*! \file isc/msgs.h */ -#include <isc/lib.h> /* Provide isc_msgcat global variable. */ -#include <isc/msgcat.h> /* Provide isc_msgcat_*() functions. */ +#include <isc/lib.h> /*@{*/ /*! diff --git a/usr.sbin/bind/lib/isc/include/isc/result.h b/usr.sbin/bind/lib/isc/include/isc/result.h index 00b00f07cf0..8e5e69b7161 100644 --- a/usr.sbin/bind/lib/isc/include/isc/result.h +++ b/usr.sbin/bind/lib/isc/include/isc/result.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: result.h,v 1.4 2019/12/17 01:46:35 sthen Exp $ */ +/* $Id: result.h,v 1.5 2020/01/20 18:46:57 florian Exp $ */ #ifndef ISC_RESULT_H #define ISC_RESULT_H 1 @@ -103,7 +103,7 @@ isc_result_totext(isc_result_t); isc_result_t isc_result_register(unsigned int base, unsigned int nresults, - const char **text, isc_msgcat_t *msgcat, int set); + const char **text, int set); ISC_LANG_ENDDECLS diff --git a/usr.sbin/bind/lib/isc/include/isc/types.h b/usr.sbin/bind/lib/isc/include/isc/types.h index a5ee0fb9ca6..65cd346699a 100644 --- a/usr.sbin/bind/lib/isc/include/isc/types.h +++ b/usr.sbin/bind/lib/isc/include/isc/types.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: types.h,v 1.10 2020/01/09 19:50:35 florian Exp $ */ +/* $Id: types.h,v 1.11 2020/01/20 18:46:57 florian Exp $ */ #ifndef ISC_TYPES_H #define ISC_TYPES_H 1 @@ -68,7 +68,6 @@ typedef struct isc_logconfig isc_logconfig_t; /*%< Log Configuration */ typedef struct isc_logmodule isc_logmodule_t; /*%< Log Module */ typedef struct isc_mem isc_mem_t; /*%< Memory */ typedef struct isc_mempool isc_mempool_t; /*%< Memory Pool */ -typedef struct isc_msgcat isc_msgcat_t; /*%< Message Catalog */ typedef struct isc_ondestroy isc_ondestroy_t; /*%< On Destroy */ typedef struct isc_netaddr isc_netaddr_t; /*%< Net Address */ typedef struct isc_portset isc_portset_t; /*%< Port Set */ diff --git a/usr.sbin/bind/lib/isc/include/isc/util.h b/usr.sbin/bind/lib/isc/include/isc/util.h index d9639de7326..f12b515118a 100644 --- a/usr.sbin/bind/lib/isc/include/isc/util.h +++ b/usr.sbin/bind/lib/isc/include/isc/util.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: util.h,v 1.3 2019/12/17 01:46:35 sthen Exp $ */ +/* $Id: util.h,v 1.4 2020/01/20 18:46:57 florian Exp $ */ #ifndef ISC_UTIL_H #define ISC_UTIL_H 1 @@ -85,33 +85,13 @@ * for us to continue if they fail. */ -#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 - #include <isc/result.h> /* Contractual promise. */ #define LOCK(lp) do { \ - 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, "%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, "%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) #define DESTROYLOCK(lp) \ @@ -119,35 +99,13 @@ #define BROADCAST(cvp) do { \ - 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, "%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, "%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, "%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) /* @@ -161,21 +119,9 @@ isc_condition_waituntil((cvp), (lp), (tp)) #define RWLOCK(lp, t) do { \ - 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, "%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, "%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) diff --git a/usr.sbin/bind/lib/isc/lex.c b/usr.sbin/bind/lib/isc/lex.c index ad09c10f621..956ac51e848 100644 --- a/usr.sbin/bind/lib/isc/lex.c +++ b/usr.sbin/bind/lib/isc/lex.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lex.c,v 1.10 2020/01/09 18:17:19 florian Exp $ */ +/* $Id: lex.c,v 1.11 2020/01/20 18:46:57 florian Exp $ */ /*! \file */ @@ -779,10 +779,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { } break; default: - FATAL_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_LEX, - ISC_MSG_UNEXPECTEDSTATE, - "Unexpected state %d"), + FATAL_ERROR(__FILE__, __LINE__, "Unexpected state %d", state); /* Does not return. */ } diff --git a/usr.sbin/bind/lib/isc/lib.c b/usr.sbin/bind/lib/isc/lib.c index 78d68dabc1b..3b4c75a0b85 100644 --- a/usr.sbin/bind/lib/isc/lib.c +++ b/usr.sbin/bind/lib/isc/lib.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lib.c,v 1.5 2020/01/09 14:18:30 florian Exp $ */ +/* $Id: lib.c,v 1.6 2020/01/20 18:46:57 florian Exp $ */ /*! \file */ @@ -38,51 +38,14 @@ *** Globals ***/ -isc_msgcat_t * isc_msgcat = NULL; - - /*** *** Private ***/ -static isc_once_t msgcat_once = ISC_ONCE_INIT; - /*** *** Functions ***/ -static void -open_msgcat(void) { - isc_msgcat_open("libisc.cat", &isc_msgcat); -} - -void -isc_lib_initmsgcat(void) { - isc_result_t result; - - /*! - * Initialize the ISC library's message catalog, isc_msgcat, if it - * has not already been initialized. - */ - - result = isc_once_do(&msgcat_once, open_msgcat); - if (result != ISC_R_SUCCESS) { - /* - * 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: %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(); - } -} - static isc_once_t register_once = ISC_ONCE_INIT; static void diff --git a/usr.sbin/bind/lib/isc/log.c b/usr.sbin/bind/lib/isc/log.c index e8d5bbbba9e..b9333b5d196 100644 --- a/usr.sbin/bind/lib/isc/log.c +++ b/usr.sbin/bind/lib/isc/log.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: log.c,v 1.15 2020/01/09 18:17:19 florian Exp $ */ +/* $Id: log.c,v 1.16 2020/01/20 18:46:57 florian Exp $ */ /*! \file * \author Principal Authors: DCL */ @@ -239,9 +239,8 @@ roll_log(isc_logchannel_t *channel); static void isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, isc_logmodule_t *module, int level, isc_boolean_t write_once, - isc_msgcat_t *msgcat, int msgset, int msg, const char *format, va_list args) - ISC_FORMAT_PRINTF(9, 0); + ISC_FORMAT_PRINTF(6, 0); /*@{*/ /*! @@ -838,8 +837,7 @@ isc_log_write(isc_log_t *lctx, isc_logcategory_t *category, */ va_start(args, format); - isc_log_doit(lctx, category, module, level, ISC_FALSE, - NULL, 0, 0, format, args); + isc_log_doit(lctx, category, module, level, ISC_FALSE, format, args); va_end(args); } @@ -851,8 +849,7 @@ isc_log_vwrite(isc_log_t *lctx, isc_logcategory_t *category, /* * Contract checking is done in isc_log_doit(). */ - isc_log_doit(lctx, category, module, level, ISC_FALSE, - NULL, 0, 0, format, args); + isc_log_doit(lctx, category, module, level, ISC_FALSE, format, args); } void @@ -866,8 +863,7 @@ isc_log_write1(isc_log_t *lctx, isc_logcategory_t *category, */ va_start(args, format); - isc_log_doit(lctx, category, module, level, ISC_TRUE, - NULL, 0, 0, format, args); + isc_log_doit(lctx, category, module, level, ISC_TRUE, format, args); va_end(args); } @@ -879,70 +875,7 @@ isc_log_vwrite1(isc_log_t *lctx, isc_logcategory_t *category, /* * Contract checking is done in isc_log_doit(). */ - isc_log_doit(lctx, category, module, level, ISC_TRUE, - NULL, 0, 0, format, args); -} - -void -isc_log_iwrite(isc_log_t *lctx, isc_logcategory_t *category, - isc_logmodule_t *module, int level, - isc_msgcat_t *msgcat, int msgset, int msg, - const char *format, ...) -{ - va_list args; - - /* - * Contract checking is done in isc_log_doit(). - */ - - va_start(args, format); - isc_log_doit(lctx, category, module, level, ISC_FALSE, - msgcat, msgset, msg, format, args); - va_end(args); -} - -void -isc_log_ivwrite(isc_log_t *lctx, isc_logcategory_t *category, - isc_logmodule_t *module, int level, - isc_msgcat_t *msgcat, int msgset, int msg, - const char *format, va_list args) -{ - /* - * Contract checking is done in isc_log_doit(). - */ - isc_log_doit(lctx, category, module, level, ISC_FALSE, - msgcat, msgset, msg, format, args); -} - -void -isc_log_iwrite1(isc_log_t *lctx, isc_logcategory_t *category, - isc_logmodule_t *module, int level, - isc_msgcat_t *msgcat, int msgset, int msg, - const char *format, ...) -{ - va_list args; - - /* - * Contract checking is done in isc_log_doit(). - */ - - va_start(args, format); - isc_log_doit(lctx, category, module, level, ISC_TRUE, - msgcat, msgset, msg, format, args); - va_end(args); -} - -void -isc_log_ivwrite1(isc_log_t *lctx, isc_logcategory_t *category, - isc_logmodule_t *module, int level, - isc_msgcat_t *msgcat, int msgset, int msg, - const char *format, va_list args) -{ - /* - * Contract checking is done in isc_log_doit(). - */ - isc_log_doit(lctx, category, module, level, ISC_TRUE, - msgcat, msgset, msg, format, args); + isc_log_doit(lctx, category, module, level, ISC_TRUE, format, args); } void @@ -1392,7 +1325,6 @@ isc_log_wouldlog(isc_log_t *lctx, int level) { static void isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, isc_logmodule_t *module, int level, isc_boolean_t write_once, - isc_msgcat_t *msgcat, int msgset, int msg, const char *format, va_list args) { int syslog_level; @@ -1428,10 +1360,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, if (! isc_log_wouldlog(lctx, level)) return; - if (msgcat != NULL) - iformat = isc_msgcat_get(msgcat, msgset, msg, format); - else - iformat = format; + iformat = format; time_string[0] = '\0'; level_string[0] = '\0'; @@ -1508,11 +1437,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, level_string[0] == '\0') { if (level < ISC_LOG_CRITICAL) snprintf(level_string, sizeof(level_string), - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_LOG, - ISC_MSG_LEVEL, - "level %d: "), - level); + "level %d: ", level); else if (level > ISC_LOG_DYNAMIC) snprintf(level_string, sizeof(level_string), "%s %d: ", log_level_strings[0], diff --git a/usr.sbin/bind/lib/isc/mem.c b/usr.sbin/bind/lib/isc/mem.c index eec2360fefc..47324f07f18 100644 --- a/usr.sbin/bind/lib/isc/mem.c +++ b/usr.sbin/bind/lib/isc/mem.c @@ -390,10 +390,7 @@ add_trace_entry(isc__mem_t *mctx, const void *ptr, size_t size FLARG) { size_t mysize = size; if ((isc_mem_debugging & ISC_MEM_DEBUGTRACE) != 0) - fprintf(stderr, isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM, - ISC_MSG_ADDTRACE, - "add %p size %u " - "file %s line %u mctx %p\n"), + fprintf(stderr, "add %p size %lu file %s line %u mctx %p\n", ptr, size, file, line, mctx); if (mctx->debuglist == NULL) @@ -449,10 +446,7 @@ delete_trace_entry(isc__mem_t *mctx, const void *ptr, size_t size, unsigned int i; if ((isc_mem_debugging & ISC_MEM_DEBUGTRACE) != 0) - fprintf(stderr, isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM, - ISC_MSG_DELTRACE, - "del %p size %u " - "file %s line %u mctx %p\n"), + fprintf(stderr, "del %p size %lu file %s line %u mctx %p\n", ptr, size, file, line, mctx); if (mctx->debuglist == NULL) @@ -1361,14 +1355,10 @@ print_active(isc__mem_t *mctx, FILE *out) { const char *format; isc_boolean_t found; - fprintf(out, "%s", isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM, - ISC_MSG_DUMPALLOC, - "Dump of all outstanding " - "memory allocations:\n")); + fprintf(out, "%s", "Dump of all outstanding " + "memory allocations:\n"); found = ISC_FALSE; - format = isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM, - ISC_MSG_PTRFILELINE, - "\tptr %p size %u file %s line %u\n"); + format = "\tptr %p size %u file %s line %u\n"; for (i = 0; i <= mctx->max_size; i++) { dl = ISC_LIST_HEAD(mctx->debuglist[i]); @@ -1387,8 +1377,7 @@ print_active(isc__mem_t *mctx, FILE *out) { } } if (!found) - fputs(isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM, - ISC_MSG_NONE, "\tNone.\n"), out); + fputs("\tNone.\n", out); } } #endif @@ -1430,27 +1419,10 @@ isc_mem_stats(isc_mem_t *ctx0, FILE *out) { */ pool = ISC_LIST_HEAD(ctx->pools); if (pool != NULL) { - fprintf(out, "%s", isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM, - ISC_MSG_POOLSTATS, - "[Pool statistics]\n")); + fprintf(out, "%s", "[Pool statistics]\n"); fprintf(out, "%15s %10s %10s %10s %10s %10s %10s %10s %1s\n", - 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"); + "name", "size", "maxalloc", "allocated", "freecount", + "freemax", "fillcount", "gets", "L"); } while (pool != NULL) { fprintf(out, "%15s %10lu %10u %10u %10u %10u %10u %10u %s\n", diff --git a/usr.sbin/bind/lib/isc/netaddr.c b/usr.sbin/bind/lib/isc/netaddr.c index 9c49b4e806d..bf4c5175b40 100644 --- a/usr.sbin/bind/lib/isc/netaddr.c +++ b/usr.sbin/bind/lib/isc/netaddr.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: netaddr.c,v 1.8 2020/01/09 18:17:19 florian Exp $ */ +/* $Id: netaddr.c,v 1.9 2020/01/20 18:46:57 florian Exp $ */ /*! \file */ @@ -195,10 +195,7 @@ isc_netaddr_format(const isc_netaddr_t *na, char *array, unsigned int size) { } if (result != ISC_R_SUCCESS) { - snprintf(array, size, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_NETADDR, - ISC_MSG_UNKNOWNADDR, - "<unknown address, family %u>"), + snprintf(array, size, "<unknown address, family %u>", na->family); array[size - 1] = '\0'; } diff --git a/usr.sbin/bind/lib/isc/nls/Makefile.in b/usr.sbin/bind/lib/isc/nls/Makefile.in deleted file mode 100644 index 2db746fb91a..00000000000 --- a/usr.sbin/bind/lib/isc/nls/Makefile.in +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.in,v 1.3 2019/12/17 01:46:35 sthen Exp $ - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -CINCLUDES = -I../unix/include \ - -I${srcdir}/../unix/include \ - -I../include \ - -I${srcdir}/../include - -CDEFINES = -CWARNINGS = - -OBJS = msgcat.@O@ - -SRCS = msgcat.c - -SUBDIRS = -TARGETS = ${OBJS} - -@BIND9_MAKE_RULES@ diff --git a/usr.sbin/bind/lib/isc/nls/msgcat.c b/usr.sbin/bind/lib/isc/nls/msgcat.c deleted file mode 100644 index 73e58f78101..00000000000 --- a/usr.sbin/bind/lib/isc/nls/msgcat.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: msgcat.c,v 1.3 2019/12/17 01:46:35 sthen Exp $ */ - -/*! \file msgcat.c - * - * \author Principal Author: Bob Halley - */ - -#include <config.h> - -#include <stddef.h> -#include <stdlib.h> - -#include <isc/magic.h> -#include <isc/msgcat.h> -#include <isc/util.h> - -#ifdef HAVE_CATGETS -#include <nl_types.h> /* Required for nl_catd. */ -#endif - -/* - * Implementation Notes: - * - * We use malloc() and free() instead of isc_mem_get() and isc_mem_put() - * because we don't want to require a memory context to be specified - * in order to use a message catalog. - */ - -struct isc_msgcat { - unsigned int magic; -#ifdef HAVE_CATGETS - nl_catd catalog; -#endif -}; - -#define MSGCAT_MAGIC ISC_MAGIC('M', 'C', 'a', 't') -#define VALID_MSGCAT(m) ISC_MAGIC_VALID(m, MSGCAT_MAGIC) - -void -isc_msgcat_open(const char *name, isc_msgcat_t **msgcatp) { - isc_msgcat_t *msgcat; - - /* - * Open a message catalog. - */ - - REQUIRE(name != NULL); - REQUIRE(msgcatp != NULL && *msgcatp == NULL); - - msgcat = malloc(sizeof(*msgcat)); - if (msgcat == NULL) { - *msgcatp = NULL; - return; - } - -#ifdef HAVE_CATGETS - /* - * We don't check if catopen() fails because we don't care. - * If it does fail, then when we call catgets(), it will use - * the default string. - */ - msgcat->catalog = catopen(name, 0); -#endif - msgcat->magic = MSGCAT_MAGIC; - - *msgcatp = msgcat; -} - -void -isc_msgcat_close(isc_msgcat_t **msgcatp) { - isc_msgcat_t *msgcat; - - /* - * Close a message catalog. - */ - - REQUIRE(msgcatp != NULL); - msgcat = *msgcatp; - REQUIRE(VALID_MSGCAT(msgcat) || msgcat == NULL); - - if (msgcat != NULL) { -#ifdef HAVE_CATGETS - if (msgcat->catalog != (nl_catd)(-1)) - (void)catclose(msgcat->catalog); -#endif - msgcat->magic = 0; - free(msgcat); - } - - *msgcatp = NULL; -} - -const char * -isc_msgcat_get(isc_msgcat_t *msgcat, int set, int message, - const char *default_text) -{ - /* - * Get message 'message' from message set 'set' in 'msgcat'. If it - * is not available, use 'default'. - */ - - REQUIRE(VALID_MSGCAT(msgcat) || msgcat == NULL); - REQUIRE(set > 0); - REQUIRE(message > 0); - REQUIRE(default_text != NULL); - -#ifdef HAVE_CATGETS - if (msgcat == NULL) - return (default_text); - return (catgets(msgcat->catalog, set, message, default_text)); -#else - return (default_text); -#endif -} diff --git a/usr.sbin/bind/lib/isc/result.c b/usr.sbin/bind/lib/isc/result.c index 01369809756..7207140caa4 100644 --- a/usr.sbin/bind/lib/isc/result.c +++ b/usr.sbin/bind/lib/isc/result.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: result.c,v 1.3 2019/12/17 01:46:34 sthen Exp $ */ +/* $Id: result.c,v 1.4 2020/01/20 18:46:57 florian Exp $ */ /*! \file */ @@ -34,7 +34,6 @@ typedef struct resulttable { unsigned int base; unsigned int last; const char ** text; - isc_msgcat_t * msgcat; int set; ISC_LINK(struct resulttable) link; } resulttable; @@ -115,7 +114,7 @@ static isc_mutex_t lock; static isc_result_t register_table(unsigned int base, unsigned int nresults, const char **text, - isc_msgcat_t *msgcat, int set) + int set) { resulttable *table; @@ -133,7 +132,6 @@ register_table(unsigned int base, unsigned int nresults, const char **text, table->base = base; table->last = base + nresults - 1; table->text = text; - table->msgcat = msgcat; table->set = set; ISC_LINK_INIT(table, link); @@ -154,25 +152,22 @@ initialize_action(void) { ISC_LIST_INIT(tables); result = register_table(ISC_RESULTCLASS_ISC, ISC_R_NRESULTS, - description, isc_msgcat, ISC_RESULT_RESULTSET); + description, ISC_RESULT_RESULTSET); if (result != ISC_R_SUCCESS) UNEXPECTED_ERROR(__FILE__, __LINE__, - "register_table() %s: %u", - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed"), + "register_table() %s: %u", "failed", result); } static void initialize(void) { - isc_lib_initmsgcat(); RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS); } const char * isc_result_totext(isc_result_t result) { resulttable *table; - const char *text, *default_text; + const char *text; int index; initialize(); @@ -185,20 +180,12 @@ isc_result_totext(isc_result_t result) { table = ISC_LIST_NEXT(table, link)) { if (result >= table->base && result <= table->last) { index = (int)(result - table->base); - default_text = table->text[index]; - /* - * Note: we use 'index + 1' as the message number - * instead of index because isc_msgcat_get() requires - * the message number to be > 0. - */ - text = isc_msgcat_get(table->msgcat, table->set, - index + 1, default_text); + text = table->text[index]; break; } } if (text == NULL) - text = isc_msgcat_get(isc_msgcat, ISC_RESULT_UNAVAILABLESET, - 1, "(result code text not available)"); + text = "(result code text not available)"; UNLOCK(&lock); @@ -207,9 +194,9 @@ isc_result_totext(isc_result_t result) { isc_result_t isc_result_register(unsigned int base, unsigned int nresults, - const char **text, isc_msgcat_t *msgcat, int set) + const char **text, int set) { initialize(); - return (register_table(base, nresults, text, msgcat, set)); + return (register_table(base, nresults, text, set)); } diff --git a/usr.sbin/bind/lib/isc/sockaddr.c b/usr.sbin/bind/lib/isc/sockaddr.c index 1a7a15f0f32..108abb16434 100644 --- a/usr.sbin/bind/lib/isc/sockaddr.c +++ b/usr.sbin/bind/lib/isc/sockaddr.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sockaddr.c,v 1.12 2020/01/09 14:18:30 florian Exp $ */ +/* $Id: sockaddr.c,v 1.13 2020/01/20 18:46:57 florian Exp $ */ /*! \file */ @@ -188,10 +188,7 @@ isc_sockaddr_format(const isc_sockaddr_t *sa, char *array, unsigned int size) { /* * The message is the same as in netaddr.c. */ - snprintf(array, size, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_NETADDR, - ISC_MSG_UNKNOWNADDR, - "<unknown address, family %u>"), + snprintf(array, size, "<unknown address, family %u>", sa->type.sa.sa_family); array[size - 1] = '\0'; } @@ -225,11 +222,8 @@ isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only) { break; default: UNEXPECTED_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_SOCKADDR, - ISC_MSG_UNKNOWNFAMILY, - "unknown address family: %d"), - (int)sockaddr->type.sa.sa_family); + "unknown address family: %d", + (int)sockaddr->type.sa.sa_family); s = (const unsigned char *)&sockaddr->type; length = sockaddr->length; p = 0; @@ -341,9 +335,7 @@ isc_sockaddr_pf(const isc_sockaddr_t *sockaddr) { return (PF_INET6); default: FATAL_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKADDR, - ISC_MSG_UNKNOWNFAMILY, - "unknown address family: %d"), + "unknown address family: %d", (int)sockaddr->type.sa.sa_family); } #endif @@ -386,9 +378,7 @@ isc_sockaddr_setport(isc_sockaddr_t *sockaddr, in_port_t port) { break; default: FATAL_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKADDR, - ISC_MSG_UNKNOWNFAMILY, - "unknown address family: %d"), + "unknown address family: %d", (int)sockaddr->type.sa.sa_family); } } @@ -406,9 +396,7 @@ isc_sockaddr_getport(const isc_sockaddr_t *sockaddr) { break; default: FATAL_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKADDR, - ISC_MSG_UNKNOWNFAMILY, - "unknown address family: %d"), + "unknown address family: %d", (int)sockaddr->type.sa.sa_family); } diff --git a/usr.sbin/bind/lib/isc/task.c b/usr.sbin/bind/lib/isc/task.c index 40b2af491fe..2aee4654565 100644 --- a/usr.sbin/bind/lib/isc/task.c +++ b/usr.sbin/bind/lib/isc/task.c @@ -373,8 +373,7 @@ task_shutdown(isc__task_t *task) { XTRACE("task_shutdown"); if (! TASK_SHUTTINGDOWN(task)) { - XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_SHUTTINGDOWN, "shutting down")); + XTRACE("shutting down"); task->flags |= TASK_F_SHUTTINGDOWN; if (task->state == task_state_idle) { INSIST(EMPTY(task->events)); @@ -994,8 +993,7 @@ dispatch(isc__taskmgr_t *manager) { if (total_dispatch_count >= DEFAULT_TASKMGR_QUANTUM || empty_readyq(manager)) break; - XTHREADTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TASK, - ISC_MSG_WORKING, "working")); + XTHREADTRACE("working"); task = pop_readyq(manager); if (task != NULL) { @@ -1019,8 +1017,7 @@ dispatch(isc__taskmgr_t *manager) { LOCK(&task->lock); INSIST(task->state == task_state_ready); task->state = task_state_running; - XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_RUNNING, "running")); + XTRACE("running"); isc_stdtime_get(&task->now); do { if (!EMPTY(task->events)) { @@ -1031,10 +1028,7 @@ dispatch(isc__taskmgr_t *manager) { /* * Execute the event action. */ - XTRACE(isc_msgcat_get(isc_msgcat, - ISC_MSGSET_TASK, - ISC_MSG_EXECUTE, - "execute action")); + XTRACE("execute action"); if (event->ev_action != NULL) { UNLOCK(&task->lock); (event->ev_action)( @@ -1082,20 +1076,13 @@ dispatch(isc__taskmgr_t *manager) { * Nothing else to do for this task * right now. */ - XTRACE(isc_msgcat_get(isc_msgcat, - ISC_MSGSET_TASK, - ISC_MSG_EMPTY, - "empty")); + XTRACE("empty"); if (task->references == 0 && TASK_SHUTTINGDOWN(task)) { /* * The task is done. */ - XTRACE(isc_msgcat_get( - isc_msgcat, - ISC_MSGSET_TASK, - ISC_MSG_DONE, - "done")); + XTRACE("done"); finished = ISC_TRUE; task->state = task_state_done; } else @@ -1112,10 +1099,7 @@ dispatch(isc__taskmgr_t *manager) { * dispatching at least one event, * so the minimum quantum is one. */ - XTRACE(isc_msgcat_get(isc_msgcat, - ISC_MSGSET_TASK, - ISC_MSG_QUANTUM, - "quantum")); + XTRACE("quantum"); task->state = task_state_ready; requeue = ISC_TRUE; done = ISC_TRUE; diff --git a/usr.sbin/bind/lib/isc/timer.c b/usr.sbin/bind/lib/isc/timer.c index 2272b1bac8b..2e61f0a927e 100644 --- a/usr.sbin/bind/lib/isc/timer.c +++ b/usr.sbin/bind/lib/isc/timer.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: timer.c,v 1.10 2020/01/20 18:45:29 florian Exp $ */ +/* $Id: timer.c,v 1.11 2020/01/20 18:46:57 florian Exp $ */ /*! \file */ @@ -230,8 +230,7 @@ schedule(isc__timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) { manager->nscheduled++; } - XTRACETIMER(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TIMER, - ISC_MSG_SCHEDULE, "schedule"), timer, due); + XTRACETIMER("schedule", timer, due); /* * If this timer is at the head of the queue, we need to ensure @@ -635,21 +634,14 @@ dispatch(isc__timermgr_t *manager, isc_time_t *now) { * Idle timer has been touched; * reschedule. */ - XTRACEID(isc_msgcat_get(isc_msgcat, - ISC_MSGSET_TIMER, - ISC_MSG_IDLERESCHED, - "idle reschedule"), - timer); + XTRACEID("idle reschedule", timer); post_event = ISC_FALSE; need_schedule = ISC_TRUE; } } if (post_event) { - XTRACEID(isc_msgcat_get(isc_msgcat, - ISC_MSGSET_TIMER, - ISC_MSG_POSTING, - "posting"), timer); + XTRACEID("posting", timer); /* * XXX We could preallocate this event. */ @@ -666,11 +658,7 @@ dispatch(isc__timermgr_t *manager, isc_time_t *now) { ISC_EVENT_PTR(&event)); } else UNEXPECTED_ERROR(__FILE__, __LINE__, "%s", - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_TIMER, - ISC_MSG_EVENTNOTALLOC, - "couldn't " - "allocate event")); + "couldn't allocate event"); } timer->index = 0; @@ -681,13 +669,9 @@ dispatch(isc__timermgr_t *manager, isc_time_t *now) { result = schedule(timer, now, ISC_FALSE); if (result != ISC_R_SUCCESS) UNEXPECTED_ERROR(__FILE__, __LINE__, - "%s: %u", - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_TIMER, - ISC_MSG_SCHEDFAIL, - "couldn't schedule " - "timer"), - result); + "%s: %u", + "couldn't schedule timer", + result); } } else { manager->due = timer->due; diff --git a/usr.sbin/bind/lib/isc/unix/app.c b/usr.sbin/bind/lib/isc/unix/app.c index 41a40bf537e..52d64942054 100644 --- a/usr.sbin/bind/lib/isc/unix/app.c +++ b/usr.sbin/bind/lib/isc/unix/app.c @@ -171,10 +171,7 @@ handle_signal(int sig, void (*handler)(int)) { sigaction(sig, &sa, NULL) < 0) { isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_APP, - ISC_MSG_SIGNALSETUP, - "handle_signal() %d setup: %s"), - sig, strbuf); + "handle_signal() %d setup: %s", sig, strbuf); return (ISC_R_UNEXPECTED); } diff --git a/usr.sbin/bind/lib/isc/unix/net.c b/usr.sbin/bind/lib/isc/unix/net.c index 9988989e3dd..5c0fb9c45ed 100644 --- a/usr.sbin/bind/lib/isc/unix/net.c +++ b/usr.sbin/bind/lib/isc/unix/net.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: net.c,v 1.10 2020/01/09 13:45:33 florian Exp $ */ +/* $Id: net.c,v 1.11 2020/01/20 18:46:57 florian Exp $ */ #include <config.h> @@ -148,11 +148,7 @@ try_proto(int domain) { default: isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, - "socket() %s: %s", - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), + "socket() %s: %s", "failed", strbuf); return (ISC_R_UNEXPECTED); } @@ -258,12 +254,7 @@ try_ipv6only(void) { if (s == -1) { isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, - "socket() %s: %s", - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); + "socket() %s: %s", "failed", strbuf); ipv6only_result = ISC_R_UNEXPECTED; return; } @@ -281,12 +272,7 @@ try_ipv6only(void) { if (s == -1) { isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, - "socket() %s: %s", - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); + "socket() %s: %s", "failed", strbuf); ipv6only_result = ISC_R_UNEXPECTED; return; } @@ -331,12 +317,7 @@ try_ipv6pktinfo(void) { if (s == -1) { isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, - "socket() %s: %s", - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); + "socket() %s: %s", "failed", strbuf); ipv6pktinfo_result = ISC_R_UNEXPECTED; return; } diff --git a/usr.sbin/bind/lib/isc/unix/socket.c b/usr.sbin/bind/lib/isc/unix/socket.c index 0055e88d782..cc9cd333c5a 100644 --- a/usr.sbin/bind/lib/isc/unix/socket.c +++ b/usr.sbin/bind/lib/isc/unix/socket.c @@ -643,12 +643,10 @@ manager_log(isc__socketmgr_t *sockmgr, static void socket_log(isc__socket_t *sock, isc_sockaddr_t *address, isc_logcategory_t *category, isc_logmodule_t *module, int level, - isc_msgcat_t *msgcat, int msgset, int message, - const char *fmt, ...) ISC_FORMAT_PRINTF(9, 10); + const char *fmt, ...) ISC_FORMAT_PRINTF(6, 7); static void socket_log(isc__socket_t *sock, isc_sockaddr_t *address, isc_logcategory_t *category, isc_logmodule_t *module, int level, - isc_msgcat_t *msgcat, int msgset, int message, const char *fmt, ...) { char msgbuf[2048]; @@ -663,13 +661,11 @@ socket_log(isc__socket_t *sock, isc_sockaddr_t *address, va_end(ap); if (address == NULL) { - isc_log_iwrite(isc_lctx, category, module, level, - msgcat, msgset, message, + isc_log_write(isc_lctx, category, module, level, "socket %p: %s", sock, msgbuf); } else { isc_sockaddr_format(address, peerbuf, sizeof(peerbuf)); - isc_log_iwrite(isc_lctx, category, module, level, - msgcat, msgset, message, + isc_log_write(isc_lctx, category, module, level, "socket %p %s: %s", sock, peerbuf, msgbuf); } } @@ -985,7 +981,6 @@ 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, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_PROCESSCMSG, "processing cmsg %p", cmsgp); if (cmsgp->cmsg_level == IPPROTO_IPV6 @@ -996,8 +991,6 @@ 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, - isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_IFRECEIVED, "interface received on ifindex %u", dev->pktinfo.ipi6_ifindex); if (IN6_IS_ADDR_MULTICAST(&pktinfop->ipi6_addr)) @@ -1135,7 +1128,6 @@ build_msghdr_send(isc__socket_t *sock, char* cmsgbuf, isc_socketevent_t *dev, struct in6_pktinfo *pktinfop; socket_log(sock, NULL, TRACE, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_SENDTODATA, "sendto pktinfo data, ifindex %u", dev->pktinfo.ipi6_ifindex); @@ -1206,11 +1198,7 @@ build_msghdr_send(isc__socket_t *sock, char* cmsgbuf, isc_socketevent_t *dev, "setsockopt(%d, IP_TOS, %.02x)" " %s: %s", sock->fd, dscp >> 2, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); + "failed", strbuf); } else sock->dscp = dscp; } @@ -1235,11 +1223,7 @@ build_msghdr_send(isc__socket_t *sock, char* cmsgbuf, isc_socketevent_t *dev, "setsockopt(%d, IPV6_TCLASS, " "%.02x) %s: %s", sock->fd, dscp >> 2, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); + "failed", strbuf); } else sock->dscp = dscp; } @@ -1479,8 +1463,6 @@ doio_recv(isc__socket_t *sock, isc_socketevent_t *dev) { if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL)) { isc__strerror(recv_errno, strbuf, sizeof(strbuf)); socket_log(sock, NULL, IOEVENT, - isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_DOIORECV, "doio_recv: recvmsg(%d) %d bytes, err %d/%s", sock->fd, cc, recv_errno, strbuf); } @@ -1550,8 +1532,6 @@ doio_recv(isc__socket_t *sock, isc_socketevent_t *dev) { if (isc_sockaddr_getport(&dev->address) == 0) { if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL)) { socket_log(sock, &dev->address, IOEVENT, - isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_ZEROPORT, "dropping source port zero packet"); } return (DOIO_SOFT); @@ -1565,7 +1545,6 @@ doio_recv(isc__socket_t *sock, isc_socketevent_t *dev) { } socket_log(sock, &dev->address, IOEVENT, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_PKTRECV, "packet received correctly"); /* @@ -1723,9 +1702,7 @@ doio_send(isc__socket_t *sock, isc_socketevent_t *dev) { if (cc == 0) { UNEXPECTED_ERROR(__FILE__, __LINE__, - "doio_send: send() %s 0", - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_RETURNED, "returned")); + "doio_send: send() %s 0", "returned"); } /* @@ -1817,8 +1794,7 @@ destroy(isc__socket_t **sockp) { isc__socket_t *sock = *sockp; isc__socketmgr_t *manager = sock->manager; - socket_log(sock, NULL, CREATION, isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_DESTROYING, "destroying"); + socket_log(sock, NULL, CREATION, "destroying"); INSIST(ISC_LIST_EMPTY(sock->accept_list)); INSIST(ISC_LIST_EMPTY(sock->recv_list)); @@ -2183,10 +2159,8 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, if (sock->fd >= (int)manager->maxsocks) { (void)close(sock->fd); - isc_log_iwrite(isc_lctx, ISC_LOGCATEGORY_GENERAL, + isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, - isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_TOOMANYFDS, "socket: file descriptor exceeds limit (%d/%u)", sock->fd, manager->maxsocks); return (ISC_R_NORESOURCES); @@ -2197,10 +2171,8 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, case EMFILE: case ENFILE: isc__strerror(errno, strbuf, sizeof(strbuf)); - isc_log_iwrite(isc_lctx, ISC_LOGCATEGORY_GENERAL, + isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, - isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_TOOMANYFDS, "%s: %s", err, strbuf); /* fallthrough */ case ENOBUFS: @@ -2219,11 +2191,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, default: isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, - "%s() %s: %s", err, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), + "%s() %s: %s", err, "failed", strbuf); return (ISC_R_UNEXPECTED); } @@ -2247,10 +2215,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, SO_BSDCOMPAT) %s: %s", - sock->fd, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed"), - strbuf); + sock->fd, "failed", strbuf); /* Press on... */ } #endif @@ -2261,10 +2226,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, SO_NOSIGPIPE) %s: %s", - sock->fd, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed"), - strbuf); + sock->fd, "failed", strbuf); /* Press on... */ } #endif @@ -2285,12 +2247,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, SO_TIMESTAMP) %s: %s", - sock->fd, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); + sock->fd, "failed", strbuf); /* Press on... */ } @@ -2302,11 +2259,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, IPV6_RECVPKTINFO) " - "%s: %s", sock->fd, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), + "%s: %s", sock->fd, "failed", strbuf); } #else @@ -2317,12 +2270,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, IPV6_PKTINFO) %s: %s", - sock->fd, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); + sock->fd, "failed", strbuf); } #endif /* IPV6_RECVPKTINFO */ #if defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DONT) @@ -2382,12 +2330,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, SO_RCVBUF, %d) %s: %s", - sock->fd, rcvbuf, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); + sock->fd, rcvbuf, "failed", strbuf); } } #endif @@ -2473,8 +2416,7 @@ socket_create(isc_socketmgr_t *manager0, int pf, isc_sockettype_t type, #endif UNLOCK(&manager->lock); - socket_log(sock, NULL, CREATION, isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_CREATED, dup_socket != NULL ? "dupped" : "created"); + socket_log(sock, NULL, CREATION, dup_socket != NULL ? "dupped" : "created"); return (ISC_R_SUCCESS); } @@ -2614,8 +2556,7 @@ isc__socket_fdwatchcreate(isc_socketmgr_t *manager0, int fd, int flags, if (flags & ISC_SOCKFDWATCH_WRITE) select_poke(sock->manager, sock->fd, SELECT_POKE_WRITE); - socket_log(sock, NULL, CREATION, isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_CREATED, "fdwatch-created"); + socket_log(sock, NULL, CREATION, "fdwatch-created"); return (ISC_R_SUCCESS); } @@ -2652,8 +2593,7 @@ isc__socket_fdwatchpoke(isc_socket_t *sock0, int flags) UNLOCK(&sock->lock); } - socket_log(sock, NULL, TRACE, isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_POKED, "fdwatch-poked flags: %d", flags); + socket_log(sock, NULL, TRACE, "fdwatch-poked flags: %d", flags); return (ISC_R_SUCCESS); } @@ -2951,7 +2891,6 @@ internal_accept(isc_task_t *me, isc_event_t *ev) { LOCK(&sock->lock); socket_log(sock, NULL, TRACE, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_ACCEPTLOCK, "internal_accept called, locked socket"); manager = sock->manager; @@ -3016,10 +2955,8 @@ internal_accept(isc_task_t *me, isc_event_t *ev) { switch (errno) { case ENFILE: case EMFILE: - isc_log_iwrite(isc_lctx, ISC_LOGCATEGORY_GENERAL, + isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, - isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_TOOMANYFDS, "%s: too many open file descriptors", err); goto soft_error; @@ -3046,11 +2983,7 @@ internal_accept(isc_task_t *me, isc_event_t *ev) { isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "internal_accept: %s() %s: %s", err, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); + "failed", strbuf); fd = -1; result = ISC_R_UNEXPECTED; } else { @@ -3075,10 +3008,8 @@ internal_accept(isc_task_t *me, isc_event_t *ev) { (void)close(fd); goto soft_error; } else if (fd >= (int)manager->maxsocks) { - isc_log_iwrite(isc_lctx, ISC_LOGCATEGORY_GENERAL, + isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, - isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_TOOMANYFDS, "accept: " "file descriptor exceeds limit (%d/%u)", fd, manager->maxsocks); @@ -3159,7 +3090,6 @@ internal_accept(isc_task_t *me, isc_event_t *ev) { #endif socket_log(sock, &NEWCONNSOCK(dev)->peer_address, CREATION, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_ACCEPTEDCXN, "accepted connection, new socket %p", dev->newsocket); @@ -3201,7 +3131,6 @@ internal_recv(isc_task_t *me, isc_event_t *ev) { LOCK(&sock->lock); socket_log(sock, NULL, IOEVENT, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_INTERNALRECV, "internal_recv: task %p got event %p", me, ev); INSIST(sock->pending_recv == 1); @@ -3269,7 +3198,6 @@ internal_send(isc_task_t *me, isc_event_t *ev) { LOCK(&sock->lock); socket_log(sock, NULL, IOEVENT, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_INTERNALSEND, "internal_send: task %p got event %p", me, ev); INSIST(sock->pending_send == 1); @@ -3324,7 +3252,6 @@ internal_fdwatch_write(isc_task_t *me, isc_event_t *ev) { LOCK(&sock->lock); socket_log(sock, NULL, IOEVENT, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_INTERNALSEND, "internal_fdwatch_write: task %p got event %p", me, ev); INSIST(sock->pending_send == 1); @@ -3365,7 +3292,6 @@ internal_fdwatch_read(isc_task_t *me, isc_event_t *ev) { LOCK(&sock->lock); socket_log(sock, NULL, IOEVENT, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_INTERNALRECV, "internal_fdwatch_read: task %p got event %p", me, ev); INSIST(sock->pending_recv == 1); @@ -3582,10 +3508,7 @@ setup_watcher(isc_mem_t *mctx, isc__socketmgr_t *manager) { result = isc__errno2result(errno); isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, - "kqueue %s: %s", - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed"), - strbuf); + "kqueue %s: %s", "failed", strbuf); isc_mem_put(mctx, manager->events, sizeof(struct kevent) * manager->nevents); return (result); @@ -3602,10 +3525,7 @@ setup_watcher(isc_mem_t *mctx, isc__socketmgr_t *manager) { result = isc__errno2result(errno); isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, - "epoll_create %s: %s", - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed"), - strbuf); + "epoll_create %s: %s", "failed", strbuf); isc_mem_put(mctx, manager->events, sizeof(struct epoll_event) * manager->nevents); return (result); @@ -4112,8 +4032,7 @@ socket_send(isc__socket_t *sock, isc_socketevent_t *dev, isc_task_t *task, if (!isc_sockaddr_issitelocal(&dev->address) && !isc_sockaddr_islinklocal(&dev->address)) { - socket_log(sock, NULL, TRACE, isc_msgcat, - ISC_MSGSET_SOCKET, ISC_MSG_PKTINFOPROVIDED, + socket_log(sock, NULL, TRACE, "pktinfo structure provided, ifindex %u " "(set to 0)", pktinfo->ipi6_ifindex); @@ -4513,9 +4432,7 @@ isc__socket_bind(isc_socket_t *sock0, isc_sockaddr_t *sockaddr, setsockopt(sock->fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on, sizeof(on)) < 0) { UNEXPECTED_ERROR(__FILE__, __LINE__, - "setsockopt(%d) %s", sock->fd, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed")); + "setsockopt(%d) %s", sock->fd, "failed"); /* Press on... */ } #ifdef AF_UNIX @@ -4541,8 +4458,7 @@ isc__socket_bind(isc_socket_t *sock0, isc_sockaddr_t *sockaddr, } } - socket_log(sock, sockaddr, TRACE, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_BOUND, "bound"); + socket_log(sock, sockaddr, TRACE, "bound"); sock->bound = 1; UNLOCK(&sock->lock); @@ -4575,9 +4491,8 @@ isc__socket_filter(isc_socket_t *sock0, const char *filter) { if (setsockopt(sock->fd, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa)) == -1) { isc__strerror(errno, strbuf, sizeof(strbuf)); - socket_log(sock, NULL, CREATION, isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_FILTER, "setsockopt(SO_ACCEPTFILTER): %s", - strbuf); + socket_log(sock, NULL, CREATION, + "setsockopt(SO_ACCEPTFILTER): %s", strbuf); return (ISC_R_FAILURE); } return (ISC_R_SUCCESS); @@ -5182,11 +5097,7 @@ isc__socket_ipv6only(isc_socket_t *sock0, isc_boolean_t yes) { isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, IPV6_V6ONLY) " - "%s: %s", sock->fd, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), + "%s: %s", sock->fd, "failed", strbuf); } } @@ -5207,11 +5118,7 @@ setdscp(isc__socket_t *sock, isc_dscp_t dscp) { UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, IP_TOS, %.02x) " "%s: %s", sock->fd, value >> 2, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); + "failed", strbuf); } } if (sock->pf == AF_INET6) { @@ -5222,11 +5129,7 @@ setdscp(isc__socket_t *sock, isc_dscp_t dscp) { UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d, IPV6_TCLASS, %.02x) " "%s: %s", sock->fd, dscp >> 2, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); + "failed", strbuf); } } } |
