From cc1b6f86f2e0bff7e903a4e7d2cd10e6a59b8b9c Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Thu, 6 Jan 2000 14:47:39 +0000 Subject: [PATCH] added ISC_RESULTCLASS_OMAPI --- bin/named/log.c | 3 + bin/tests/Makefile.in | 11 +- bin/tests/log_test.c | 10 +- configure | 283 +++++++++++++++++------------- configure.in | 46 ++++- lib/dns/log.c | 4 +- lib/isc/include/isc/log.h | 53 +++++- lib/isc/include/isc/resultclass.h | 1 + lib/isc/log.c | 66 ++++++- lib/isc/unix/include/isc/net.h | 3 + 10 files changed, 344 insertions(+), 136 deletions(-) diff --git a/bin/named/log.c b/bin/named/log.c index ecaa717c32..a43980ab3c 100644 --- a/bin/named/log.c +++ b/bin/named/log.c @@ -83,6 +83,9 @@ ns_log_init(void) { goto cleanup; isc_log_registermodules(ns_g_lctx, ns_g_modules); result = dns_log_init(ns_g_lctx); + if (result != ISC_R_SUCCESS) + goto cleanup; + result = isc_log_usecontext(ns_g_lctx); if (result != ISC_R_SUCCESS) goto cleanup; diff --git a/bin/tests/Makefile.in b/bin/tests/Makefile.in index 8c0537ec03..68fd493b88 100644 --- a/bin/tests/Makefile.in +++ b/bin/tests/Makefile.in @@ -19,16 +19,19 @@ top_srcdir = @top_srcdir@ @BIND9_INCLUDES@ -CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} +OMAPI_INCLUDES = -I${top_srcdir}/lib/omapi/include +CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} ${OMAPI_INCLUDES} CDEFINES = CWARNINGS = DNSLIBS = ../../lib/dns/libdns.@A@ ISCLIBS = ../../lib/isc/libisc.@A@ +OMAPILIBS = ../../lib/omapi/libomapi.@A@ DNSDEPLIBS = ../../lib/dns/libdns.@A@ ISCDEPLIBS = ../../lib/isc/libisc.@A@ +OMAPIDEPLIBS = ../../lib/omapi/libomapi.@A@ LIBS = @LIBS@ @@ -49,6 +52,7 @@ TARGETS = adb_test \ name_test \ nconf_test \ nxtify \ + omapi_test \ ratelimiter_test \ rbt_test \ rdata_test \ @@ -80,6 +84,7 @@ SRCS = adb_test.c \ name_test.c \ nconf_test.c \ nxtify.c \ + omapi_test.c \ printmsg.c \ ratelimiter_test.c \ rbt_test.c \ @@ -140,6 +145,10 @@ name_test: name_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} ${LIBTOOL} ${CC} ${CFLAGS} -o $@ name_test.@O@ \ ${DNSLIBS} ${ISCLIBS} ${LIBS} +omapi_test: omapi_test.@O@ ${ISCDEPLIBS} ${OMAPIDEPLIBS} + ${LIBTOOL} ${CC} ${CFLAGS} -o $@ omapi_test.@O@ \ + ${OMAPILIBS} ${ISCLIBS} ${LIBS} + sock_test: sock_test.@O@ ${ISCDEPLIBS} ${LIBTOOL} ${CC} ${CFLAGS} -o $@ sock_test.@O@ \ ${ISCLIBS} ${LIBS} diff --git a/bin/tests/log_test.c b/bin/tests/log_test.c index c15344f735..f4a0b42007 100644 --- a/bin/tests/log_test.c +++ b/bin/tests/log_test.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: log_test.c,v 1.4 1999/10/25 19:55:49 tale Exp $ */ +/* $Id: log_test.c,v 1.5 2000/01/06 14:47:35 tale Exp $ */ /* Principal Authors: DCL */ @@ -115,6 +115,7 @@ main (int argc, char **argv) { CHECK_ISC(isc_mem_create(0, 0, &mctx)); CHECK_ISC(isc_log_create(mctx, &lctx)); CHECK_DNS(dns_log_init(lctx)); + CHECK_ISC(isc_log_usecontext(lctx)); /* * Create a file channel to test file opening, size limiting and @@ -249,12 +250,13 @@ main (int argc, char **argv) { /* * Write debugging messages to a dynamic debugging channel. + * Also check that dns_lctx is set and working. */ isc_log_setdebuglevel(lctx, 3); - isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB, - ISC_LOG_DEBUG(1), "Dynamic debugging to stderr"); - isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB, + isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB, + ISC_LOG_DEBUG(1), "Dynamic debug to dns_lctx stderr"); + isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB, ISC_LOG_DEBUG(5), "This debug level is too high and should not appear!"); diff --git a/configure b/configure index 4504769714..d0d3f0bbfd 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh -# From configure.in Revision: 1.65 +# From configure.in Revision: 1.66 @@ -111,11 +111,11 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help - --with-mit-pthreads use the mit-pthreads thread library" + --with-mit-pthreads use the mit-pthreads thread library" ac_help="$ac_help - --with-ptl2 use the ptl2 thread library" + --with-ptl2 use the ptl2 thread library" ac_help="$ac_help - --with-libtool use GNU libtool" + --with-libtool use GNU libtool" ac_help="$ac_help --enable-shared[=PKGS] build shared libraries [default=yes]" ac_help="$ac_help @@ -126,6 +126,8 @@ ac_help="$ac_help --with-gnu-ld assume the C compiler uses GNU ld [default=no]" ac_help="$ac_help --disable-libtool-lock avoid locking (might break parallel builds)" +ac_help="$ac_help + --with-kame[=PATH] use Kame IPv6 [default path /usr/local/v6]" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -664,7 +666,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:668: checking host system type" >&5 +echo "configure:670: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -686,7 +688,7 @@ echo "$ac_t""$host" 1>&6 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:690: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:692: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -715,7 +717,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:719: checking for $ac_word" >&5 +echo "configure:721: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -754,7 +756,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:758: checking for a BSD compatible install" >&5 +echo "configure:760: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -817,7 +819,7 @@ STD_CWARNINGS="" # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:821: checking for $ac_word" >&5 +echo "configure:823: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -890,7 +892,7 @@ case "$host" in *-netbsd*) CC="gcc" echo $ac_n "checking which thread library to use""... $ac_c" 1>&6 -echo "configure:894: checking which thread library to use" >&5 +echo "configure:896: checking which thread library to use" >&5 # Check whether --with-mit-pthreads or --without-mit-pthreads was given. if test "${with_mit_pthreads+set}" = set; then @@ -953,7 +955,7 @@ esac # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:957: checking for $ac_word" >&5 +echo "configure:959: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -983,7 +985,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:987: checking for $ac_word" >&5 +echo "configure:989: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1034,7 +1036,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1038: checking for $ac_word" >&5 +echo "configure:1040: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1066,7 +1068,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1070: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1072: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1077,12 +1079,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1081 "configure" +#line 1083 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1086: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1108,12 +1110,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1112: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1114: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1117: checking whether we are using GNU C" >&5 +echo "configure:1119: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1122,7 +1124,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1126: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1128: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1141,7 +1143,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1145: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1147: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1177,7 +1179,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1181: checking for $ac_word" >&5 +echo "configure:1183: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1209,7 +1211,7 @@ test -n "$YACC" || YACC="yacc" echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1213: checking how to run the C preprocessor" >&5 +echo "configure:1215: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1224,13 +1226,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1234: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1236: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1241,13 +1243,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1251: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1253: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1258,13 +1260,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1268: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1270: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1289,12 +1291,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1293: checking for ANSI C header files" >&5 +echo "configure:1295: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1302,7 +1304,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1306: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1308: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1319,7 +1321,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1337,7 +1339,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1358,7 +1360,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1369,7 +1371,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1396,17 +1398,17 @@ for ac_hdr in fcntl.h sys/time.h unistd.h sys/sockio.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1400: checking for $ac_hdr" >&5 +echo "configure:1402: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1410: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1412: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1434,12 +1436,12 @@ done echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1438: checking for working const" >&5 +echo "configure:1440: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1494: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1509,21 +1511,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1513: checking for inline" >&5 +echo "configure:1515: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1529: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -1549,12 +1551,12 @@ EOF esac echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1553: checking for size_t" >&5 +echo "configure:1555: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1582,12 +1584,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1586: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1588: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1596,7 +1598,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1600: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1602: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1618,7 +1620,7 @@ fi echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:1622: checking for pthread_create in -lpthread" >&5 +echo "configure:1624: checking for pthread_create in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1626,7 +1628,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1663,7 +1665,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for __pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:1667: checking for __pthread_create in -lpthread" >&5 +echo "configure:1669: checking for __pthread_create in -lpthread" >&5 ac_lib_var=`echo pthread'_'__pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1671,7 +1673,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1710,7 +1712,7 @@ else fi echo $ac_n "checking for __pthread_create_system in -lpthread""... $ac_c" 1>&6 -echo "configure:1714: checking for __pthread_create_system in -lpthread" >&5 +echo "configure:1716: checking for __pthread_create_system in -lpthread" >&5 ac_lib_var=`echo pthread'_'__pthread_create_system | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1718,7 +1720,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1763,7 +1765,7 @@ fi if test "$ac_cv_lib_pthread" != "yes"; then echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 -echo "configure:1767: checking for pthread_create in -lc_r" >&5 +echo "configure:1769: checking for pthread_create in -lc_r" >&5 ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1771,7 +1773,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc_r $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1788: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1813,7 +1815,7 @@ fi echo $ac_n "checking for sigwait in -lpthread""... $ac_c" 1>&6 -echo "configure:1817: checking for sigwait in -lpthread" >&5 +echo "configure:1819: checking for sigwait in -lpthread" >&5 ac_lib_var=`echo pthread'_'sigwait | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1821,7 +1823,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1854,7 +1856,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for _Psigwait in -lpthread""... $ac_c" 1>&6 -echo "configure:1858: checking for _Psigwait in -lpthread" >&5 +echo "configure:1860: checking for _Psigwait in -lpthread" >&5 ac_lib_var=`echo pthread'_'_Psigwait | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1862,7 +1864,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1910,12 +1912,12 @@ EOF esac echo $ac_n "checking for catgets""... $ac_c" 1>&6 -echo "configure:1914: checking for catgets" >&5 +echo "configure:1916: checking for catgets" >&5 if eval "test \"`echo '$''{'ac_cv_func_catgets'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1944: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_catgets=yes" else @@ -1982,7 +1984,7 @@ case "$host" in ;; *) echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:1986: checking for socket in -lsocket" >&5 +echo "configure:1988: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1990,7 +1992,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2029,7 +2031,7 @@ else fi echo $ac_n "checking for inet_ntoa in -lnsl""... $ac_c" 1>&6 -echo "configure:2033: checking for inet_ntoa in -lnsl" >&5 +echo "configure:2035: checking for inet_ntoa in -lnsl" >&5 ac_lib_var=`echo nsl'_'inet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2037,7 +2039,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2054: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2119,9 +2121,9 @@ esac echo $ac_n "checking for sa_len in struct sockaddr""... $ac_c" 1>&6 -echo "configure:2123: checking for sa_len in struct sockaddr" >&5 +echo "configure:2125: checking for sa_len in struct sockaddr" >&5 cat > conftest.$ac_ext < @@ -2130,7 +2132,7 @@ int main() { struct sockaddr sa; sa.sa_len = 0; return (0); ; return 0; } EOF -if { (eval echo configure:2134: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2136: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 ISC_PLATFORM_HAVESALEN="#define ISC_PLATFORM_HAVESALEN 1" @@ -2146,9 +2148,9 @@ rm -f conftest* echo $ac_n "checking for struct msghdr flavor""... $ac_c" 1>&6 -echo "configure:2150: checking for struct msghdr flavor" >&5 +echo "configure:2152: checking for struct msghdr flavor" >&5 cat > conftest.$ac_ext < @@ -2157,7 +2159,7 @@ int main() { struct msghdr msg; msg.msg_flags = 0; return (0); ; return 0; } EOF -if { (eval echo configure:2161: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2163: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""4.4BSD" 1>&6 ISC_PLATFORM_MSGHDRFLAVOR="#define ISC_NET_BSD44MSGHDR 1" @@ -2172,9 +2174,9 @@ rm -f conftest* echo $ac_n "checking for type in_port_t""... $ac_c" 1>&6 -echo "configure:2176: checking for type in_port_t" >&5 +echo "configure:2178: checking for type in_port_t" >&5 cat > conftest.$ac_ext < @@ -2183,7 +2185,7 @@ int main() { in_port_t port = 25; return (0); ; return 0; } EOF -if { (eval echo configure:2187: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 ISC_PLATFORM_NEEDPORTT="#undef ISC_PLATFORM_NEEDPORTT" @@ -2199,9 +2201,9 @@ rm -f conftest* echo $ac_n "checking for interface list sysctl""... $ac_c" 1>&6 -echo "configure:2203: checking for interface list sysctl" >&5 +echo "configure:2205: checking for interface list sysctl" >&5 cat > conftest.$ac_ext < @@ -2308,7 +2310,7 @@ else fi echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:2312: checking build system type" >&5 +echo "configure:2314: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -2337,7 +2339,7 @@ ac_prog=ld if test "$ac_cv_prog_gcc" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:2341: checking for ld used by GCC" >&5 +echo "configure:2343: checking for ld used by GCC" >&5 ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. @@ -2361,10 +2363,10 @@ echo "configure:2341: checking for ld used by GCC" >&5 esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:2365: checking for GNU ld" >&5 +echo "configure:2367: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:2368: checking for non-GNU ld" >&5 +echo "configure:2370: checking for non-GNU ld" >&5 fi if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2400,7 +2402,7 @@ fi test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:2404: checking if the linker ($LD) is GNU ld" >&5 +echo "configure:2406: checking if the linker ($LD) is GNU ld" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2416,7 +2418,7 @@ echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:2420: checking for BSD-compatible nm" >&5 +echo "configure:2422: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2453,7 +2455,7 @@ echo "$ac_t""$NM" 1>&6 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:2457: checking whether ln -s works" >&5 +echo "configure:2459: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2497,8 +2499,8 @@ test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" case "$host" in *-*-irix6*) # Find out which ABI we are using. - echo '#line 2501 "configure"' > conftest.$ac_ext - if { (eval echo configure:2502: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 2503 "configure"' > conftest.$ac_ext + if { (eval echo configure:2504: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *32-bit*) LD="${LD-ld} -32" @@ -2519,19 +2521,19 @@ case "$host" in SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2523: checking whether the C compiler needs -belf" >&5 +echo "configure:2525: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2537: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else @@ -2646,9 +2648,9 @@ esac echo $ac_n "checking for IPv6 structures""... $ac_c" 1>&6 -echo "configure:2650: checking for IPv6 structures" >&5 +echo "configure:2652: checking for IPv6 structures" >&5 cat > conftest.$ac_ext < @@ -2658,7 +2660,7 @@ int main() { struct sockaddr_in6 sin6; return (0); ; return 0; } EOF -if { (eval echo configure:2662: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2664: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 ISC_PLATFORM_HAVEIPV6="#define ISC_PLATFORM_HAVEIPV6 1" @@ -2680,13 +2682,54 @@ rm -f conftest* +echo $ac_n "checking looking for Kame IPv6 support""... $ac_c" 1>&6 +echo "configure:2687: checking looking for Kame IPv6 support" >&5 +# Check whether --with-kame or --without-kame was given. +if test "${with_kame+set}" = set; then + withval="$with_kame" + use_kame="$withval" +else + use_kame="no" +fi + + +case "$use_kame" in + no) + ;; + yes) + kame_path=/usr/local/v6 + ;; + *) + kame_path="$use_kame" + ;; +esac + +case "$use_kame" in + no) + ;; + *) + if test -f $kame_path/lib/libinet6.a; then + echo "$ac_t""$kame_path/lib/libinet6.a" 1>&6 + LIBS="$kame_path/lib -linet6 $LIBS" + else + { echo "configure: error: $kame_path/lib/libinet6.a not found. + +Please choose the proper path with the following command: + + configure --with-kame=PATH +" 1>&2; exit 1; } + fi + ;; +esac + + echo $ac_n "checking for inet_ntop""... $ac_c" 1>&6 -echo "configure:2685: checking for inet_ntop" >&5 +echo "configure:2728: checking for inet_ntop" >&5 if eval "test \"`echo '$''{'ac_cv_func_inet_ntop'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_inet_ntop=yes" else @@ -2733,12 +2776,12 @@ ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O" fi echo $ac_n "checking for inet_pton""... $ac_c" 1>&6 -echo "configure:2737: checking for inet_pton" >&5 +echo "configure:2780: checking for inet_pton" >&5 if eval "test \"`echo '$''{'ac_cv_func_inet_pton'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2808: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_inet_pton=yes" else @@ -2785,12 +2828,12 @@ ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O" fi echo $ac_n "checking for inet_aton""... $ac_c" 1>&6 -echo "configure:2789: checking for inet_aton" >&5 +echo "configure:2832: checking for inet_aton" >&5 if eval "test \"`echo '$''{'ac_cv_func_inet_aton'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_inet_aton=yes" else @@ -2837,12 +2880,12 @@ ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_aton.$O" fi echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6 -echo "configure:2841: checking for vsnprintf" >&5 +echo "configure:2884: checking for vsnprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vsnprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vsnprintf=yes" else @@ -2897,12 +2940,12 @@ fi echo $ac_n "checking for chroot""... $ac_c" 1>&6 -echo "configure:2901: checking for chroot" >&5 +echo "configure:2944: checking for chroot" >&5 if eval "test \"`echo '$''{'ac_cv_func_chroot'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_chroot=yes" else @@ -2951,17 +2994,17 @@ for ac_hdr in linux/capability.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2955: checking for $ac_hdr" >&5 +echo "configure:2998: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2965: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3008: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* diff --git a/configure.in b/configure.in index a59eafd149..85c399dd71 100644 --- a/configure.in +++ b/configure.in @@ -13,7 +13,7 @@ dnl PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS dnl ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS dnl SOFTWARE. -AC_REVISION($Revision: 1.66 $) +AC_REVISION($Revision: 1.67 $) AC_PREREQ(2.13) @@ -90,11 +90,11 @@ case "$host" in AC_MSG_CHECKING(which thread library to use) AC_ARG_WITH(mit-pthreads, - [ --with-mit-pthreads use the mit-pthreads thread library], + [ --with-mit-pthreads use the mit-pthreads thread library], use_mit_pthreads="$withval", use_mit_pthreads="no") AC_ARG_WITH(ptl2, - [ --with-ptl2 use the ptl2 thread library], + [ --with-ptl2 use the ptl2 thread library], use_ptl2="$withval", use_ptl2="no") dnl If user did not choose a thread library explicitly, @@ -328,7 +328,7 @@ dnl dnl GNU libtool support dnl AC_ARG_WITH(libtool, - [ --with-libtool use GNU libtool], + [ --with-libtool use GNU libtool], use_libtool="$withval", use_libtool="no") case $use_libtool in @@ -373,6 +373,44 @@ AC_SUBST(ISC_IPV6_O) AC_SUBST(ISC_ISCIPV6_O) AC_SUBST(ISC_IPV6_C) +dnl +dnl IPv6 support provided via Kame +dnl +AC_MSG_CHECKING(for Kame IPv6 support) +AC_ARG_WITH(kame, + [ --with-kame[=PATH] use Kame IPv6 [default path /usr/local/v6]], + use_kame="$withval", use_kame="no") + +case "$use_kame" in + no) + ;; + yes) + kame_path=/usr/local/v6 + ;; + *) + kame_path="$use_kame" + ;; +esac + +case "$use_kame" in + no) + ;; + *) + if test -f $kame_path/lib/libinet6.a; then + AC_MSG_RESULT($kame_path/lib/libinet6.a) + LIBS="$kame_path/lib -linet6 $LIBS" + else + AC_MSG_ERROR([$kame_path/lib/libinet6.a not found. + +Please choose the proper path with the following command: + + configure --with-kame=PATH +]) + fi + ;; +esac + + dnl dnl Check for network functions that are often missing. We do this dnl after the libtool checking, so we can put the right suffix on diff --git a/lib/dns/log.c b/lib/dns/log.c index fcb813387b..c88f076c72 100644 --- a/lib/dns/log.c +++ b/lib/dns/log.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: log.c,v 1.10 1999/12/23 00:08:29 explorer Exp $ */ +/* $Id: log.c,v 1.11 2000/01/06 14:47:37 tale Exp $ */ /* Principal Authors: DCL */ @@ -78,7 +78,7 @@ dns_log_init(isc_log_t *lctx) { if (result == ISC_R_SUCCESS) { isc_log_registermodules(lctx, dns_modules); - dns_lctx = lctx; + result = isc_log_registercontext(lctx, &dns_lctx); } return (result); diff --git a/lib/isc/include/isc/log.h b/lib/isc/include/isc/log.h index 9ed44414a8..ec20cf84d6 100644 --- a/lib/isc/include/isc/log.h +++ b/lib/isc/include/isc/log.h @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: log.h,v 1.5 1999/10/25 19:47:42 tale Exp $ */ +/* $Id: log.h,v 1.6 2000/01/06 14:47:38 tale Exp $ */ #ifndef ISC_LOG_H #define ISC_LOG_H 1 @@ -184,7 +184,6 @@ isc_log_destroy(isc_log_t **lctxp); * The logging context is marked as invalid. */ - isc_result_t isc_log_registercategories(isc_log_t *lctx, isc_logcategory_t categories[]); /* @@ -248,6 +247,31 @@ isc_log_registermodules(isc_log_t *lctx, isc_logmodule_t modules[]); * used with isc_log_usechannel() and isc_log_write(). */ +isc_result_t +isc_log_registercontext(isc_log_t *lctx, isc_log_t **lctxp); +/* + * Note a log context pointer that needs to be updated when the the configured + * context is activated with dns_log_usecontext(). + * + * Notes: + * This is mainly intended for use by libraries to assign a logging + * context to their own internal pointer, such as dns_lctx in libdns.a. + * It is not sufficient to have, for example, 'dns_lctx = lctx' in the + * the libraries dns_log_init() function because of multithreading + * pitfalls. + * + * Requires: + * lctx is a valid logging context and not yet active. + * lctxp is not NULL. + * + * Ensures: + * lctxp is registered to be updated when lctx is made active. + * + * Returns: + * ISC_R_SUCCESS Success. + * ISC_R_NOMEMORY No memory was available to store lctxp. + */ + isc_result_t isc_log_createchannel(isc_log_t *lctx, const char *name, unsigned int type, int level, isc_logdestination_t *destination, @@ -375,6 +399,31 @@ isc_log_usechannel(isc_log_t *lctx, const char *name, * ISC_R_NOMEMORY Resource limit: Out of memory */ +isc_result_t +isc_log_usecontext(isc_log_t *lctx); +/* + * Start using a logging context. + * + * Notes: + * This is the last thing that should be done after the logging + * context is fully configured via isc_log_registercategories + * and isc_log_registermodules, but before any isc_log_*write* function + * is used with the context. Channels can be created/used at any time + * before or after isc_log_usecontext(). + * + * Requires: + * lctx is a valid logging context. + * + * isc_log_usecontext has not been previously called on lctx. + * + * Ensures: + * + * Returns: + * ISC_R_SUCCESS Success + * Any unsuccessful return from isc_mutex_lock() + * or isc_mutex_unlock(). + */ + void isc_log_write(isc_log_t *lctx, isc_logcategory_t *category, isc_logmodule_t *module, int level, const char *format, ...); diff --git a/lib/isc/include/isc/resultclass.h b/lib/isc/include/isc/resultclass.h index 7323c7f308..47581e8bf1 100644 --- a/lib/isc/include/isc/resultclass.h +++ b/lib/isc/include/isc/resultclass.h @@ -46,6 +46,7 @@ ISC_LANG_BEGINDECLS #define ISC_RESULTCLASS_DNS ISC_RESULTCLASS_FROMNUM(1) #define ISC_RESULTCLASS_DST ISC_RESULTCLASS_FROMNUM(2) #define ISC_RESULTCLASS_DNSRCODE ISC_RESULTCLASS_FROMNUM(3) +#define ISC_RESULTCLASS_OMAPI ISC_RESULTCLASS_FROMNUM(4) /* * Result classes >= 1024 and <= 65535 are reserved for application use. diff --git a/lib/isc/log.c b/lib/isc/log.c index 4de6f9d5e7..7e73e93ee6 100644 --- a/lib/isc/log.c +++ b/lib/isc/log.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: log.c,v 1.12 1999/11/03 01:07:02 marka Exp $ */ +/* $Id: log.c,v 1.13 2000/01/06 14:47:37 tale Exp $ */ /* Principal Authors: DCL */ @@ -105,6 +105,7 @@ struct isc_log { unsigned int magic; isc_mem_t * mctx; isc_mutex_t lock; + isc_boolean_t active; char buffer[LOG_BUFFER_SIZE]; int debug_level; unsigned int duplicate_interval; @@ -113,6 +114,8 @@ struct isc_log { unsigned int category_count; isc_logmodule_t ** modules; unsigned int module_count; + isc_log_t *** contexts; + unsigned int context_count; ISC_LIST(isc_logmessage_t) messages; }; @@ -201,13 +204,16 @@ isc_log_create(isc_mem_t *mctx, isc_log_t **lctxp) { return (ISC_R_NOMEMORY); lctx->mctx = mctx; + lctx->active = ISC_FALSE; + lctx->debug_level = 0; + lctx->duplicate_interval = 0; lctx->channels = NULL; lctx->categories = NULL; lctx->category_count = 0; - lctx->debug_level = 0; - lctx->duplicate_interval = 0; lctx->modules = NULL; lctx->module_count = 0; + lctx->contexts = NULL; + lctx->context_count = 0; ISC_LIST_INIT(lctx->messages); @@ -328,8 +334,13 @@ isc_log_destroy(isc_log_t **lctxp) { } ISC_LIST_INIT(lctx->messages); + if (lctx->context_count > 0) + isc_mem_put(mctx, lctx->contexts, + lctx->context_count * sizeof(isc_log_t **)); + isc_mutex_destroy(&lctx->lock); + lctx->active = ISC_FALSE; lctx->magic = 0; isc_mem_put(mctx, lctx, sizeof(*lctx)); @@ -394,6 +405,33 @@ isc_log_registermodules(isc_log_t *lctx, isc_logmodule_t modules[]) { lctx->module_count = new_count; } +isc_result_t +isc_log_registercontext(isc_log_t *lctx, isc_log_t **lctxp) { + isc_log_t ***contexts; + + REQUIRE(VALID_CONTEXT(lctx)); + REQUIRE(! lctx->active); + REQUIRE(lctxp != NULL); + + contexts = (isc_log_t ***)isc_mem_get(lctx->mctx, + (lctx->context_count + 1) * + sizeof(isc_log_t **)); + if (contexts == NULL) + return (ISC_R_NOMEMORY); + + if (lctx->context_count > 0) { + memcpy(contexts, lctx->contexts, + (lctx->context_count + 1) * sizeof(isc_log_t **)); + isc_mem_put(lctx->mctx, lctx->contexts, + lctx->context_count * sizeof(isc_log_t **)); + } + + lctx->contexts = contexts; + lctx->context_count++; + + return (ISC_R_SUCCESS); +} + isc_result_t isc_log_createchannel(isc_log_t *lctx, const char *name, unsigned int type, int level, isc_logdestination_t *destination, @@ -519,6 +557,27 @@ isc_log_usechannel(isc_log_t *lctx, const char *name, return (result); } +isc_result_t +isc_log_usecontext(isc_log_t *lctx) { + isc_result_t result; + unsigned int i; + + REQUIRE(VALID_CONTEXT(lctx)); + REQUIRE(! lctx->active); + + result = isc_mutex_lock(&lctx->lock); + if (result != ISC_R_SUCCESS) + return (result); + + for (i = 0; i < lctx->context_count; i++) + *(lctx->contexts[i]) = lctx; + + lctx->active = ISC_TRUE; + + result = isc_mutex_unlock(&lctx->lock); + return (result); +} + void isc_log_write(isc_log_t *lctx, isc_logcategory_t *category, isc_logmodule_t *module, int level, const char *format, ...) @@ -854,6 +913,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, REQUIRE(module != NULL && module->id < lctx->module_count); REQUIRE(level != ISC_LOG_DYNAMIC); REQUIRE(format != NULL); + REQUIRE(lctx->active); time_string[0] = '\0'; level_string[0] = '\0'; diff --git a/lib/isc/unix/include/isc/net.h b/lib/isc/unix/include/isc/net.h index faff3b9213..6ff4168013 100644 --- a/lib/isc/unix/include/isc/net.h +++ b/lib/isc/unix/include/isc/net.h @@ -84,6 +84,9 @@ #ifndef ISC_PLATFORM_HAVEIPV6 #include +#else +/* XXXDCL this is just for BSD/OS 4.01 to compile. */ +#include #endif /*