From 510bb376e14122ba0c5d89e5f8dc5306e6cecd6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 4 Sep 2018 10:09:24 +0200 Subject: [PATCH 01/39] Define platform.h ISC_PLATFORM_USEBACKTRACE with config.h USE_BACKTRACE --- config.h.in | 5 ++++- config.h.win32 | 3 +++ configure | 26 ++++++++++----------- configure.in | 30 ++++++++++++------------- lib/isc/backtrace.c | 6 ++--- lib/isc/include/isc/platform.h.in | 5 ----- lib/isc/win32/include/isc/platform.h.in | 5 ----- win32utils/Configure | 8 +++---- 8 files changed, 40 insertions(+), 48 deletions(-) diff --git a/config.h.in b/config.h.in index 775da4c95b..65844b472f 100644 --- a/config.h.in +++ b/config.h.in @@ -272,7 +272,7 @@ /* Define to 1 if you have the header file. */ #undef HAVE_KRB5_KRB5_H -/* if system have backtrace function */ +/* define if system have backtrace function */ #undef HAVE_LIBCTRACE /* Define if libidn2 was found */ @@ -539,6 +539,9 @@ /* Define to use large-system tuning. */ #undef TUNE_LARGE +/* define if we can use backtrace */ +#undef USE_BACKTRACE + /* Enable DNS Response Policy Service API */ #undef USE_DNSRPS diff --git a/config.h.win32 b/config.h.win32 index 0595c543e1..f0be1db618 100644 --- a/config.h.win32 +++ b/config.h.win32 @@ -367,6 +367,9 @@ typedef __int64 off_t; /* Large system tuning */ @TUNE_LARGE@ +/* define if we can use backtrace */ +@USE_BACKTRACE@ + /* the default value of dnssec-validation option */ @VALIDATION_DEFAULT@ diff --git a/configure b/configure index 11f54d643d..af0ab25968 100755 --- a/configure +++ b/configure @@ -734,7 +734,6 @@ A O ALWAYS_MAKE_SYMTABLE MKSYMTBL_PROGRAM -ISC_PLATFORM_USEBACKTRACE PURIFY purify_path MKDEPPROG @@ -17511,38 +17510,37 @@ esac # # Check whether --enable-backtrace was given. if test "${enable_backtrace+set}" = set; then : - enableval=$enable_backtrace; want_backtrace="$enableval" + enableval=$enable_backtrace; else - want_backtrace="yes" + enable_backtrace="yes" fi -case $want_backtrace in -yes) - ISC_PLATFORM_USEBACKTRACE="#define ISC_PLATFORM_USEBACKTRACE 1" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + +if test "$enable_backtrace" = "yes"; then : + +$as_echo "#define USE_BACKTRACE 1" >>confdefs.h + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { return (backtrace((void **)0, 0)); + ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : -$as_echo "#define HAVE_LIBCTRACE /**/" >>confdefs.h +$as_echo "#define HAVE_LIBCTRACE 1" >>confdefs.h + fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - ;; -*) - ISC_PLATFORM_USEBACKTRACE="#undef ISC_PLATFORM_USEBACKTRACE" - ;; -esac - +fi # Check whether --enable-symtable was given. if test "${enable_symtable+set}" = set; then : diff --git a/configure.in b/configure.in index 8703dfc3b5..c1594e2c78 100644 --- a/configure.in +++ b/configure.in @@ -1811,22 +1811,20 @@ esac # enable/disable dumping stack backtrace. Also check if the system supports # glibc-compatible backtrace() function. # -AC_ARG_ENABLE(backtrace, - AS_HELP_STRING([--enable-backtrace], - [log stack backtrace on abort [default=yes]]), - want_backtrace="$enableval", want_backtrace="yes") -case $want_backtrace in -yes) - ISC_PLATFORM_USEBACKTRACE="#define ISC_PLATFORM_USEBACKTRACE 1" - AC_TRY_LINK([#include ], - [return (backtrace((void **)0, 0));], - [AC_DEFINE([HAVE_LIBCTRACE], [], [if system have backtrace function])],) - ;; -*) - ISC_PLATFORM_USEBACKTRACE="#undef ISC_PLATFORM_USEBACKTRACE" - ;; -esac -AC_SUBST(ISC_PLATFORM_USEBACKTRACE) +AC_ARG_ENABLE([backtrace], + [AS_HELP_STRING([--enable-backtrace], + [log stack backtrace on abort [default=yes]])], + [], [enable_backtrace="yes"]) + +AS_IF([test "$enable_backtrace" = "yes"], + [AC_DEFINE([USE_BACKTRACE], [1], [define if we can use backtrace]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[return (backtrace((void **)0, 0));]] + )], + [AC_DEFINE([HAVE_LIBCTRACE], [1], [define if system have backtrace function])] + )]) AC_ARG_ENABLE(symtable, AS_HELP_STRING([--enable-symtable], diff --git a/lib/isc/backtrace.c b/lib/isc/backtrace.c index 0ea145511e..7c645d7d04 100644 --- a/lib/isc/backtrace.c +++ b/lib/isc/backtrace.c @@ -24,7 +24,7 @@ #include #include -#ifdef ISC_PLATFORM_USEBACKTRACE +#ifdef USE_BACKTRACE /* * Getting a back trace of a running process is tricky and highly platform * dependent. Our current approach is as follows: @@ -52,9 +52,9 @@ #else #define BACKTRACE_DISABLED #endif /* HAVE_LIBCTRACE */ -#else /* !ISC_PLATFORM_USEBACKTRACE */ +#else /* USE_BACKTRACE */ #define BACKTRACE_DISABLED -#endif /* ISC_PLATFORM_USEBACKTRACE */ +#endif /* USE_BACKTRACE */ #ifdef BACKTRACE_LIBC isc_result_t diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index ba34ed6ff8..0280e438e7 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -78,11 +78,6 @@ */ @ISC_PLATFORM_HAVEDEVPOLL@ -/*! \brief - * Define if we want to log backtrace - */ -@ISC_PLATFORM_USEBACKTRACE@ - /* *** Printing. ***/ diff --git a/lib/isc/win32/include/isc/platform.h.in b/lib/isc/win32/include/isc/platform.h.in index a0fc5c644a..8c4f9dc795 100644 --- a/lib/isc/win32/include/isc/platform.h.in +++ b/lib/isc/win32/include/isc/platform.h.in @@ -67,11 +67,6 @@ */ #undef ISC_PLATFORM_HAVESYSUNH -/* - * Define if we want to log backtrace - */ -@ISC_PLATFORM_USEBACKTRACE@ - /* * Defines for the noreturn attribute. */ diff --git a/win32utils/Configure b/win32utils/Configure index b8f8ae2b7c..a0015ae01a 100644 --- a/win32utils/Configure +++ b/win32utils/Configure @@ -207,6 +207,7 @@ my @substdefh = ("AES_CC", "HAVE_DSA_GET0_PQG", "HAVE_ECDSA_SIG_GET0", "HAVE_RSA_SET0_KEY", + "USE_BACKTRACE", "USE_OPENSSL", "USE_PKCS11", "HAVE_PKCS11_ED25519", @@ -231,8 +232,7 @@ my @substdefp = ("ISC_PLATFORM_BUSYWAITNOP", "ISC_PLATFORM_HAVECMPXCHG", "ISC_PLATFORM_HAVEXADD", "ISC_PLATFORM_HAVEXADDQ", - "ISC_PLATFORM_NEEDSTRCASESTR", - "ISC_PLATFORM_USEBACKTRACE"); + "ISC_PLATFORM_NEEDSTRCASESTR"); # for conf.sh @@ -1160,7 +1160,7 @@ if ($msc_ver < 1400) { # backtrace for >= VS 2012 if ($msc_ver >= 1700) { - $configdefp{"ISC_PLATFORM_USEBACKTRACE"} = 1; + $configdefh{"USE_BACKTRACE"} = 1; } # no version of MSVS supports strcasestr() yet @@ -1411,7 +1411,7 @@ if ($use_openssl eq "yes") { die "find more than one OpenSSL libcrypto-*.dll DLL candidate\n"; } $openssl_dll = File::Spec->catdir($openssl_path, "@dirlist[0]"); - } + } $cryptolib = "openssl"; $configvar{"OPENSSL_PATH"} = "$openssl_path"; From 376bea8b40bbf6495410d16c2e4956abb640b536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 4 Sep 2018 10:16:02 +0200 Subject: [PATCH 02/39] Cleanup the custom atomic defines from Windows and remove empty atomic_test.c --- lib/isc/tests/Atffile | 1 - lib/isc/tests/Kyuafile | 1 - lib/isc/tests/Makefile.in | 8 +- lib/isc/tests/atomic_test.c | 354 ------------------------------------ util/copyrights | 1 - 5 files changed, 2 insertions(+), 363 deletions(-) delete mode 100644 lib/isc/tests/atomic_test.c diff --git a/lib/isc/tests/Atffile b/lib/isc/tests/Atffile index 335b1dbb64..742cad3a6b 100644 --- a/lib/isc/tests/Atffile +++ b/lib/isc/tests/Atffile @@ -3,7 +3,6 @@ Content-Type: application/X-atf-atffile; version="1" prop: test-suite = bind9 tp: aes_test -tp: atomic_test tp: buffer_test tp: counter_test tp: errno_test diff --git a/lib/isc/tests/Kyuafile b/lib/isc/tests/Kyuafile index b1005e7e9b..401cbe5d1d 100644 --- a/lib/isc/tests/Kyuafile +++ b/lib/isc/tests/Kyuafile @@ -2,7 +2,6 @@ syntax(2) test_suite('bind9') atf_test_program{name='aes_test'} -atf_test_program{name='atomic_test'} atf_test_program{name='buffer_test'} atf_test_program{name='counter_test'} atf_test_program{name='errno_test'} diff --git a/lib/isc/tests/Makefile.in b/lib/isc/tests/Makefile.in index fe570b56f8..4f585af9b3 100644 --- a/lib/isc/tests/Makefile.in +++ b/lib/isc/tests/Makefile.in @@ -31,7 +31,7 @@ CMOCKA_CFLAGS = @CMOCKA_CFLAGS@ CMOCKA_LIBS = @CMOCKA_LIBS@ OBJS = isctest.@O@ -SRCS = isctest.c aes_test.c atomic_test.c buffer_test.c \ +SRCS = isctest.c aes_test.c buffer_test.c \ counter_test.c errno_test.c file_test.c hash_test.c \ heap_test.c ht_test.c lex_test.c \ mem_test.c netaddr_test.c parse_test.c pool_test.c \ @@ -41,7 +41,7 @@ SRCS = isctest.c aes_test.c atomic_test.c buffer_test.c \ taskpool_test.c time_test.c timer_test.c SUBDIRS = -TARGETS = aes_test@EXEEXT@ atomic_test@EXEEXT@ buffer_test@EXEEXT@ \ +TARGETS = aes_test@EXEEXT@ buffer_test@EXEEXT@ \ counter_test@EXEEXT@ errno_test@EXEEXT@ file_test@EXEEXT@ \ hash_test@EXEEXT@ heap_test@EXEEXT@ ht_test@EXEEXT@ \ lex_test@EXEEXT@ mem_test@EXEEXT@ \ @@ -54,10 +54,6 @@ TARGETS = aes_test@EXEEXT@ atomic_test@EXEEXT@ buffer_test@EXEEXT@ \ @BIND9_MAKE_RULES@ -atomic_test@EXEEXT@: atomic_test.@O@ isctest.@O@ ${ISCDEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ - atomic_test.@O@ isctest.@O@ ${ISCLIBS} ${LIBS} - aes_test@EXEEXT@: aes_test.@O@ ${ISCDEPLIBS} ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ aes_test.@O@ ${ISCLIBS} ${LIBS} diff --git a/lib/isc/tests/atomic_test.c b/lib/isc/tests/atomic_test.c deleted file mode 100644 index 801301049d..0000000000 --- a/lib/isc/tests/atomic_test.c +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -#include - -#include -#include - -#include - -#include -#include -#include - -#include "isctest.h" - -#define TASKS 32 -#define ITERATIONS 1000 -#define COUNTS_PER_ITERATION 1000 -#define INCREMENT_64 (int64_t)0x0000000010000000 -#define EXPECTED_COUNT_32 (TASKS * ITERATIONS * COUNTS_PER_ITERATION) -#define EXPECTED_COUNT_64 (TASKS * ITERATIONS * COUNTS_PER_ITERATION * INCREMENT_64) - -typedef struct { - uint32_t iteration; -} counter_t; - -counter_t counters[TASKS]; - -#if defined(ISC_PLATFORM_HAVEXADD) -static int32_t counter_32; - -static void -do_xadd(isc_task_t *task, isc_event_t *ev) { - counter_t *state = (counter_t *)ev->ev_arg; - int i; - - for (i = 0 ; i < COUNTS_PER_ITERATION ; i++) { - isc_atomic_xadd(&counter_32, 1); - } - - state->iteration++; - if (state->iteration < ITERATIONS) { - isc_task_send(task, &ev); - } else { - isc_event_free(&ev); - } -} - -ATF_TC(atomic_xadd); -ATF_TC_HEAD(atomic_xadd, tc) { - atf_tc_set_md_var(tc, "descr", "atomic XADD"); -} -ATF_TC_BODY(atomic_xadd, tc) { - isc_result_t result; - isc_task_t *tasks[TASKS]; - isc_event_t *event = NULL; - int i; - - UNUSED(tc); - - result = isc_test_begin(NULL, true, 0); - ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - - memset(counters, 0, sizeof(counters)); - counter_32 = 0; - - /* - * Create our tasks, and allocate an event to get the counters going. - */ - for (i = 0 ; i < TASKS ; i++) { - tasks[i] = NULL; - ATF_REQUIRE_EQ(isc_task_create(taskmgr, 0, &tasks[i]), - ISC_R_SUCCESS); - event = isc_event_allocate(mctx, NULL, 1000, do_xadd, - &counters[i], - sizeof(struct isc_event)); - ATF_REQUIRE(event != NULL); - isc_task_sendanddetach(&tasks[i], &event); - } - - isc_test_end(); - - printf("32-bit counter %d, expected %d\n", - counter_32, EXPECTED_COUNT_32); - - ATF_CHECK_EQ(counter_32, EXPECTED_COUNT_32); - counter_32 = 0; -} -#endif - -#if defined(ISC_PLATFORM_HAVEXADDQ) -static int64_t counter_64; - -static void -do_xaddq(isc_task_t *task, isc_event_t *ev) { - counter_t *state = (counter_t *)ev->ev_arg; - int i; - - for (i = 0 ; i < COUNTS_PER_ITERATION ; i++) { - isc_atomic_xaddq(&counter_64, INCREMENT_64); - } - - state->iteration++; - if (state->iteration < ITERATIONS) { - isc_task_send(task, &ev); - } else { - isc_event_free(&ev); - } -} - -ATF_TC(atomic_xaddq); -ATF_TC_HEAD(atomic_xaddq, tc) { - atf_tc_set_md_var(tc, "descr", "atomic XADDQ"); -} -ATF_TC_BODY(atomic_xaddq, tc) { - isc_result_t result; - isc_task_t *tasks[TASKS]; - isc_event_t *event = NULL; - int i; - - UNUSED(tc); - - result = isc_test_begin(NULL, true, 0); - ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - - memset(counters, 0, sizeof(counters)); - counter_64 = 0; - - /* - * Create our tasks, and allocate an event to get the counters going. - */ - for (i = 0 ; i < TASKS ; i++) { - tasks[i] = NULL; - ATF_REQUIRE_EQ(isc_task_create(taskmgr, 0, &tasks[i]), - ISC_R_SUCCESS); - event = isc_event_allocate(mctx, NULL, 1000, do_xaddq, - &counters[i], - sizeof(struct isc_event)); - ATF_REQUIRE(event != NULL); - isc_task_sendanddetach(&tasks[i], &event); - } - - isc_test_end(); - - printf("64-bit counter %" PRId64 ", " - "expected %" PRId64 "\n", - counter_64, EXPECTED_COUNT_64); - - ATF_CHECK_EQ(counter_64, EXPECTED_COUNT_64); - counter_32 = 0; -} -#endif - -#if defined(ISC_PLATFORM_HAVEATOMICSTORE) -static int32_t store_32; - -static void -do_store(isc_task_t *task, isc_event_t *ev) { - counter_t *state = (counter_t *)ev->ev_arg; - int i; - uint32_t r; - uint32_t val; - - r = random() % 256; - val = (r << 24) | (r << 16) | (r << 8) | r; - - for (i = 0 ; i < COUNTS_PER_ITERATION ; i++) { - isc_atomic_store(&store_32, val); - } - - state->iteration++; - if (state->iteration < ITERATIONS) { - isc_task_send(task, &ev); - } else { - isc_event_free(&ev); - } -} - -ATF_TC(atomic_store); -ATF_TC_HEAD(atomic_store, tc) { - atf_tc_set_md_var(tc, "descr", "atomic STORE"); -} -ATF_TC_BODY(atomic_store, tc) { - isc_result_t result; - isc_task_t *tasks[TASKS]; - isc_event_t *event = NULL; - uint32_t val; - uint32_t r; - int i; - - UNUSED(tc); - - result = isc_test_begin(NULL, true, 0); - ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - - memset(counters, 0, sizeof(counters)); - store_32 = 0; - - /* - * Create our tasks, and allocate an event to get the counters - * going. - */ - for (i = 0 ; i < TASKS ; i++) { - tasks[i] = NULL; - ATF_REQUIRE_EQ(isc_task_create(taskmgr, 0, &tasks[i]), - ISC_R_SUCCESS); - event = isc_event_allocate(mctx, NULL, 1000, do_store, - &counters[i], - sizeof(struct isc_event)); - ATF_REQUIRE(event != NULL); - isc_task_sendanddetach(&tasks[i], &event); - } - - isc_test_end(); - - r = store_32 & 0xff; - val = (r << 24) | (r << 16) | (r << 8) | r; - - printf("32-bit store 0x%x, expected 0x%x\n", - (uint32_t) store_32, val); - - ATF_CHECK_EQ((uint32_t) store_32, val); - store_32 = 0; -} -#endif - -#if defined(ISC_PLATFORM_HAVEATOMICSTOREQ) -static int64_t store_64; - -static void -do_storeq(isc_task_t *task, isc_event_t *ev) { - counter_t *state = (counter_t *)ev->ev_arg; - int i; - uint8_t r; - uint64_t val; - - r = random() % 256; - val = (((uint64_t) r << 24) | - ((uint64_t) r << 16) | - ((uint64_t) r << 8) | - (uint64_t) r); - val |= ((uint64_t) val << 32); - - for (i = 0 ; i < COUNTS_PER_ITERATION ; i++) { - isc_atomic_storeq(&store_64, val); - } - - state->iteration++; - if (state->iteration < ITERATIONS) { - isc_task_send(task, &ev); - } else { - isc_event_free(&ev); - } -} - -ATF_TC(atomic_storeq); -ATF_TC_HEAD(atomic_storeq, tc) { - atf_tc_set_md_var(tc, "descr", "atomic STOREQ"); -} -ATF_TC_BODY(atomic_storeq, tc) { - isc_result_t result; - isc_task_t *tasks[TASKS]; - isc_event_t *event = NULL; - uint64_t val; - uint32_t r; - int i; - - UNUSED(tc); - - result = isc_test_begin(NULL, true, 0); - ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - - memset(counters, 0, sizeof(counters)); - store_64 = 0; - - /* - * Create our tasks, and allocate an event to get the counters - * going. - */ - for (i = 0 ; i < TASKS ; i++) { - tasks[i] = NULL; - ATF_REQUIRE_EQ(isc_task_create(taskmgr, 0, &tasks[i]), - ISC_R_SUCCESS); - event = isc_event_allocate(mctx, NULL, 1000, do_storeq, - &counters[i], - sizeof(struct isc_event)); - ATF_REQUIRE(event != NULL); - isc_task_sendanddetach(&tasks[i], &event); - } - - isc_test_end(); - - r = store_64 & 0xff; - val = (((uint64_t) r << 24) | - ((uint64_t) r << 16) | - ((uint64_t) r << 8) | - (uint64_t) r); - val |= ((uint64_t) val << 32); - - printf("64-bit store 0x%" PRIx64 ", " - "expected 0x%" PRIx64 "\n", - (uint64_t) store_64, val); - - ATF_CHECK_EQ((uint64_t) store_64, val); - store_64 = 0; -} -#endif - -#if !defined(ISC_PLATFORM_HAVEXADD) && \ - !defined(ISC_PLATFORM_HAVEXADDQ) && \ - !defined(ISC_PLATFORM_HAVEATOMICSTOREQ) -ATF_TC(untested); -ATF_TC_HEAD(untested, tc) { - atf_tc_set_md_var(tc, "descr", "skipping aes test"); -} -ATF_TC_BODY(untested, tc) { - UNUSED(tc); - atf_tc_skip("AES not available"); -} -#endif /* !HAVEXADD, !HAVEXADDQ, !HAVEATOMICSTOREQ */ - -/* - * Main - */ -ATF_TP_ADD_TCS(tp) { -#if defined(ISC_PLATFORM_HAVEXADD) - ATF_TP_ADD_TC(tp, atomic_xadd); -#endif -#if defined(ISC_PLATFORM_HAVEXADDQ) - ATF_TP_ADD_TC(tp, atomic_xaddq); -#endif -#ifdef ISC_PLATFORM_HAVEATOMICSTORE - ATF_TP_ADD_TC(tp, atomic_store); -#endif -#if defined(ISC_PLATFORM_HAVEATOMICSTOREQ) - ATF_TP_ADD_TC(tp, atomic_storeq); -#endif -#if !defined(ISC_PLATFORM_HAVEXADD) && \ - !defined(ISC_PLATFORM_HAVEXADDQ) && \ - !defined(ISC_PLATFORM_HAVEATOMICSTOREQ) - ATF_TP_ADD_TC(tp, untested); -#endif - - return (atf_no_error()); -} diff --git a/util/copyrights b/util/copyrights index 4b2dfd62d1..6b74dc659c 100644 --- a/util/copyrights +++ b/util/copyrights @@ -3465,7 +3465,6 @@ ./lib/isc/tests/Atffile X 2011,2017,2018 ./lib/isc/tests/Kyuafile X 2017,2018 ./lib/isc/tests/aes_test.c C 2014,2016,2018 -./lib/isc/tests/atomic_test.c C 2018 ./lib/isc/tests/buffer_test.c C 2014,2015,2016,2017,2018 ./lib/isc/tests/counter_test.c C 2014,2016,2018 ./lib/isc/tests/errno_test.c C 2016,2018 From 22e5231f99ceac8371ac0e74a114df64aa3fc868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 4 Sep 2018 12:26:39 +0200 Subject: [PATCH 03/39] Remove ISC_PLATFORM_BUSYWAITNOP in favour of direct isc_rwlock_pause() define --- configure | 107 ------------------------ configure.in | 49 ----------- lib/isc/include/isc/platform.h.in | 5 -- lib/isc/rwlock.c | 23 ++++- lib/isc/win32/include/isc/platform.h.in | 37 -------- win32utils/Configure | 27 +----- 6 files changed, 22 insertions(+), 226 deletions(-) diff --git a/configure b/configure index af0ab25968..7e7bdd9fae 100755 --- a/configure +++ b/configure @@ -706,7 +706,6 @@ DNSTAPSRCS DNSTAP FSTRM_CAPTURE PROTOC_C -ISC_PLATFORM_BUSYWAITNOP ISC_PLATFORM_HAVEIFNAMETOINDEX ISC_PLATFORM_HAVESTRINGSH IRS_PLATFORM_USEDECLSPEC @@ -18461,112 +18460,6 @@ $as_echo "#define HAVE_BUILTIN_CLZ 1" >>confdefs.h fi -# -# CPU relax (for spin locks) -# -case "$host" in -i[3456]86-*) - # x86_32 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if asm(\"rep; nop\"); works" >&5 -$as_echo_n "checking if asm(\"rep; nop\"); works... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -asm("rep; nop"); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"rep; nop\")" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; -x86_64-*|amd64-*) - # x86_64 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if asm(\"rep; nop\"); works" >&5 -$as_echo_n "checking if asm(\"rep; nop\"); works... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -asm("rep; nop"); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"rep; nop\")" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; -ia64-*) - # ia64 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if asm(\"hint @pause\"); works" >&5 -$as_echo_n "checking if asm(\"hint @pause\"); works... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -asm("hint @pause"); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"hint @pause\")" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; -sparc-*) - # sparc - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if cpu_relax(); or __cpu_relax(); works" >&5 -$as_echo_n "checking if cpu_relax(); or __cpu_relax(); works... " >&6; } - ac_fn_c_check_func "$LINENO" "cpu_relax" "ac_cv_func_cpu_relax" -if test "x$ac_cv_func_cpu_relax" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP cpu_relax()" -else - ac_fn_c_check_func "$LINENO" "__cpu_relax" "ac_cv_func___cpu_relax" -if test "x$ac_cv_func___cpu_relax" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP __cpu_relax()" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - -fi - - ;; -esac - - - # # Activate "rrset-order fixed" or not? # diff --git a/configure.in b/configure.in index c1594e2c78..c26cb4608b 100644 --- a/configure.in +++ b/configure.in @@ -2275,55 +2275,6 @@ if test "yes" = "$have_builtin_clz"; then AC_DEFINE(HAVE_BUILTIN_CLZ, 1, [Define to 1 if the compiler supports __builtin_clz.]) fi -# -# CPU relax (for spin locks) -# -case "$host" in -[i[3456]86-*]) - # x86_32 - AC_MSG_CHECKING([if asm("rep; nop"); works]) - AC_TRY_COMPILE(,[asm("rep; nop");], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"rep; nop\")"], - [AC_MSG_RESULT(no)], - [AC_MSG_RESULT([cross compile, assume yes]) - ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"rep; nop\")"]) - ;; -x86_64-*|amd64-*) - # x86_64 - AC_MSG_CHECKING([if asm("rep; nop"); works]) - AC_TRY_COMPILE(,[asm("rep; nop");], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"rep; nop\")"], - [AC_MSG_RESULT(no)], - [AC_MSG_RESULT([cross compile, assume yes]) - ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"rep; nop\")"]) - ;; -ia64-*) - # ia64 - AC_MSG_CHECKING([if asm("hint @pause"); works]) - AC_TRY_COMPILE(,[asm("hint @pause");], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"hint @pause\")"], - [AC_MSG_RESULT(no)], - [AC_MSG_RESULT([cross compile, assume yes]) - ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"hint @pause\")"]) - ;; -sparc-*) - # sparc - AC_MSG_CHECKING([if cpu_relax(); or __cpu_relax(); works]) - AC_CHECK_FUNC(cpu_relax, - [AC_MSG_RESULT(yes) - ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP cpu_relax()"], - [AC_CHECK_FUNC(__cpu_relax, - [AC_MSG_RESULT(yes) - ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP __cpu_relax()"], - [AC_MSG_RESULT(no)])]) - ;; -esac - -AC_SUBST(ISC_PLATFORM_BUSYWAITNOP) - # # Activate "rrset-order fixed" or not? # diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 0280e438e7..5fd9af3c59 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -134,11 +134,6 @@ */ @ISC_PLATFORM_HAVESYSUNH@ -/* - * Define with the busy wait nop asm or function call. - */ -@ISC_PLATFORM_BUSYWAITNOP@ - /* * Define if the platform has . */ diff --git a/lib/isc/rwlock.c b/lib/isc/rwlock.c index 622cd7d276..91482e6c64 100644 --- a/lib/isc/rwlock.c +++ b/lib/isc/rwlock.c @@ -41,6 +41,25 @@ #define RWLOCK_MAX_ADAPTIVE_COUNT 100 #endif +#if defined(_MSC_VER) +# include +# define isc_rwlock_pause() YieldProcessor() +#elif defined(__x86_64__) || defined(__i386__) +# include +# define isc_rwlock_pause() _mm_pause() +#elif defined(__ia64__) +# define isc_rwlock_pause() __asm__ __volatile__ ("hint @pause") +#elif defined(__arm__) +# define isc_rwlock_pause() __asm__ __volatile__ ("yield") +#elif defined(__sparc) || defined(__sparc__) +# define plasma_spin_pause() __asm__ __volatile__ ("pause") +#elif defined(__ppc__) || defined(_ARCH_PPC) || \ + defined(_ARCH_PWR) || defined(_ARCH_PWR2) || defined(_POWER) +# define isc_rwlock_pause() __asm__ volatile ("or 27,27,27") +#else +# define isc_rwlock_pause() +#endif + static isc_result_t isc__rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type); @@ -350,9 +369,7 @@ isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { result = isc__rwlock_lock(rwl, type); break; } -#ifdef ISC_PLATFORM_BUSYWAITNOP - ISC_PLATFORM_BUSYWAITNOP; -#endif + isc_rwlock_pause(); } while (isc_rwlock_trylock(rwl, type) != ISC_R_SUCCESS); rwl->spins += (cnt - rwl->spins) / 8; diff --git a/lib/isc/win32/include/isc/platform.h.in b/lib/isc/win32/include/isc/platform.h.in index 8c4f9dc795..b36233a695 100644 --- a/lib/isc/win32/include/isc/platform.h.in +++ b/lib/isc/win32/include/isc/platform.h.in @@ -46,22 +46,14 @@ #undef MSG_TRUNC -#define ISC_PLATFORM_NEEDSTRSEP #define ISC_PLATFORM_NEEDSTRLCPY #define ISC_PLATFORM_NEEDSTRLCAT -#define ISC_PLATFORM_NEEDSTRLCPY /* * Used to control how extern data is linked; needed for Win32 platforms. */ #define ISC_PLATFORM_USEDECLSPEC 1 -/* - * Define this here for now as winsock2.h defines h_errno - * and we don't want to redeclare it. - */ -#define ISC_PLATFORM_NONSTDHERRNO - /* * Define if the platform has . */ @@ -73,35 +65,6 @@ #define ISC_PLATFORM_NORETURN_PRE __declspec(noreturn) #define ISC_PLATFORM_NORETURN_POST -/* - * If the "xadd" operation is available on this architecture, - * ISC_PLATFORM_HAVEXADD will be defined. - */ -@ISC_PLATFORM_HAVEXADD@ - -/* - * If the "xaddq" operation (64bit xadd) is available on this architecture, - * ISC_PLATFORM_HAVEXADDQ will be defined. - */ -@ISC_PLATFORM_HAVEXADDQ@ - -/* - * If the "atomic swap" operation is available on this architecture, - * ISC_PLATFORM_HAVEATOMICSTORE" will be defined. - */ -@ISC_PLATFORM_HAVEATOMICSTORE@ - -/* - * If the "compare-and-exchange" operation is available on this architecture, - * ISC_PLATFORM_HAVECMPXCHG will be defined. - */ -@ISC_PLATFORM_HAVECMPXCHG@ - -/* - * Define with the busy wait nop asm or function call. - */ -@ISC_PLATFORM_BUSYWAITNOP@ - /* * If the strcasestr() operation is not available on this platform, * ISC_PLATFORM_NEEDSTRCASESTR will be defined. diff --git a/win32utils/Configure b/win32utils/Configure index a0015ae01a..eaa29247a1 100644 --- a/win32utils/Configure +++ b/win32utils/Configure @@ -220,19 +220,14 @@ my @substdefh = ("AES_CC", "TUNE_LARGE", "WANT_QUERYTRACE", "WITH_IDN", + "CPU_RELAX", "VALIDATION_DEFAULT"); # for platform.h my %configdefp; -my @substdefp = ("ISC_PLATFORM_BUSYWAITNOP", - "ISC_PLATFORM_HAVEATOMICSTORE", - "ISC_PLATFORM_HAVEATOMICSTOREQ", - "ISC_PLATFORM_HAVECMPXCHG", - "ISC_PLATFORM_HAVEXADD", - "ISC_PLATFORM_HAVEXADDQ", - "ISC_PLATFORM_NEEDSTRCASESTR"); +my @substdefp = ("ISC_PLATFORM_NEEDSTRCASESTR"); # for conf.sh @@ -576,13 +571,11 @@ if (($want_win32 eq "yes") && ($want_x64 eq "yes")) { $configvar{"BUILD_PLATFORM"} = "Win32"; $configvar{"MACHINE"} = "/machine:X86"; $configvar{"BUILD_MACHINE"} = "/machine:X86"; - $configdefp{"ISC_PLATFORM_BUSYWAITNOP"} = "__asm { rep nop }"; } elsif ($want_x64 eq "yes") { $configvar{"PLATFORM"} = "x64"; $configvar{"BUILD_PLATFORM"} = "x64"; $configvar{"MACHINE"} = "/machine:X64"; $configvar{"BUILD_MACHINE"} = "/machine:X64"; - $configdefp{"ISC_PLATFORM_BUSYWAITNOP"} = "_mm_pause()"; } # Standard configure variable $configvar{"EXEEXT"} = ".exe"; @@ -1231,22 +1224,6 @@ EOF # Process arguments -# enable-intrinsics -if ($enable_intrinsics eq "yes") { - $configcond{"ATOMIC"} = 1; - $configvar{"INTRINSIC"} = "true"; - $configvar{"COPTI"} = "/Oi"; - $configdefp{"ISC_PLATFORM_HAVEXADD"} = 1; - if ($want_x64 eq "yes") { - $configdefp{"ISC_PLATFORM_HAVEXADDQ"} = 1; - $configdefp{"ISC_PLATFORM_HAVEATOMICSTOREQ"} = 1; - } - $configdefp{"ISC_PLATFORM_HAVEATOMICSTORE"} = 1; - $configdefp{"ISC_PLATFORM_HAVECMPXCHG"} = 1; -} else { - $configvar{"INTRINSIC"} = "false"; -} - # enable-native-pkcs11 if ($enable_native_pkcs11 eq "yes") { $cryptolib = "pkcs11"; From f8635fd719a69ed2fa7685d3fe2d4b3412ef53aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 4 Sep 2018 12:29:24 +0200 Subject: [PATCH 04/39] Remove dummy ISC_PLATFORM_NEEDSTRCASESTR define from platform.h --- lib/isc/include/isc/platform.h.in | 5 ----- lib/isc/win32/include/isc/platform.h.in | 6 ------ win32utils/Configure | 5 +---- 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 5fd9af3c59..3916bdf055 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -82,11 +82,6 @@ *** Printing. ***/ -/* - * If the system needs strlcpy(), ISC_PLATFORM_NEEDSTRLCPY will be defined. - */ -@ISC_PLATFORM_NEEDSTRLCPY@ - /* * If the system needs strlcat(), ISC_PLATFORM_NEEDSTRLCAT will be defined. */ diff --git a/lib/isc/win32/include/isc/platform.h.in b/lib/isc/win32/include/isc/platform.h.in index b36233a695..c01aad2764 100644 --- a/lib/isc/win32/include/isc/platform.h.in +++ b/lib/isc/win32/include/isc/platform.h.in @@ -65,12 +65,6 @@ #define ISC_PLATFORM_NORETURN_PRE __declspec(noreturn) #define ISC_PLATFORM_NORETURN_POST -/* - * If the strcasestr() operation is not available on this platform, - * ISC_PLATFORM_NEEDSTRCASESTR will be defined. - */ -@ISC_PLATFORM_NEEDSTRCASESTR@ - /* * Set up a macro for importing and exporting from the DLL */ diff --git a/win32utils/Configure b/win32utils/Configure index eaa29247a1..c2b63a0c37 100644 --- a/win32utils/Configure +++ b/win32utils/Configure @@ -227,7 +227,7 @@ my @substdefh = ("AES_CC", my %configdefp; -my @substdefp = ("ISC_PLATFORM_NEEDSTRCASESTR"); +my @substdefp = (); # for conf.sh @@ -1156,9 +1156,6 @@ if ($msc_ver >= 1700) { $configdefh{"USE_BACKTRACE"} = 1; } -# no version of MSVS supports strcasestr() yet -$configdefp{"ISC_PLATFORM_NEEDSTRCASESTR"} = 1; - # warn when cross compiling if ($cross_compile eq "yes") { From c798db0fcd34df604264808e8f82aad1fce2de73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 4 Sep 2018 12:30:59 +0200 Subject: [PATCH 05/39] Remove dummy ISC_PLATFORM_HAVEIF_LADDRCONF define --- configure | 30 ------------------------------ configure.in | 11 ----------- lib/isc/include/isc/platform.h.in | 6 ------ 3 files changed, 47 deletions(-) diff --git a/configure b/configure index 7e7bdd9fae..c75da2e26d 100755 --- a/configure +++ b/configure @@ -720,7 +720,6 @@ READLINE_LIB ISC_PLATFORM_NEEDSTRLCAT ISC_PLATFORM_NEEDSTRLCPY ISC_PLATFORM_HAVETFO -ISC_PLATFORM_HAVEIF_LADDRCONF ISC_PLATFORM_HAVEIF_LADDRREQ BIND9_CO_RULE LIBTOOL_MODE_UNINSTALL @@ -17678,35 +17677,6 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct if_laddrconf" >&5 -$as_echo_n "checking for struct if_laddrconf... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include - -int -main () -{ - struct if_laddrconf a; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_HAVEIF_LADDRCONF="#define ISC_PLATFORM_HAVEIF_LADDRCONF 1" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_PLATFORM_HAVEIF_LADDRCONF="#undef ISC_PLATFORM_HAVEIF_LADDRCONF" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - # # Allow forcibly disabling TCP Fast Open support as autodetection might yield # confusing results on some systems (e.g. FreeBSD; see set_tcp_fastopen() diff --git a/configure.in b/configure.in index c26cb4608b..ddfd37505d 100644 --- a/configure.in +++ b/configure.in @@ -1925,17 +1925,6 @@ AC_TRY_LINK([ ISC_PLATFORM_HAVEIF_LADDRREQ="#undef ISC_PLATFORM_HAVEIF_LADDRREQ"]) AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRREQ) -AC_MSG_CHECKING([for struct if_laddrconf]) -AC_TRY_LINK([ -#include -#include -],[ struct if_laddrconf a; ], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_HAVEIF_LADDRCONF="#define ISC_PLATFORM_HAVEIF_LADDRCONF 1"], - [AC_MSG_RESULT(no) - ISC_PLATFORM_HAVEIF_LADDRCONF="#undef ISC_PLATFORM_HAVEIF_LADDRCONF"]) -AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRCONF) - # # Allow forcibly disabling TCP Fast Open support as autodetection might yield # confusing results on some systems (e.g. FreeBSD; see set_tcp_fastopen() diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 3916bdf055..1d51efe5c4 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -42,12 +42,6 @@ */ @ISC_PLATFORM_HAVELIFCONF@ -/*! \brief - * Define if the system has struct if_laddrconf which is a extended struct - * ifconf for IPv6. - */ -@ISC_PLATFORM_HAVEIF_LADDRCONF@ - /*! \brief * Define if the system has struct if_laddrreq. */ From 53d87175dfe089d72c945a0d56c746b0334e9bfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 4 Sep 2018 12:32:23 +0200 Subject: [PATCH 06/39] Remove dummy ISC_PLATFORM_HAVEIF_LADDRREQ platform define --- configure | 30 ------------------------------ configure.in | 11 ----------- lib/isc/include/isc/platform.h.in | 5 ----- 3 files changed, 46 deletions(-) diff --git a/configure b/configure index c75da2e26d..121f37f778 100755 --- a/configure +++ b/configure @@ -720,7 +720,6 @@ READLINE_LIB ISC_PLATFORM_NEEDSTRLCAT ISC_PLATFORM_NEEDSTRLCPY ISC_PLATFORM_HAVETFO -ISC_PLATFORM_HAVEIF_LADDRREQ BIND9_CO_RULE LIBTOOL_MODE_UNINSTALL LIBTOOL_MODE_LINK @@ -17648,35 +17647,6 @@ See \`config.log' for more details" "$LINENO" 5; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct if_laddrreq" >&5 -$as_echo_n "checking for struct if_laddrreq... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include - -int -main () -{ - struct if_laddrreq a; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_HAVEIF_LADDRREQ="#define ISC_PLATFORM_HAVEIF_LADDRREQ 1" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_PLATFORM_HAVEIF_LADDRREQ="#undef ISC_PLATFORM_HAVEIF_LADDRREQ" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - # # Allow forcibly disabling TCP Fast Open support as autodetection might yield # confusing results on some systems (e.g. FreeBSD; see set_tcp_fastopen() diff --git a/configure.in b/configure.in index ddfd37505d..b490c9a43d 100644 --- a/configure.in +++ b/configure.in @@ -1914,17 +1914,6 @@ AC_COMPILE_IFELSE( [AC_MSG_RESULT([yes])], [AC_MSG_FAILURE([IPv6 support is mandatory])]) -AC_MSG_CHECKING([for struct if_laddrreq]) -AC_TRY_LINK([ -#include -#include -],[ struct if_laddrreq a; ], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_HAVEIF_LADDRREQ="#define ISC_PLATFORM_HAVEIF_LADDRREQ 1"], - [AC_MSG_RESULT(no) - ISC_PLATFORM_HAVEIF_LADDRREQ="#undef ISC_PLATFORM_HAVEIF_LADDRREQ"]) -AC_SUBST(ISC_PLATFORM_HAVEIF_LADDRREQ) - # # Allow forcibly disabling TCP Fast Open support as autodetection might yield # confusing results on some systems (e.g. FreeBSD; see set_tcp_fastopen() diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 1d51efe5c4..7609253e81 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -42,11 +42,6 @@ */ @ISC_PLATFORM_HAVELIFCONF@ -/*! \brief - * Define if the system has struct if_laddrreq. - */ -@ISC_PLATFORM_HAVEIF_LADDRREQ@ - /*! \brief * Define if the system supports if_nametoindex. */ From 0bea5c2bafb344be0394569e99170acfb5a5713b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 4 Sep 2018 12:35:42 +0200 Subject: [PATCH 07/39] Replace platform.h ISC_PLATFORM_HAVEIFNAMETOINDEX with config HAVE_IF_NAMETOINDEX --- config.h.in | 2 +- configure | 25 ++++++++----------------- configure.in | 14 +------------- lib/isc/include/isc/platform.h.in | 5 ----- lib/isc/netscope.c | 6 +++--- lib/isc/unix/interfaceiter.c | 4 ++-- 6 files changed, 15 insertions(+), 41 deletions(-) diff --git a/config.h.in b/config.h.in index 65844b472f..83a1e8a99e 100644 --- a/config.h.in +++ b/config.h.in @@ -251,7 +251,7 @@ /* Define to 1 if you have the header file. */ #undef HAVE_IDN2_H -/* Define to 1 if you have the if_nametoindex function. */ +/* Define to 1 if you have the `if_nametoindex' function. */ #undef HAVE_IF_NAMETOINDEX /* Define to 1 if you have the header file. */ diff --git a/configure b/configure index 121f37f778..53ab9f8d13 100755 --- a/configure +++ b/configure @@ -706,7 +706,6 @@ DNSTAPSRCS DNSTAP FSTRM_CAPTURE PROTOC_C -ISC_PLATFORM_HAVEIFNAMETOINDEX ISC_PLATFORM_HAVESTRINGSH IRS_PLATFORM_USEDECLSPEC ISC_PLATFORM_USEDECLSPEC @@ -18157,24 +18156,16 @@ done # # Check for if_nametoindex() for IPv6 scoped addresses support # -ac_fn_c_check_func "$LINENO" "if_nametoindex" "ac_cv_func_if_nametoindex" +for ac_func in if_nametoindex +do : + ac_fn_c_check_func "$LINENO" "if_nametoindex" "ac_cv_func_if_nametoindex" if test "x$ac_cv_func_if_nametoindex" = xyes; then : - ac_cv_have_if_nametoindex=yes -else - ac_cv_have_if_nametoindex=no + cat >>confdefs.h <<_ACEOF +#define HAVE_IF_NAMETOINDEX 1 +_ACEOF + fi - -case $ac_cv_have_if_nametoindex in -yes) - ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1" - -$as_echo "#define HAVE_IF_NAMETOINDEX 1" >>confdefs.h - - ;; -*) - ISC_PLATFORM_HAVEIFNAMETOINDEX="#undef ISC_PLATFORM_HAVEIFNAMETOINDEX" - ;; -esac +done for ac_func in nanosleep usleep explicit_bzero diff --git a/configure.in b/configure.in index b490c9a43d..87e1d6efb6 100644 --- a/configure.in +++ b/configure.in @@ -2154,19 +2154,7 @@ AC_SUBST(ISC_PLATFORM_HAVESTRINGSH) # # Check for if_nametoindex() for IPv6 scoped addresses support # -AC_CHECK_FUNC(if_nametoindex, ac_cv_have_if_nametoindex=yes, - ac_cv_have_if_nametoindex=no) -case $ac_cv_have_if_nametoindex in -yes) - ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1" - AC_DEFINE(HAVE_IF_NAMETOINDEX, 1, - [Define to 1 if you have the if_nametoindex function.]) - ;; -*) - ISC_PLATFORM_HAVEIFNAMETOINDEX="#undef ISC_PLATFORM_HAVEIFNAMETOINDEX" - ;; -esac -AC_SUBST(ISC_PLATFORM_HAVEIFNAMETOINDEX) +AC_CHECK_FUNCS([if_nametoindex]) AC_CHECK_FUNCS(nanosleep usleep explicit_bzero) diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 7609253e81..05fe3071bf 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -42,11 +42,6 @@ */ @ISC_PLATFORM_HAVELIFCONF@ -/*! \brief - * Define if the system supports if_nametoindex. - */ -@ISC_PLATFORM_HAVEIFNAMETOINDEX@ - /*! \brief * Define if the system has TCP_FASTOPEN socket option. */ diff --git a/lib/isc/netscope.c b/lib/isc/netscope.c index 7fed44ecc1..da0046398a 100644 --- a/lib/isc/netscope.c +++ b/lib/isc/netscope.c @@ -24,7 +24,7 @@ isc_result_t isc_netscope_pton(int af, char *scopename, void *addr, uint32_t *zoneid) { char *ep; -#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX +#ifdef HAVE_IF_NAMETOINDEX unsigned int ifid; struct in6_addr *in6; #endif @@ -43,7 +43,7 @@ isc_netscope_pton(int af, char *scopename, void *addr, uint32_t *zoneid) { * interface names as link names, assuming one to one mapping between * interfaces and links. */ -#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX +#ifdef HAVE_IF_NAMETOINDEX in6 = (struct in6_addr *)addr; if (IN6_IS_ADDR_LINKLOCAL(in6) && (ifid = if_nametoindex((const char *)scopename)) != 0) @@ -58,7 +58,7 @@ isc_netscope_pton(int af, char *scopename, void *addr, uint32_t *zoneid) { zone = (uint32_t)(llz & 0xffffffffUL); if (zone != llz) return (ISC_R_FAILURE); -#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX +#ifdef HAVE_IF_NAMETOINDEX } #endif diff --git a/lib/isc/unix/interfaceiter.c b/lib/isc/unix/interfaceiter.c index 0e7712a77e..3f0f1053c2 100644 --- a/lib/isc/unix/interfaceiter.c +++ b/lib/isc/unix/interfaceiter.c @@ -62,7 +62,7 @@ get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src, { struct sockaddr_in6 *sa6; -#if !defined(ISC_PLATFORM_HAVEIFNAMETOINDEX) +#if !defined(HAVE_IF_NAMETOINDEX) UNUSED(ifname); #endif @@ -106,7 +106,7 @@ get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src, (uint32_t)zone16); dst->type.in6.s6_addr[2] = 0; dst->type.in6.s6_addr[3] = 0; -#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX +#ifdef HAVE_IF_NAMETOINDEX } else if (ifname != NULL) { unsigned int zone; From 1333d4a71a000c4dbb0a7a528ed71ff6ef6e0248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 4 Sep 2018 12:37:59 +0200 Subject: [PATCH 08/39] Remove dummy ISC_PLATFORM_HAVELIFCONF platform define --- configure | 37 ------------------------------- configure.in | 20 ----------------- lib/isc/include/isc/platform.h.in | 6 ----- 3 files changed, 63 deletions(-) diff --git a/configure b/configure index 53ab9f8d13..cbf970700b 100755 --- a/configure +++ b/configure @@ -769,7 +769,6 @@ ISC_PLATFORM_NEEDSYSSELECTH ISC_PLATFORM_HAVEDEVPOLL ISC_PLATFORM_HAVEEPOLL ISC_PLATFORM_HAVEKQUEUE -ISC_PLATFORM_HAVELIFCONF ISC_PLATFORM_NORETURN_POST ISC_PLATFORM_NORETURN_PRE ISC_SOCKADDR_LEN_T @@ -13880,42 +13879,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# -# check if we have lifconf -# -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct lifconf" >&5 -$as_echo_n "checking for struct lifconf... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include - -int -main () -{ - -struct lifconf lifconf; -lifconf.lifc_len = 0; - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_HAVELIFCONF="#define ISC_PLATFORM_HAVELIFCONF 1" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_PLATFORM_HAVELIFCONF="#undef ISC_PLATFORM_HAVELIFCONF" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - # # check if we have kqueue # diff --git a/configure.in b/configure.in index 87e1d6efb6..04f51bc77f 100644 --- a/configure.in +++ b/configure.in @@ -528,26 +528,6 @@ AC_TRY_COMPILE([],[void foo() __attribute__((noreturn));], AC_SUBST(ISC_PLATFORM_NORETURN_PRE) AC_SUBST(ISC_PLATFORM_NORETURN_POST) -# -# check if we have lifconf -# -AC_MSG_CHECKING(for struct lifconf) -AC_TRY_COMPILE([ -#include -#include -#include -], -[ -struct lifconf lifconf; -lifconf.lifc_len = 0; -] -, - [AC_MSG_RESULT(yes) - ISC_PLATFORM_HAVELIFCONF="#define ISC_PLATFORM_HAVELIFCONF 1"], - [AC_MSG_RESULT(no) - ISC_PLATFORM_HAVELIFCONF="#undef ISC_PLATFORM_HAVELIFCONF"]) -AC_SUBST(ISC_PLATFORM_HAVELIFCONF) - # # check if we have kqueue # diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 05fe3071bf..13e138e6e1 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -36,12 +36,6 @@ *** Network. ***/ -/*! \brief - * Define if the system has struct lifconf which is a extended struct ifconf - * for IPv6. - */ -@ISC_PLATFORM_HAVELIFCONF@ - /*! \brief * Define if the system has TCP_FASTOPEN socket option. */ From 4014bc42dd587bf2b9ce8fd595ec28bccad7aa5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 4 Sep 2018 12:42:48 +0200 Subject: [PATCH 09/39] According to POSIX.1-2001, POSIX.1-2008 #include is correct way to get fd_set --- bin/tests/optional/zone_test.c | 5 +-- configure | 53 ------------------------------- configure.in | 36 --------------------- lib/isc/include/isc/platform.h.in | 11 ++++--- lib/isc/unix/socket_p.h | 4 +-- 5 files changed, 8 insertions(+), 101 deletions(-) diff --git a/bin/tests/optional/zone_test.c b/bin/tests/optional/zone_test.c index d64bd189ae..b26acea0b1 100644 --- a/bin/tests/optional/zone_test.c +++ b/bin/tests/optional/zone_test.c @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -35,10 +36,6 @@ #include #include -#ifdef ISC_PLATFORM_NEEDSYSSELECTH -#include -#endif - static int debug = 0; static int quiet = 0; static int stats = 0; diff --git a/configure b/configure index cbf970700b..8d44145be1 100755 --- a/configure +++ b/configure @@ -765,7 +765,6 @@ ax_pthread_config CHECK_DSA GEOIPLINKOBJS GEOIPLINKSRCS -ISC_PLATFORM_NEEDSYSSELECTH ISC_PLATFORM_HAVEDEVPOLL ISC_PLATFORM_HAVEEPOLL ISC_PLATFORM_HAVEKQUEUE @@ -14003,58 +14002,6 @@ done esac -# -# check if we need to #include sys/select.h explicitly -# -case $ac_cv_header_unistd_h in -yes) -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if unistd.h or sys/types.h defines fd_set" >&5 -$as_echo_n "checking if unistd.h or sys/types.h defines fd_set... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include /* Ultrix */ -#include -int -main () -{ -fd_set read_set; return (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - case $ac_cv_header_sys_select_h in - yes) - ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1" - ;; - no) - as_fn_error $? "need either working unistd.h or sys/select.h" "$LINENO" 5 - ;; - esac - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; -no) - case $ac_cv_header_sys_select_h in - yes) - ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1" - ;; - no) - as_fn_error $? "need either unistd.h or sys/select.h" "$LINENO" 5 - ;; - esac - ;; -esac - - # # Find the machine's endian flavor. # diff --git a/configure.in b/configure.in index 04f51bc77f..5de4a1e300 100644 --- a/configure.in +++ b/configure.in @@ -609,42 +609,6 @@ yes) esac AC_SUBST(ISC_PLATFORM_HAVEDEVPOLL) -# -# check if we need to #include sys/select.h explicitly -# -case $ac_cv_header_unistd_h in -yes) -AC_MSG_CHECKING(if unistd.h or sys/types.h defines fd_set) -AC_TRY_COMPILE([ -#include /* Ultrix */ -#include ], -[fd_set read_set; return (0);], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_NEEDSYSSELECTH="#undef ISC_PLATFORM_NEEDSYSSELECTH"], - [AC_MSG_RESULT(no) - case $ac_cv_header_sys_select_h in - yes) - ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1" - ;; - no) - AC_MSG_ERROR([need either working unistd.h or sys/select.h]) - ;; - esac - ]) - ;; -no) - case $ac_cv_header_sys_select_h in - yes) - ISC_PLATFORM_NEEDSYSSELECTH="#define ISC_PLATFORM_NEEDSYSSELECTH 1" - ;; - no) - AC_MSG_ERROR([need either unistd.h or sys/select.h]) - ;; - esac - ;; -esac -AC_SUBST(ISC_PLATFORM_NEEDSYSSELECTH) - # # Find the machine's endian flavor. # diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 13e138e6e1..ee6b87adb6 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -36,6 +36,12 @@ *** Network. ***/ +/*! \brief + * Define if the system has struct lifconf which is a extended struct ifconf + * for IPv6. + */ +@ISC_PLATFORM_HAVELIFCONF@ + /*! \brief * Define if the system has TCP_FASTOPEN socket option. */ @@ -69,11 +75,6 @@ *** Miscellaneous. ***/ -/* - * Defined if unistd.h does not cause fd_set to be delared. - */ -@ISC_PLATFORM_NEEDSYSSELECTH@ - /* * Defined to or for how to include * the GSSAPI header. diff --git a/lib/isc/unix/socket_p.h b/lib/isc/unix/socket_p.h index fb4fdb89d7..6ab124d054 100644 --- a/lib/isc/unix/socket_p.h +++ b/lib/isc/unix/socket_p.h @@ -15,9 +15,7 @@ /*! \file */ -#ifdef ISC_PLATFORM_NEEDSYSSELECTH -#include -#endif +#include typedef struct isc_socketwait isc_socketwait_t; int isc__socketmgr_waitevents(isc_socketmgr_t *, struct timeval *, From 47f18c7d50f4993a1fe36945fbeaaf57fd63ebc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 4 Sep 2018 21:10:02 +0200 Subject: [PATCH 10/39] Replace platform ISC_PLATFORM_NEEDSTRLCPY and ISC_PLATFORM_NEEDSTRLCAT with AC_CHECK_FUNCS call --- config.h.in | 6 ++++++ configure | 27 +++++++++---------------- configure.in | 10 +-------- lib/isc/include/isc/platform.h.in | 9 --------- lib/isc/include/isc/string.h | 14 +++++-------- lib/isc/string.c | 8 ++++++-- lib/isc/win32/include/isc/platform.h.in | 3 --- 7 files changed, 28 insertions(+), 49 deletions(-) diff --git a/config.h.in b/config.h.in index 83a1e8a99e..5ccb35efc5 100644 --- a/config.h.in +++ b/config.h.in @@ -404,6 +404,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H +/* Define to 1 if you have the `strlcat' function. */ +#undef HAVE_STRLCAT + +/* Define to 1 if you have the `strlcpy' function. */ +#undef HAVE_STRLCPY + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_CAPABILITY_H diff --git a/configure b/configure index 8d44145be1..2ac9d6efb4 100755 --- a/configure +++ b/configure @@ -716,8 +716,6 @@ DST_EXTRA_SRCS DST_EXTRA_OBJS USE_ISC_SPNEGO READLINE_LIB -ISC_PLATFORM_NEEDSTRLCAT -ISC_PLATFORM_NEEDSTRLCPY ISC_PLATFORM_HAVETFO BIND9_CO_RULE LIBTOOL_MODE_UNINSTALL @@ -17608,22 +17606,17 @@ esac # # Check for some other useful functions that are not ever-present. # -ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy" -if test "x$ac_cv_func_strlcpy" = xyes; then : - ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY" -else - ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1" +for ac_func in strlcpy strlcat +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi - - - -ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat" -if test "x$ac_cv_func_strlcat" = xyes; then : - ISC_PLATFORM_NEEDSTRLCAT="#undef ISC_PLATFORM_NEEDSTRLCAT" -else - ISC_PLATFORM_NEEDSTRLCAT="#define ISC_PLATFORM_NEEDSTRLCAT 1" -fi - +done diff --git a/configure.in b/configure.in index 5de4a1e300..1b80783f46 100644 --- a/configure.in +++ b/configure.in @@ -1895,15 +1895,7 @@ AC_SUBST(ISC_PLATFORM_HAVETFO) # # Check for some other useful functions that are not ever-present. # -AC_CHECK_FUNC(strlcpy, - [ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY"], - [ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"]) -AC_SUBST(ISC_PLATFORM_NEEDSTRLCPY) - -AC_CHECK_FUNC(strlcat, - [ISC_PLATFORM_NEEDSTRLCAT="#undef ISC_PLATFORM_NEEDSTRLCAT"], - [ISC_PLATFORM_NEEDSTRLCAT="#define ISC_PLATFORM_NEEDSTRLCAT 1"]) -AC_SUBST(ISC_PLATFORM_NEEDSTRLCAT) +AC_CHECK_FUNCS([strlcpy strlcat]) AC_SUBST(READLINE_LIB) AC_ARG_WITH(readline, diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index ee6b87adb6..ee1845bd25 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -62,15 +62,6 @@ */ @ISC_PLATFORM_HAVEDEVPOLL@ -/* - *** Printing. - ***/ - -/* - * If the system needs strlcat(), ISC_PLATFORM_NEEDSTRLCAT will be defined. - */ -@ISC_PLATFORM_NEEDSTRLCAT@ - /*** *** Miscellaneous. ***/ diff --git a/lib/isc/include/isc/string.h b/lib/isc/include/isc/string.h index 52c959e340..309b1277a6 100644 --- a/lib/isc/include/isc/string.h +++ b/lib/isc/include/isc/string.h @@ -20,18 +20,14 @@ ISC_LANG_BEGINDECLS +#if !defined(HAVE_STRLCPY) size_t -isc_string_strlcpy(char *dst, const char *src, size_t size); - -#ifdef ISC_PLATFORM_NEEDSTRLCPY -#define strlcpy isc_string_strlcpy -#endif +strlcpy(char *dst, const char *src, size_t size); +#endif /* !defined(HAVE_STRLCPY) */ +#if !defined(HAVE_STRLCAT) size_t -isc_string_strlcat(char *dst, const char *src, size_t size); - -#ifdef ISC_PLATFORM_NEEDSTRLCAT -#define strlcat isc_string_strlcat +strlcat(char *dst, const char *src, size_t size); #endif int diff --git a/lib/isc/string.c b/lib/isc/string.c index 46e5303166..096793da77 100644 --- a/lib/isc/string.c +++ b/lib/isc/string.c @@ -49,8 +49,9 @@ #include "isc/string.h" // IWYU pragma: keep +#if !defined(HAVE_STRLCPY) size_t -isc_string_strlcpy(char *dst, const char *src, size_t size) +strlcpy(char *dst, const char *src, size_t size) { char *d = dst; const char *s = src; @@ -76,9 +77,11 @@ isc_string_strlcpy(char *dst, const char *src, size_t size) return(s - src - 1); /* count does not include NUL */ } +#endif /* !defined(HAVE_STRLCPY) */ +#if !defined(HAVE_STRLCAT) size_t -isc_string_strlcat(char *dst, const char *src, size_t size) +strlcat(char *dst, const char *src, size_t size) { char *d = dst; const char *s = src; @@ -106,6 +109,7 @@ isc_string_strlcat(char *dst, const char *src, size_t size) return(dlen + (s - src)); /* count does not include NUL */ } +#endif /* !defined(HAVE_STRLCAT) */ int isc_string_strerror_r(int errnum, char *buf, size_t buflen) { diff --git a/lib/isc/win32/include/isc/platform.h.in b/lib/isc/win32/include/isc/platform.h.in index c01aad2764..1e0a0354dc 100644 --- a/lib/isc/win32/include/isc/platform.h.in +++ b/lib/isc/win32/include/isc/platform.h.in @@ -46,9 +46,6 @@ #undef MSG_TRUNC -#define ISC_PLATFORM_NEEDSTRLCPY -#define ISC_PLATFORM_NEEDSTRLCAT - /* * Used to control how extern data is linked; needed for Win32 platforms. */ From d00ef56dfac4c725d436bb6d8c3f5bb0c2926584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 12:01:10 +0200 Subject: [PATCH 11/39] Remove dummy ISC_PLATFORM_HAVESTRINGSH platform define --- configure | 24 ------------------------ configure.in | 12 ------------ lib/isc/include/isc/platform.h.in | 5 ----- 3 files changed, 41 deletions(-) diff --git a/configure b/configure index 2ac9d6efb4..1ff1fbd73b 100755 --- a/configure +++ b/configure @@ -706,7 +706,6 @@ DNSTAPSRCS DNSTAP FSTRM_CAPTURE PROTOC_C -ISC_PLATFORM_HAVESTRINGSH IRS_PLATFORM_USEDECLSPEC ISC_PLATFORM_USEDECLSPEC ISC_PLATFORM_HAVESTATNSEC @@ -18033,29 +18032,6 @@ ISC_PLATFORM_USEDECLSPEC="#undef ISC_PLATFORM_USEDECLSPEC" IRS_PLATFORM_USEDECLSPEC="#undef IRS_PLATFORM_USEDECLSPEC" -# -# Random remaining OS-specific issues involving compiler warnings. -# XXXDCL print messages to indicate some compensation is being done? -# - -for ac_header in strings.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "strings.h" "ac_cv_header_strings_h" "$ac_includes_default" -if test "x$ac_cv_header_strings_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STRINGS_H 1 -_ACEOF - ISC_PLATFORM_HAVESTRINGSH="#define ISC_PLATFORM_HAVESTRINGSH 1" - -else - ISC_PLATFORM_HAVESTRINGSH="#undef ISC_PLATFORM_HAVESTRINGSH" - -fi - -done - - - # # Check for if_nametoindex() for IPv6 scoped addresses support # diff --git a/configure.in b/configure.in index 1b80783f46..1a8dd2d2df 100644 --- a/configure.in +++ b/configure.in @@ -2075,18 +2075,6 @@ ISC_PLATFORM_USEDECLSPEC="#undef ISC_PLATFORM_USEDECLSPEC" AC_SUBST(IRS_PLATFORM_USEDECLSPEC) IRS_PLATFORM_USEDECLSPEC="#undef IRS_PLATFORM_USEDECLSPEC" -# -# Random remaining OS-specific issues involving compiler warnings. -# XXXDCL print messages to indicate some compensation is being done? -# - -AC_CHECK_HEADERS(strings.h, - ISC_PLATFORM_HAVESTRINGSH="#define ISC_PLATFORM_HAVESTRINGSH 1" -, - ISC_PLATFORM_HAVESTRINGSH="#undef ISC_PLATFORM_HAVESTRINGSH" -) -AC_SUBST(ISC_PLATFORM_HAVESTRINGSH) - # # Check for if_nametoindex() for IPv6 scoped addresses support # diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index ee1845bd25..e96e12f2cd 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -99,11 +99,6 @@ */ @ISC_PLATFORM_HAVESYSUNH@ -/* - * Define if the platform has . - */ -@ISC_PLATFORM_HAVESTRINGSH@ - /* * Defines for the noreturn attribute. */ From 68f473a25eba956b31adb314a0c1ba8a56410605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 12:05:32 +0200 Subject: [PATCH 12/39] Replace platform ISC_PLATFORM_HAVEKQUEUE with config HAVE_KQUEUE --- config.h.in | 3 +++ configure | 36 +++++++++++-------------------- configure.in | 28 ++++++------------------ lib/isc/include/isc/platform.h.in | 5 ----- lib/isc/unix/socket.c | 6 +++--- 5 files changed, 26 insertions(+), 52 deletions(-) diff --git a/config.h.in b/config.h.in index 5ccb35efc5..3cb938fc2c 100644 --- a/config.h.in +++ b/config.h.in @@ -266,6 +266,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_KERBEROSV5_KRB5_H +/* Define to 1 if you have the `kqueue' function. */ +#undef HAVE_KQUEUE + /* Define to 1 if you have the header file. */ #undef HAVE_KRB5_H diff --git a/configure b/configure index 1ff1fbd73b..1204a0ce88 100755 --- a/configure +++ b/configure @@ -764,7 +764,6 @@ GEOIPLINKOBJS GEOIPLINKSRCS ISC_PLATFORM_HAVEDEVPOLL ISC_PLATFORM_HAVEEPOLL -ISC_PLATFORM_HAVEKQUEUE ISC_PLATFORM_NORETURN_POST ISC_PLATFORM_NORETURN_PRE ISC_SOCKADDR_LEN_T @@ -13880,34 +13879,25 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # # Check whether --enable-kqueue was given. if test "${enable_kqueue+set}" = set; then : - enableval=$enable_kqueue; want_kqueue="$enableval" + enableval=$enable_kqueue; else - want_kqueue="yes" + enable_kqueue="yes" fi -case $want_kqueue in -yes) - ac_fn_c_check_func "$LINENO" "kqueue" "ac_cv_func_kqueue" + +if test "$enable_kqueue" = "yes"; then : + for ac_func in kqueue +do : + ac_fn_c_check_func "$LINENO" "kqueue" "ac_cv_func_kqueue" if test "x$ac_cv_func_kqueue" = xyes; then : - ac_cv_have_kqueue=yes -else - ac_cv_have_kqueue=no + cat >>confdefs.h <<_ACEOF +#define HAVE_KQUEUE 1 +_ACEOF + fi +done - case $ac_cv_have_kqueue in - yes) - ISC_PLATFORM_HAVEKQUEUE="#define ISC_PLATFORM_HAVEKQUEUE 1" - ;; - *) - ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE" - ;; - esac - ;; -*) - ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE" - ;; -esac - +fi # # check if we have epoll. Linux kernel 2.4 has epoll_create() which fails, diff --git a/configure.in b/configure.in index 1a8dd2d2df..fd8259ce1c 100644 --- a/configure.in +++ b/configure.in @@ -531,27 +531,13 @@ AC_SUBST(ISC_PLATFORM_NORETURN_POST) # # check if we have kqueue # -AC_ARG_ENABLE(kqueue, - AS_HELP_STRING([--enable-kqueue], - [use BSD kqueue when available [default=yes]]), - want_kqueue="$enableval", want_kqueue="yes") -case $want_kqueue in -yes) - AC_CHECK_FUNC(kqueue, ac_cv_have_kqueue=yes, ac_cv_have_kqueue=no) - case $ac_cv_have_kqueue in - yes) - ISC_PLATFORM_HAVEKQUEUE="#define ISC_PLATFORM_HAVEKQUEUE 1" - ;; - *) - ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE" - ;; - esac - ;; -*) - ISC_PLATFORM_HAVEKQUEUE="#undef ISC_PLATFORM_HAVEKQUEUE" - ;; -esac -AC_SUBST(ISC_PLATFORM_HAVEKQUEUE) +AC_ARG_ENABLE([kqueue], + [AS_HELP_STRING([--enable-kqueue], + [use BSD kqueue when available [default=yes]])], + [], enable_kqueue="yes") + +AS_IF([test "$enable_kqueue" = "yes"], + [AC_CHECK_FUNCS([kqueue])]) # # check if we have epoll. Linux kernel 2.4 has epoll_create() which fails, diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index e96e12f2cd..f0888d1c4c 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -47,11 +47,6 @@ */ @ISC_PLATFORM_HAVETFO@ -/*! \brief - * Define if the system supports kqueue multiplexing - */ -@ISC_PLATFORM_HAVEKQUEUE@ - /*! \brief * Define if the system supports epoll multiplexing */ diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 62a00cddac..9acac69052 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -65,7 +65,7 @@ #ifdef ISC_PLATFORM_HAVESYSUNH #include #endif -#ifdef ISC_PLATFORM_HAVEKQUEUE +#ifdef HAVE_KQUEUE #include #endif #ifdef ISC_PLATFORM_HAVEEPOLL @@ -94,7 +94,7 @@ /*% * Choose the most preferable multiplex method. */ -#ifdef ISC_PLATFORM_HAVEKQUEUE +#if defined(HAVE_KQUEUE) #define USE_KQUEUE #elif defined (ISC_PLATFORM_HAVEEPOLL) #define USE_EPOLL @@ -106,7 +106,7 @@ typedef struct { } pollinfo_t; #else #define USE_SELECT -#endif /* ISC_PLATFORM_HAVEKQUEUE */ +#endif /* HAVE_KQUEUE */ /* * Set by the -T dscp option on the command line. If set to a value From 5d65392d1848e5acf591decadfb0b7fb48d7da00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 12:14:27 +0200 Subject: [PATCH 13/39] Replace platform ISC_PLATFORM_HAVEEPOLL with config HAVE_EPOLL_CREATE1 --- config.h.in | 3 ++ configure | 53 +++++++------------------------ configure.in | 37 ++++----------------- lib/isc/include/isc/platform.h.in | 5 --- lib/isc/unix/socket.c | 4 +-- 5 files changed, 24 insertions(+), 78 deletions(-) diff --git a/config.h.in b/config.h.in index 3cb938fc2c..4cd770ac7a 100644 --- a/config.h.in +++ b/config.h.in @@ -188,6 +188,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_EDIT_READLINE_READLINE_H +/* Define to 1 if you have the `epoll_create1' function. */ +#undef HAVE_EPOLL_CREATE1 + /* Define to 1 if you have the `EVP_aes_128_ecb' function. */ #undef HAVE_EVP_AES_128_ECB diff --git a/configure b/configure index 1204a0ce88..ac8b8224a7 100755 --- a/configure +++ b/configure @@ -763,7 +763,6 @@ CHECK_DSA GEOIPLINKOBJS GEOIPLINKSRCS ISC_PLATFORM_HAVEDEVPOLL -ISC_PLATFORM_HAVEEPOLL ISC_PLATFORM_NORETURN_POST ISC_PLATFORM_NORETURN_PRE ISC_SOCKADDR_LEN_T @@ -13905,53 +13904,25 @@ fi # # Check whether --enable-epoll was given. if test "${enable_epoll+set}" = set; then : - enableval=$enable_epoll; want_epoll="$enableval" + enableval=$enable_epoll; else - want_epoll="auto" + enable_epoll="yes" fi -case $want_epoll in -auto) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking epoll support" >&5 -$as_echo_n "checking epoll support... " >&6; } - if test "$cross_compiling" = yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -int main() { - if (epoll_create(1) < 0) - return (1); - return (0); -} +if test "$enable_epoll" = "yes"; then : + for ac_func in epoll_create1 +do : + ac_fn_c_check_func "$LINENO" "epoll_create1" "ac_cv_func_epoll_create1" +if test "x$ac_cv_func_epoll_create1" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_EPOLL_CREATE1 1 _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - ;; -yes) - ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1" - ;; -*) - ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL" - ;; -esac +fi +done +fi # # check if we support /dev/poll diff --git a/configure.in b/configure.in index fd8259ce1c..982a36dcf6 100644 --- a/configure.in +++ b/configure.in @@ -543,36 +543,13 @@ AS_IF([test "$enable_kqueue" = "yes"], # check if we have epoll. Linux kernel 2.4 has epoll_create() which fails, # so we need to try running the code, not just test its existence. # -AC_ARG_ENABLE(epoll, - AS_HELP_STRING([--enable-epoll], - [use Linux epoll when available [default=auto]]), - want_epoll="$enableval", want_epoll="auto") -case $want_epoll in -auto) - AC_MSG_CHECKING(epoll support) - AC_TRY_RUN([ -#include -int main() { - if (epoll_create(1) < 0) - return (1); - return (0); -} -], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1"], - [AC_MSG_RESULT(no) - ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"], - [AC_MSG_RESULT(no) - ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL"]) - ;; -yes) - ISC_PLATFORM_HAVEEPOLL="#define ISC_PLATFORM_HAVEEPOLL 1" - ;; -*) - ISC_PLATFORM_HAVEEPOLL="#undef ISC_PLATFORM_HAVEEPOLL" - ;; -esac -AC_SUBST(ISC_PLATFORM_HAVEEPOLL) +AC_ARG_ENABLE([epoll], + [AS_HELP_STRING([--enable-epoll], + [use Linux epoll when available [default=auto]])], + [], [enable_epoll="yes"]) + +AS_IF([test "$enable_epoll" = "yes"], + [AC_CHECK_FUNCS([epoll_create1])]) # # check if we support /dev/poll diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index f0888d1c4c..cda8611047 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -47,11 +47,6 @@ */ @ISC_PLATFORM_HAVETFO@ -/*! \brief - * Define if the system supports epoll multiplexing - */ -@ISC_PLATFORM_HAVEEPOLL@ - /*! \brief * Define if the system supports /dev/poll multiplexing */ diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 9acac69052..8185f485a0 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -68,7 +68,7 @@ #ifdef HAVE_KQUEUE #include #endif -#ifdef ISC_PLATFORM_HAVEEPOLL +#ifdef HAVE_EPOLL_CREATE1 #include #endif #ifdef ISC_PLATFORM_HAVEDEVPOLL @@ -96,7 +96,7 @@ */ #if defined(HAVE_KQUEUE) #define USE_KQUEUE -#elif defined (ISC_PLATFORM_HAVEEPOLL) +#elif defined(HAVE_EPOLL_CREATE1) #define USE_EPOLL #elif defined (ISC_PLATFORM_HAVEDEVPOLL) #define USE_DEVPOLL From 092edb5b445ea7529018a14b2b065550f829ecf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 12:26:40 +0200 Subject: [PATCH 14/39] Replace platform ISC_PLATFORM_HAVEDEVPOLL with check for devpoll.h headers --- configure | 21 +++++---------------- configure.in | 23 ++++++----------------- lib/isc/include/isc/platform.h.in | 5 ----- lib/isc/unix/socket.c | 4 +--- 4 files changed, 12 insertions(+), 41 deletions(-) diff --git a/configure b/configure index ac8b8224a7..81c249eda5 100755 --- a/configure +++ b/configure @@ -762,7 +762,6 @@ ax_pthread_config CHECK_DSA GEOIPLINKOBJS GEOIPLINKSRCS -ISC_PLATFORM_HAVEDEVPOLL ISC_PLATFORM_NORETURN_POST ISC_PLATFORM_NORETURN_PRE ISC_SOCKADDR_LEN_T @@ -13929,14 +13928,13 @@ fi # # Check whether --enable-devpoll was given. if test "${enable_devpoll+set}" = set; then : - enableval=$enable_devpoll; want_devpoll="$enableval" + enableval=$enable_devpoll; else - want_devpoll="yes" + enable_devpoll="yes" fi -case $want_devpoll in -yes) - for ac_header in sys/devpoll.h devpoll.h +if test "$enable_devpoll" = "yes"; then : + for ac_header in sys/devpoll.h devpoll.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -13944,21 +13942,12 @@ if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF - ISC_PLATFORM_HAVEDEVPOLL="#define ISC_PLATFORM_HAVEDEVPOLL 1" - -else - ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL" fi done - ;; -*) - ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL" - ;; -esac - +fi # # Find the machine's endian flavor. diff --git a/configure.in b/configure.in index 982a36dcf6..6b5825e78f 100644 --- a/configure.in +++ b/configure.in @@ -554,23 +554,12 @@ AS_IF([test "$enable_epoll" = "yes"], # # check if we support /dev/poll # -AC_ARG_ENABLE(devpoll, - AS_HELP_STRING([--enable-devpoll], - [use /dev/poll when available [default=yes]]), - want_devpoll="$enableval", want_devpoll="yes") -case $want_devpoll in -yes) - AC_CHECK_HEADERS(sys/devpoll.h devpoll.h, - ISC_PLATFORM_HAVEDEVPOLL="#define ISC_PLATFORM_HAVEDEVPOLL 1" - , - ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL" - ) - ;; -*) - ISC_PLATFORM_HAVEDEVPOLL="#undef ISC_PLATFORM_HAVEDEVPOLL" - ;; -esac -AC_SUBST(ISC_PLATFORM_HAVEDEVPOLL) +AC_ARG_ENABLE([devpoll], + [AS_HELP_STRING([--enable-devpoll], + [use /dev/poll when available [default=yes]])], + [], [enable_devpoll="yes"]) +AS_IF([test "$enable_devpoll" = "yes"], + [AC_CHECK_HEADERS([sys/devpoll.h devpoll.h])]) # # Find the machine's endian flavor. diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index cda8611047..6552c01f80 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -47,11 +47,6 @@ */ @ISC_PLATFORM_HAVETFO@ -/*! \brief - * Define if the system supports /dev/poll multiplexing - */ -@ISC_PLATFORM_HAVEDEVPOLL@ - /*** *** Miscellaneous. ***/ diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 8185f485a0..d61827b16a 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -71,13 +71,11 @@ #ifdef HAVE_EPOLL_CREATE1 #include #endif -#ifdef ISC_PLATFORM_HAVEDEVPOLL #if defined(HAVE_SYS_DEVPOLL_H) #include #elif defined(HAVE_DEVPOLL_H) #include #endif -#endif #include @@ -98,7 +96,7 @@ #define USE_KQUEUE #elif defined(HAVE_EPOLL_CREATE1) #define USE_EPOLL -#elif defined (ISC_PLATFORM_HAVEDEVPOLL) +#elif defined(HAVE_SYS_DEVPOLL_H) || defined(HAVE_DEVPOLL_H) #define USE_DEVPOLL typedef struct { unsigned int want_read : 1, From f1d3055d7b04c8a4c090b3a97dced29b99156584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 12:34:10 +0200 Subject: [PATCH 15/39] Replace platform ISC_PLATFORM_HAVETFO with config ENABLE_TCP_FASTOPEN --- config.h.in | 3 +++ configure | 42 +++++-------------------------- configure.in | 32 +++++------------------ lib/isc/include/isc/platform.h.in | 11 -------- lib/isc/unix/socket.c | 4 +-- lib/isc/win32/socket.c | 4 +-- 6 files changed, 19 insertions(+), 77 deletions(-) diff --git a/config.h.in b/config.h.in index 4cd770ac7a..0b97d4107f 100644 --- a/config.h.in +++ b/config.h.in @@ -110,6 +110,9 @@ /* Define to enable rpz nsip rules. */ #undef ENABLE_RPZ_NSIP +/* define if you want TCP_FASTOPEN enabled if available */ +#undef ENABLE_TCP_FASTOPEN + /* Solaris hack to get select_large_fdset. */ #undef FD_SETSIZE diff --git a/configure b/configure index 81c249eda5..5525ff2dd0 100755 --- a/configure +++ b/configure @@ -715,7 +715,6 @@ DST_EXTRA_SRCS DST_EXTRA_OBJS USE_ISC_SPNEGO READLINE_LIB -ISC_PLATFORM_HAVETFO BIND9_CO_RULE LIBTOOL_MODE_UNINSTALL LIBTOOL_MODE_LINK @@ -1606,7 +1605,7 @@ Optional Features: --enable-backtrace log stack backtrace on abort [default=yes] --enable-symtable use internal symbol table for backtrace [all|minimal(default)|none] - --disable-tcp-fastopen disable TCP Fast Open support [default=autodetect] + --disable-tcp-fastopen disable TCP Fast Open support [default=yes] --disable-isc-spnego use SPNEGO from GSSAPI library --disable-chroot disable chroot --disable-linux-caps disable Linux capabilities @@ -17512,45 +17511,16 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Check whether --enable-tcp_fastopen was given. if test "${enable_tcp_fastopen+set}" = set; then : enableval=$enable_tcp_fastopen; -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TCP_FASTOPEN socket option" >&5 -$as_echo_n "checking for TCP_FASTOPEN socket option... " >&6; } -case "$enable_tcp_fastopen" in -yes|''|autodetect) - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include -#ifdef TCP_FASTOPEN -int has_tfo() { return (0); } -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "has_tfo" >/dev/null 2>&1; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_HAVETFO="#define ISC_PLATFORM_HAVETFO 1" else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_PLATFORM_HAVETFO="#undef ISC_PLATFORM_HAVETFO" + enable_tcp_fastopen="yes" fi -rm -f conftest* - ;; - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 -$as_echo "disabled" >&6; } - ISC_PLATFORM_HAVETFO="#undef ISC_PLATFORM_HAVETFO" - ;; -esac +if test "$enable_tcp_fastopen" = "yes"; then : +$as_echo "#define ENABLE_TCP_FASTOPEN 1" >>confdefs.h + +fi # # Check for some other useful functions that are not ever-present. diff --git a/configure.in b/configure.in index 6b5825e78f..cc65682838 100644 --- a/configure.in +++ b/configure.in @@ -1816,33 +1816,13 @@ AC_COMPILE_IFELSE( # comment in lib/isc/unix/socket.c). # -AC_ARG_ENABLE(tcp_fastopen, - AS_HELP_STRING([--disable-tcp-fastopen], - [disable TCP Fast Open support [default=autodetect]])) +AC_ARG_ENABLE([tcp_fastopen], + [AS_HELP_STRING([--disable-tcp-fastopen], + [disable TCP Fast Open support [default=yes]])], + [], [enable_tcp_fastopen="yes"]) -AC_MSG_CHECKING(for TCP_FASTOPEN socket option) -case "$enable_tcp_fastopen" in -yes|''|autodetect) - AC_EGREP_CPP(has_tfo, [ -#include -#include -#include -#ifdef TCP_FASTOPEN -int has_tfo() { return (0); } -#endif -], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_HAVETFO="#define ISC_PLATFORM_HAVETFO 1"], - [AC_MSG_RESULT(no) - ISC_PLATFORM_HAVETFO="#undef ISC_PLATFORM_HAVETFO"]) - - ;; - no) - AC_MSG_RESULT(disabled) - ISC_PLATFORM_HAVETFO="#undef ISC_PLATFORM_HAVETFO" - ;; -esac -AC_SUBST(ISC_PLATFORM_HAVETFO) +AS_IF([test "$enable_tcp_fastopen" = "yes"], + [AC_DEFINE([ENABLE_TCP_FASTOPEN], [1], [define if you want TCP_FASTOPEN enabled if available])]) # # Check for some other useful functions that are not ever-present. diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 6552c01f80..689950146d 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -36,17 +36,6 @@ *** Network. ***/ -/*! \brief - * Define if the system has struct lifconf which is a extended struct ifconf - * for IPv6. - */ -@ISC_PLATFORM_HAVELIFCONF@ - -/*! \brief - * Define if the system has TCP_FASTOPEN socket option. - */ -@ISC_PLATFORM_HAVETFO@ - /*** *** Miscellaneous. ***/ diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index d61827b16a..d8ecdcb3cb 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -85,7 +85,7 @@ #include #endif -#ifdef ISC_PLATFORM_HAVETFO +#ifdef ENABLE_TCP_FASTOPEN #include #endif @@ -5464,7 +5464,7 @@ isc__socket_filter(isc_socket_t *sock0, const char *filter) { */ static void set_tcp_fastopen(isc__socket_t *sock, unsigned int backlog) { -#if defined(ISC_PLATFORM_HAVETFO) && defined(TCP_FASTOPEN) +#if defined(ENABLE_TCP_FASTOPEN) && defined(TCP_FASTOPEN) char strbuf[ISC_STRERRORSIZE]; /* diff --git a/lib/isc/win32/socket.c b/lib/isc/win32/socket.c index 9add374881..b4b9e2d609 100644 --- a/lib/isc/win32/socket.c +++ b/lib/isc/win32/socket.c @@ -3318,7 +3318,7 @@ isc__socket_filter(isc_socket_t *sock, const char *filter) { isc_result_t isc__socket_listen(isc_socket_t *sock, unsigned int backlog) { char strbuf[ISC_STRERRORSIZE]; -#if defined(ISC_PLATFORM_HAVETFO) && defined(TCP_FASTOPEN) +#if defined(ENABLE_TCP_FASTOPEN) && defined(TCP_FASTOPEN) char on = 1; #endif @@ -3351,7 +3351,7 @@ isc__socket_listen(isc_socket_t *sock, unsigned int backlog) { return (ISC_R_UNEXPECTED); } -#if defined(ISC_PLATFORM_HAVETFO) && defined(TCP_FASTOPEN) +#if defined(ENABLE_TCP_FASTOPEN) && defined(TCP_FASTOPEN) if (setsockopt(sock->fd, IPPROTO_TCP, TCP_FASTOPEN, &on, sizeof(on)) < 0) { strerror_r(errno, strbuf, sizeof(strbuf)); From 51b0d5d55e347b99af109d879a177f681c719226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 12:39:51 +0200 Subject: [PATCH 16/39] Replace platform ISC_PLATFORM_HAVESTATNSEC with config ENABLE_STAT_NSEC --- config.h.in | 3 +++ configure | 20 ++++++++------------ configure.in | 15 ++++++++------- lib/isc/include/isc/platform.h.in | 5 ----- lib/isc/unix/file.c | 2 +- 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/config.h.in b/config.h.in index 0b97d4107f..f7cce40986 100644 --- a/config.h.in +++ b/config.h.in @@ -398,6 +398,9 @@ /* Define to 1 if you have the `sigwait' function. */ #undef HAVE_SIGWAIT +/* define if struct stat has st_mtim.tv_nsec field */ +#undef HAVE_STAT_NSEC + /* Define to 1 if you have the header file. */ #undef HAVE_STDATOMIC_H diff --git a/configure b/configure index 5525ff2dd0..53edafab2b 100755 --- a/configure +++ b/configure @@ -708,7 +708,6 @@ FSTRM_CAPTURE PROTOC_C IRS_PLATFORM_USEDECLSPEC ISC_PLATFORM_USEDECLSPEC -ISC_PLATFORM_HAVESTATNSEC ISC_PLATFORM_HAVESYSUNH LIBCAP_LIBS DST_EXTRA_SRCS @@ -17918,31 +17917,28 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # # Check for nanoseconds in file stats # -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking st_mtim.tv_nsec" >&5 -$as_echo_n "checking st_mtim.tv_nsec... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for st_mtim.tv_nsec" >&5 +$as_echo_n "checking for st_mtim.tv_nsec... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { -struct stat s; return(s.st_mtim.tv_nsec); +struct stat s; + return(s.st_mtim.tv_nsec); + ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ISC_PLATFORM_HAVESTATNSEC="#define ISC_PLATFORM_HAVESTATNSEC 1" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ISC_PLATFORM_HAVESTATNSEC="#undef ISC_PLATFORM_HAVESTATNSEC" + +$as_echo "#define HAVE_STAT_NSEC 1" >>confdefs.h + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - # # Microsoft has their own way of handling shared libraries that requires # additional qualifiers on extern variables. Unix systems don't need it. diff --git a/configure.in b/configure.in index cc65682838..4c99a89561 100644 --- a/configure.in +++ b/configure.in @@ -1990,13 +1990,14 @@ AC_DEFINE(NEED_OPTARG, 1, [Defined if extern char *optarg is not declared.])]) # # Check for nanoseconds in file stats # -AC_MSG_CHECKING(st_mtim.tv_nsec) -AC_TRY_COMPILE([#include ],[struct stat s; return(s.st_mtim.tv_nsec);], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_HAVESTATNSEC="#define ISC_PLATFORM_HAVESTATNSEC 1"], - [AC_MSG_RESULT(no) - ISC_PLATFORM_HAVESTATNSEC="#undef ISC_PLATFORM_HAVESTATNSEC"]) -AC_SUBST(ISC_PLATFORM_HAVESTATNSEC) +AC_MSG_CHECKING([for st_mtim.tv_nsec]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[struct stat s; + return(s.st_mtim.tv_nsec); + ]])], + [AC_DEFINE([HAVE_STAT_NSEC], [1], [define if struct stat has st_mtim.tv_nsec field])]) # # Microsoft has their own way of handling shared libraries that requires diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 689950146d..dc8cc619b3 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -58,11 +58,6 @@ */ @ISC_PLATFORM_KRB5HEADER@ -/* - * Define if the system has nanosecond-level accuracy in file stats. - */ -@ISC_PLATFORM_HAVESTATNSEC@ - /* * Used to control how extern data is linked; needed for Win32 platforms. */ diff --git a/lib/isc/unix/file.c b/lib/isc/unix/file.c index 6f214602d6..d2d3e101ff 100644 --- a/lib/isc/unix/file.c +++ b/lib/isc/unix/file.c @@ -146,7 +146,7 @@ isc_file_getmodtime(const char *file, isc_time_t *modtime) { result = file_stats(file, &stats); if (result == ISC_R_SUCCESS) -#ifdef ISC_PLATFORM_HAVESTATNSEC +#if defined(HAVE_STAT_NSEC) isc_time_set(modtime, stats.st_mtime, stats.st_mtim.tv_nsec); #else isc_time_set(modtime, stats.st_mtime, 0); From 4d46f0f95d9115045325cfd3feea55bd9361ea30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 12:46:55 +0200 Subject: [PATCH 17/39] Drop ISC_PLATFORM_USEDECLSPEC and IRS_PLATFORM_USEDECLSPEC as they are platform dependent and only unix vs win32 platform.h header difference is enough --- configure | 11 ------ configure.in | 9 ----- lib/irs/include/irs/platform.h.in | 8 ----- lib/irs/win32/include/irs/platform.h | 4 --- lib/isc/include/isc/platform.h.in | 47 ------------------------- lib/isc/win32/include/isc/platform.h.in | 5 --- 6 files changed, 84 deletions(-) diff --git a/configure b/configure index 53edafab2b..371f62000e 100755 --- a/configure +++ b/configure @@ -706,8 +706,6 @@ DNSTAPSRCS DNSTAP FSTRM_CAPTURE PROTOC_C -IRS_PLATFORM_USEDECLSPEC -ISC_PLATFORM_USEDECLSPEC ISC_PLATFORM_HAVESYSUNH LIBCAP_LIBS DST_EXTRA_SRCS @@ -17939,15 +17937,6 @@ $as_echo "#define HAVE_STAT_NSEC 1" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# -# Microsoft has their own way of handling shared libraries that requires -# additional qualifiers on extern variables. Unix systems don't need it. -# - -ISC_PLATFORM_USEDECLSPEC="#undef ISC_PLATFORM_USEDECLSPEC" - -IRS_PLATFORM_USEDECLSPEC="#undef IRS_PLATFORM_USEDECLSPEC" - # # Check for if_nametoindex() for IPv6 scoped addresses support # diff --git a/configure.in b/configure.in index 4c99a89561..ff783632f9 100644 --- a/configure.in +++ b/configure.in @@ -1999,15 +1999,6 @@ AC_COMPILE_IFELSE( ]])], [AC_DEFINE([HAVE_STAT_NSEC], [1], [define if struct stat has st_mtim.tv_nsec field])]) -# -# Microsoft has their own way of handling shared libraries that requires -# additional qualifiers on extern variables. Unix systems don't need it. -# -AC_SUBST(ISC_PLATFORM_USEDECLSPEC) -ISC_PLATFORM_USEDECLSPEC="#undef ISC_PLATFORM_USEDECLSPEC" -AC_SUBST(IRS_PLATFORM_USEDECLSPEC) -IRS_PLATFORM_USEDECLSPEC="#undef IRS_PLATFORM_USEDECLSPEC" - # # Check for if_nametoindex() for IPv6 scoped addresses support # diff --git a/lib/irs/include/irs/platform.h.in b/lib/irs/include/irs/platform.h.in index 78c91ce144..5599374078 100644 --- a/lib/irs/include/irs/platform.h.in +++ b/lib/irs/include/irs/platform.h.in @@ -18,15 +18,7 @@ ***** Platform-dependent defines. *****/ -#ifndef IRS_PLATFORM_USEDECLSPEC #define LIBIRS_EXTERNAL_DATA -#else -#ifdef LIBIRS_EXPORTS -#define LIBIRS_EXTERNAL_DATA __declspec(dllexport) -#else -#define LIBIRS_EXTERNAL_DATA __declspec(dllimport) -#endif -#endif /* * Tell Emacs to use C mode on this file. diff --git a/lib/irs/win32/include/irs/platform.h b/lib/irs/win32/include/irs/platform.h index 78c91ce144..7170a73f07 100644 --- a/lib/irs/win32/include/irs/platform.h +++ b/lib/irs/win32/include/irs/platform.h @@ -18,15 +18,11 @@ ***** Platform-dependent defines. *****/ -#ifndef IRS_PLATFORM_USEDECLSPEC -#define LIBIRS_EXTERNAL_DATA -#else #ifdef LIBIRS_EXPORTS #define LIBIRS_EXTERNAL_DATA __declspec(dllexport) #else #define LIBIRS_EXTERNAL_DATA __declspec(dllimport) #endif -#endif /* * Tell Emacs to use C mode on this file. diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index dc8cc619b3..90b9a2ee36 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -32,10 +32,6 @@ #define ISC_STRERRORSIZE 128 -/*** - *** Network. - ***/ - /*** *** Miscellaneous. ***/ @@ -58,11 +54,6 @@ */ @ISC_PLATFORM_KRB5HEADER@ -/* - * Used to control how extern data is linked; needed for Win32 platforms. - */ -@ISC_PLATFORM_USEDECLSPEC@ - /* * Define if the platform has . */ @@ -78,7 +69,6 @@ *** Windows dll support. ***/ -#ifndef ISC_PLATFORM_USEDECLSPEC #define LIBISC_EXTERNAL_DATA #define LIBDNS_EXTERNAL_DATA #define LIBISCCC_EXTERNAL_DATA @@ -86,43 +76,6 @@ #define LIBNS_EXTERNAL_DATA #define LIBBIND9_EXTERNAL_DATA #define LIBTESTS_EXTERNAL_DATA -#else /*! \brief ISC_PLATFORM_USEDECLSPEC */ -#ifdef LIBISC_EXPORTS -#define LIBISC_EXTERNAL_DATA __declspec(dllexport) -#else -#define LIBISC_EXTERNAL_DATA __declspec(dllimport) -#endif -#ifdef LIBDNS_EXPORTS -#define LIBDNS_EXTERNAL_DATA __declspec(dllexport) -#else -#define LIBDNS_EXTERNAL_DATA __declspec(dllimport) -#endif -#ifdef LIBISCCC_EXPORTS -#define LIBISCCC_EXTERNAL_DATA __declspec(dllexport) -#else -#define LIBISCCC_EXTERNAL_DATA __declspec(dllimport) -#endif -#ifdef LIBISCCFG_EXPORTS -#define LIBISCCFG_EXTERNAL_DATA __declspec(dllexport) -#else -#define LIBISCCFG_EXTERNAL_DATA __declspec(dllimport) -#endif -#ifdef LIBNS_EXPORTS -#define LIBNS_EXTERNAL_DATA __declspec(dllexport) -#else -#define LIBNS_EXTERNAL_DATA __declspec(dllimport) -#endif -#ifdef LIBBIND9_EXPORTS -#define LIBBIND9_EXTERNAL_DATA __declspec(dllexport) -#else -#define LIBBIND9_EXTERNAL_DATA __declspec(dllimport) -#endif -#ifdef LIBTESTS_EXPORTS -#define LIBTESTS_EXTERNAL_DATA __declspec(dllexport) -#else -#define LIBTESTS_EXTERNAL_DATA __declspec(dllimport) -#endif -#endif /*! \brief ISC_PLATFORM_USEDECLSPEC */ /* * Tell emacs to use C mode for this file. diff --git a/lib/isc/win32/include/isc/platform.h.in b/lib/isc/win32/include/isc/platform.h.in index 1e0a0354dc..3ae3e3c895 100644 --- a/lib/isc/win32/include/isc/platform.h.in +++ b/lib/isc/win32/include/isc/platform.h.in @@ -46,11 +46,6 @@ #undef MSG_TRUNC -/* - * Used to control how extern data is linked; needed for Win32 platforms. - */ -#define ISC_PLATFORM_USEDECLSPEC 1 - /* * Define if the platform has . */ From 2f02552a9341c2040fc79278c9c80babea637f8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 12:58:02 +0200 Subject: [PATCH 18/39] Remove now dummy NEED_PTHREAD_INIT --- acconfig.h | 3 --- config.h.in | 9 ++++++--- config.h.win32 | 3 --- configure | 27 +++++++++++++++++---------- configure.in | 35 +++++++++++++++++++---------------- lib/isc/unix/app.c | 13 ------------- 6 files changed, 42 insertions(+), 48 deletions(-) diff --git a/acconfig.h b/acconfig.h index efdb99455f..ee05bbc862 100644 --- a/acconfig.h +++ b/acconfig.h @@ -17,9 +17,6 @@ ***/ @TOP@ -/** define if your system needs pthread_init() before using pthreads */ -#undef NEED_PTHREAD_INIT - /** define if your system has sigwait() */ #undef HAVE_SIGWAIT diff --git a/config.h.in b/config.h.in index f7cce40986..0c5941ff64 100644 --- a/config.h.in +++ b/config.h.in @@ -17,9 +17,6 @@ *** it does not get installed. ***/ -/** define if your system needs pthread_init() before using pthreads */ -#undef NEED_PTHREAD_INIT - /** define if your system has sigwait() */ #undef HAVE_SIGWAIT @@ -470,12 +467,18 @@ /* Define if Thread-Local Storage is available */ #undef HAVE_TLS +/* Define to 1 if you have the `tzset' function. */ +#undef HAVE_TZSET + /* Define to 1 if you have the header file. */ #undef HAVE_UCHAR_H /* Define to 1 if the system has the type `uintptr_t'. */ #undef HAVE_UINTPTR_T +/* define if uname is available */ +#undef HAVE_UNAME + /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H diff --git a/config.h.win32 b/config.h.win32 index f0be1db618..fe881f50cd 100644 --- a/config.h.win32 +++ b/config.h.win32 @@ -67,9 +67,6 @@ /* define on DEC OSF to enable 4.4BSD style sa_len support */ /* #undef _SOCKADDR_LEN */ -/* define if your system needs pthread_init() before using pthreads */ -/* #undef NEED_PTHREAD_INIT */ - /* define if your system has sigwait() */ /* #undef HAVE_SIGWAIT */ diff --git a/configure b/configure index 371f62000e..41d04d9ce8 100755 --- a/configure +++ b/configure @@ -13807,18 +13807,17 @@ fi $as_echo_n "checking for uname... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include -#include + #include int main () { -struct utsname uts; -uname(&uts); -printf("running on %s %s %s for %s\n", - uts.sysname, uts.release, uts.version, uts.machine); + struct utsname uts; + uname(&uts); + printf("running on %s %s %s for %s\n", + uts.sysname, uts.release, uts.version, uts.machine); ; return 0; @@ -13827,13 +13826,16 @@ _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - $as_echo "#define HAVE_UNAME 1" >>confdefs.h + +$as_echo "#define HAVE_UNAME 1" >>confdefs.h + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: uname is not correctly supported" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: uname is not correctly supported" >&5 $as_echo "$as_me: WARNING: uname is not correctly supported" >&2;} + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext @@ -17877,11 +17879,16 @@ esac # # Time Zone Stuff # -ac_fn_c_check_func "$LINENO" "tzset" "ac_cv_func_tzset" +for ac_func in tzset +do : + ac_fn_c_check_func "$LINENO" "tzset" "ac_cv_func_tzset" if test "x$ac_cv_func_tzset" = xyes; then : - $as_echo "#define HAVE_TZSET 1" >>confdefs.h + cat >>confdefs.h <<_ACEOF +#define HAVE_TZSET 1 +_ACEOF fi +done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for optarg declaration" >&5 diff --git a/configure.in b/configure.in index ff783632f9..29cb31ca6a 100644 --- a/configure.in +++ b/configure.in @@ -498,21 +498,24 @@ AC_HEADER_TIME # # check for uname library routine # -AC_MSG_CHECKING(for uname) -AC_TRY_COMPILE([ -#include -#include -], -[ -struct utsname uts; -uname(&uts); -printf("running on %s %s %s for %s\n", - uts.sysname, uts.release, uts.version, uts.machine); -], - [AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_UNAME)], - [AC_MSG_RESULT(no) - AC_MSG_WARN([uname is not correctly supported])]) +AC_MSG_CHECKING([for uname]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + ]], + [[ + struct utsname uts; + uname(&uts); + printf("running on %s %s %s for %s\n", + uts.sysname, uts.release, uts.version, uts.machine); + ]])], + [AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_UNAME], [1], [define if uname is available]) + ], + [AC_MSG_RESULT(no) + AC_MSG_WARN([uname is not correctly supported]) + ]) # # check for GCC noreturn attribute @@ -1975,7 +1978,7 @@ esac # # Time Zone Stuff # -AC_CHECK_FUNC(tzset, AC_DEFINE(HAVE_TZSET)) +AC_CHECK_FUNCS([tzset]) AC_MSG_CHECKING(for optarg declaration) AC_TRY_COMPILE([ diff --git a/lib/isc/unix/app.c b/lib/isc/unix/app.c index 8d5ec29366..db82bdd6af 100644 --- a/lib/isc/unix/app.c +++ b/lib/isc/unix/app.c @@ -208,19 +208,6 @@ isc__app_ctxstart(isc_appctx_t *ctx0) { * Start an ISC library application. */ -#ifdef NEED_PTHREAD_INIT - /* - * BSDI 3.1 seg faults in pthread_sigmask() if we don't do this. - */ - presult = pthread_init(); - if (presult != 0) { - strerror_r(presult, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_app_start() pthread_init: %s", strbuf); - return (ISC_R_UNEXPECTED); - } -#endif - #ifdef HAVE_LINUXTHREADS main_thread = pthread_self(); #endif /* HAVE_LINUXTHREADS */ From c7b1e7fd0810a58313f34aa1b2e6055582733b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 13:24:15 +0200 Subject: [PATCH 19/39] Linux (glibc) has NPTL since LinuxThreads are no-more, so remove HAVE_LINUXTHREADS --- PLATFORMS.md | 1 + acconfig.h | 3 --- bin/named/unix/os.c | 58 ++++----------------------------------------- config.h.in | 3 --- config.h.win32 | 3 --- configure | 8 ------- configure.in | 7 ------ lib/isc/unix/app.c | 58 --------------------------------------------- 8 files changed, 5 insertions(+), 136 deletions(-) diff --git a/PLATFORMS.md b/PLATFORMS.md index 6f2c0deaf6..840af14b34 100644 --- a/PLATFORMS.md +++ b/PLATFORMS.md @@ -66,3 +66,4 @@ These are platforms on which BIND is known *not* to build or run: * Windows Server 2012 and older * Platforms that don't support IPv6 Advanced Socket API (RFC 3542) * Platforms that don't support atomic operations (via compiler or library) +* Linux without NPTL (Native POSIX Thread Library) diff --git a/acconfig.h b/acconfig.h index ee05bbc862..4b1304f273 100644 --- a/acconfig.h +++ b/acconfig.h @@ -23,9 +23,6 @@ /** define if sigwait() is the UnixWare flavor */ #undef HAVE_UNIXWARE_SIGWAIT -/** define if LinuxThreads is in use */ -#undef HAVE_LINUXTHREADS - /** define if sysconf() is available */ #undef HAVE_SYSCONF diff --git a/bin/named/unix/os.c b/bin/named/unix/os.c index 00052e8cf8..1571b88be9 100644 --- a/bin/named/unix/os.c +++ b/bin/named/unix/os.c @@ -68,7 +68,6 @@ static int singletonfd = -1; /* * Linux defines: - * (T) HAVE_LINUXTHREADS * (C) HAVE_SYS_CAPABILITY_H * (P) HAVE_SYS_PRCTL_H * The possible cases are: @@ -103,10 +102,6 @@ static int singletonfd = -1; * It will be nice when Linux threads work properly with setuid(). */ -#ifdef HAVE_LINUXTHREADS -static pid_t mainpid = 0; -#endif - static struct passwd *runas_pw = NULL; static bool done_setuid = false; static int dfd[2] = { -1, -1 }; @@ -201,7 +196,7 @@ linux_initialprivs(void) { */ SET_CAP(CAP_SYS_CHROOT); -#if defined(HAVE_SYS_PRCTL_H) || !defined(HAVE_LINUXTHREADS) +#if defined(HAVE_SYS_PRCTL_H) /* * We can setuid() only if either the kernel supports keeping * capabilities after setuid() (which we don't know until we've @@ -317,9 +312,6 @@ named_os_init(const char *progname) { #ifdef HAVE_SYS_CAPABILITY_H linux_initialprivs(); #endif -#ifdef HAVE_LINUXTHREADS - mainpid = getpid(); -#endif #ifdef SIGXFSZ signal(SIGXFSZ, SIG_IGN); #endif @@ -362,10 +354,6 @@ named_os_daemonize(void) { * We're the child. */ -#ifdef HAVE_LINUXTHREADS - mainpid = getpid(); -#endif - if (setsid() == -1) { strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlyfatal("setsid(): %s", strbuf); @@ -499,20 +487,6 @@ named_os_changeuser(void) { done_setuid = true; -#ifdef HAVE_LINUXTHREADS -#ifdef HAVE_SYS_CAPABILITY_H - if (!non_root_caps) { - named_main_earlyfatal("-u with Linux threads not supported: " - "requires kernel support for " - "prctl(PR_SET_KEEPCAPS)"); - } -#else - named_main_earlyfatal("-u with Linux threads not supported: " - "no capabilities support or capabilities " - "disabled at build time"); -#endif -#endif - if (setgid(runas_pw->pw_gid) < 0) { strerror_r(errno, strbuf, sizeof(strbuf)); named_main_earlyfatal("setgid(): %s", strbuf); @@ -534,7 +508,7 @@ named_os_changeuser(void) { strbuf); } #endif -#if defined(HAVE_SYS_CAPABILITY_H) && !defined(HAVE_LINUXTHREADS) +#if defined(HAVE_SYS_CAPABILITY_H) linux_minprivs(); #endif } @@ -548,7 +522,7 @@ ns_os_uid(void) { void named_os_adjustnofile(void) { -#ifdef HAVE_LINUXTHREADS +#if defined(__linux__) isc_result_t result; isc_resourcevalue_t newvalue; @@ -570,11 +544,7 @@ named_os_minprivs(void) { linux_keepcaps(); #endif -#ifdef HAVE_LINUXTHREADS - named_os_changeuser(); /* Call setuid() before threads are started */ -#endif - -#if defined(HAVE_SYS_CAPABILITY_H) && defined(HAVE_LINUXTHREADS) +#if defined(HAVE_SYS_CAPABILITY_H) linux_minprivs(); #endif } @@ -759,21 +729,16 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) { free(f); if (switch_user && runas_pw != NULL) { -#ifndef HAVE_LINUXTHREADS gid_t oldgid = getgid(); -#endif /* Set UID/GID to the one we'll be running with eventually */ setperms(runas_pw->pw_uid, runas_pw->pw_gid); fd = safe_open(filename, mode, false); -#ifndef HAVE_LINUXTHREADS /* Restore UID/GID to root */ setperms(0, oldgid); -#endif /* HAVE_LINUXTHREADS */ if (fd == -1) { -#ifndef HAVE_LINUXTHREADS fd = safe_open(filename, mode, false); if (fd != -1) { named_main_earlywarning("Required root " @@ -786,13 +751,6 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) { named_main_earlywarning("Please check file and " "directory permissions " "or reconfigure the filename."); -#else /* HAVE_LINUXTHREADS */ - named_main_earlywarning("Could not open " - "'%s'.", filename); - named_main_earlywarning("Please check file and " - "directory permissions " - "or reconfigure the filename."); -#endif /* HAVE_LINUXTHREADS */ } } else { fd = safe_open(filename, mode, false); @@ -846,11 +804,7 @@ named_os_writepidfile(const char *filename, bool first_time) { cleanup_pidfile(); return; } -#ifdef HAVE_LINUXTHREADS - pid = mainpid; -#else pid = getpid(); -#endif if (fprintf(fh, "%ld\n", (long)pid) < 0) { (*report)("fprintf() to pid file '%s' failed", filename); (void)fclose(fh); @@ -956,11 +910,7 @@ named_os_shutdownmsg(char *command, isc_buffer_t *text) { return; } -#ifdef HAVE_LINUXTHREADS - pid = mainpid; -#else pid = getpid(); -#endif (void)isc_buffer_printf(text, "pid: %ld", (long)pid); } diff --git a/config.h.in b/config.h.in index 0c5941ff64..c5283ae70e 100644 --- a/config.h.in +++ b/config.h.in @@ -23,9 +23,6 @@ /** define if sigwait() is the UnixWare flavor */ #undef HAVE_UNIXWARE_SIGWAIT -/** define if LinuxThreads is in use */ -#undef HAVE_LINUXTHREADS - /** define if sysconf() is available */ #undef HAVE_SYSCONF diff --git a/config.h.win32 b/config.h.win32 index fe881f50cd..15d42b928b 100644 --- a/config.h.win32 +++ b/config.h.win32 @@ -73,9 +73,6 @@ /* define on Solaris to get sigwait() to work using pthreads semantics */ /* #undef _POSIX_PTHREAD_SEMANTICS */ -/* define if LinuxThreads is in use */ -/* #undef HAVE_LINUXTHREADS */ - /* define if catgets() is available */ /* #undef HAVE_CATGETS */ diff --git a/configure b/configure index 41d04d9ce8..dda2137af9 100755 --- a/configure +++ b/configure @@ -15325,14 +15325,6 @@ fi ;; esac - ;; - # - # LinuxThreads requires some changes to the way we - # deal with signals. - # - *-linux*) - $as_echo "#define HAVE_LINUXTHREADS 1" >>confdefs.h - ;; esac diff --git a/configure.in b/configure.in index 29cb31ca6a..ce82ce1dc0 100644 --- a/configure.in +++ b/configure.in @@ -752,13 +752,6 @@ case "$host" in ;; esac ;; - # - # LinuxThreads requires some changes to the way we - # deal with signals. - # - *-linux*) - AC_DEFINE(HAVE_LINUXTHREADS) - ;; esac # Look for functions relating to thread naming diff --git a/lib/isc/unix/app.c b/lib/isc/unix/app.c index db82bdd6af..a02311f7fc 100644 --- a/lib/isc/unix/app.c +++ b/lib/isc/unix/app.c @@ -144,20 +144,6 @@ static struct { (void *)isc__app_unblock }; -#ifdef HAVE_LINUXTHREADS -/*! - * Linux has sigwait(), but it appears to prevent signal handlers from - * running, even if they're not in the set being waited for. This makes - * it impossible to get the default actions for SIGILL, SIGSEGV, etc. - * Instead of messing with it, we just use sigsuspend() instead. - */ -#undef HAVE_SIGWAIT -/*! - * We need to remember which thread is the main thread... - */ -static pthread_t main_thread; -#endif - #ifndef HAVE_SIGWAIT static void exit_action(int arg) { @@ -208,10 +194,6 @@ isc__app_ctxstart(isc_appctx_t *ctx0) { * Start an ISC library application. */ -#ifdef HAVE_LINUXTHREADS - main_thread = pthread_self(); -#endif /* HAVE_LINUXTHREADS */ - result = isc_mutex_init(&ctx->readylock); if (result != ISC_R_SUCCESS) return (result); @@ -388,10 +370,6 @@ isc__app_ctxrun(isc_appctx_t *ctx0) { REQUIRE(VALID_APPCTX(ctx)); -#ifdef HAVE_LINUXTHREADS - REQUIRE(main_thread == pthread_self()); -#endif - LOCK(&ctx->lock); if (!ctx->running) { @@ -564,23 +542,6 @@ isc__app_ctxshutdown(isc_appctx_t *ctx0) { /* BIND9 internal, but using multiple contexts */ ctx->want_shutdown = true; else { -#ifdef HAVE_LINUXTHREADS - if (isc_bind9) { - /* BIND9 internal, single context */ - int result; - - result = pthread_kill(main_thread, SIGTERM); - if (result != 0) { - strerror_r(result, - strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_app_shutdown() " - "pthread_kill: %s", - strbuf); - return (ISC_R_UNEXPECTED); - } - } -#else if (isc_bind9) { /* BIND9 internal, single context */ if (kill(getpid(), SIGTERM) < 0) { @@ -592,7 +553,6 @@ isc__app_ctxshutdown(isc_appctx_t *ctx0) { return (ISC_R_UNEXPECTED); } } -#endif /* HAVE_LINUXTHREADS */ else { /* External, multiple contexts */ LOCK(&ctx->readylock); @@ -637,23 +597,6 @@ isc__app_ctxsuspend(isc_appctx_t *ctx0) { ctx->want_reload = true; else { ctx->want_reload = true; -#ifdef HAVE_LINUXTHREADS - if (isc_bind9) { - /* BIND9 internal, single context */ - int result; - - result = pthread_kill(main_thread, SIGHUP); - if (result != 0) { - strerror_r(result, - strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_app_reload() " - "pthread_kill: %s", - strbuf); - return (ISC_R_UNEXPECTED); - } - } -#else if (isc_bind9) { /* BIND9 internal, single context */ if (kill(getpid(), SIGHUP) < 0) { @@ -665,7 +608,6 @@ isc__app_ctxsuspend(isc_appctx_t *ctx0) { return (ISC_R_UNEXPECTED); } } -#endif /* HAVE_LINUXTHREADS */ else { /* External, multiple contexts */ LOCK(&ctx->readylock); From 927b65aa7facc9ea55a531a5233a04e564dd2906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 13:28:39 +0200 Subject: [PATCH 20/39] Remove now dummy HAVE_UNIXWARE_SIGWAIT define --- acconfig.h | 3 --- config.h.in | 3 --- lib/isc/unix/app.c | 10 ---------- 3 files changed, 16 deletions(-) diff --git a/acconfig.h b/acconfig.h index 4b1304f273..43a2e90993 100644 --- a/acconfig.h +++ b/acconfig.h @@ -20,9 +20,6 @@ /** define if your system has sigwait() */ #undef HAVE_SIGWAIT -/** define if sigwait() is the UnixWare flavor */ -#undef HAVE_UNIXWARE_SIGWAIT - /** define if sysconf() is available */ #undef HAVE_SYSCONF diff --git a/config.h.in b/config.h.in index c5283ae70e..f2ad6c379e 100644 --- a/config.h.in +++ b/config.h.in @@ -20,9 +20,6 @@ /** define if your system has sigwait() */ #undef HAVE_SIGWAIT -/** define if sigwait() is the UnixWare flavor */ -#undef HAVE_UNIXWARE_SIGWAIT - /** define if sysconf() is available */ #undef HAVE_SYSCONF diff --git a/lib/isc/unix/app.c b/lib/isc/unix/app.c index a02311f7fc..eb742ff030 100644 --- a/lib/isc/unix/app.c +++ b/lib/isc/unix/app.c @@ -423,7 +423,6 @@ isc__app_ctxrun(isc_appctx_t *ctx0) { return (ISC_R_UNEXPECTED); } -#ifndef HAVE_UNIXWARE_SIGWAIT result = sigwait(&sset, &sig); if (result == 0) { if (sig == SIGINT || sig == SIGTERM) @@ -432,15 +431,6 @@ isc__app_ctxrun(isc_appctx_t *ctx0) { ctx->want_reload = true; } -#else /* Using UnixWare sigwait semantics. */ - sig = sigwait(&sset); - if (sig >= 0) { - if (sig == SIGINT || sig == SIGTERM) - ctx->want_shutdown = true; - else if (sig == SIGHUP) - ctx->want_reload = true; - } -#endif /* HAVE_UNIXWARE_SIGWAIT */ } else { /* * External, or BIND9 using multiple contexts: From 19ae4438ab53be2dc3a0ddd2bfd94c5a78e40363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 13:29:28 +0200 Subject: [PATCH 21/39] Replace custom HAVE_SYSCONF with proper AC_CHECK_FUNCS call --- acconfig.h | 3 --- config.h.in | 6 +++--- configure | 9 +++++++-- configure.in | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/acconfig.h b/acconfig.h index 43a2e90993..2ab1a827cd 100644 --- a/acconfig.h +++ b/acconfig.h @@ -20,9 +20,6 @@ /** define if your system has sigwait() */ #undef HAVE_SIGWAIT -/** define if sysconf() is available */ -#undef HAVE_SYSCONF - /** define if sysctlbyname() is available */ #undef HAVE_SYSCTLBYNAME diff --git a/config.h.in b/config.h.in index f2ad6c379e..3cc00140c0 100644 --- a/config.h.in +++ b/config.h.in @@ -20,9 +20,6 @@ /** define if your system has sigwait() */ #undef HAVE_SIGWAIT -/** define if sysconf() is available */ -#undef HAVE_SYSCONF - /** define if sysctlbyname() is available */ #undef HAVE_SYSCTLBYNAME @@ -413,6 +410,9 @@ /* Define to 1 if you have the `strlcpy' function. */ #undef HAVE_STRLCPY +/* Define to 1 if you have the `sysconf' function. */ +#undef HAVE_SYSCONF + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_CAPABILITY_H diff --git a/configure b/configure index dda2137af9..701d58e226 100755 --- a/configure +++ b/configure @@ -15358,11 +15358,16 @@ done # # Look for sysconf to allow detection of the number of processors. # -ac_fn_c_check_func "$LINENO" "sysconf" "ac_cv_func_sysconf" +for ac_func in sysconf +do : + ac_fn_c_check_func "$LINENO" "sysconf" "ac_cv_func_sysconf" if test "x$ac_cv_func_sysconf" = xyes; then : - $as_echo "#define HAVE_SYSCONF 1" >>confdefs.h + cat >>confdefs.h <<_ACEOF +#define HAVE_SYSCONF 1 +_ACEOF fi +done diff --git a/configure.in b/configure.in index ce82ce1dc0..fd135f7436 100644 --- a/configure.in +++ b/configure.in @@ -761,7 +761,7 @@ AC_CHECK_HEADERS([pthread_np.h], [], [], [#include ]) # # Look for sysconf to allow detection of the number of processors. # -AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),) +AC_CHECK_FUNCS([sysconf]) AC_SUBST(ALWAYS_DEFINES) From 4a5ecad0380d8b516ebc0ad5e08df80970e08883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 13:31:27 +0200 Subject: [PATCH 22/39] Replace custom HAVE_SIGWAIT define with AC_CHECK_FUNCS --- acconfig.h | 3 --- config.h.in | 3 --- configure | 46 +--------------------------------------------- configure.in | 6 +----- 4 files changed, 2 insertions(+), 56 deletions(-) diff --git a/acconfig.h b/acconfig.h index 2ab1a827cd..7b87198d04 100644 --- a/acconfig.h +++ b/acconfig.h @@ -17,9 +17,6 @@ ***/ @TOP@ -/** define if your system has sigwait() */ -#undef HAVE_SIGWAIT - /** define if sysctlbyname() is available */ #undef HAVE_SYSCTLBYNAME diff --git a/config.h.in b/config.h.in index 3cc00140c0..eeeea85bc6 100644 --- a/config.h.in +++ b/config.h.in @@ -17,9 +17,6 @@ *** it does not get installed. ***/ -/** define if your system has sigwait() */ -#undef HAVE_SIGWAIT - /** define if sysctlbyname() is available */ #undef HAVE_SYSCTLBYNAME diff --git a/configure b/configure index 701d58e226..293ecfe419 100755 --- a/configure +++ b/configure @@ -15266,54 +15266,10 @@ done # -# Additional OS-specific issues related to pthreads and sigwait. +# Additional OS-specific issues related to pthreads. # case "$host" in - # - # One more place to look for sigwait. - # *-freebsd*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigwait in -lc_r" >&5 -$as_echo_n "checking for sigwait in -lc_r... " >&6; } -if ${ac_cv_lib_c_r_sigwait+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc_r $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char sigwait (); -int -main () -{ -return sigwait (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_r_sigwait=yes -else - ac_cv_lib_c_r_sigwait=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_sigwait" >&5 -$as_echo "$ac_cv_lib_c_r_sigwait" >&6; } -if test "x$ac_cv_lib_c_r_sigwait" = xyes; then : - $as_echo "#define HAVE_SIGWAIT 1" >>confdefs.h - -fi - case $host in *-freebsd5.[012]|*-freebsd5.[012].*);; *-freebsd5.[3456789]|*-freebsd5.[3456789].*) diff --git a/configure.in b/configure.in index fd135f7436..d4fe8ebc1d 100644 --- a/configure.in +++ b/configure.in @@ -734,14 +734,10 @@ AC_SEARCH_LIBS([sched_yield],[rt]) AC_CHECK_FUNCS([sched_yield pthread_yield pthread_yield_np]) # -# Additional OS-specific issues related to pthreads and sigwait. +# Additional OS-specific issues related to pthreads. # case "$host" in - # - # One more place to look for sigwait. - # *-freebsd*) - AC_CHECK_LIB(c_r, sigwait, AC_DEFINE(HAVE_SIGWAIT),) case $host in *-freebsd5.[[012]]|*-freebsd5.[[012]].*);; *-freebsd5.[[3456789]]|*-freebsd5.[[3456789]].*) From 78bb5761a0f1630fc17228b68e19bb664d25d6ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 13:33:59 +0200 Subject: [PATCH 23/39] Replace custom HAVE_SYSCTLBYNAME define with AC_CHECK_FUNCS call --- acconfig.h | 3 --- config.h.in | 6 +++--- configure | 18 ++++++++++++------ configure.in | 3 ++- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/acconfig.h b/acconfig.h index 7b87198d04..6cc24a4b3b 100644 --- a/acconfig.h +++ b/acconfig.h @@ -17,9 +17,6 @@ ***/ @TOP@ -/** define if sysctlbyname() is available */ -#undef HAVE_SYSCTLBYNAME - /** define if catgets() is available */ #undef HAVE_CATGETS diff --git a/config.h.in b/config.h.in index eeeea85bc6..d0a1eda1bd 100644 --- a/config.h.in +++ b/config.h.in @@ -17,9 +17,6 @@ *** it does not get installed. ***/ -/** define if sysctlbyname() is available */ -#undef HAVE_SYSCTLBYNAME - /** define if catgets() is available */ #undef HAVE_CATGETS @@ -410,6 +407,9 @@ /* Define to 1 if you have the `sysconf' function. */ #undef HAVE_SYSCONF +/* Define to 1 if you have the `sysctlbyname' function. */ +#undef HAVE_SYSCTLBYNAME + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_CAPABILITY_H diff --git a/configure b/configure index 293ecfe419..8d87d716ee 100755 --- a/configure +++ b/configure @@ -13573,12 +13573,6 @@ if test $ac_cv_c_volatile = no; then $as_echo "#define volatile /**/" >>confdefs.h -fi - -ac_fn_c_check_func "$LINENO" "sysctlbyname" "ac_cv_func_sysctlbyname" -if test "x$ac_cv_func_sysctlbyname" = xyes; then : - $as_echo "#define HAVE_SYSCTLBYNAME 1" >>confdefs.h - fi @@ -13624,6 +13618,18 @@ $as_echo "#define FLEXIBLE_ARRAY_MEMBER /**/" >>confdefs.h fi +for ac_func in sysctlbyname +do : + ac_fn_c_check_func "$LINENO" "sysctlbyname" "ac_cv_func_sysctlbyname" +if test "x$ac_cv_func_sysctlbyname" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYSCTLBYNAME 1 +_ACEOF + +fi +done + + # # Check for the existence of mmap to enable the fast format zones # diff --git a/configure.in b/configure.in index d4fe8ebc1d..9a673fe073 100644 --- a/configure.in +++ b/configure.in @@ -458,9 +458,10 @@ AC_CHECK_HEADERS([threads.h], AC_C_CONST AC_C_INLINE AC_C_VOLATILE -AC_CHECK_FUNC(sysctlbyname, AC_DEFINE(HAVE_SYSCTLBYNAME)) AC_C_FLEXIBLE_ARRAY_MEMBER +AC_CHECK_FUNCS([sysctlbyname]) + # # Check for the existence of mmap to enable the fast format zones # From 7384a9f23aa9decdbfcaaeb577b8130925a6588a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 13:34:44 +0200 Subject: [PATCH 24/39] Replace custom HAVE_CATGETS define with AC_CHECK_FUNCS call --- acconfig.h | 3 --- config.h.in | 6 +++--- configure | 9 +++++++-- configure.in | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/acconfig.h b/acconfig.h index 6cc24a4b3b..43c2eace17 100644 --- a/acconfig.h +++ b/acconfig.h @@ -17,9 +17,6 @@ ***/ @TOP@ -/** define if catgets() is available */ -#undef HAVE_CATGETS - /** define if getifaddrs() exists */ #undef HAVE_GETIFADDRS diff --git a/config.h.in b/config.h.in index d0a1eda1bd..f50291852a 100644 --- a/config.h.in +++ b/config.h.in @@ -17,9 +17,6 @@ *** it does not get installed. ***/ -/** define if catgets() is available */ -#undef HAVE_CATGETS - /** define if getifaddrs() exists */ #undef HAVE_GETIFADDRS @@ -122,6 +119,9 @@ /* Define to 1 if the compiler supports __builtin_expect. */ #undef HAVE_BUILTIN_EXPECT +/* Define to 1 if you have the `catgets' function. */ +#undef HAVE_CATGETS + /* Define to 1 if you have the `chroot' function. */ #undef HAVE_CHROOT diff --git a/configure b/configure index 8d87d716ee..193423fb7f 100755 --- a/configure +++ b/configure @@ -17071,11 +17071,16 @@ fi # # NLS # -ac_fn_c_check_func "$LINENO" "catgets" "ac_cv_func_catgets" +for ac_func in catgets +do : + ac_fn_c_check_func "$LINENO" "catgets" "ac_cv_func_catgets" if test "x$ac_cv_func_catgets" = xyes; then : - $as_echo "#define HAVE_CATGETS 1" >>confdefs.h + cat >>confdefs.h <<_ACEOF +#define HAVE_CATGETS 1 +_ACEOF fi +done # diff --git a/configure.in b/configure.in index 9a673fe073..c6e1489964 100644 --- a/configure.in +++ b/configure.in @@ -1603,7 +1603,7 @@ AC_SUBST(MKDEPPROG) # # NLS # -AC_CHECK_FUNC(catgets, AC_DEFINE(HAVE_CATGETS),) +AC_CHECK_FUNCS([catgets]) # # -lxnet buys us one big porting headache... standards, gotta love 'em. From 51bcdb78afdf0d66405998c553e13a92c2406bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 13:35:43 +0200 Subject: [PATCH 25/39] Remove now dummy HAVE_GETIFADDRS define --- acconfig.h | 3 --- config.h.in | 3 --- 2 files changed, 6 deletions(-) diff --git a/acconfig.h b/acconfig.h index 43c2eace17..78d2e9b827 100644 --- a/acconfig.h +++ b/acconfig.h @@ -17,9 +17,6 @@ ***/ @TOP@ -/** define if getifaddrs() exists */ -#undef HAVE_GETIFADDRS - /** define if you have the NET_RT_IFLIST sysctl variable and sys/sysctl.h */ #undef HAVE_IFLIST_SYSCTL diff --git a/config.h.in b/config.h.in index f50291852a..a768eeccb6 100644 --- a/config.h.in +++ b/config.h.in @@ -17,9 +17,6 @@ *** it does not get installed. ***/ -/** define if getifaddrs() exists */ -#undef HAVE_GETIFADDRS - /** define if you have the NET_RT_IFLIST sysctl variable and sys/sysctl.h */ #undef HAVE_IFLIST_SYSCTL From c83d9b9b500961a032ae98af312f5f217739e5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 13:36:53 +0200 Subject: [PATCH 26/39] Remove now dummy HAVE_IFLIST_SYSCTL define --- acconfig.h | 3 --- config.h.in | 3 --- config.h.win32 | 3 --- 3 files changed, 9 deletions(-) diff --git a/acconfig.h b/acconfig.h index 78d2e9b827..8b37b5b8db 100644 --- a/acconfig.h +++ b/acconfig.h @@ -17,9 +17,6 @@ ***/ @TOP@ -/** define if you have the NET_RT_IFLIST sysctl variable and sys/sysctl.h */ -#undef HAVE_IFLIST_SYSCTL - /** define if tzset() is available */ #undef HAVE_TZSET diff --git a/config.h.in b/config.h.in index a768eeccb6..d4673ead18 100644 --- a/config.h.in +++ b/config.h.in @@ -17,9 +17,6 @@ *** it does not get installed. ***/ -/** define if you have the NET_RT_IFLIST sysctl variable and sys/sysctl.h */ -#undef HAVE_IFLIST_SYSCTL - /** define if tzset() is available */ #undef HAVE_TZSET diff --git a/config.h.win32 b/config.h.win32 index 15d42b928b..4f19200b1d 100644 --- a/config.h.win32 +++ b/config.h.win32 @@ -76,9 +76,6 @@ /* define if catgets() is available */ /* #undef HAVE_CATGETS */ -/* define if you have the NET_RT_IFLIST sysctl variable. */ -#define HAVE_IFLIST_SYSCTL 1 - /* define if you need to #define _XPG4_2 before including sys/socket.h */ /* #undef NEED_XPG4_2_BEFORE_SOCKET_H */ From fa048a9b2c6b8edbf30a7374bd4d8c53e75a4fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 13:37:48 +0200 Subject: [PATCH 27/39] Replace custom HAVE_TZSET define with AC_CHECK_FUNCS call --- acconfig.h | 3 --- config.h.in | 3 --- 2 files changed, 6 deletions(-) diff --git a/acconfig.h b/acconfig.h index 8b37b5b8db..5b59f2e9f8 100644 --- a/acconfig.h +++ b/acconfig.h @@ -17,9 +17,6 @@ ***/ @TOP@ -/** define if tzset() is available */ -#undef HAVE_TZSET - /** * define if pthread_setconcurrency() should be called to tell the * OS how many threads we might want to run. diff --git a/config.h.in b/config.h.in index d4673ead18..546c17727e 100644 --- a/config.h.in +++ b/config.h.in @@ -17,9 +17,6 @@ *** it does not get installed. ***/ -/** define if tzset() is available */ -#undef HAVE_TZSET - /** * define if pthread_setconcurrency() should be called to tell the * OS how many threads we might want to run. From 5d8f9bf935e7229911fec6dcdbfe248cce49b8f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 13:39:47 +0200 Subject: [PATCH 28/39] Always enable CALL_PTHREAD_SETCONCURRENCY as it is part of POSIX Threads --- acconfig.h | 6 ------ config.h.in | 6 ------ lib/isc/pthreads/thread.c | 4 ---- 3 files changed, 16 deletions(-) diff --git a/acconfig.h b/acconfig.h index 5b59f2e9f8..8d667442bc 100644 --- a/acconfig.h +++ b/acconfig.h @@ -17,12 +17,6 @@ ***/ @TOP@ -/** - * define if pthread_setconcurrency() should be called to tell the - * OS how many threads we might want to run. - */ -#undef CALL_PTHREAD_SETCONCURRENCY - /** define if flockfile() is available */ #undef HAVE_FLOCKFILE diff --git a/config.h.in b/config.h.in index 546c17727e..e838e776a4 100644 --- a/config.h.in +++ b/config.h.in @@ -17,12 +17,6 @@ *** it does not get installed. ***/ -/** - * define if pthread_setconcurrency() should be called to tell the - * OS how many threads we might want to run. - */ -#undef CALL_PTHREAD_SETCONCURRENCY - /** define if flockfile() is available */ #undef HAVE_FLOCKFILE diff --git a/lib/isc/pthreads/thread.c b/lib/isc/pthreads/thread.c index c84196799b..5f82475ed5 100644 --- a/lib/isc/pthreads/thread.c +++ b/lib/isc/pthreads/thread.c @@ -68,11 +68,7 @@ isc_thread_create(isc_threadfunc_t func, isc_threadarg_t arg, void isc_thread_setconcurrency(unsigned int level) { -#if defined(CALL_PTHREAD_SETCONCURRENCY) (void)pthread_setconcurrency(level); -#else - UNUSED(level); -#endif } void From 43c468926b1c683b3348ffbb6be5648a4cb3340a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 13:42:19 +0200 Subject: [PATCH 29/39] Remove HAVE_FLOCKFILE and HAVE_GETCUNLOCKED custom defines in favour of AC_CHECK_FUNCS call --- acconfig.h | 6 ------ config.h.in | 6 ------ configure | 18 ------------------ configure.in | 8 -------- 4 files changed, 38 deletions(-) diff --git a/acconfig.h b/acconfig.h index 8d667442bc..d3b0ee4d3a 100644 --- a/acconfig.h +++ b/acconfig.h @@ -17,12 +17,6 @@ ***/ @TOP@ -/** define if flockfile() is available */ -#undef HAVE_FLOCKFILE - -/** define if getc_unlocked() is available */ -#undef HAVE_GETCUNLOCKED - /** define if the system has a random number generating device */ #undef PATH_RANDOMDEV diff --git a/config.h.in b/config.h.in index e838e776a4..9c7a06992b 100644 --- a/config.h.in +++ b/config.h.in @@ -17,12 +17,6 @@ *** it does not get installed. ***/ -/** define if flockfile() is available */ -#undef HAVE_FLOCKFILE - -/** define if getc_unlocked() is available */ -#undef HAVE_GETCUNLOCKED - /** define if the system has a random number generating device */ #undef PATH_RANDOMDEV diff --git a/configure b/configure index 193423fb7f..00ca246ca0 100755 --- a/configure +++ b/configure @@ -16943,24 +16943,6 @@ _ACEOF fi -# -# flockfile is usually provided by pthreads, but we may want to use it -# even if compiled with --disable-threads. getc_unlocked might also not -# be defined. -# -ac_fn_c_check_func "$LINENO" "flockfile" "ac_cv_func_flockfile" -if test "x$ac_cv_func_flockfile" = xyes; then : - $as_echo "#define HAVE_FLOCKFILE 1" >>confdefs.h - -fi - -ac_fn_c_check_func "$LINENO" "getc_unlocked" "ac_cv_func_getc_unlocked" -if test "x$ac_cv_func_getc_unlocked" = xyes; then : - $as_echo "#define HAVE_GETCUNLOCKED 1" >>confdefs.h - -fi - - # # Large File # diff --git a/configure.in b/configure.in index c6e1489964..652dd20199 100644 --- a/configure.in +++ b/configure.in @@ -1526,14 +1526,6 @@ AC_SUBST(ZLIB) # AC_CHECK_LIB(scf, smf_enable_instance) -# -# flockfile is usually provided by pthreads, but we may want to use it -# even if compiled with --disable-threads. getc_unlocked might also not -# be defined. -# -AC_CHECK_FUNC(flockfile, AC_DEFINE(HAVE_FLOCKFILE),) -AC_CHECK_FUNC(getc_unlocked, AC_DEFINE(HAVE_GETCUNLOCKED),) - # # Large File # From 7716bdd400e5f5bf26dc3c76fe228268eb1ee486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 13:47:35 +0200 Subject: [PATCH 30/39] Remove dummy PATH_RANDOMDEV and CHECK_DSA defines --- acconfig.h | 3 --- bin/tests/system/conf.sh.in | 1 - bin/tests/system/conf.sh.win32 | 1 - bin/tests/system/inline/.gitignore | 1 - bin/tests/system/inline/checkdsa.sh.in | 17 ----------------- bin/tests/system/inline/ns3/sign.sh | 20 ++------------------ config.h.in | 3 --- config.h.win32 | 3 --- configure | 20 +------------------- configure.in | 17 ----------------- util/copyrights | 1 - win32utils/Configure | 6 +----- 12 files changed, 4 insertions(+), 89 deletions(-) delete mode 100644 bin/tests/system/inline/.gitignore delete mode 100644 bin/tests/system/inline/checkdsa.sh.in diff --git a/acconfig.h b/acconfig.h index d3b0ee4d3a..369986e9c8 100644 --- a/acconfig.h +++ b/acconfig.h @@ -17,9 +17,6 @@ ***/ @TOP@ -/** define if the system has a random number generating device */ -#undef PATH_RANDOMDEV - /** define if pthread_attr_getstacksize() is available */ #undef HAVE_PTHREAD_ATTR_GETSTACKSIZE diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in index 6c77ce7e58..a440a31a76 100644 --- a/bin/tests/system/conf.sh.in +++ b/bin/tests/system/conf.sh.in @@ -148,7 +148,6 @@ PYTHON=@PYTHON@ # # Determine if we support various optional features. # -CHECK_DSA=@CHECK_DSA@ HAVEXMLSTATS=@XMLSTATS@ HAVEJSONSTATS=@JSONSTATS@ ZLIB=@ZLIB@ diff --git a/bin/tests/system/conf.sh.win32 b/bin/tests/system/conf.sh.win32 index 737da36d3f..da89e167c2 100644 --- a/bin/tests/system/conf.sh.win32 +++ b/bin/tests/system/conf.sh.win32 @@ -147,7 +147,6 @@ PYTHON=@PYTHON@ # # Determine if we support various optional features. # -CHECK_DSA=@CHECK_DSA@ HAVEXMLSTATS=@XMLSTATS@ HAVEJSONSTATS=@JSONSTATS@ ZLIB=@ZLIB@ diff --git a/bin/tests/system/inline/.gitignore b/bin/tests/system/inline/.gitignore deleted file mode 100644 index 67c4611e9c..0000000000 --- a/bin/tests/system/inline/.gitignore +++ /dev/null @@ -1 +0,0 @@ -checkdsa.sh diff --git a/bin/tests/system/inline/checkdsa.sh.in b/bin/tests/system/inline/checkdsa.sh.in deleted file mode 100644 index 5b6ea2ebd3..0000000000 --- a/bin/tests/system/inline/checkdsa.sh.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -if [ "@CHECK_DSA@" -eq 0 ]; then - exit 1 -fi -if [ ! -r /dev/random -o ! -r /dev/urandom ]; then - exit 1 -fi - -exit 0 diff --git a/bin/tests/system/inline/ns3/sign.sh b/bin/tests/system/inline/ns3/sign.sh index 09e3fc8874..eeb03032fd 100755 --- a/bin/tests/system/inline/ns3/sign.sh +++ b/bin/tests/system/inline/ns3/sign.sh @@ -135,22 +135,6 @@ rm -f K${zone}.+*+*.private for alg in ECDSAP256SHA256 NSEC3RSASHA1 DSA do - case $alg in - DSA) - $SHELL ../checkdsa.sh 2> /dev/null || continue - checkfile=../checkdsa - touch $checkfile ;; - ECDSAP256SHA256) - fail=0 - $KEYGEN -q -a ecdsap256sha256 test > /dev/null 2>&1 || fail=1 - rm -f Ktest* - [ $fail != 0 ] && continue - $SHELL ../checkdsa.sh 2> /dev/null || continue - checkfile=../checkecdsa - touch $checkfile ;; - *) ;; - esac - k1=`$KEYGEN -q -a $alg -b 1024 -n zone -f KSK $zone` k2=`$KEYGEN -q -a $alg -b 1024 -n zone $zone` k3=`$KEYGEN -q -a $alg -b 1024 -n zone $zone` @@ -161,9 +145,9 @@ do rm -f $k1.private mv $k1.key a-file $IMPORTKEY -P now -D now+3600 -f a-file $zone > /dev/null 2>&1 || - ( echo "importkey failed: $alg"; rm -f $checkfile ) + ( echo "importkey failed: $alg" ) rm -f $k2.private mv $k2.key a-file $IMPORTKEY -f a-file $zone > /dev/null 2>&1 || - ( echo "importkey failed: $alg"; rm -f $checkfile ) + ( echo "importkey failed: $alg" ) done diff --git a/config.h.in b/config.h.in index 9c7a06992b..e0e624ad67 100644 --- a/config.h.in +++ b/config.h.in @@ -17,9 +17,6 @@ *** it does not get installed. ***/ -/** define if the system has a random number generating device */ -#undef PATH_RANDOMDEV - /** define if pthread_attr_getstacksize() is available */ #undef HAVE_PTHREAD_ATTR_GETSTACKSIZE diff --git a/config.h.win32 b/config.h.win32 index 4f19200b1d..01a0cddbcf 100644 --- a/config.h.win32 +++ b/config.h.win32 @@ -227,9 +227,6 @@ typedef __int64 off_t; */ #include -/* We actually are using the CryptAPI and not a device */ -#define PATH_RANDOMDEV "CryptAPI" - #include #include #include diff --git a/configure b/configure index 00ca246ca0..81d41b1998 100755 --- a/configure +++ b/configure @@ -755,7 +755,6 @@ PTHREAD_CFLAGS PTHREAD_LIBS PTHREAD_CC ax_pthread_config -CHECK_DSA GEOIPLINKOBJS GEOIPLINKSRCS ISC_PLATFORM_NORETURN_POST @@ -14442,22 +14441,6 @@ esac -# XXXOND: Change this to deterministic DSA generation -# -# Only check dsa signature generation on these platforms when performing -# system tests. -# -CHECK_DSA=0 -if grep "#define PATH_RANDOMDEV " confdefs.h > /dev/null -then - case "$host" in - *darwin*|*freebsd*) - CHECK_DSA=1 - ;; - esac -fi - - # # Do we have arc4random(), etc ? # @@ -21513,7 +21496,7 @@ ac_config_commands="$ac_config_commands chmod" # elsewhere if there's a good reason for doing so. # -ac_config_files="$ac_config_files make/Makefile make/mkdep Makefile bin/Makefile bin/check/Makefile bin/confgen/Makefile bin/confgen/unix/Makefile bin/delv/Makefile bin/dig/Makefile bin/dnssec/Makefile bin/named/Makefile bin/named/unix/Makefile bin/nsupdate/Makefile bin/pkcs11/Makefile bin/python/Makefile bin/python/isc/Makefile bin/python/isc/utils.py bin/python/isc/tests/Makefile bin/python/dnssec-checkds.py bin/python/dnssec-coverage.py bin/python/dnssec-keymgr.py bin/python/isc/__init__.py bin/python/isc/checkds.py bin/python/isc/coverage.py bin/python/isc/dnskey.py bin/python/isc/eventlist.py bin/python/isc/keydict.py bin/python/isc/keyevent.py bin/python/isc/keymgr.py bin/python/isc/keyseries.py bin/python/isc/keyzone.py bin/python/isc/policy.py bin/python/isc/rndc.py bin/python/isc/tests/dnskey_test.py bin/python/isc/tests/policy_test.py bin/rndc/Makefile bin/tests/Makefile bin/tests/headerdep_test.sh bin/tests/optional/Makefile bin/tests/pkcs11/Makefile bin/tests/pkcs11/benchmarks/Makefile bin/tests/system/Makefile bin/tests/system/conf.sh bin/tests/system/dlz/prereq.sh bin/tests/system/dlzexternal/Makefile bin/tests/system/dlzexternal/ns1/dlzs.conf bin/tests/system/dyndb/Makefile bin/tests/system/dyndb/driver/Makefile bin/tests/system/inline/checkdsa.sh bin/tests/system/pipelined/Makefile bin/tests/system/rndc/Makefile bin/tests/system/rpz/Makefile bin/tests/system/rsabigexponent/Makefile bin/tests/system/tkey/Makefile bin/tests/virtual-time/Makefile bin/tests/virtual-time/conf.sh bin/tools/Makefile contrib/scripts/check-secure-delegation.pl contrib/scripts/zone-edit.sh doc/Makefile doc/arm/Makefile doc/arm/noteversion.xml doc/arm/pkgversion.xml doc/arm/releaseinfo.xml doc/doxygen/Doxyfile doc/doxygen/Makefile doc/doxygen/doxygen-input-filter doc/misc/Makefile doc/tex/Makefile doc/tex/armstyle.sty doc/xsl/Makefile doc/xsl/isc-docbook-chunk.xsl doc/xsl/isc-docbook-html.xsl doc/xsl/isc-manpage.xsl doc/xsl/isc-notes-html.xsl isc-config.sh lib/Makefile lib/bind9/Makefile lib/bind9/include/Makefile lib/bind9/include/bind9/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/dns/tests/Makefile lib/irs/Makefile lib/irs/include/Makefile lib/irs/include/irs/Makefile lib/irs/include/irs/netdb.h lib/irs/include/irs/platform.h lib/irs/tests/Makefile lib/isc/pthreads/Makefile lib/isc/pthreads/include/Makefile lib/isc/pthreads/include/isc/Makefile lib/isc/Makefile lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h lib/isc/include/pk11/Makefile lib/isc/include/pkcs11/Makefile lib/isc/tests/Makefile lib/isc/nls/Makefile lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile lib/isc/unix/include/pkcs11/Makefile lib/isccc/Makefile lib/isccc/include/Makefile lib/isccc/include/isccc/Makefile lib/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/isccfg/tests/Makefile lib/ns/Makefile lib/ns/include/Makefile lib/ns/include/ns/Makefile lib/ns/tests/Makefile lib/samples/Makefile lib/samples/Makefile-postinstall unit/Makefile unit/unittest.sh fuzz/Makefile" +ac_config_files="$ac_config_files make/Makefile make/mkdep Makefile bin/Makefile bin/check/Makefile bin/confgen/Makefile bin/confgen/unix/Makefile bin/delv/Makefile bin/dig/Makefile bin/dnssec/Makefile bin/named/Makefile bin/named/unix/Makefile bin/nsupdate/Makefile bin/pkcs11/Makefile bin/python/Makefile bin/python/isc/Makefile bin/python/isc/utils.py bin/python/isc/tests/Makefile bin/python/dnssec-checkds.py bin/python/dnssec-coverage.py bin/python/dnssec-keymgr.py bin/python/isc/__init__.py bin/python/isc/checkds.py bin/python/isc/coverage.py bin/python/isc/dnskey.py bin/python/isc/eventlist.py bin/python/isc/keydict.py bin/python/isc/keyevent.py bin/python/isc/keymgr.py bin/python/isc/keyseries.py bin/python/isc/keyzone.py bin/python/isc/policy.py bin/python/isc/rndc.py bin/python/isc/tests/dnskey_test.py bin/python/isc/tests/policy_test.py bin/rndc/Makefile bin/tests/Makefile bin/tests/headerdep_test.sh bin/tests/optional/Makefile bin/tests/pkcs11/Makefile bin/tests/pkcs11/benchmarks/Makefile bin/tests/system/Makefile bin/tests/system/conf.sh bin/tests/system/dlz/prereq.sh bin/tests/system/dlzexternal/Makefile bin/tests/system/dlzexternal/ns1/dlzs.conf bin/tests/system/dyndb/Makefile bin/tests/system/dyndb/driver/Makefile bin/tests/system/pipelined/Makefile bin/tests/system/rndc/Makefile bin/tests/system/rpz/Makefile bin/tests/system/rsabigexponent/Makefile bin/tests/system/tkey/Makefile bin/tests/virtual-time/Makefile bin/tests/virtual-time/conf.sh bin/tools/Makefile contrib/scripts/check-secure-delegation.pl contrib/scripts/zone-edit.sh doc/Makefile doc/arm/Makefile doc/arm/noteversion.xml doc/arm/pkgversion.xml doc/arm/releaseinfo.xml doc/doxygen/Doxyfile doc/doxygen/Makefile doc/doxygen/doxygen-input-filter doc/misc/Makefile doc/tex/Makefile doc/tex/armstyle.sty doc/xsl/Makefile doc/xsl/isc-docbook-chunk.xsl doc/xsl/isc-docbook-html.xsl doc/xsl/isc-manpage.xsl doc/xsl/isc-notes-html.xsl isc-config.sh lib/Makefile lib/bind9/Makefile lib/bind9/include/Makefile lib/bind9/include/bind9/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/dns/tests/Makefile lib/irs/Makefile lib/irs/include/Makefile lib/irs/include/irs/Makefile lib/irs/include/irs/netdb.h lib/irs/include/irs/platform.h lib/irs/tests/Makefile lib/isc/pthreads/Makefile lib/isc/pthreads/include/Makefile lib/isc/pthreads/include/isc/Makefile lib/isc/Makefile lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h lib/isc/include/pk11/Makefile lib/isc/include/pkcs11/Makefile lib/isc/tests/Makefile lib/isc/nls/Makefile lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile lib/isc/unix/include/pkcs11/Makefile lib/isccc/Makefile lib/isccc/include/Makefile lib/isccc/include/isccc/Makefile lib/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/isccfg/tests/Makefile lib/ns/Makefile lib/ns/include/Makefile lib/ns/include/ns/Makefile lib/ns/tests/Makefile lib/samples/Makefile lib/samples/Makefile-postinstall unit/Makefile unit/unittest.sh fuzz/Makefile" # @@ -22563,7 +22546,6 @@ do "bin/tests/system/dlzexternal/ns1/dlzs.conf") CONFIG_FILES="$CONFIG_FILES bin/tests/system/dlzexternal/ns1/dlzs.conf" ;; "bin/tests/system/dyndb/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/system/dyndb/Makefile" ;; "bin/tests/system/dyndb/driver/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/system/dyndb/driver/Makefile" ;; - "bin/tests/system/inline/checkdsa.sh") CONFIG_FILES="$CONFIG_FILES bin/tests/system/inline/checkdsa.sh" ;; "bin/tests/system/pipelined/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/system/pipelined/Makefile" ;; "bin/tests/system/rndc/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/system/rndc/Makefile" ;; "bin/tests/system/rpz/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/system/rpz/Makefile" ;; diff --git a/configure.in b/configure.in index 652dd20199..608e62a59c 100644 --- a/configure.in +++ b/configure.in @@ -667,22 +667,6 @@ esac AC_SUBST(GEOIPLINKSRCS) AC_SUBST(GEOIPLINKOBJS) -# XXXOND: Change this to deterministic DSA generation -# -# Only check dsa signature generation on these platforms when performing -# system tests. -# -CHECK_DSA=0 -if grep "#define PATH_RANDOMDEV " confdefs.h > /dev/null -then - case "$host" in - *darwin*|*freebsd*) - CHECK_DSA=1 - ;; - esac -fi -AC_SUBST(CHECK_DSA) - # # Do we have arc4random(), etc ? # @@ -3077,7 +3061,6 @@ AC_CONFIG_FILES([ bin/tests/system/dlzexternal/ns1/dlzs.conf bin/tests/system/dyndb/Makefile bin/tests/system/dyndb/driver/Makefile - bin/tests/system/inline/checkdsa.sh bin/tests/system/pipelined/Makefile bin/tests/system/rndc/Makefile bin/tests/system/rpz/Makefile diff --git a/util/copyrights b/util/copyrights index 6b74dc659c..9facfc4b60 100644 --- a/util/copyrights +++ b/util/copyrights @@ -1331,7 +1331,6 @@ ./bin/tests/system/idna/tests.sh SH 2018 ./bin/tests/system/ifconfig.bat BAT 2016,2018 ./bin/tests/system/ifconfig.sh SH 2000,2001,2002,2003,2004,2007,2008,2009,2010,2012,2013,2016,2018 -./bin/tests/system/inline/checkdsa.sh.in SH 2013,2014,2016,2018 ./bin/tests/system/inline/clean.sh SH 2011,2012,2013,2014,2015,2016,2017,2018 ./bin/tests/system/inline/ns1/named.conf.in CONF-C 2011,2016,2018 ./bin/tests/system/inline/ns1/root.db.in ZONE 2011,2012,2013,2016,2017,2018 diff --git a/win32utils/Configure b/win32utils/Configure index c2b63a0c37..d2eed20e83 100644 --- a/win32utils/Configure +++ b/win32utils/Configure @@ -233,8 +233,7 @@ my @substdefp = (); my %configtest; -my @substtest = ("CHECK_DSA", - "CHECKDS", +my @substtest = ("CHECKDS", "COVERAGE", "DNSTAP", "FSTRM_CAPTURE", @@ -2837,9 +2836,6 @@ sub makeinstallfile { # Adjust system tests -# WIN32 not a BSD -$configtest{"CHECK_DSA"} = 0; - # dnstap not supported #$configtest{"DNSTAP"} = "dnstap"; #$configtest{"FSTRM_CAPTURE"} = "fstrm_capture"; From 5a0f618d22d9dfc7454c897c126e1093578c726e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 13:51:00 +0200 Subject: [PATCH 31/39] Replace custom HAVE_PTHREAD_ATTR_GETSTACKSIZE and HAVE_PTHREAD_ATTR_SETSTACKSIZE with proper AC_CHECK_FUNCS call --- acconfig.h | 6 ------ config.h.in | 6 ------ 2 files changed, 12 deletions(-) diff --git a/acconfig.h b/acconfig.h index 369986e9c8..8b4a7ea626 100644 --- a/acconfig.h +++ b/acconfig.h @@ -17,12 +17,6 @@ ***/ @TOP@ -/** define if pthread_attr_getstacksize() is available */ -#undef HAVE_PTHREAD_ATTR_GETSTACKSIZE - -/** define if pthread_attr_setstacksize() is available */ -#undef HAVE_PTHREAD_ATTR_SETSTACKSIZE - /** define if you have strerror in the C library. */ #undef HAVE_STRERROR diff --git a/config.h.in b/config.h.in index e0e624ad67..619a3b4b37 100644 --- a/config.h.in +++ b/config.h.in @@ -17,12 +17,6 @@ *** it does not get installed. ***/ -/** define if pthread_attr_getstacksize() is available */ -#undef HAVE_PTHREAD_ATTR_GETSTACKSIZE - -/** define if pthread_attr_setstacksize() is available */ -#undef HAVE_PTHREAD_ATTR_SETSTACKSIZE - /** define if you have strerror in the C library. */ #undef HAVE_STRERROR From 7e25330b3d4d3727303459639a6e59e0ee1b566e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 13:51:44 +0200 Subject: [PATCH 32/39] Remove now dummy HAVE_STRERROR --- acconfig.h | 3 --- config.h.in | 3 --- 2 files changed, 6 deletions(-) diff --git a/acconfig.h b/acconfig.h index 8b4a7ea626..5ab7a83f8a 100644 --- a/acconfig.h +++ b/acconfig.h @@ -17,9 +17,6 @@ ***/ @TOP@ -/** define if you have strerror in the C library. */ -#undef HAVE_STRERROR - /* Define to the length type used by the socket API (socklen_t, size_t, int). */ #undef ISC_SOCKADDR_LEN_T diff --git a/config.h.in b/config.h.in index 619a3b4b37..bcfd015a8c 100644 --- a/config.h.in +++ b/config.h.in @@ -17,9 +17,6 @@ *** it does not get installed. ***/ -/** define if you have strerror in the C library. */ -#undef HAVE_STRERROR - /* Define to the length type used by the socket API (socklen_t, size_t, int). */ #undef ISC_SOCKADDR_LEN_T From 2750799132cac9138fd98d06bed329b892ccf6f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 14:03:10 +0200 Subject: [PATCH 33/39] Assume socklen_t is always available on all supported platforms (except on Windows where it is typedefed to int32_t) --- acconfig.h | 3 -- bin/tests/system/feature-test.c | 2 +- config.h.in | 3 -- configure | 38 ------------------------- configure.in | 17 ----------- lib/isc/unix/net.c | 18 ++++++------ lib/isc/unix/socket.c | 32 ++++++++++----------- lib/isc/win32/include/isc/platform.h.in | 4 +++ lib/isc/win32/socket.c | 16 +++-------- 9 files changed, 34 insertions(+), 99 deletions(-) diff --git a/acconfig.h b/acconfig.h index 5ab7a83f8a..28fd2841d6 100644 --- a/acconfig.h +++ b/acconfig.h @@ -17,9 +17,6 @@ ***/ @TOP@ -/* Define to the length type used by the socket API (socklen_t, size_t, int). */ -#undef ISC_SOCKADDR_LEN_T - /* Define if threads need PTHREAD_SCOPE_SYSTEM */ #undef NEED_PTHREAD_SCOPE_SYSTEM diff --git a/bin/tests/system/feature-test.c b/bin/tests/system/feature-test.c index f95ce4742a..44b0558d4f 100644 --- a/bin/tests/system/feature-test.c +++ b/bin/tests/system/feature-test.c @@ -175,7 +175,7 @@ main(int argc, char **argv) { int s; int n = -1; int v6only = -1; - ISC_SOCKADDR_LEN_T len = sizeof(v6only); + socklen_t len = sizeof(v6only); s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); if (s >= 0) { diff --git a/config.h.in b/config.h.in index bcfd015a8c..12c116f492 100644 --- a/config.h.in +++ b/config.h.in @@ -17,9 +17,6 @@ *** it does not get installed. ***/ -/* Define to the length type used by the socket API (socklen_t, size_t, int). */ -#undef ISC_SOCKADDR_LEN_T - /* Define if threads need PTHREAD_SCOPE_SYSTEM */ #undef NEED_PTHREAD_SCOPE_SYSTEM diff --git a/configure b/configure index 81d41b1998..1657f57faa 100755 --- a/configure +++ b/configure @@ -759,7 +759,6 @@ GEOIPLINKOBJS GEOIPLINKSRCS ISC_PLATFORM_NORETURN_POST ISC_PLATFORM_NORETURN_PRE -ISC_SOCKADDR_LEN_T expanded_sysconfdir PYTHON_INSTALL_LIB PYTHON_INSTALL_DIR @@ -13732,43 +13731,6 @@ fi -ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " -#include -#include - -" -if test "x$ac_cv_type_socklen_t" = xyes; then : - $as_echo "#define ISC_SOCKADDR_LEN_T socklen_t" >>confdefs.h - -else - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -int getsockname(int, struct sockaddr *, size_t *); - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - $as_echo "#define ISC_SOCKADDR_LEN_T size_t" >>confdefs.h - -else - $as_echo "#define ISC_SOCKADDR_LEN_T int" >>confdefs.h - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : diff --git a/configure.in b/configure.in index 608e62a59c..a627195e0a 100644 --- a/configure.in +++ b/configure.in @@ -477,23 +477,6 @@ AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_TYPE_UINTPTR_T -AC_CHECK_TYPE(socklen_t, -[AC_DEFINE(ISC_SOCKADDR_LEN_T, socklen_t)], -[ -AC_TRY_COMPILE( -[ -#include -#include -int getsockname(int, struct sockaddr *, size_t *); -],[], -[AC_DEFINE(ISC_SOCKADDR_LEN_T, size_t)], -[AC_DEFINE(ISC_SOCKADDR_LEN_T, int)]) -], -[ -#include -#include -]) -AC_SUBST(ISC_SOCKADDR_LEN_T) AC_HEADER_TIME # diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c index 5b5fb4db0e..7d663c2df4 100644 --- a/lib/isc/unix/net.c +++ b/lib/isc/unix/net.c @@ -36,8 +36,8 @@ #include #include -#ifndef ISC_SOCKADDR_LEN_T -#define ISC_SOCKADDR_LEN_T unsigned int +#ifndef socklen_t +#define socklen_t unsigned int #endif /*% @@ -366,24 +366,24 @@ isc_net_probe_ipv6pktinfo(void) { #if ISC_CMSG_IP_TOS || defined(IPV6_TCLASS) -static inline ISC_SOCKADDR_LEN_T -cmsg_len(ISC_SOCKADDR_LEN_T len) { +static inline socklen_t +cmsg_len(socklen_t len) { #ifdef CMSG_LEN return (CMSG_LEN(len)); #else - ISC_SOCKADDR_LEN_T hdrlen; + socklen_t hdrlen; /* * Cast NULL so that any pointer arithmetic performed by CMSG_DATA * is correct. */ - hdrlen = (ISC_SOCKADDR_LEN_T)CMSG_DATA(((struct cmsghdr *)NULL)); + hdrlen = (socklen_t)CMSG_DATA(((struct cmsghdr *)NULL)); return (hdrlen + len); #endif } -static inline ISC_SOCKADDR_LEN_T -cmsg_space(ISC_SOCKADDR_LEN_T len) { +static inline socklen_t +cmsg_space(socklen_t len) { #ifdef CMSG_SPACE return (CMSG_SPACE(len)); #else @@ -448,7 +448,7 @@ static bool cmsgsend(int s, int level, int type, struct addrinfo *res) { char strbuf[ISC_STRERRORSIZE]; struct sockaddr_storage ss; - ISC_SOCKADDR_LEN_T len = sizeof(ss); + socklen_t len = sizeof(ss); struct msghdr msg; union { struct cmsghdr h; diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index d8ecdcb3cb..f59a85e5cc 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -207,8 +207,8 @@ typedef enum { poll_idle, poll_active, poll_checking } pollstate_t; * Some systems define the socket length argument as an int, some as size_t, * some as socklen_t. This is here so it can be easily changed if needed. */ -#ifndef ISC_SOCKADDR_LEN_T -#define ISC_SOCKADDR_LEN_T unsigned int +#ifndef socklen_t +#define socklen_t unsigned int #endif /*% @@ -1195,24 +1195,24 @@ make_nonblock(int fd) { * Note that cmsg_space() could run slow on OSes that do not have * CMSG_SPACE. */ -static inline ISC_SOCKADDR_LEN_T -cmsg_len(ISC_SOCKADDR_LEN_T len) { +static inline socklen_t +cmsg_len(socklen_t len) { #ifdef CMSG_LEN return (CMSG_LEN(len)); #else - ISC_SOCKADDR_LEN_T hdrlen; + socklen_t hdrlen; /* * Cast NULL so that any pointer arithmetic performed by CMSG_DATA * is correct. */ - hdrlen = (ISC_SOCKADDR_LEN_T)CMSG_DATA(((struct cmsghdr *)NULL)); + hdrlen = (socklen_t)CMSG_DATA(((struct cmsghdr *)NULL)); return (hdrlen + len); #endif } -static inline ISC_SOCKADDR_LEN_T -cmsg_space(ISC_SOCKADDR_LEN_T len) { +static inline socklen_t +cmsg_space(socklen_t len) { #ifdef CMSG_SPACE return (CMSG_SPACE(len)); #else @@ -2274,7 +2274,7 @@ static void set_rcvbuf(void) { int fd; int max = rcvbuf, min; - ISC_SOCKADDR_LEN_T len; + socklen_t len; fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (fd == -1) { @@ -2328,7 +2328,7 @@ static void set_sndbuf(void) { int fd; int max = sndbuf, min; - ISC_SOCKADDR_LEN_T len; + socklen_t len; fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); #if defined(ISC_PLATFORM_HAVEIPV6) @@ -2463,7 +2463,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, int on = 1; #endif #if defined(SO_RCVBUF) || defined(SO_SNDBUF) - ISC_SOCKADDR_LEN_T optlen; + socklen_t optlen; int size = 0; #endif @@ -3412,7 +3412,7 @@ internal_accept(isc_task_t *me, isc_event_t *ev) { isc__socketmgr_t *manager; isc_socket_newconnev_t *dev; isc_task_t *task; - ISC_SOCKADDR_LEN_T addrlen; + socklen_t addrlen; int fd; isc_result_t result = ISC_R_SUCCESS; char strbuf[ISC_STRERRORSIZE]; @@ -5812,7 +5812,7 @@ internal_connect(isc_task_t *me, isc_event_t *ev) { isc_socket_connev_t *dev; int cc; isc_result_t result; - ISC_SOCKADDR_LEN_T optlen; + socklen_t optlen; char strbuf[ISC_STRERRORSIZE]; char peerbuf[ISC_SOCKADDR_FORMATSIZE]; @@ -5948,7 +5948,7 @@ isc__socket_getpeername(isc_socket_t *sock0, isc_sockaddr_t *addressp) { isc_result_t isc__socket_getsockname(isc_socket_t *sock0, isc_sockaddr_t *addressp) { isc__socket_t *sock = (isc__socket_t *)sock0; - ISC_SOCKADDR_LEN_T len; + socklen_t len; isc_result_t result; char strbuf[ISC_STRERRORSIZE]; @@ -6304,7 +6304,7 @@ isc_socketmgr_renderxml(isc_socketmgr_t *mgr0, xmlTextWriterPtr writer) { isc__socket_t *sock = NULL; char peerbuf[ISC_SOCKADDR_FORMATSIZE]; isc_sockaddr_t addr; - ISC_SOCKADDR_LEN_T len; + socklen_t len; int xmlrc; LOCK(&mgr->lock); @@ -6416,7 +6416,7 @@ isc_socketmgr_renderjson(isc_socketmgr_t *mgr0, json_object *stats) { isc__socket_t *sock = NULL; char peerbuf[ISC_SOCKADDR_FORMATSIZE]; isc_sockaddr_t addr; - ISC_SOCKADDR_LEN_T len; + socklen_t len; json_object *obj, *array = json_object_new_array(); CHECKMEM(array); diff --git a/lib/isc/win32/include/isc/platform.h.in b/lib/isc/win32/include/isc/platform.h.in index 3ae3e3c895..b927888f1c 100644 --- a/lib/isc/win32/include/isc/platform.h.in +++ b/lib/isc/win32/include/isc/platform.h.in @@ -34,6 +34,10 @@ #ifndef strtoull #define strtoull _strtoui64 #endif + +#include +typedef uint32_t socklen_t; + #endif /*** diff --git a/lib/isc/win32/socket.c b/lib/isc/win32/socket.c index b4b9e2d609..22aa74fb86 100644 --- a/lib/isc/win32/socket.c +++ b/lib/isc/win32/socket.c @@ -112,14 +112,6 @@ static void consistent(isc_socket_t *sock); #define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12) #endif -/* - * Some systems define the socket length argument as an int, some as size_t, - * some as socklen_t. This is here so it can be easily changed if needed. - */ -#ifndef ISC_SOCKADDR_LEN_T -#define ISC_SOCKADDR_LEN_T unsigned int -#endif - /* * Define what the possible "soft" errors can be. These are non-fatal returns * of various network related functions, like recv() and so on. @@ -1649,7 +1641,7 @@ socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, int on = 1; #endif #if defined(SO_RCVBUF) - ISC_SOCKADDR_LEN_T optlen; + socklen_t optlen; int size; #endif int socket_errno; @@ -3655,7 +3647,7 @@ isc__socket_getpeername(isc_socket_t *sock, isc_sockaddr_t *addressp) { isc_result_t isc__socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) { - ISC_SOCKADDR_LEN_T len; + socklen_t len; isc_result_t result; char strbuf[ISC_STRERRORSIZE]; @@ -4007,7 +3999,7 @@ isc_socketmgr_renderxml(isc_socketmgr_t *mgr, xmlTextWriterPtr writer) isc_socket_t *sock = NULL; char peerbuf[ISC_SOCKADDR_FORMATSIZE]; isc_sockaddr_t addr; - ISC_SOCKADDR_LEN_T len; + socklen_t len; int xmlrc; LOCK(&mgr->lock); @@ -4118,7 +4110,7 @@ isc_socketmgr_renderjson(isc_socketmgr_t *mgr, json_object *stats) { isc_socket_t *sock = NULL; char peerbuf[ISC_SOCKADDR_FORMATSIZE]; isc_sockaddr_t addr; - ISC_SOCKADDR_LEN_T len; + socklen_t len; json_object *obj, *array = json_object_new_array(); CHECKMEM(array); From 161b5dccae0f9620c80a16c129d24070be67e787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 14:06:10 +0200 Subject: [PATCH 34/39] Remove NEED_PTHREAD_SCOPE_SYSTEM define that was needed on older FreeBSDs --- acconfig.h | 3 --- config.h.in | 3 --- configure | 19 ------------------- configure.in | 17 ----------------- lib/isc/pthreads/thread.c | 6 ------ 5 files changed, 48 deletions(-) diff --git a/acconfig.h b/acconfig.h index 28fd2841d6..e87336e48b 100644 --- a/acconfig.h +++ b/acconfig.h @@ -17,8 +17,5 @@ ***/ @TOP@ -/* Define if threads need PTHREAD_SCOPE_SYSTEM */ -#undef NEED_PTHREAD_SCOPE_SYSTEM - /* Define to 1 if you have the uname library function. */ #undef HAVE_UNAME diff --git a/config.h.in b/config.h.in index 12c116f492..b6dc6d6a5a 100644 --- a/config.h.in +++ b/config.h.in @@ -17,9 +17,6 @@ *** it does not get installed. ***/ -/* Define if threads need PTHREAD_SCOPE_SYSTEM */ -#undef NEED_PTHREAD_SCOPE_SYSTEM - /* Define to 1 if you have the uname library function. */ #undef HAVE_UNAME diff --git a/configure b/configure index 1657f57faa..4dbc0c81c6 100755 --- a/configure +++ b/configure @@ -15216,25 +15216,6 @@ fi done -# -# Additional OS-specific issues related to pthreads. -# -case "$host" in - *-freebsd*) - case $host in - *-freebsd5.[012]|*-freebsd5.[012].*);; - *-freebsd5.[3456789]|*-freebsd5.[3456789].*) - $as_echo "#define NEED_PTHREAD_SCOPE_SYSTEM 1" >>confdefs.h - - ;; - *-freebsd6.*) - $as_echo "#define NEED_PTHREAD_SCOPE_SYSTEM 1" >>confdefs.h - - ;; - esac - ;; -esac - # Look for functions relating to thread naming for ac_func in pthread_setname_np pthread_set_name_np do : diff --git a/configure.in b/configure.in index a627195e0a..e4654d5807 100644 --- a/configure.in +++ b/configure.in @@ -701,23 +701,6 @@ AC_CHECK_HEADERS([sched.h]) AC_SEARCH_LIBS([sched_yield],[rt]) AC_CHECK_FUNCS([sched_yield pthread_yield pthread_yield_np]) -# -# Additional OS-specific issues related to pthreads. -# -case "$host" in - *-freebsd*) - case $host in - *-freebsd5.[[012]]|*-freebsd5.[[012]].*);; - *-freebsd5.[[3456789]]|*-freebsd5.[[3456789]].*) - AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM) - ;; - *-freebsd6.*) - AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM) - ;; - esac - ;; -esac - # Look for functions relating to thread naming AC_CHECK_FUNCS([pthread_setname_np pthread_set_name_np]) AC_CHECK_HEADERS([pthread_np.h], [], [], [#include ]) diff --git a/lib/isc/pthreads/thread.c b/lib/isc/pthreads/thread.c index 5f82475ed5..ba7ae52daa 100644 --- a/lib/isc/pthreads/thread.c +++ b/lib/isc/pthreads/thread.c @@ -51,12 +51,6 @@ isc_thread_create(isc_threadfunc_t func, isc_threadarg_t arg, } #endif -#if defined(PTHREAD_SCOPE_SYSTEM) && defined(NEED_PTHREAD_SCOPE_SYSTEM) - ret = pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); - if (ret != 0) - return (ISC_R_UNEXPECTED); -#endif - ret = pthread_create(thread, &attr, func, arg); if (ret != 0) return (ISC_R_UNEXPECTED); From 341fd22bb0f8622f3bfa2782452a11bbea65cc05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 14:07:09 +0200 Subject: [PATCH 35/39] Remove custom HAVE_UNAME define with proper AC_DEFINE call --- acconfig.h | 3 --- config.h.in | 3 --- 2 files changed, 6 deletions(-) diff --git a/acconfig.h b/acconfig.h index e87336e48b..7c8669f39c 100644 --- a/acconfig.h +++ b/acconfig.h @@ -16,6 +16,3 @@ *** it does not get installed. ***/ @TOP@ - -/* Define to 1 if you have the uname library function. */ -#undef HAVE_UNAME diff --git a/config.h.in b/config.h.in index b6dc6d6a5a..0891a2e80c 100644 --- a/config.h.in +++ b/config.h.in @@ -17,9 +17,6 @@ *** it does not get installed. ***/ -/* Define to 1 if you have the uname library function. */ -#undef HAVE_UNAME - /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD From 2ed5eb3b9ef4ed50befc32c19fd862a69305e984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 5 Sep 2018 14:07:33 +0200 Subject: [PATCH 36/39] Remove now empty acconfig.h --- acconfig.h | 18 ------------------ config.h.in | 17 ----------------- util/copyrights | 1 - 3 files changed, 36 deletions(-) delete mode 100644 acconfig.h diff --git a/acconfig.h b/acconfig.h deleted file mode 100644 index 7c8669f39c..0000000000 --- a/acconfig.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -/*! \file */ - -/*** - *** This file is not to be included by any public header files, because - *** it does not get installed. - ***/ -@TOP@ diff --git a/config.h.in b/config.h.in index 0891a2e80c..088bd4d4b0 100644 --- a/config.h.in +++ b/config.h.in @@ -1,21 +1,4 @@ /* config.h.in. Generated from configure.in by autoheader. */ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -/*! \file */ - -/*** - *** This file is not to be included by any public header files, because - *** it does not get installed. - ***/ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD diff --git a/util/copyrights b/util/copyrights index 9facfc4b60..a2fd57f224 100644 --- a/util/copyrights +++ b/util/copyrights @@ -10,7 +10,6 @@ ./OPTIONS X 2017,2018 ./PLATFORMS X 2018 ./README X 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018 -./acconfig.h C 1999,2000,2001,2002,2003,2004,2005,2007,2008,2012,2014,2016,2018 ./aclocal.m4 X 1999,2000,2001,2012,2014,2018 ./autogen.sh SH 2015,2016,2018 ./bin/check/check-tool.c C 2000,2001,2002,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018 From 8e4cc152f7acc90250f45d1e79d9a404fd19ba78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Fri, 7 Sep 2018 12:32:42 +0200 Subject: [PATCH 37/39] Remove HAVE_SYS_PRCTL_H check as the prctl() system call was introduced in Linux 2.1.57. --- bin/named/unix/os.c | 66 ++++----------------------------------------- config.h.in | 3 --- configure | 13 --------- configure.in | 2 -- 4 files changed, 5 insertions(+), 79 deletions(-) diff --git a/bin/named/unix/os.c b/bin/named/unix/os.c index 1571b88be9..7ca80d5d4e 100644 --- a/bin/named/unix/os.c +++ b/bin/named/unix/os.c @@ -59,49 +59,6 @@ static int singletonfd = -1; #define ISC_FACILITY LOG_DAEMON #endif -/* - * If there's no , we don't care about - */ -#ifndef HAVE_SYS_CAPABILITY_H -#undef HAVE_SYS_PRCTL_H -#endif - -/* - * Linux defines: - * (C) HAVE_SYS_CAPABILITY_H - * (P) HAVE_SYS_PRCTL_H - * The possible cases are: - * none: setuid() normally - * T: no setuid() - * C: setuid() normally, drop caps (keep CAP_SETUID) - * T+C: no setuid(), drop caps (don't keep CAP_SETUID) - * T+C+P: setuid() early, drop caps (keep CAP_SETUID) - * C+P: setuid() normally, drop caps (keep CAP_SETUID) - * P: not possible - * T+P: not possible - * - * if (C) - * caps = BIND_SERVICE + CHROOT + SETGID - * if ((T && C && P) || !T) - * caps += SETUID - * endif - * capset(caps) - * endif - * if (T && C && P && -u) - * setuid() - * else if (T && -u) - * fail - * --> start threads - * if (!T && -u) - * setuid() - * if (C && (P || !-u)) - * caps = BIND_SERVICE - * capset(caps) - * endif - * - * It will be nice when Linux threads work properly with setuid(). - */ - static struct passwd *runas_pw = NULL; static bool done_setuid = false; static int dfd[2] = { -1, -1 }; @@ -112,10 +69,7 @@ static bool non_root = false; static bool non_root_caps = false; #include - -#ifdef HAVE_SYS_PRCTL_H -#include /* Required for prctl(). */ -#endif /* HAVE_SYS_PRCTL_H */ +#include static void linux_setcaps(cap_t caps) { @@ -196,15 +150,11 @@ linux_initialprivs(void) { */ SET_CAP(CAP_SYS_CHROOT); -#if defined(HAVE_SYS_PRCTL_H) /* - * We can setuid() only if either the kernel supports keeping - * capabilities after setuid() (which we don't know until we've - * tried) or we're not using threads. If either of these is - * true, we want the setuid capability. + * We need setuid() as the kernel supports keeping capabilities after + * setuid(). */ SET_CAP(CAP_SETUID); -#endif /* * Since we call initgroups, we need this. @@ -270,7 +220,6 @@ linux_minprivs(void) { FREE_CAP; } -#ifdef HAVE_SYS_PRCTL_H static void linux_keepcaps(void) { char strbuf[ISC_STRERRORSIZE]; @@ -290,11 +239,9 @@ linux_keepcaps(void) { non_root = true; } } -#endif #endif /* HAVE_SYS_CAPABILITY_H */ - static void setup_syslog(const char *progname) { int options; @@ -497,7 +444,7 @@ named_os_changeuser(void) { named_main_earlyfatal("setuid(): %s", strbuf); } -#if defined(HAVE_SYS_PRCTL_H) && defined(PR_SET_DUMPABLE) +#if defined(PR_SET_DUMPABLE) /* * Restore the ability of named to drop core after the setuid() * call has disabled it. @@ -540,11 +487,8 @@ named_os_adjustnofile(void) { void named_os_minprivs(void) { -#ifdef HAVE_SYS_PRCTL_H - linux_keepcaps(); -#endif - #if defined(HAVE_SYS_CAPABILITY_H) + linux_keepcaps(); linux_minprivs(); #endif } diff --git a/config.h.in b/config.h.in index 088bd4d4b0..18cd748b74 100644 --- a/config.h.in +++ b/config.h.in @@ -363,9 +363,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PRCTL_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H diff --git a/configure b/configure index 4dbc0c81c6..d10db7f43b 100755 --- a/configure +++ b/configure @@ -17709,19 +17709,6 @@ $as_echo "no" >&6; } fi -for ac_header in sys/prctl.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/prctl.h" "ac_cv_header_sys_prctl_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_prctl_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_PRCTL_H 1 -_ACEOF - -fi - -done - - for ac_header in sys/un.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/un.h" "ac_cv_header_sys_un_h" "$ac_includes_default" diff --git a/configure.in b/configure.in index e4654d5807..1210ed5c4c 100644 --- a/configure.in +++ b/configure.in @@ -1891,8 +1891,6 @@ AS_IF([test "$enable_linux_caps" = "yes"], [AC_MSG_RESULT([no])]) AC_SUBST([LIBCAP_LIBS]) -AC_CHECK_HEADERS(sys/prctl.h) - AC_CHECK_HEADERS(sys/un.h, ISC_PLATFORM_HAVESYSUNH="#define ISC_PLATFORM_HAVESYSUNH 1" , From 8ffd9a9b7116fb0942c11e39693e0c09621cdde0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Fri, 7 Sep 2018 12:48:49 +0200 Subject: [PATCH 38/39] Remove PR_SET_DUMPABLE check as it is available since Linux 2.3.20 --- bin/named/unix/os.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/named/unix/os.c b/bin/named/unix/os.c index 7ca80d5d4e..fc58d02737 100644 --- a/bin/named/unix/os.c +++ b/bin/named/unix/os.c @@ -444,7 +444,7 @@ named_os_changeuser(void) { named_main_earlyfatal("setuid(): %s", strbuf); } -#if defined(PR_SET_DUMPABLE) +#if defined(HAVE_SYS_CAPABILITY_H) /* * Restore the ability of named to drop core after the setuid() * call has disabled it. @@ -454,8 +454,7 @@ named_os_changeuser(void) { named_main_earlywarning("prctl(PR_SET_DUMPABLE) failed: %s", strbuf); } -#endif -#if defined(HAVE_SYS_CAPABILITY_H) + linux_minprivs(); #endif } From 68e017792fba3528a39be1ce19c999c18ba398f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Fri, 7 Sep 2018 13:02:48 +0200 Subject: [PATCH 39/39] Add CHANGES note for GL #525. 5031. [cleanup] Various defines in platform.h has been either dropped if always or never triggered on supported platforms or replaced with config.h equivalents if the defines didn't have any impact on public headers. Workarounds for LinuxThreads have been removed because NPTL is available since Linux kernel 2.6.0. --- CHANGES | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGES b/CHANGES index 959a8d32ec..9c714bd809 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,10 @@ +5031. [cleanup] Various defines in platform.h has been either dropped + if always or never triggered on supported platforms + or replaced with config.h equivalents if the defines + didn't have any impact on public headers. Workarounds + for LinuxThreads have been removed because NPTL is + available since Linux kernel 2.6.0. [GL #525] + 5030. [bug] Align CMSG buffers to a 64-bit boundary, fixes crash on architectures with strict alignment. [GL #521]