summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2020-01-07 19:08:11 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2020-01-07 19:08:11 +0000
commit2776fbe413fb180e5835cf7628eb3876894b2203 (patch)
tree27f101e8872f5293552b2137ec7a0fb343085d0c
parent970c8a4c28d2acd68f390b8650e5896a7c58549c (diff)
Remove thread support. Minus 4k lines.
OK millert
-rw-r--r--usr.sbin/bind/Makefile.bsd-wrapper3
-rw-r--r--usr.sbin/bind/bin/dig/dig.c6
-rw-r--r--usr.sbin/bind/config.threads.in132
-rw-r--r--usr.sbin/bind/configure1099
-rw-r--r--usr.sbin/bind/configure.in229
-rw-r--r--usr.sbin/bind/lib/dns/dst_api.c16
-rw-r--r--usr.sbin/bind/lib/dns/name.c125
-rw-r--r--usr.sbin/bind/lib/dns/resolver.c15
-rw-r--r--usr.sbin/bind/lib/dns/zone.c18
-rw-r--r--usr.sbin/bind/lib/isc/Makefile.in8
-rw-r--r--usr.sbin/bind/lib/isc/include/isc/platform.h.in5
-rw-r--r--usr.sbin/bind/lib/isc/include/isc/refcount.h164
-rw-r--r--usr.sbin/bind/lib/isc/include/isc/rwlock.h77
-rw-r--r--usr.sbin/bind/lib/isc/nothreads/Makefile.in6
-rw-r--r--usr.sbin/bind/lib/isc/pthreads/Makefile.in37
-rw-r--r--usr.sbin/bind/lib/isc/pthreads/condition.c80
-rw-r--r--usr.sbin/bind/lib/isc/pthreads/include/Makefile.in24
-rw-r--r--usr.sbin/bind/lib/isc/pthreads/include/isc/Makefile.in41
-rw-r--r--usr.sbin/bind/lib/isc/pthreads/include/isc/condition.h64
-rw-r--r--usr.sbin/bind/lib/isc/pthreads/include/isc/mutex.h144
-rw-r--r--usr.sbin/bind/lib/isc/pthreads/include/isc/once.h49
-rw-r--r--usr.sbin/bind/lib/isc/pthreads/include/isc/thread.h69
-rw-r--r--usr.sbin/bind/lib/isc/pthreads/mutex.c307
-rw-r--r--usr.sbin/bind/lib/isc/pthreads/thread.c109
-rw-r--r--usr.sbin/bind/lib/isc/refcount.c6
-rw-r--r--usr.sbin/bind/lib/isc/rwlock.c796
-rw-r--r--usr.sbin/bind/lib/isc/task.c35
-rw-r--r--usr.sbin/bind/lib/isc/task_p.h10
-rw-r--r--usr.sbin/bind/lib/isc/timer.c6
-rw-r--r--usr.sbin/bind/lib/isc/unix/Makefile.in2
-rw-r--r--usr.sbin/bind/lib/isc/unix/app.c306
-rw-r--r--usr.sbin/bind/lib/isc/unix/socket.c42
-rw-r--r--usr.sbin/bind/lib/isc/unix/time.c24
-rw-r--r--usr.sbin/bind/lib/isc/x86_32/include/isc/atomic.h34
-rw-r--r--usr.sbin/bind/lib/isc/x86_64/include/isc/atomic.h17
-rw-r--r--usr.sbin/bind/make/includes.in4
36 files changed, 37 insertions, 4072 deletions
diff --git a/usr.sbin/bind/Makefile.bsd-wrapper b/usr.sbin/bind/Makefile.bsd-wrapper
index eb0db1d065e..0775f46ce6b 100644
--- a/usr.sbin/bind/Makefile.bsd-wrapper
+++ b/usr.sbin/bind/Makefile.bsd-wrapper
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.bsd-wrapper,v 1.21 2020/01/06 18:26:33 sthen Exp $
+# $OpenBSD: Makefile.bsd-wrapper,v 1.22 2020/01/07 19:08:09 florian Exp $
.include <bsd.own.mk>
@@ -15,7 +15,6 @@ CONFIGURE_OPTS= --prefix=/usr \
--with-docbook-xsl=no \
--with-libjson=no \
--disable-shared \
- --disable-threads \
--enable-sit
PROG= bin/dig/dig \
diff --git a/usr.sbin/bind/bin/dig/dig.c b/usr.sbin/bind/bin/dig/dig.c
index 4cb5a34a5e7..04a93745496 100644
--- a/usr.sbin/bind/bin/dig/dig.c
+++ b/usr.sbin/bind/bin/dig/dig.c
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dig.c,v 1.28 2020/01/02 10:27:46 schwarze Exp $ */
+/* $Id: dig.c,v 1.29 2020/01/07 19:08:09 florian Exp $ */
/*! \file */
@@ -211,11 +211,7 @@ received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
printf(";; Query time: %ld msec\n", (long) diff / 1000);
printf(";; SERVER: %s(%s)\n", fromtext, query->servname);
time(&tnow);
-#if defined(ISC_PLATFORM_USETHREADS) && !defined(WIN32)
- (void)localtime_r(&tnow, &tmnow);
-#else
tmnow = *localtime(&tnow);
-#endif
#ifdef WIN32
/*
diff --git a/usr.sbin/bind/config.threads.in b/usr.sbin/bind/config.threads.in
deleted file mode 100644
index 30cf7cda523..00000000000
--- a/usr.sbin/bind/config.threads.in
+++ /dev/null
@@ -1,132 +0,0 @@
-#
-# Begin pthreads checking.
-#
-# First, decide whether to use multithreading or not.
-#
-# Enable multithreading by default on systems where it is known
-# to work well, and where debugging of multithreaded programs
-# is supported.
-#
-
-AC_MSG_CHECKING(whether to build with thread support)
-
-case $host in
-*-dec-osf*)
- use_threads=true ;;
-[*-solaris2.[0-6]])
- # Thread signals are broken on Solaris 2.6; they are sometimes
- # delivered to the wrong thread.
- use_threads=false ;;
-*-solaris*)
- use_threads=true ;;
-*-ibm-aix*)
- use_threads=true ;;
-*-hp-hpux10*)
- use_threads=false ;;
-*-hp-hpux11*)
- use_threads=true ;;
-*-sgi-irix*)
- use_threads=true ;;
-*-sco-sysv*uw*|*-*-sysv*UnixWare*)
- # UnixWare
- use_threads=false ;;
-*-*-sysv*OpenUNIX*)
- # UnixWare
- use_threads=true ;;
-[*-netbsd[1234].*])
- # NetBSD earlier than NetBSD 5.0 has poor pthreads.
- # Don't use it by default.
- use_threads=false ;;
-*-netbsd*)
- use_threads=true ;;
-*-openbsd*)
- # OpenBSD users have reported that named dumps core on
- # startup when built with threads.
- use_threads=false ;;
-[*-freebsd[1234567].*])
- # Threads are broken at least up to FreeBSD 4.11.
- # FreeBSD 5, 6 and 7 we have never officially supported threads
- # on. YMMV
- use_threads=false ;;
-*-freebsd*)
- use_threads=true ;;
-[*-bsdi[234]*])
- # Thread signals do not work reliably on some versions of BSD/OS.
- use_threads=false ;;
-*-bsdi5*)
- use_threads=true ;;
-*-linux*)
- use_threads=true ;;
-*-darwin[[123456789]].*)
- use_threads=false ;;
-*-darwin*.*)
- use_threads=true ;;
-*)
- use_threads=true ;;
-esac
-
-AC_ARG_ENABLE(threads,
- [ --enable-threads enable multithreading])
-case "$enable_threads" in
- yes)
- use_threads=true
- ;;
- no)
- use_threads=false
- ;;
- '')
- # Use system-dependent default
- ;;
- *)
- AC_MSG_ERROR([--enable-threads takes yes or no])
- ;;
-esac
-
-if $use_threads
-then
- AC_MSG_RESULT(yes)
-else
- AC_MSG_RESULT(no)
-fi
-
-if $use_threads
-then
- #
- # Search for / configure pthreads in a system-dependent fashion.
- #
- case "$host" in
- *-freebsd*)
- # We don't want to set -lpthread as that break
- # the ability to choose threads library at final
- # link time and is not valid for all architectures.
-
- PTHREAD=
- if test "X$GCC" = "Xyes"; then
- saved_cc="$CC"
- CC="$CC -pthread"
- AC_MSG_CHECKING(for gcc -pthread support);
- AC_TRY_LINK([#include <pthread.h>],
- [printf("%x\n", pthread_create);],
- PTHREAD="yes"
- AC_MSG_RESULT(yes),
- AC_MSG_RESULT(no))
- CC="$saved_cc"
- fi
- if test "X$PTHREAD" != "Xyes"; then
- AC_CHECK_LIB(pthread, pthread_create,,
- AC_CHECK_LIB(thr, thread_create,,
- AC_CHECK_LIB(c_r, pthread_create,,
- AC_CHECK_LIB(c, pthread_create,,
- AC_MSG_ERROR("could not find thread libraries")))))
- fi
- ;;
- *)
- AC_CHECK_LIB(pthread, pthread_create,,
- AC_CHECK_LIB(pthread, __pthread_create,,
- AC_CHECK_LIB(pthread, __pthread_create_system,,
- AC_CHECK_LIB(c_r, pthread_create,,
- AC_CHECK_LIB(c, pthread_create,,
- AC_MSG_ERROR("could not find thread libraries"))))))
- ;;
- esac
-fi
diff --git a/usr.sbin/bind/configure b/usr.sbin/bind/configure
index 64a003db7f0..47d0fcf9129 100644
--- a/usr.sbin/bind/configure
+++ b/usr.sbin/bind/configure
@@ -830,10 +830,6 @@ DST_OPENSSL_INC
HAVE_SIT
ISC_PLATFORM_USESIT
INSTALL_LIBRARY
-ISC_THREAD_DIR
-THREADOPTSRCS
-THREADOPTOBJS
-ISC_PLATFORM_USETHREADS
ALWAYS_DEFINES
CHECK_DSA
DNS_CRYPTO_LIBS
@@ -982,8 +978,6 @@ enable_epoll
enable_devpoll
with_gssapi
with_randomdev
-enable_threads
-with_locktype
with_libtool
enable_native_pkcs11
with_openssl
@@ -1667,7 +1661,6 @@ Optional Features:
--enable-kqueue use BSD kqueue when available [default=yes]
--enable-epoll use Linux epoll when available [default=auto]
--enable-devpoll use /dev/poll when available [default=yes]
- --enable-threads enable multithreading
--enable-native-pkcs11 use native PKCS11 for all crypto [default=no]
--enable-openssl-hash use OpenSSL for hash functions [default=no]
--enable-sit enable source identity token [default=no]
@@ -1705,7 +1698,6 @@ Optional Packages:
Specify path for system-supplied GSSAPI
[default=yes]
--with-randomdev=PATH Specify path for random device
- --with-locktype=ARG Specify mutex lock type (adaptive or standard)
--with-libtool use GNU libtool
--with-openssl=PATH Build with OpenSSL [yes|no|path]. (Crypto is
required for DNSSEC)
@@ -14323,1051 +14315,7 @@ fi
done
-#
-# Begin pthreads checking.
-#
-# First, decide whether to use multithreading or not.
-#
-# Enable multithreading by default on systems where it is known
-# to work well, and where debugging of multithreaded programs
-# is supported.
-#
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with thread support" >&5
-$as_echo_n "checking whether to build with thread support... " >&6; }
-
-case $host in
-*-dec-osf*)
- use_threads=true ;;
-*-solaris2.[0-6])
- # Thread signals are broken on Solaris 2.6; they are sometimes
- # delivered to the wrong thread.
- use_threads=false ;;
-*-solaris*)
- use_threads=true ;;
-*-ibm-aix*)
- use_threads=true ;;
-*-hp-hpux10*)
- use_threads=false ;;
-*-hp-hpux11*)
- use_threads=true ;;
-*-sgi-irix*)
- use_threads=true ;;
-*-sco-sysv*uw*|*-*-sysv*UnixWare*)
- # UnixWare
- use_threads=false ;;
-*-*-sysv*OpenUNIX*)
- # UnixWare
- use_threads=true ;;
-*-netbsd[1234].*)
- # NetBSD earlier than NetBSD 5.0 has poor pthreads.
- # Don't use it by default.
- use_threads=false ;;
-*-netbsd*)
- use_threads=true ;;
-*-openbsd*)
- # OpenBSD users have reported that named dumps core on
- # startup when built with threads.
- use_threads=false ;;
-*-freebsd[1234567].*)
- # Threads are broken at least up to FreeBSD 4.11.
- # FreeBSD 5, 6 and 7 we have never officially supported threads
- # on. YMMV
- use_threads=false ;;
-*-freebsd*)
- use_threads=true ;;
-*-bsdi[234]*)
- # Thread signals do not work reliably on some versions of BSD/OS.
- use_threads=false ;;
-*-bsdi5*)
- use_threads=true ;;
-*-linux*)
- use_threads=true ;;
-*-darwin[123456789].*)
- use_threads=false ;;
-*-darwin*.*)
- use_threads=true ;;
-*)
- use_threads=true ;;
-esac
-
-# Check whether --enable-threads was given.
-if test "${enable_threads+set}" = set; then :
- enableval=$enable_threads;
-fi
-
-case "$enable_threads" in
- yes)
- use_threads=true
- ;;
- no)
- use_threads=false
- ;;
- '')
- # Use system-dependent default
- ;;
- *)
- as_fn_error $? "--enable-threads takes yes or no" "$LINENO" 5
- ;;
-esac
-
-if $use_threads
-then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-if $use_threads
-then
- #
- # Search for / configure pthreads in a system-dependent fashion.
- #
- case "$host" in
- *-freebsd*)
- # We don't want to set -lpthread as that break
- # the ability to choose threads library at final
- # link time and is not valid for all architectures.
-
- PTHREAD=
- if test "X$GCC" = "Xyes"; then
- saved_cc="$CC"
- CC="$CC -pthread"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc -pthread support" >&5
-$as_echo_n "checking for gcc -pthread support... " >&6; };
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <pthread.h>
-int
-main ()
-{
-printf("%x\n", pthread_create);
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- PTHREAD="yes"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-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_exeext conftest.$ac_ext
- CC="$saved_cc"
- fi
- if test "X$PTHREAD" != "Xyes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
-$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread_pthread_create+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $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 pthread_create ();
-int
-main ()
-{
-return pthread_create ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_pthread_pthread_create=yes
-else
- ac_cv_lib_pthread_pthread_create=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_pthread_pthread_create" >&5
-$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
-if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPTHREAD 1
-_ACEOF
-
- LIBS="-lpthread $LIBS"
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread_create in -lthr" >&5
-$as_echo_n "checking for thread_create in -lthr... " >&6; }
-if ${ac_cv_lib_thr_thread_create+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lthr $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 thread_create ();
-int
-main ()
-{
-return thread_create ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_thr_thread_create=yes
-else
- ac_cv_lib_thr_thread_create=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_thr_thread_create" >&5
-$as_echo "$ac_cv_lib_thr_thread_create" >&6; }
-if test "x$ac_cv_lib_thr_thread_create" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBTHR 1
-_ACEOF
-
- LIBS="-lthr $LIBS"
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lc_r" >&5
-$as_echo_n "checking for pthread_create in -lc_r... " >&6; }
-if ${ac_cv_lib_c_r_pthread_create+:} 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 pthread_create ();
-int
-main ()
-{
-return pthread_create ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_c_r_pthread_create=yes
-else
- ac_cv_lib_c_r_pthread_create=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_pthread_create" >&5
-$as_echo "$ac_cv_lib_c_r_pthread_create" >&6; }
-if test "x$ac_cv_lib_c_r_pthread_create" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBC_R 1
-_ACEOF
-
- LIBS="-lc_r $LIBS"
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lc" >&5
-$as_echo_n "checking for pthread_create in -lc... " >&6; }
-if ${ac_cv_lib_c_pthread_create+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $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 pthread_create ();
-int
-main ()
-{
-return pthread_create ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_c_pthread_create=yes
-else
- ac_cv_lib_c_pthread_create=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_pthread_create" >&5
-$as_echo "$ac_cv_lib_c_pthread_create" >&6; }
-if test "x$ac_cv_lib_c_pthread_create" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBC 1
-_ACEOF
-
- LIBS="-lc $LIBS"
-
-else
- as_fn_error $? "\"could not find thread libraries\"" "$LINENO" 5
-fi
-
-fi
-
-fi
-
-fi
-
- fi
- ;;
- *)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
-$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread_pthread_create+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $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 pthread_create ();
-int
-main ()
-{
-return pthread_create ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_pthread_pthread_create=yes
-else
- ac_cv_lib_pthread_pthread_create=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_pthread_pthread_create" >&5
-$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
-if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPTHREAD 1
-_ACEOF
-
- LIBS="-lpthread $LIBS"
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __pthread_create in -lpthread" >&5
-$as_echo_n "checking for __pthread_create in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread___pthread_create+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $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 __pthread_create ();
-int
-main ()
-{
-return __pthread_create ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_pthread___pthread_create=yes
-else
- ac_cv_lib_pthread___pthread_create=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_pthread___pthread_create" >&5
-$as_echo "$ac_cv_lib_pthread___pthread_create" >&6; }
-if test "x$ac_cv_lib_pthread___pthread_create" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPTHREAD 1
-_ACEOF
-
- LIBS="-lpthread $LIBS"
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __pthread_create_system in -lpthread" >&5
-$as_echo_n "checking for __pthread_create_system in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread___pthread_create_system+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $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 __pthread_create_system ();
-int
-main ()
-{
-return __pthread_create_system ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_pthread___pthread_create_system=yes
-else
- ac_cv_lib_pthread___pthread_create_system=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_pthread___pthread_create_system" >&5
-$as_echo "$ac_cv_lib_pthread___pthread_create_system" >&6; }
-if test "x$ac_cv_lib_pthread___pthread_create_system" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPTHREAD 1
-_ACEOF
-
- LIBS="-lpthread $LIBS"
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lc_r" >&5
-$as_echo_n "checking for pthread_create in -lc_r... " >&6; }
-if ${ac_cv_lib_c_r_pthread_create+:} 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 pthread_create ();
-int
-main ()
-{
-return pthread_create ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_c_r_pthread_create=yes
-else
- ac_cv_lib_c_r_pthread_create=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_pthread_create" >&5
-$as_echo "$ac_cv_lib_c_r_pthread_create" >&6; }
-if test "x$ac_cv_lib_c_r_pthread_create" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBC_R 1
-_ACEOF
-
- LIBS="-lc_r $LIBS"
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lc" >&5
-$as_echo_n "checking for pthread_create in -lc... " >&6; }
-if ${ac_cv_lib_c_pthread_create+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $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 pthread_create ();
-int
-main ()
-{
-return pthread_create ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_c_pthread_create=yes
-else
- ac_cv_lib_c_pthread_create=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_pthread_create" >&5
-$as_echo "$ac_cv_lib_c_pthread_create" >&6; }
-if test "x$ac_cv_lib_c_pthread_create" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBC 1
-_ACEOF
-
- LIBS="-lc $LIBS"
-
-else
- as_fn_error $? "\"could not find thread libraries\"" "$LINENO" 5
-fi
-
-fi
-
-fi
-
-fi
-
-fi
-
- ;;
- esac
-fi
-
-if $use_threads
-then
- if test "X$GCC" = "Xyes"; then
- case "$host" in
- *-freebsd*)
- CC="$CC -pthread"
- CCOPT="$CCOPT -pthread"
- CCNOOPT="$CCNOOPT -pthread"
- STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
- ;;
- *-openbsd*)
- CC="$CC -pthread"
- CCOPT="$CCOPT -pthread"
- CCNOOPT="$CCNOOPT -pthread"
- ;;
- *-solaris*)
- LIBS="$LIBS -lthread"
- ;;
- *-ibm-aix*)
- STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
- ;;
- esac
- else
- case $host in
- *-dec-osf*)
- CC="$CC -pthread"
- CCOPT="$CCOPT -pthread"
- CCNOOPT="$CCNOOPT -pthread"
- ;;
- *-solaris*)
- CC="$CC -mt"
- CCOPT="$CCOPT -mt"
- CCNOOPT="$CCNOOPT -mt"
- ;;
- *-ibm-aix*)
- STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
- ;;
- *-sco-sysv*uw*|*-*-sysv*UnixWare*)
- CC="$CC -Kthread"
- CCOPT="$CCOPT -Kthread"
- CCNOOPT="$CCNOOPT -Kthread"
- ;;
- *-*-sysv*OpenUNIX*)
- CC="$CC -Kpthread"
- CCOPT="$CCOPT -Kpthread"
- CCNOOPT="$CCNOOPT -Kpthread"
- ;;
- esac
- fi
- ALWAYS_DEFINES="-D_REENTRANT"
- ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
- THREADOPTOBJS='${THREADOPTOBJS}'
- THREADOPTSRCS='${THREADOPTSRCS}'
- thread_dir=pthreads
- #
- # We'd like to use sigwait() too
- #
- ac_fn_c_check_func "$LINENO" "sigwait" "ac_cv_func_sigwait"
-if test "x$ac_cv_func_sigwait" = xyes; then :
- $as_echo "#define HAVE_SIGWAIT 1" >>confdefs.h
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigwait in -lc" >&5
-$as_echo_n "checking for sigwait in -lc... " >&6; }
-if ${ac_cv_lib_c_sigwait+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $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_sigwait=yes
-else
- ac_cv_lib_c_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_sigwait" >&5
-$as_echo "$ac_cv_lib_c_sigwait" >&6; }
-if test "x$ac_cv_lib_c_sigwait" = xyes; then :
- $as_echo "#define HAVE_SIGWAIT 1" >>confdefs.h
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigwait in -lpthread" >&5
-$as_echo_n "checking for sigwait in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread_sigwait+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $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_pthread_sigwait=yes
-else
- ac_cv_lib_pthread_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_pthread_sigwait" >&5
-$as_echo "$ac_cv_lib_pthread_sigwait" >&6; }
-if test "x$ac_cv_lib_pthread_sigwait" = xyes; then :
- $as_echo "#define HAVE_SIGWAIT 1" >>confdefs.h
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _Psigwait in -lpthread" >&5
-$as_echo_n "checking for _Psigwait in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread__Psigwait+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $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 _Psigwait ();
-int
-main ()
-{
-return _Psigwait ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_pthread__Psigwait=yes
-else
- ac_cv_lib_pthread__Psigwait=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_pthread__Psigwait" >&5
-$as_echo "$ac_cv_lib_pthread__Psigwait" >&6; }
-if test "x$ac_cv_lib_pthread__Psigwait" = xyes; then :
- $as_echo "#define HAVE_SIGWAIT 1" >>confdefs.h
-
-fi
-
-fi
-
-fi
-
-fi
-
-
- ac_fn_c_check_func "$LINENO" "pthread_attr_getstacksize" "ac_cv_func_pthread_attr_getstacksize"
-if test "x$ac_cv_func_pthread_attr_getstacksize" = xyes; then :
- $as_echo "#define HAVE_PTHREAD_ATTR_GETSTACKSIZE 1" >>confdefs.h
-
-fi
-
-
- ac_fn_c_check_func "$LINENO" "pthread_attr_setstacksize" "ac_cv_func_pthread_attr_setstacksize"
-if test "x$ac_cv_func_pthread_attr_setstacksize" = xyes; then :
- $as_echo "#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1" >>confdefs.h
-
-fi
-
-
-
-# Check whether --with-locktype was given.
-if test "${with_locktype+set}" = set; then :
- withval=$with_locktype; locktype="$withval"
-else
- locktype="adaptive"
-fi
-
-
- case "$locktype" in
- adaptive)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_MUTEX_ADAPTIVE_NP" >&5
-$as_echo_n "checking for PTHREAD_MUTEX_ADAPTIVE_NP... " >&6; }
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
- #ifndef _GNU_SOURCE
- #define _GNU_SOURCE
- #endif
- #include <pthread.h>
-
-int
-main ()
-{
-
- return (PTHREAD_MUTEX_ADAPTIVE_NP);
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: using adaptive lock type" >&5
-$as_echo "using adaptive lock type" >&6; }
-
-$as_echo "#define HAVE_PTHREAD_MUTEX_ADAPTIVE_NP 1" >>confdefs.h
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: using standard lock type" >&5
-$as_echo "using standard lock type" >&6; }
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ;;
- standard)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: using standard lock type" >&5
-$as_echo "using standard lock type" >&6; }
- ;;
- *)
- as_fn_error $? "You must specify \"adaptive\" or \"standard\" for --with-locktype." "$LINENO" 5
- ;;
- esac
-
- for ac_header in sched.h
-do :
- ac_fn_c_check_header_mongrel "$LINENO" "sched.h" "ac_cv_header_sched_h" "$ac_includes_default"
-if test "x$ac_cv_header_sched_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_SCHED_H 1
-_ACEOF
-
-fi
-
-done
-
-
- case "$host" in
- *solaris-*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5
-$as_echo_n "checking for sched_yield in -lrt... " >&6; }
-if ${ac_cv_lib_rt_sched_yield+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lrt $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 sched_yield ();
-int
-main ()
-{
-return sched_yield ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_rt_sched_yield=yes
-else
- ac_cv_lib_rt_sched_yield=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_rt_sched_yield" >&5
-$as_echo "$ac_cv_lib_rt_sched_yield" >&6; }
-if test "x$ac_cv_lib_rt_sched_yield" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBRT 1
-_ACEOF
-
- LIBS="-lrt $LIBS"
-
-fi
-
- ;;
- esac
-
- for ac_func in sched_yield pthread_yield pthread_yield_np
-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
-done
-
-
- #
- # Additional OS-specific issues related to pthreads and sigwait.
- #
- 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].*)
- $as_echo "#define NEED_PTHREAD_SCOPE_SYSTEM 1" >>confdefs.h
-
- ;;
- *-freebsd6.*)
- $as_echo "#define NEED_PTHREAD_SCOPE_SYSTEM 1" >>confdefs.h
-
- ;;
- esac
- ;;
- #
- # BSDI 3.0 through 4.0.1 needs pthread_init() to be
- # called before certain pthreads calls. This is deprecated
- # in BSD/OS 4.1.
- #
- *-bsdi3.*|*-bsdi4.0*)
- $as_echo "#define NEED_PTHREAD_INIT 1" >>confdefs.h
-
- ;;
- #
- # LinuxThreads requires some changes to the way we
- # deal with signals.
- #
- *-linux*)
- $as_echo "#define HAVE_LINUXTHREADS 1" >>confdefs.h
-
- ;;
- #
- # Ensure the right sigwait() semantics on Solaris and make
- # sure we call pthread_setconcurrency.
- #
- *-solaris*)
- $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
-
- ac_fn_c_check_func "$LINENO" "pthread_setconcurrency" "ac_cv_func_pthread_setconcurrency"
-if test "x$ac_cv_func_pthread_setconcurrency" = xyes; then :
- $as_echo "#define CALL_PTHREAD_SETCONCURRENCY 1" >>confdefs.h
-
-fi
-
- ;;
- #
- # UnixWare does things its own way.
- #
- *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
- $as_echo "#define HAVE_UNIXWARE_SIGWAIT 1" >>confdefs.h
-
- ;;
- esac
-
- # Look for functions relating to thread naming
- for ac_func in pthread_setname_np pthread_set_name_np
-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
-done
-
- for ac_header in pthread_np.h
-do :
- ac_fn_c_check_header_compile "$LINENO" "pthread_np.h" "ac_cv_header_pthread_np_h" "#include <pthread.h>
-"
-if test "x$ac_cv_header_pthread_np_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_PTHREAD_NP_H 1
-_ACEOF
-
-fi
-
-done
-
-
- #
- # Look for sysconf to allow detection of the number of processors.
- #
- 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
-
-fi
-
-
-else
- ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
- thread_dir=nothreads
- THREADOPTOBJS=""
- THREADOPTSRCS=""
- ALWAYS_DEFINES=""
-fi
-
-
-
-
-
-ISC_THREAD_DIR=$thread_dir
+ALWAYS_DEFINES=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libtool" >&5
@@ -15970,15 +14918,6 @@ $as_echo "#define HAVE_OPENSSL_ECDSA 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL GOST support" >&5
$as_echo_n "checking for OpenSSL GOST support... " >&6; }
have_gost=""
- case "$use_pkcs11" in
- auto|no)
- ;;
- *)
- if $use_threads; then
- CC="$CC -pthread"
- fi
- ;;
- esac
if test "$cross_compiling" = yes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: using --with-gost" >&5
$as_echo "using --with-gost" >&6; }
@@ -16416,9 +15355,7 @@ $as_echo "no" >&6; }
yes|*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- if ! $use_threads; then
- as_fn_error $? "PKCS11 requires thread support" "$LINENO" 5
- fi
+ as_fn_error $? "PKCS11 requires thread support" "$LINENO" 5
if test "X$CRYPTO" = "X-DOPENSSL"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL with PKCS11 support" >&5
@@ -17023,19 +15960,6 @@ fi
#
-# Indicate what the final decision was regarding threads.
-#
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with threads" >&5
-$as_echo_n "checking whether to build with threads... " >&6; }
-if $use_threads; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-#
# End of pthreads stuff.
#
@@ -21082,9 +20006,7 @@ fi
case "$use_tuning" in
large)
- if ! $use_threads; then
- as_fn_error $? "Large-system tuning requires threads." "$LINENO" 5
- fi
+ as_fn_error $? "Large-system tuning requires threads." "$LINENO" 5
$as_echo "#define TUNE_LARGE 1" >>confdefs.h
@@ -21565,7 +20487,7 @@ DNS_CRYPTO_LIBS="$NEWFLAGS"
# elsewhere if there's a good reason for doing so.
#
-ac_config_files="$ac_config_files make/Makefile make/mkdep Makefile bin/Makefile bin/dig/Makefile lib/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/isc/$arch/Makefile lib/isc/$arch/include/Makefile lib/isc/$arch/include/isc/Makefile lib/isc/$thread_dir/Makefile lib/isc/$thread_dir/include/Makefile lib/isc/$thread_dir/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/nls/Makefile lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile lib/isc/unix/include/pkcs11/Makefile lib/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/lwres/Makefile"
+ac_config_files="$ac_config_files make/Makefile make/mkdep Makefile bin/Makefile bin/dig/Makefile lib/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/isc/$arch/Makefile lib/isc/$arch/include/Makefile lib/isc/$arch/include/isc/Makefile lib/isc/nothreads/Makefile lib/isc/nothreads/include/Makefile lib/isc/nothreads/include/isc/Makefile lib/isc/Makefile lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h lib/isc/include/pk11/Makefile lib/isc/include/pkcs11/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/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/lwres/Makefile"
#
@@ -22570,9 +21492,9 @@ do
"lib/isc/$arch/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/$arch/Makefile" ;;
"lib/isc/$arch/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/$arch/include/Makefile" ;;
"lib/isc/$arch/include/isc/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/$arch/include/isc/Makefile" ;;
- "lib/isc/$thread_dir/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/$thread_dir/Makefile" ;;
- "lib/isc/$thread_dir/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/$thread_dir/include/Makefile" ;;
- "lib/isc/$thread_dir/include/isc/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/$thread_dir/include/isc/Makefile" ;;
+ "lib/isc/nothreads/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/nothreads/Makefile" ;;
+ "lib/isc/nothreads/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/nothreads/include/Makefile" ;;
+ "lib/isc/nothreads/include/isc/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/nothreads/include/isc/Makefile" ;;
"lib/isc/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/Makefile" ;;
"lib/isc/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/include/Makefile" ;;
"lib/isc/include/isc/Makefile") CONFIG_FILES="$CONFIG_FILES lib/isc/include/isc/Makefile" ;;
@@ -23896,12 +22818,6 @@ report() {
echo "Configuration summary:"
echo "------------------------------------------------------------------------"
echo "Optional features enabled:"
- if $use_threads; then
- echo " Multiprocessing support (--enable-threads)"
- if test "yes" = "$enable_full_report" -o "standard" = "$locktype"; then
- echo " Mutex lock type: $locktype"
- fi
- fi
test "large" = "$use_tuning" && echo " Large-system tuning (--with-tuning)"
test "no" = "$use_gssapi" || echo " GSS-API (--with-gssapi)"
test "yes" = "$enable_fetchlimit" && \
@@ -23976,7 +22892,6 @@ report() {
echo "------------------------------------------------------------------------"
echo "Features disabled or unavailable on this platform:"
- $use_threads || echo " Multiprocessing support (--enable-threads)"
test "no" = "$enable_ipv6" -o "no" = "$found_ipv6" && \
echo " IPv6 support (--enable-ipv6)"
test "large" = "$use_tuning" || echo " Large-system tuning (--with-tuning)"
diff --git a/usr.sbin/bind/configure.in b/usr.sbin/bind/configure.in
index c023ade4188..3da6b8b82e0 100644
--- a/usr.sbin/bind/configure.in
+++ b/usr.sbin/bind/configure.in
@@ -1111,195 +1111,8 @@ AC_CHECK_FUNCS(arc4random)
AC_CHECK_FUNCS(arc4random_stir)
AC_CHECK_FUNCS(arc4random_addrandom)
-sinclude(config.threads.in)dnl
-
-if $use_threads
-then
- if test "X$GCC" = "Xyes"; then
- case "$host" in
- *-freebsd*)
- CC="$CC -pthread"
- CCOPT="$CCOPT -pthread"
- CCNOOPT="$CCNOOPT -pthread"
- STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
- ;;
- *-openbsd*)
- CC="$CC -pthread"
- CCOPT="$CCOPT -pthread"
- CCNOOPT="$CCNOOPT -pthread"
- ;;
- *-solaris*)
- LIBS="$LIBS -lthread"
- ;;
- *-ibm-aix*)
- STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
- ;;
- esac
- else
- case $host in
- *-dec-osf*)
- CC="$CC -pthread"
- CCOPT="$CCOPT -pthread"
- CCNOOPT="$CCNOOPT -pthread"
- ;;
- *-solaris*)
- CC="$CC -mt"
- CCOPT="$CCOPT -mt"
- CCNOOPT="$CCNOOPT -mt"
- ;;
- *-ibm-aix*)
- STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
- ;;
- *-sco-sysv*uw*|*-*-sysv*UnixWare*)
- CC="$CC -Kthread"
- CCOPT="$CCOPT -Kthread"
- CCNOOPT="$CCNOOPT -Kthread"
- ;;
- *-*-sysv*OpenUNIX*)
- CC="$CC -Kpthread"
- CCOPT="$CCOPT -Kpthread"
- CCNOOPT="$CCNOOPT -Kpthread"
- ;;
- esac
- fi
- ALWAYS_DEFINES="-D_REENTRANT"
- ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
- THREADOPTOBJS='${THREADOPTOBJS}'
- THREADOPTSRCS='${THREADOPTSRCS}'
- thread_dir=pthreads
- #
- # We'd like to use sigwait() too
- #
- AC_CHECK_FUNC(sigwait,
- AC_DEFINE(HAVE_SIGWAIT),
- AC_CHECK_LIB(c, sigwait,
- AC_DEFINE(HAVE_SIGWAIT),
- AC_CHECK_LIB(pthread, sigwait,
- AC_DEFINE(HAVE_SIGWAIT),
- AC_CHECK_LIB(pthread, _Psigwait,
- AC_DEFINE(HAVE_SIGWAIT),))))
-
- AC_CHECK_FUNC(pthread_attr_getstacksize,
- AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
-
- AC_CHECK_FUNC(pthread_attr_setstacksize,
- AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE),)
-
- AC_ARG_WITH(locktype,
- AS_HELP_STRING([--with-locktype=ARG],
- [Specify mutex lock type
- (adaptive or standard)]),
- locktype="$withval", locktype="adaptive")
-
- case "$locktype" in
- adaptive)
- AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
-
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- #ifndef _GNU_SOURCE
- #define _GNU_SOURCE
- #endif
- #include <pthread.h>
- ]], [[
- return (PTHREAD_MUTEX_ADAPTIVE_NP);
- ]])],
- [ AC_MSG_RESULT(using adaptive lock type)
- AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
- [Support for PTHREAD_MUTEX_ADAPTIVE_NP]) ],
- [ AC_MSG_RESULT(using standard lock type) ])
- ;;
- standard)
- AC_MSG_RESULT(using standard lock type)
- ;;
- *)
- AC_MSG_ERROR([You must specify "adaptive" or "standard" for --with-locktype.])
- ;;
- esac
-
- AC_CHECK_HEADERS(sched.h)
-
- case "$host" in
- *solaris-*)
- AC_CHECK_LIB(rt, sched_yield)
- ;;
- esac
-
- AC_CHECK_FUNCS(sched_yield pthread_yield pthread_yield_np)
-
- #
- # Additional OS-specific issues related to pthreads and sigwait.
- #
- 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]].*)
- AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
- ;;
- *-freebsd6.*)
- AC_DEFINE(NEED_PTHREAD_SCOPE_SYSTEM)
- ;;
- esac
- ;;
- #
- # BSDI 3.0 through 4.0.1 needs pthread_init() to be
- # called before certain pthreads calls. This is deprecated
- # in BSD/OS 4.1.
- #
- *-bsdi3.*|*-bsdi4.0*)
- AC_DEFINE(NEED_PTHREAD_INIT)
- ;;
- #
- # LinuxThreads requires some changes to the way we
- # deal with signals.
- #
- *-linux*)
- AC_DEFINE(HAVE_LINUXTHREADS)
- ;;
- #
- # Ensure the right sigwait() semantics on Solaris and make
- # sure we call pthread_setconcurrency.
- #
- *-solaris*)
- AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
- AC_CHECK_FUNC(pthread_setconcurrency,
- AC_DEFINE(CALL_PTHREAD_SETCONCURRENCY))
- ;;
- #
- # UnixWare does things its own way.
- #
- *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
- AC_DEFINE(HAVE_UNIXWARE_SIGWAIT)
- ;;
- 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 <pthread.h>])
-
- #
- # Look for sysconf to allow detection of the number of processors.
- #
- AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
-
-else
- ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
- thread_dir=nothreads
- THREADOPTOBJS=""
- THREADOPTSRCS=""
- ALWAYS_DEFINES=""
-fi
-
+ALWAYS_DEFINES=""
AC_SUBST(ALWAYS_DEFINES)
-AC_SUBST(ISC_PLATFORM_USETHREADS)
-AC_SUBST(THREADOPTOBJS)
-AC_SUBST(THREADOPTSRCS)
-ISC_THREAD_DIR=$thread_dir
-AC_SUBST(ISC_THREAD_DIR)
AC_MSG_CHECKING(for libtool)
AC_ARG_WITH(libtool, AS_HELP_STRING([--with-libtool], [use GNU libtool]),
@@ -1745,15 +1558,6 @@ int main() {
AC_MSG_CHECKING(for OpenSSL GOST support)
have_gost=""
- case "$use_pkcs11" in
- auto|no)
- ;;
- *)
- if $use_threads; then
- CC="$CC -pthread"
- fi
- ;;
- esac
AC_TRY_RUN([
#include <openssl/conf.h>
#include <openssl/engine.h>
@@ -2105,9 +1909,7 @@ case "$use_pkcs11" in
;;
yes|*)
AC_MSG_RESULT(yes)
- if ! $use_threads; then
- AC_MSG_ERROR([PKCS11 requires thread support])
- fi
+ AC_MSG_ERROR([PKCS11 requires thread support])
if test "X$CRYPTO" = "X-DOPENSSL"
then
AC_MSG_CHECKING(for OpenSSL with PKCS11 support)
@@ -2470,16 +2272,6 @@ AC_CHECK_FUNC(flockfile, AC_DEFINE(HAVE_FLOCKFILE),)
AC_CHECK_FUNC(getc_unlocked, AC_DEFINE(HAVE_GETCUNLOCKED),)
#
-# Indicate what the final decision was regarding threads.
-#
-AC_MSG_CHECKING(whether to build with threads)
-if $use_threads; then
- AC_MSG_RESULT(yes)
-else
- AC_MSG_RESULT(no)
-fi
-
-#
# End of pthreads stuff.
#
@@ -4437,9 +4229,7 @@ AC_ARG_WITH(tuning,
case "$use_tuning" in
large)
- if ! $use_threads; then
- AC_MSG_ERROR([Large-system tuning requires threads.])
- fi
+ AC_MSG_ERROR([Large-system tuning requires threads.])
AC_DEFINE(TUNE_LARGE, 1, [Define to use large-system tuning.])
AC_MSG_RESULT(using large-system tuning)
;;
@@ -4860,9 +4650,9 @@ AC_CONFIG_FILES([
lib/isc/$arch/Makefile
lib/isc/$arch/include/Makefile
lib/isc/$arch/include/isc/Makefile
- lib/isc/$thread_dir/Makefile
- lib/isc/$thread_dir/include/Makefile
- lib/isc/$thread_dir/include/isc/Makefile
+ lib/isc/nothreads/Makefile
+ lib/isc/nothreads/include/Makefile
+ lib/isc/nothreads/include/isc/Makefile
lib/isc/Makefile
lib/isc/include/Makefile
lib/isc/include/isc/Makefile
@@ -4916,12 +4706,6 @@ report() {
echo "Configuration summary:"
echo "------------------------------------------------------------------------"
echo "Optional features enabled:"
- if $use_threads; then
- echo " Multiprocessing support (--enable-threads)"
- if test "yes" = "$enable_full_report" -o "standard" = "$locktype"; then
- echo " Mutex lock type: $locktype"
- fi
- fi
test "large" = "$use_tuning" && echo " Large-system tuning (--with-tuning)"
test "no" = "$use_gssapi" || echo " GSS-API (--with-gssapi)"
test "yes" = "$enable_fetchlimit" && \
@@ -4996,7 +4780,6 @@ report() {
echo "------------------------------------------------------------------------"
echo "Features disabled or unavailable on this platform:"
- $use_threads || echo " Multiprocessing support (--enable-threads)"
test "no" = "$enable_ipv6" -o "no" = "$found_ipv6" && \
echo " IPv6 support (--enable-ipv6)"
test "large" = "$use_tuning" || echo " Large-system tuning (--with-tuning)"
diff --git a/usr.sbin/bind/lib/dns/dst_api.c b/usr.sbin/bind/lib/dns/dst_api.c
index 4eabb3b0356..41a5524c6b7 100644
--- a/usr.sbin/bind/lib/dns/dst_api.c
+++ b/usr.sbin/bind/lib/dns/dst_api.c
@@ -33,7 +33,7 @@
/*
* Principal Author: Brian Wellington
- * $Id: dst_api.c,v 1.7 2019/12/17 01:46:31 sthen Exp $
+ * $Id: dst_api.c,v 1.8 2020/01/07 19:08:09 florian Exp $
*/
/*! \file */
@@ -1653,11 +1653,7 @@ issymmetric(const dst_key_t *key) {
static void
printtime(const dst_key_t *key, int type, const char *tag, FILE *stream) {
isc_result_t result;
-#ifdef ISC_PLATFORM_USETHREADS
- char output[26]; /* Minimum buffer as per ctime_r() specification. */
-#else
const char *output;
-#endif
isc_stdtime_t when;
time_t t;
char utc[sizeof("YYYYMMDDHHSSMM")];
@@ -1670,17 +1666,7 @@ printtime(const dst_key_t *key, int type, const char *tag, FILE *stream) {
/* time_t and isc_stdtime_t might be different sizes */
t = when;
-#ifdef ISC_PLATFORM_USETHREADS
-#ifdef WIN32
- if (ctime_s(output, sizeof(output), &t) != 0)
- goto error;
-#else
- if (ctime_r(&t, output) == NULL)
- goto error;
-#endif
-#else
output = ctime(&t);
-#endif
isc_buffer_init(&b, utc, sizeof(utc));
result = dns_time32_totext(when, &b);
diff --git a/usr.sbin/bind/lib/dns/name.c b/usr.sbin/bind/lib/dns/name.c
index daf2b0c1133..77bfb7dcd6d 100644
--- a/usr.sbin/bind/lib/dns/name.c
+++ b/usr.sbin/bind/lib/dns/name.c
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: name.c,v 1.13 2019/12/17 01:46:32 sthen Exp $ */
+/* $Id: name.c,v 1.14 2020/01/07 19:08:09 florian Exp $ */
/*! \file */
@@ -194,15 +194,7 @@ dns_fullname_hash(dns_name_t *name, isc_boolean_t case_sensitive);
/*
* dns_name_t to text post-conversion procedure.
*/
-#ifdef ISC_PLATFORM_USETHREADS
-static int thread_key_initialized = 0;
-static isc_mutex_t thread_key_mutex;
-static isc_mem_t *thread_key_mctx = NULL;
-static isc_thread_key_t totext_filter_proc_key;
-static isc_once_t once = ISC_ONCE_INIT;
-#else
static dns_name_totextfilter_t totext_filter_proc = NULL;
-#endif
static void
set_offsets(const dns_name_t *name, unsigned char *offsets,
@@ -1343,55 +1335,6 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source,
return (ISC_R_SUCCESS);
}
-#ifdef ISC_PLATFORM_USETHREADS
-static void
-free_specific(void *arg) {
- dns_name_totextfilter_t *mem = arg;
- isc_mem_put(thread_key_mctx, mem, sizeof(*mem));
- /* Stop use being called again. */
- (void)isc_thread_key_setspecific(totext_filter_proc_key, NULL);
-}
-
-static void
-thread_key_mutex_init(void) {
- RUNTIME_CHECK(isc_mutex_init(&thread_key_mutex) == ISC_R_SUCCESS);
-}
-
-static isc_result_t
-totext_filter_proc_key_init(void) {
- isc_result_t result;
-
- /*
- * We need the call to isc_once_do() to support profiled mutex
- * otherwise thread_key_mutex could be initialized at compile time.
- */
- result = isc_once_do(&once, thread_key_mutex_init);
- if (result != ISC_R_SUCCESS)
- return (result);
-
- if (!thread_key_initialized) {
- LOCK(&thread_key_mutex);
- if (thread_key_mctx == NULL)
- result = isc_mem_create2(0, 0, &thread_key_mctx, 0);
- if (result != ISC_R_SUCCESS)
- goto unlock;
- isc_mem_setname(thread_key_mctx, "threadkey", NULL);
- isc_mem_setdestroycheck(thread_key_mctx, ISC_FALSE);
-
- if (!thread_key_initialized &&
- isc_thread_key_create(&totext_filter_proc_key,
- free_specific) != 0) {
- result = ISC_R_FAILURE;
- isc_mem_detach(&thread_key_mctx);
- } else
- thread_key_initialized = 1;
- unlock:
- UNLOCK(&thread_key_mutex);
- }
- return (result);
-}
-#endif
-
isc_result_t
dns_name_totext(dns_name_t *name, isc_boolean_t omit_final_dot,
isc_buffer_t *target)
@@ -1419,11 +1362,6 @@ dns_name_totext2(dns_name_t *name, unsigned int options, isc_buffer_t *target)
unsigned int labels;
isc_boolean_t saw_root = ISC_FALSE;
unsigned int oused = target->used;
-#ifdef ISC_PLATFORM_USETHREADS
- dns_name_totextfilter_t *mem;
- dns_name_totextfilter_t totext_filter_proc = NULL;
- isc_result_t result;
-#endif
isc_boolean_t omit_final_dot =
ISC_TF(options & DNS_NAME_OMITFINALDOT);
@@ -1434,11 +1372,6 @@ dns_name_totext2(dns_name_t *name, unsigned int options, isc_buffer_t *target)
REQUIRE(VALID_NAME(name));
REQUIRE(ISC_BUFFER_VALID(target));
-#ifdef ISC_PLATFORM_USETHREADS
- result = totext_filter_proc_key_init();
- if (result != ISC_R_SUCCESS)
- return (result);
-#endif
ndata = name->ndata;
nlen = name->length;
labels = name->labels;
@@ -1574,11 +1507,6 @@ dns_name_totext2(dns_name_t *name, unsigned int options, isc_buffer_t *target)
isc_buffer_add(target, tlen - trem);
-#ifdef ISC_PLATFORM_USETHREADS
- mem = isc_thread_key_getspecific(totext_filter_proc_key);
- if (mem != NULL)
- totext_filter_proc = *mem;
-#endif
if (totext_filter_proc != NULL)
return ((*totext_filter_proc)(target, oused, saw_root));
@@ -2370,46 +2298,8 @@ dns_name_print(dns_name_t *name, FILE *stream) {
isc_result_t
dns_name_settotextfilter(dns_name_totextfilter_t proc) {
-#ifdef ISC_PLATFORM_USETHREADS
- isc_result_t result;
- dns_name_totextfilter_t *mem;
- int res;
-
- result = totext_filter_proc_key_init();
- if (result != ISC_R_SUCCESS)
- return (result);
-
- /*
- * If we already have been here set / clear as appropriate.
- * Otherwise allocate memory.
- */
- mem = isc_thread_key_getspecific(totext_filter_proc_key);
- if (mem != NULL && proc != NULL) {
- *mem = proc;
- return (ISC_R_SUCCESS);
- }
- if (proc == NULL) {
- if (mem != NULL)
- isc_mem_put(thread_key_mctx, mem, sizeof(*mem));
- res = isc_thread_key_setspecific(totext_filter_proc_key, NULL);
- if (res != 0)
- result = ISC_R_UNEXPECTED;
- return (result);
- }
-
- mem = isc_mem_get(thread_key_mctx, sizeof(*mem));
- if (mem == NULL)
- return (ISC_R_NOMEMORY);
- *mem = proc;
- if (isc_thread_key_setspecific(totext_filter_proc_key, mem) != 0) {
- isc_mem_put(thread_key_mctx, mem, sizeof(*mem));
- result = ISC_R_UNEXPECTED;
- }
- return (result);
-#else
totext_filter_proc = proc;
return (ISC_R_SUCCESS);
-#endif
}
void
@@ -2560,19 +2450,6 @@ dns_name_copy(dns_name_t *source, dns_name_t *dest, isc_buffer_t *target) {
void
dns_name_destroy(void) {
-#ifdef ISC_PLATFORM_USETHREADS
- RUNTIME_CHECK(isc_once_do(&once, thread_key_mutex_init)
- == ISC_R_SUCCESS);
-
- LOCK(&thread_key_mutex);
- if (thread_key_initialized) {
- isc_mem_detach(&thread_key_mctx);
- isc_thread_key_delete(totext_filter_proc_key);
- thread_key_initialized = 0;
- }
- UNLOCK(&thread_key_mutex);
-
-#endif
}
/*
diff --git a/usr.sbin/bind/lib/dns/resolver.c b/usr.sbin/bind/lib/dns/resolver.c
index 884e2a66cda..5ab53da4004 100644
--- a/usr.sbin/bind/lib/dns/resolver.c
+++ b/usr.sbin/bind/lib/dns/resolver.c
@@ -8829,22 +8829,7 @@ dns_resolver_create(dns_view_t *view,
}
res->buckets[i].mctx = NULL;
snprintf(name, sizeof(name), "res%u", i);
-#ifdef ISC_PLATFORM_USETHREADS
- /*
- * Use a separate memory context for each bucket to reduce
- * contention among multiple threads. Do this only when
- * enabling threads because it will be require more memory.
- */
- result = isc_mem_create(0, 0, &res->buckets[i].mctx);
- if (result != ISC_R_SUCCESS) {
- isc_task_detach(&res->buckets[i].task);
- DESTROYLOCK(&res->buckets[i].lock);
- goto cleanup_buckets;
- }
- isc_mem_setname(res->buckets[i].mctx, name, NULL);
-#else
isc_mem_attach(view->mctx, &res->buckets[i].mctx);
-#endif
isc_task_setname(res->buckets[i].task, name, res);
ISC_LIST_INIT(res->buckets[i].fctxs);
res->buckets[i].exiting = ISC_FALSE;
diff --git a/usr.sbin/bind/lib/dns/zone.c b/usr.sbin/bind/lib/dns/zone.c
index 57612684abd..40b5cc4dc58 100644
--- a/usr.sbin/bind/lib/dns/zone.c
+++ b/usr.sbin/bind/lib/dns/zone.c
@@ -9997,9 +9997,6 @@ dns_zone_markdirty(dns_zone_t *zone) {
if (result != ISC_R_SUCCESS) {
UNLOCK_ZONE(zone);
secure = NULL;
-#ifdef ISC_PLATFORM_USETHREADS
- isc_thread_yield();
-#endif
goto again;
}
@@ -10220,9 +10217,6 @@ dump_done(void *arg, isc_result_t result) {
if (result != ISC_R_SUCCESS) {
UNLOCK_ZONE(zone);
secure = NULL;
-#if ISC_PLATFORM_USETHREADS
- isc_thread_yield();
-#endif
goto again;
}
}
@@ -14676,9 +14670,6 @@ dns_zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) {
if (result != ISC_R_SUCCESS) {
UNLOCK_ZONE(zone);
secure = NULL;
-#if ISC_PLATFORM_USETHREADS
- isc_thread_yield();
-#endif
goto again;
}
}
@@ -14943,9 +14934,6 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) {
if (result != ISC_R_SUCCESS) {
UNLOCK_ZONE(zone);
secure = NULL;
-#if ISC_PLATFORM_USETHREADS
- isc_thread_yield();
-#endif
goto again;
}
}
@@ -15219,9 +15207,6 @@ zone_loaddone(void *arg, isc_result_t result) {
if (result != ISC_R_SUCCESS) {
UNLOCK_ZONE(zone);
secure = NULL;
-#if ISC_PLATFORM_USETHREADS
- isc_thread_yield();
-#endif
goto again;
}
}
@@ -18170,9 +18155,6 @@ dns_zone_dlzpostload(dns_zone_t *zone, dns_db_t *db)
if (result != ISC_R_SUCCESS) {
UNLOCK_ZONE(zone);
secure = NULL;
-#if ISC_PLATFORM_USETHREADS
- isc_thread_yield();
-#endif
goto again;
}
}
diff --git a/usr.sbin/bind/lib/isc/Makefile.in b/usr.sbin/bind/lib/isc/Makefile.in
index f7ca5e957a3..9fc1df7f998 100644
--- a/usr.sbin/bind/lib/isc/Makefile.in
+++ b/usr.sbin/bind/lib/isc/Makefile.in
@@ -25,7 +25,7 @@ VERSION=@BIND9_VERSION@
PROVIDER = @PKCS11_PROVIDER@
CINCLUDES = -I${srcdir}/unix/include \
- -I${srcdir}/@ISC_THREAD_DIR@/include \
+ -I${srcdir}/nothreads/include \
-I${srcdir}/@ISC_ARCH_DIR@/include \
-I./include \
-I${srcdir}/include ${DNS_INCLUDES} @ISC_OPENSSL_INC@
@@ -42,9 +42,9 @@ UNIXOBJS = @ISC_ISCIPV6_O@ @ISC_ISCPK11_API_O@ \
NLSOBJS = nls/msgcat.@O@
-THREADOPTOBJS = @ISC_THREAD_DIR@/condition.@O@ @ISC_THREAD_DIR@/mutex.@O@
+THREADOPTOBJS = nothreads/condition.@O@ nothreads/mutex.@O@
-THREADOBJS = @THREADOPTOBJS@ @ISC_THREAD_DIR@/thread.@O@
+THREADOBJS = nothreads/thread.@O@
WIN32OBJS = win32/condition.@O@ win32/dir.@O@ win32/errno.@O@ \
win32/file.@O@ win32/fsaccess.@O@ \
@@ -91,7 +91,7 @@ LIBS = @ISC_OPENSSL_LIBS@ @LIBS@
# Attempt to disable parallel processing.
.NOTPARALLEL:
.NO_PARALLEL:
-SUBDIRS = include unix nls @ISC_THREAD_DIR@ @ISC_ARCH_DIR@
+SUBDIRS = include unix nls nothreads @ISC_ARCH_DIR@
TARGETS = timestamp
TESTDIRS = @UNITTESTS@
diff --git a/usr.sbin/bind/lib/isc/include/isc/platform.h.in b/usr.sbin/bind/lib/isc/include/isc/platform.h.in
index ecaaba1dd11..ac47dbdfad8 100644
--- a/usr.sbin/bind/lib/isc/include/isc/platform.h.in
+++ b/usr.sbin/bind/lib/isc/include/isc/platform.h.in
@@ -221,11 +221,6 @@
***/
/*
- * Defined if we are using threads.
- */
-@ISC_PLATFORM_USETHREADS@
-
-/*
* Defined if unistd.h does not cause fd_set to be delared.
*/
@ISC_PLATFORM_NEEDSYSSELECTH@
diff --git a/usr.sbin/bind/lib/isc/include/isc/refcount.h b/usr.sbin/bind/lib/isc/include/isc/refcount.h
index 016db6529e8..b413017c788 100644
--- a/usr.sbin/bind/lib/isc/include/isc/refcount.h
+++ b/usr.sbin/bind/lib/isc/include/isc/refcount.h
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: refcount.h,v 1.6 2019/12/17 01:46:35 sthen Exp $ */
+/* $Id: refcount.h,v 1.7 2020/01/07 19:08:09 florian Exp $ */
#ifndef ISC_REFCOUNT_H
#define ISC_REFCOUNT_H 1
@@ -98,166 +98,6 @@ ISC_LANG_BEGINDECLS
/*
* Sample implementations
*/
-#ifdef ISC_PLATFORM_USETHREADS
-#if (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) || defined(ISC_PLATFORM_HAVEXADD)
-#define ISC_REFCOUNT_HAVEATOMIC 1
-#if (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE))
-#define ISC_REFCOUNT_HAVESTDATOMIC 1
-#endif
-
-typedef struct isc_refcount {
-#if defined(ISC_REFCOUNT_HAVESTDATOMIC)
- atomic_int_fast32_t refs;
-#else
- isc_int32_t refs;
-#endif
-} isc_refcount_t;
-
-#if defined(ISC_REFCOUNT_HAVESTDATOMIC)
-
-#define isc_refcount_current(rp) \
- ((unsigned int)(atomic_load_explicit(&(rp)->refs, \
- memory_order_relaxed)))
-#define isc_refcount_destroy(rp) ISC_REQUIRE(isc_refcount_current(rp) == 0)
-
-#define isc_refcount_increment0(rp, tp) \
- do { \
- unsigned int *_tmp = (unsigned int *)(tp); \
- isc_int32_t prev; \
- prev = atomic_fetch_add_explicit \
- (&(rp)->refs, 1, memory_order_relaxed); \
- if (_tmp != NULL) \
- *_tmp = prev + 1; \
- } while (0)
-
-#define isc_refcount_increment(rp, tp) \
- do { \
- unsigned int *_tmp = (unsigned int *)(tp); \
- isc_int32_t prev; \
- prev = atomic_fetch_add_explicit \
- (&(rp)->refs, 1, memory_order_relaxed); \
- ISC_REQUIRE(prev > 0); \
- if (_tmp != NULL) \
- *_tmp = prev + 1; \
- } while (0)
-
-#define isc_refcount_decrement(rp, tp) \
- do { \
- unsigned int *_tmp = (unsigned int *)(tp); \
- isc_int32_t prev; \
- prev = atomic_fetch_sub_explicit \
- (&(rp)->refs, 1, memory_order_relaxed); \
- ISC_REQUIRE(prev > 0); \
- if (_tmp != NULL) \
- *_tmp = prev - 1; \
- } while (0)
-
-#else /* ISC_REFCOUNT_HAVESTDATOMIC */
-
-#define isc_refcount_current(rp) \
- ((unsigned int)(isc_atomic_xadd(&(rp)->refs, 0)))
-#define isc_refcount_destroy(rp) ISC_REQUIRE(isc_refcount_current(rp) == 0)
-
-#define isc_refcount_increment0(rp, tp) \
- do { \
- unsigned int *_tmp = (unsigned int *)(tp); \
- isc_int32_t prev; \
- prev = isc_atomic_xadd(&(rp)->refs, 1); \
- if (_tmp != NULL) \
- *_tmp = prev + 1; \
- } while (0)
-
-#define isc_refcount_increment(rp, tp) \
- do { \
- unsigned int *_tmp = (unsigned int *)(tp); \
- isc_int32_t prev; \
- prev = isc_atomic_xadd(&(rp)->refs, 1); \
- ISC_REQUIRE(prev > 0); \
- if (_tmp != NULL) \
- *_tmp = prev + 1; \
- } while (0)
-
-#define isc_refcount_decrement(rp, tp) \
- do { \
- unsigned int *_tmp = (unsigned int *)(tp); \
- isc_int32_t prev; \
- prev = isc_atomic_xadd(&(rp)->refs, -1); \
- ISC_REQUIRE(prev > 0); \
- if (_tmp != NULL) \
- *_tmp = prev - 1; \
- } while (0)
-
-#endif /* ISC_REFCOUNT_HAVESTDATOMIC */
-
-#else /* ISC_PLATFORM_HAVEXADD */
-
-typedef struct isc_refcount {
- int refs;
- isc_mutex_t lock;
-} isc_refcount_t;
-
-/*% Destroys a reference counter. */
-#define isc_refcount_destroy(rp) \
- do { \
- isc_result_t _result; \
- ISC_REQUIRE((rp)->refs == 0); \
- _result = isc_mutex_destroy(&(rp)->lock); \
- ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \
- } while (0)
-
-#define isc_refcount_current(rp) ((unsigned int)((rp)->refs))
-
-/*%
- * Increments the reference count, returning the new value in
- * 'tp' if it's not NULL.
- */
-#define isc_refcount_increment0(rp, tp) \
- do { \
- isc_result_t _result; \
- unsigned int *_tmp = (unsigned int *)(tp); \
- _result = isc_mutex_lock(&(rp)->lock); \
- ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \
- ++((rp)->refs); \
- if (_tmp != NULL) \
- *_tmp = ((rp)->refs); \
- _result = isc_mutex_unlock(&(rp)->lock); \
- ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \
- } while (0)
-
-#define isc_refcount_increment(rp, tp) \
- do { \
- isc_result_t _result; \
- unsigned int *_tmp = (unsigned int *)(tp); \
- _result = isc_mutex_lock(&(rp)->lock); \
- ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \
- ISC_REQUIRE((rp)->refs > 0); \
- ++((rp)->refs); \
- if (_tmp != NULL) \
- *_tmp = ((rp)->refs); \
- _result = isc_mutex_unlock(&(rp)->lock); \
- ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \
- } while (0)
-
-/*%
- * Decrements the reference count, returning the new value in 'tp'
- * if it's not NULL.
- */
-#define isc_refcount_decrement(rp, tp) \
- do { \
- isc_result_t _result; \
- unsigned int *_tmp = (unsigned int *)(tp); \
- _result = isc_mutex_lock(&(rp)->lock); \
- ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \
- ISC_REQUIRE((rp)->refs > 0); \
- --((rp)->refs); \
- if (_tmp != NULL) \
- *_tmp = ((rp)->refs); \
- _result = isc_mutex_unlock(&(rp)->lock); \
- ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \
- } while (0)
-
-#endif /* (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) || defined(ISC_PLATFORM_HAVEXADD) */
-#else /* ISC_PLATFORM_USETHREADS */
typedef struct isc_refcount {
int refs;
@@ -294,8 +134,6 @@ typedef struct isc_refcount {
*_tmp = _n; \
} while (0)
-#endif /* ISC_PLATFORM_USETHREADS */
-
isc_result_t
isc_refcount_init(isc_refcount_t *ref, unsigned int n);
diff --git a/usr.sbin/bind/lib/isc/include/isc/rwlock.h b/usr.sbin/bind/lib/isc/include/isc/rwlock.h
index 5f3778df05d..3b6bd2697e4 100644
--- a/usr.sbin/bind/lib/isc/include/isc/rwlock.h
+++ b/usr.sbin/bind/lib/isc/include/isc/rwlock.h
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rwlock.h,v 1.6 2019/12/17 01:46:35 sthen Exp $ */
+/* $Id: rwlock.h,v 1.7 2020/01/07 19:08:09 florian Exp $ */
#ifndef ISC_RWLOCK_H
#define ISC_RWLOCK_H 1
@@ -39,86 +39,11 @@ typedef enum {
isc_rwlocktype_write
} isc_rwlocktype_t;
-#ifdef ISC_PLATFORM_USETHREADS
-#if (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) || (defined(ISC_PLATFORM_HAVEXADD) && defined(ISC_PLATFORM_HAVECMPXCHG))
-#define ISC_RWLOCK_USEATOMIC 1
-#if (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE))
-#define ISC_RWLOCK_USESTDATOMIC 1
-#endif
-#endif
-
-struct isc_rwlock {
- /* Unlocked. */
- unsigned int magic;
- isc_mutex_t lock;
-
-#if defined(ISC_RWLOCK_USEATOMIC)
- /*
- * When some atomic instructions with hardware assistance are
- * available, rwlock will use those so that concurrent readers do not
- * interfere with each other through mutex as long as no writers
- * appear, massively reducing the lock overhead in the typical case.
- *
- * The basic algorithm of this approach is the "simple
- * writer-preference lock" shown in the following URL:
- * http://www.cs.rochester.edu/u/scott/synchronization/pseudocode/rw.html
- * but our implementation does not rely on the spin lock unlike the
- * original algorithm to be more portable as a user space application.
- */
-
- /* Read or modified atomically. */
-#if defined(ISC_RWLOCK_USESTDATOMIC)
- atomic_int_fast32_t write_requests;
- atomic_int_fast32_t write_completions;
- atomic_int_fast32_t cnt_and_flag;
-#else
- isc_int32_t write_requests;
- isc_int32_t write_completions;
- isc_int32_t cnt_and_flag;
-#endif
-
- /* Locked by lock. */
- isc_condition_t readable;
- isc_condition_t writeable;
- unsigned int readers_waiting;
-
- /* Locked by rwlock itself. */
- unsigned int write_granted;
-
- /* Unlocked. */
- unsigned int write_quota;
-
-#else /* ISC_RWLOCK_USEATOMIC */
-
- /*%< Locked by lock. */
- isc_condition_t readable;
- isc_condition_t writeable;
- isc_rwlocktype_t type;
-
- /*% The number of threads that have the lock. */
- unsigned int active;
-
- /*%
- * The number of lock grants made since the lock was last switched
- * from reading to writing or vice versa; used in determining
- * when the quota is reached and it is time to switch.
- */
- unsigned int granted;
-
- unsigned int readers_waiting;
- unsigned int writers_waiting;
- unsigned int read_quota;
- unsigned int write_quota;
- isc_rwlocktype_t original;
-#endif /* ISC_RWLOCK_USEATOMIC */
-};
-#else /* ISC_PLATFORM_USETHREADS */
struct isc_rwlock {
unsigned int magic;
isc_rwlocktype_t type;
unsigned int active;
};
-#endif /* ISC_PLATFORM_USETHREADS */
isc_result_t
diff --git a/usr.sbin/bind/lib/isc/nothreads/Makefile.in b/usr.sbin/bind/lib/isc/nothreads/Makefile.in
index 2c50acb7f83..b3fec8ea207 100644
--- a/usr.sbin/bind/lib/isc/nothreads/Makefile.in
+++ b/usr.sbin/bind/lib/isc/nothreads/Makefile.in
@@ -12,7 +12,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.3 2019/12/17 01:46:36 sthen Exp $
+# $Id: Makefile.in,v 1.4 2020/01/07 19:08:09 florian Exp $
top_srcdir = @top_srcdir@
srcdir = @srcdir@
@@ -28,10 +28,10 @@ CDEFINES =
CWARNINGS =
THREADOPTOBJS = condition.@O@ mutex.@O@
-OBJS = @THREADOPTOBJS@ thread.@O@
+OBJS = thread.@O@
THREADOPTSRCS = condition.c mutex.c
-SRCS = @THREADOPTSRCS@ thread.c
+SRCS = thread.c
SUBDIRS = include
TARGETS = ${OBJS}
diff --git a/usr.sbin/bind/lib/isc/pthreads/Makefile.in b/usr.sbin/bind/lib/isc/pthreads/Makefile.in
deleted file mode 100644
index 3fd5fa63283..00000000000
--- a/usr.sbin/bind/lib/isc/pthreads/Makefile.in
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-# PERFORMANCE OF THIS SOFTWARE.
-
-# $Id: Makefile.in,v 1.3 2019/12/17 01:46:36 sthen Exp $
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-top_srcdir = @top_srcdir@
-
-CINCLUDES = -I${srcdir}/include \
- -I${srcdir}/../unix/include \
- -I../include \
- -I${srcdir}/../include \
- -I${srcdir}/..
-
-CDEFINES =
-CWARNINGS =
-
-OBJS = condition.@O@ mutex.@O@ thread.@O@
-
-SRCS = condition.c mutex.c thread.c
-
-SUBDIRS = include
-TARGETS = ${OBJS}
-
-@BIND9_MAKE_RULES@
diff --git a/usr.sbin/bind/lib/isc/pthreads/condition.c b/usr.sbin/bind/lib/isc/pthreads/condition.c
deleted file mode 100644
index fea79415fc7..00000000000
--- a/usr.sbin/bind/lib/isc/pthreads/condition.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: condition.c,v 1.3 2019/12/17 01:46:36 sthen Exp $ */
-
-/*! \file */
-
-#include <config.h>
-
-#include <errno.h>
-
-#include <isc/condition.h>
-#include <isc/msgs.h>
-#include <isc/strerror.h>
-#include <isc/string.h>
-#include <isc/time.h>
-#include <isc/util.h>
-
-isc_result_t
-isc_condition_waituntil(isc_condition_t *c, isc_mutex_t *m, isc_time_t *t) {
- int presult;
- isc_result_t result;
- struct timespec ts;
- char strbuf[ISC_STRERRORSIZE];
-
- REQUIRE(c != NULL && m != NULL && t != NULL);
-
- /*
- * POSIX defines a timespec's tv_sec as time_t.
- */
- result = isc_time_secondsastimet(t, &ts.tv_sec);
-
- /*
- * If we have a range error ts.tv_sec is most probably a signed
- * 32 bit value. Set ts.tv_sec to INT_MAX. This is a kludge.
- */
- if (result == ISC_R_RANGE)
- ts.tv_sec = INT_MAX;
- else if (result != ISC_R_SUCCESS)
- return (result);
-
- /*!
- * POSIX defines a timespec's tv_nsec as long. isc_time_nanoseconds
- * ensures its return value is < 1 billion, which will fit in a long.
- */
- ts.tv_nsec = (long)isc_time_nanoseconds(t);
-
- do {
-#if ISC_MUTEX_PROFILE
- presult = pthread_cond_timedwait(c, &m->mutex, &ts);
-#else
- presult = pthread_cond_timedwait(c, m, &ts);
-#endif
- if (presult == 0)
- return (ISC_R_SUCCESS);
- if (presult == ETIMEDOUT)
- return (ISC_R_TIMEDOUT);
- } while (presult == EINTR);
-
- isc__strerror(presult, strbuf, sizeof(strbuf));
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "pthread_cond_timedwait() %s %s",
- isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
- ISC_MSG_RETURNED, "returned"),
- strbuf);
- return (ISC_R_UNEXPECTED);
-}
diff --git a/usr.sbin/bind/lib/isc/pthreads/include/Makefile.in b/usr.sbin/bind/lib/isc/pthreads/include/Makefile.in
deleted file mode 100644
index 01fdc099eef..00000000000
--- a/usr.sbin/bind/lib/isc/pthreads/include/Makefile.in
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-# PERFORMANCE OF THIS SOFTWARE.
-
-# $Id: Makefile.in,v 1.3 2019/12/17 01:46:36 sthen Exp $
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-top_srcdir = @top_srcdir@
-
-SUBDIRS = isc
-TARGETS =
-
-@BIND9_MAKE_RULES@
diff --git a/usr.sbin/bind/lib/isc/pthreads/include/isc/Makefile.in b/usr.sbin/bind/lib/isc/pthreads/include/isc/Makefile.in
deleted file mode 100644
index 8900f7dcb04..00000000000
--- a/usr.sbin/bind/lib/isc/pthreads/include/isc/Makefile.in
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-# PERFORMANCE OF THIS SOFTWARE.
-
-# $Id: Makefile.in,v 1.3 2019/12/17 01:46:36 sthen Exp $
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-top_srcdir = @top_srcdir@
-
-VERSION=@BIND9_VERSION@
-
-HEADERS = condition.h mutex.h once.h thread.h
-
-SUBDIRS =
-TARGETS =
-
-@BIND9_MAKE_RULES@
-
-installdirs:
- $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}/isc
-
-install:: installdirs
- for i in ${HEADERS}; do \
- ${INSTALL_DATA} $(srcdir)/$$i ${DESTDIR}${includedir}/isc ; \
- done
-
-uninstall::
- for i in ${HEADERS}; do \
- rm -f ${DESTDIR}${includedir}/isc/$$i ; \
- done
diff --git a/usr.sbin/bind/lib/isc/pthreads/include/isc/condition.h b/usr.sbin/bind/lib/isc/pthreads/include/isc/condition.h
deleted file mode 100644
index 8f25c4d9628..00000000000
--- a/usr.sbin/bind/lib/isc/pthreads/include/isc/condition.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: condition.h,v 1.3 2019/12/17 01:46:36 sthen Exp $ */
-
-#ifndef ISC_CONDITION_H
-#define ISC_CONDITION_H 1
-
-/*! \file */
-
-#include <isc/lang.h>
-#include <isc/mutex.h>
-#include <isc/result.h>
-#include <isc/types.h>
-
-typedef pthread_cond_t isc_condition_t;
-
-#define isc_condition_init(cp) \
- ((pthread_cond_init((cp), NULL) == 0) ? \
- ISC_R_SUCCESS : ISC_R_UNEXPECTED)
-
-#if ISC_MUTEX_PROFILE
-#define isc_condition_wait(cp, mp) \
- ((pthread_cond_wait((cp), &((mp)->mutex)) == 0) ? \
- ISC_R_SUCCESS : ISC_R_UNEXPECTED)
-#else
-#define isc_condition_wait(cp, mp) \
- ((pthread_cond_wait((cp), (mp)) == 0) ? \
- ISC_R_SUCCESS : ISC_R_UNEXPECTED)
-#endif
-
-#define isc_condition_signal(cp) \
- ((pthread_cond_signal((cp)) == 0) ? \
- ISC_R_SUCCESS : ISC_R_UNEXPECTED)
-
-#define isc_condition_broadcast(cp) \
- ((pthread_cond_broadcast((cp)) == 0) ? \
- ISC_R_SUCCESS : ISC_R_UNEXPECTED)
-
-#define isc_condition_destroy(cp) \
- ((pthread_cond_destroy((cp)) == 0) ? \
- ISC_R_SUCCESS : ISC_R_UNEXPECTED)
-
-ISC_LANG_BEGINDECLS
-
-isc_result_t
-isc_condition_waituntil(isc_condition_t *, isc_mutex_t *, isc_time_t *);
-
-ISC_LANG_ENDDECLS
-
-#endif /* ISC_CONDITION_H */
diff --git a/usr.sbin/bind/lib/isc/pthreads/include/isc/mutex.h b/usr.sbin/bind/lib/isc/pthreads/include/isc/mutex.h
deleted file mode 100644
index e56c43c1d06..00000000000
--- a/usr.sbin/bind/lib/isc/pthreads/include/isc/mutex.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: mutex.h,v 1.3 2019/12/17 01:46:36 sthen Exp $ */
-
-#ifndef ISC_MUTEX_H
-#define ISC_MUTEX_H 1
-
-/*! \file */
-
-#include <pthread.h>
-#include <stdio.h>
-
-#include <isc/lang.h>
-#include <isc/result.h> /* for ISC_R_ codes */
-
-ISC_LANG_BEGINDECLS
-
-/*!
- * Supply mutex attributes that enable deadlock detection
- * (helpful when debugging). This is system dependent and
- * currently only supported on NetBSD.
- */
-#if ISC_MUTEX_DEBUG && defined(__NetBSD__) && defined(PTHREAD_MUTEX_ERRORCHECK)
-extern pthread_mutexattr_t isc__mutex_attrs;
-#define ISC__MUTEX_ATTRS &isc__mutex_attrs
-#else
-#define ISC__MUTEX_ATTRS NULL
-#endif
-
-/* XXX We could do fancier error handling... */
-
-/*!
- * Define ISC_MUTEX_PROFILE to turn on profiling of mutexes by line. When
- * enabled, isc_mutex_stats() can be used to print a table showing the
- * number of times each type of mutex was locked and the amount of time
- * waiting to obtain the lock.
- */
-#ifndef ISC_MUTEX_PROFILE
-#define ISC_MUTEX_PROFILE 0
-#endif
-
-#if ISC_MUTEX_PROFILE
-typedef struct isc_mutexstats isc_mutexstats_t;
-
-typedef struct {
- pthread_mutex_t mutex; /*%< The actual mutex. */
- isc_mutexstats_t * stats; /*%< Mutex statistics. */
-} isc_mutex_t;
-#else
-typedef pthread_mutex_t isc_mutex_t;
-#endif
-
-
-#if ISC_MUTEX_PROFILE
-#define isc_mutex_init(mp) \
- isc_mutex_init_profile((mp), __FILE__, __LINE__)
-#else
-#if ISC_MUTEX_DEBUG && defined(PTHREAD_MUTEX_ERRORCHECK)
-#define isc_mutex_init(mp) \
- isc_mutex_init_errcheck((mp))
-#else
-#define isc_mutex_init(mp) \
- isc__mutex_init((mp), __FILE__, __LINE__)
-isc_result_t isc__mutex_init(isc_mutex_t *mp, const char *file, unsigned int line);
-#endif
-#endif
-
-#if ISC_MUTEX_PROFILE
-#define isc_mutex_lock(mp) \
- isc_mutex_lock_profile((mp), __FILE__, __LINE__)
-#else
-#define isc_mutex_lock(mp) \
- ((pthread_mutex_lock((mp)) == 0) ? \
- ISC_R_SUCCESS : ISC_R_UNEXPECTED)
-#endif
-
-#if ISC_MUTEX_PROFILE
-#define isc_mutex_unlock(mp) \
- isc_mutex_unlock_profile((mp), __FILE__, __LINE__)
-#else
-#define isc_mutex_unlock(mp) \
- ((pthread_mutex_unlock((mp)) == 0) ? \
- ISC_R_SUCCESS : ISC_R_UNEXPECTED)
-#endif
-
-#if ISC_MUTEX_PROFILE
-#define isc_mutex_trylock(mp) \
- ((pthread_mutex_trylock((&(mp)->mutex)) == 0) ? \
- ISC_R_SUCCESS : ISC_R_LOCKBUSY)
-#else
-#define isc_mutex_trylock(mp) \
- ((pthread_mutex_trylock((mp)) == 0) ? \
- ISC_R_SUCCESS : ISC_R_LOCKBUSY)
-#endif
-
-#if ISC_MUTEX_PROFILE
-#define isc_mutex_destroy(mp) \
- ((pthread_mutex_destroy((&(mp)->mutex)) == 0) ? \
- ISC_R_SUCCESS : ISC_R_UNEXPECTED)
-#else
-#define isc_mutex_destroy(mp) \
- ((pthread_mutex_destroy((mp)) == 0) ? \
- ISC_R_SUCCESS : ISC_R_UNEXPECTED)
-#endif
-
-#if ISC_MUTEX_PROFILE
-#define isc_mutex_stats(fp) isc_mutex_statsprofile(fp);
-#else
-#define isc_mutex_stats(fp)
-#endif
-
-#if ISC_MUTEX_PROFILE
-
-isc_result_t
-isc_mutex_init_profile(isc_mutex_t *mp, const char * _file, int _line);
-isc_result_t
-isc_mutex_lock_profile(isc_mutex_t *mp, const char * _file, int _line);
-isc_result_t
-isc_mutex_unlock_profile(isc_mutex_t *mp, const char * _file, int _line);
-
-void
-isc_mutex_statsprofile(FILE *fp);
-
-isc_result_t
-isc_mutex_init_errcheck(isc_mutex_t *mp);
-
-#endif /* ISC_MUTEX_PROFILE */
-
-ISC_LANG_ENDDECLS
-#endif /* ISC_MUTEX_H */
diff --git a/usr.sbin/bind/lib/isc/pthreads/include/isc/once.h b/usr.sbin/bind/lib/isc/pthreads/include/isc/once.h
deleted file mode 100644
index 295c3abe814..00000000000
--- a/usr.sbin/bind/lib/isc/pthreads/include/isc/once.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: once.h,v 1.3 2019/12/17 01:46:36 sthen Exp $ */
-
-#ifndef ISC_ONCE_H
-#define ISC_ONCE_H 1
-
-/*! \file */
-
-#include <pthread.h>
-
-#include <isc/platform.h>
-#include <isc/result.h>
-
-typedef pthread_once_t isc_once_t;
-
-#ifdef ISC_PLATFORM_BRACEPTHREADONCEINIT
-/*!
- * This accomodates systems that define PTHRAD_ONCE_INIT improperly.
- */
-#define ISC_ONCE_INIT { PTHREAD_ONCE_INIT }
-#else
-/*!
- * This is the usual case.
- */
-#define ISC_ONCE_INIT PTHREAD_ONCE_INIT
-#endif
-
-/* XXX We could do fancier error handling... */
-
-#define isc_once_do(op, f) \
- ((pthread_once((op), (f)) == 0) ? \
- ISC_R_SUCCESS : ISC_R_UNEXPECTED)
-
-#endif /* ISC_ONCE_H */
diff --git a/usr.sbin/bind/lib/isc/pthreads/include/isc/thread.h b/usr.sbin/bind/lib/isc/pthreads/include/isc/thread.h
deleted file mode 100644
index 7fe56e52d2b..00000000000
--- a/usr.sbin/bind/lib/isc/pthreads/include/isc/thread.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: thread.h,v 1.3 2019/12/17 01:46:36 sthen Exp $ */
-
-#ifndef ISC_THREAD_H
-#define ISC_THREAD_H 1
-
-/*! \file */
-
-#include <pthread.h>
-
-#if defined(HAVE_PTHREAD_NP_H)
-#include <pthread_np.h>
-#endif
-
-#include <isc/lang.h>
-#include <isc/result.h>
-
-ISC_LANG_BEGINDECLS
-
-typedef pthread_t isc_thread_t;
-typedef void * isc_threadresult_t;
-typedef void * isc_threadarg_t;
-typedef isc_threadresult_t (*isc_threadfunc_t)(isc_threadarg_t);
-typedef pthread_key_t isc_thread_key_t;
-
-isc_result_t
-isc_thread_create(isc_threadfunc_t, isc_threadarg_t, isc_thread_t *);
-
-void
-isc_thread_setconcurrency(unsigned int level);
-
-void
-isc_thread_yield(void);
-
-void
-isc_thread_setname(isc_thread_t thread, const char *name);
-
-/* XXX We could do fancier error handling... */
-
-#define isc_thread_join(t, rp) \
- ((pthread_join((t), (rp)) == 0) ? \
- ISC_R_SUCCESS : ISC_R_UNEXPECTED)
-
-#define isc_thread_self \
- (unsigned long)pthread_self
-
-#define isc_thread_key_create pthread_key_create
-#define isc_thread_key_getspecific pthread_getspecific
-#define isc_thread_key_setspecific pthread_setspecific
-#define isc_thread_key_delete pthread_key_delete
-
-ISC_LANG_ENDDECLS
-
-#endif /* ISC_THREAD_H */
diff --git a/usr.sbin/bind/lib/isc/pthreads/mutex.c b/usr.sbin/bind/lib/isc/pthreads/mutex.c
deleted file mode 100644
index 5e17208d8f8..00000000000
--- a/usr.sbin/bind/lib/isc/pthreads/mutex.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: mutex.c,v 1.3 2019/12/17 01:46:36 sthen Exp $ */
-
-/*! \file */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <time.h>
-#include <sys/time.h>
-#include <errno.h>
-
-#include <isc/mutex.h>
-#include <isc/util.h>
-#include <isc/print.h>
-#include <isc/strerror.h>
-#include <isc/once.h>
-
-#if ISC_MUTEX_PROFILE
-
-/*@{*/
-/*% Operations on timevals; adapted from FreeBSD's sys/time.h */
-#define timevalclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
-#define timevaladd(vvp, uvp) \
- do { \
- (vvp)->tv_sec += (uvp)->tv_sec; \
- (vvp)->tv_usec += (uvp)->tv_usec; \
- if ((vvp)->tv_usec >= 1000000) { \
- (vvp)->tv_sec++; \
- (vvp)->tv_usec -= 1000000; \
- } \
- } while (0)
-#define timevalsub(vvp, uvp) \
- do { \
- (vvp)->tv_sec -= (uvp)->tv_sec; \
- (vvp)->tv_usec -= (uvp)->tv_usec; \
- if ((vvp)->tv_usec < 0) { \
- (vvp)->tv_sec--; \
- (vvp)->tv_usec += 1000000; \
- } \
- } while (0)
-
-/*@}*/
-
-#define ISC_MUTEX_MAX_LOCKERS 32
-
-typedef struct {
- const char * file;
- int line;
- unsigned count;
- struct timeval locked_total;
- struct timeval wait_total;
-} isc_mutexlocker_t;
-
-struct isc_mutexstats {
- const char * file; /*%< File mutex was created in. */
- int line; /*%< Line mutex was created on. */
- unsigned count;
- struct timeval lock_t;
- struct timeval locked_total;
- struct timeval wait_total;
- isc_mutexlocker_t * cur_locker;
- isc_mutexlocker_t lockers[ISC_MUTEX_MAX_LOCKERS];
-};
-
-#ifndef ISC_MUTEX_PROFTABLESIZE
-#define ISC_MUTEX_PROFTABLESIZE (1024 * 1024)
-#endif
-static isc_mutexstats_t stats[ISC_MUTEX_PROFTABLESIZE];
-static int stats_next = 0;
-static isc_boolean_t stats_init = ISC_FALSE;
-static pthread_mutex_t statslock = PTHREAD_MUTEX_INITIALIZER;
-
-
-isc_result_t
-isc_mutex_init_profile(isc_mutex_t *mp, const char *file, int line) {
- int i, err;
-
- err = pthread_mutex_init(&mp->mutex, NULL);
- if (err == ENOMEM)
- return (ISC_R_NOMEMORY);
- if (err != 0)
- return (ISC_R_UNEXPECTED);
-
- RUNTIME_CHECK(pthread_mutex_lock(&statslock) == 0);
-
- if (stats_init == ISC_FALSE)
- stats_init = ISC_TRUE;
-
- /*
- * If all statistics entries have been used, give up and trigger an
- * assertion failure. There would be no other way to deal with this
- * because we'd like to keep record of all locks for the purpose of
- * debugging and the number of necessary locks is unpredictable.
- * If this failure is triggered while debugging, named should be
- * rebuilt with an increased ISC_MUTEX_PROFTABLESIZE.
- */
- RUNTIME_CHECK(stats_next < ISC_MUTEX_PROFTABLESIZE);
- mp->stats = &stats[stats_next++];
-
- RUNTIME_CHECK(pthread_mutex_unlock(&statslock) == 0);
-
- mp->stats->file = file;
- mp->stats->line = line;
- mp->stats->count = 0;
- timevalclear(&mp->stats->locked_total);
- timevalclear(&mp->stats->wait_total);
- for (i = 0; i < ISC_MUTEX_MAX_LOCKERS; i++) {
- mp->stats->lockers[i].file = NULL;
- mp->stats->lockers[i].line = 0;
- mp->stats->lockers[i].count = 0;
- timevalclear(&mp->stats->lockers[i].locked_total);
- timevalclear(&mp->stats->lockers[i].wait_total);
- }
-
- return (ISC_R_SUCCESS);
-}
-
-isc_result_t
-isc_mutex_lock_profile(isc_mutex_t *mp, const char *file, int line) {
- struct timeval prelock_t;
- struct timeval postlock_t;
- isc_mutexlocker_t *locker = NULL;
- int i;
-
- gettimeofday(&prelock_t, NULL);
-
- if (pthread_mutex_lock(&mp->mutex) != 0)
- return (ISC_R_UNEXPECTED);
-
- gettimeofday(&postlock_t, NULL);
- mp->stats->lock_t = postlock_t;
-
- timevalsub(&postlock_t, &prelock_t);
-
- mp->stats->count++;
- timevaladd(&mp->stats->wait_total, &postlock_t);
-
- for (i = 0; i < ISC_MUTEX_MAX_LOCKERS; i++) {
- if (mp->stats->lockers[i].file == NULL) {
- locker = &mp->stats->lockers[i];
- locker->file = file;
- locker->line = line;
- break;
- } else if (mp->stats->lockers[i].file == file &&
- mp->stats->lockers[i].line == line) {
- locker = &mp->stats->lockers[i];
- break;
- }
- }
-
- if (locker != NULL) {
- locker->count++;
- timevaladd(&locker->wait_total, &postlock_t);
- }
-
- mp->stats->cur_locker = locker;
-
- return (ISC_R_SUCCESS);
-}
-
-isc_result_t
-isc_mutex_unlock_profile(isc_mutex_t *mp, const char *file, int line) {
- struct timeval unlock_t;
-
- UNUSED(file);
- UNUSED(line);
-
- if (mp->stats->cur_locker != NULL) {
- gettimeofday(&unlock_t, NULL);
- timevalsub(&unlock_t, &mp->stats->lock_t);
- timevaladd(&mp->stats->locked_total, &unlock_t);
- timevaladd(&mp->stats->cur_locker->locked_total, &unlock_t);
- mp->stats->cur_locker = NULL;
- }
-
- return ((pthread_mutex_unlock((&mp->mutex)) == 0) ? \
- ISC_R_SUCCESS : ISC_R_UNEXPECTED);
-}
-
-
-void
-isc_mutex_statsprofile(FILE *fp) {
- isc_mutexlocker_t *locker;
- int i, j;
-
- fprintf(fp, "Mutex stats (in us)\n");
- for (i = 0; i < stats_next; i++) {
- fprintf(fp, "%-12s %4d: %10u %lu.%06lu %lu.%06lu %5d\n",
- stats[i].file, stats[i].line, stats[i].count,
- stats[i].locked_total.tv_sec,
- stats[i].locked_total.tv_usec,
- stats[i].wait_total.tv_sec,
- stats[i].wait_total.tv_usec,
- i);
- for (j = 0; j < ISC_MUTEX_MAX_LOCKERS; j++) {
- locker = &stats[i].lockers[j];
- if (locker->file == NULL)
- continue;
- fprintf(fp, " %-11s %4d: %10u %lu.%06lu %lu.%06lu %5d\n",
- locker->file, locker->line, locker->count,
- locker->locked_total.tv_sec,
- locker->locked_total.tv_usec,
- locker->wait_total.tv_sec,
- locker->wait_total.tv_usec,
- i);
- }
- }
-}
-
-#endif /* ISC_MUTEX_PROFILE */
-
-#if ISC_MUTEX_DEBUG && defined(PTHREAD_MUTEX_ERRORCHECK)
-
-static isc_boolean_t errcheck_initialized = ISC_FALSE;
-static pthread_mutexattr_t errcheck;
-static isc_once_t once_errcheck = ISC_ONCE_INIT;
-
-static void
-initialize_errcheck(void) {
- RUNTIME_CHECK(pthread_mutexattr_init(&errcheck) == 0);
- RUNTIME_CHECK(pthread_mutexattr_settype
- (&errcheck, PTHREAD_MUTEX_ERRORCHECK) == 0);
- errcheck_initialized = ISC_TRUE;
-}
-
-isc_result_t
-isc_mutex_init_errcheck(isc_mutex_t *mp) {
- isc_result_t result;
- int err;
-
- result = isc_once_do(&once_errcheck, initialize_errcheck);
- RUNTIME_CHECK(result == ISC_R_SUCCESS);
-
- err = pthread_mutex_init(mp, &errcheck);
- if (err == ENOMEM)
- return (ISC_R_NOMEMORY);
- return ((err == 0) ? ISC_R_SUCCESS : ISC_R_UNEXPECTED);
-}
-#endif
-
-#if ISC_MUTEX_DEBUG && defined(__NetBSD__) && defined(PTHREAD_MUTEX_ERRORCHECK)
-pthread_mutexattr_t isc__mutex_attrs = {
- PTHREAD_MUTEX_ERRORCHECK, /* m_type */
- 0 /* m_flags, which appears to be unused. */
-};
-#endif
-
-#if !(ISC_MUTEX_DEBUG && defined(PTHREAD_MUTEX_ERRORCHECK)) && !ISC_MUTEX_PROFILE
-
-#ifdef HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
-static isc_boolean_t attr_initialized = ISC_FALSE;
-static pthread_mutexattr_t attr;
-static isc_once_t once_attr = ISC_ONCE_INIT;
-#endif /* HAVE_PTHREAD_MUTEX_ADAPTIVE_NP */
-
-#ifdef HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
-static void
-initialize_attr(void) {
- RUNTIME_CHECK(pthread_mutexattr_init(&attr) == 0);
- RUNTIME_CHECK(pthread_mutexattr_settype
- (&attr, PTHREAD_MUTEX_ADAPTIVE_NP) == 0);
- attr_initialized = ISC_TRUE;
-}
-#endif /* HAVE_PTHREAD_MUTEX_ADAPTIVE_NP */
-
-isc_result_t
-isc__mutex_init(isc_mutex_t *mp, const char *file, unsigned int line) {
- char strbuf[ISC_STRERRORSIZE];
- isc_result_t result = ISC_R_SUCCESS;
- int err;
-
-#ifdef HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
- result = isc_once_do(&once_attr, initialize_attr);
- RUNTIME_CHECK(result == ISC_R_SUCCESS);
-
- err = pthread_mutex_init(mp, &attr);
-#else /* HAVE_PTHREAD_MUTEX_ADAPTIVE_NP */
- err = pthread_mutex_init(mp, ISC__MUTEX_ATTRS);
-#endif /* HAVE_PTHREAD_MUTEX_ADAPTIVE_NP */
-
- if (err == ENOMEM)
- return (ISC_R_NOMEMORY);
- if (err != 0) {
- isc__strerror(err, strbuf, sizeof(strbuf));
- UNEXPECTED_ERROR(file, line, "isc_mutex_init() failed: %s",
- strbuf);
- result = ISC_R_UNEXPECTED;
- }
- return (result);
-}
-#endif
diff --git a/usr.sbin/bind/lib/isc/pthreads/thread.c b/usr.sbin/bind/lib/isc/pthreads/thread.c
deleted file mode 100644
index 2c5dea766c5..00000000000
--- a/usr.sbin/bind/lib/isc/pthreads/thread.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* $Id: thread.c,v 1.7 2019/12/17 01:46:36 sthen Exp $ */
-
-/*! \file */
-
-#include <config.h>
-
-#if defined(HAVE_SCHED_H)
-#include <sched.h>
-#endif
-
-#include <isc/thread.h>
-#include <isc/util.h>
-
-#ifndef THREAD_MINSTACKSIZE
-#define THREAD_MINSTACKSIZE (1024U * 1024)
-#endif
-
-isc_result_t
-isc_thread_create(isc_threadfunc_t func, isc_threadarg_t arg,
- isc_thread_t *thread)
-{
- pthread_attr_t attr;
-#if defined(HAVE_PTHREAD_ATTR_GETSTACKSIZE) && \
- defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE)
- size_t stacksize;
-#endif
- int ret;
-
- pthread_attr_init(&attr);
-
-#if defined(HAVE_PTHREAD_ATTR_GETSTACKSIZE) && \
- defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE)
- ret = pthread_attr_getstacksize(&attr, &stacksize);
- if (ret != 0)
- return (ISC_R_UNEXPECTED);
-
- if (stacksize < THREAD_MINSTACKSIZE) {
- ret = pthread_attr_setstacksize(&attr, THREAD_MINSTACKSIZE);
- if (ret != 0)
- return (ISC_R_UNEXPECTED);
- }
-#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);
-
- pthread_attr_destroy(&attr);
-
- return (ISC_R_SUCCESS);
-}
-
-void
-isc_thread_setconcurrency(unsigned int level) {
-#if defined(CALL_PTHREAD_SETCONCURRENCY)
- (void)pthread_setconcurrency(level);
-#else
- UNUSED(level);
-#endif
-}
-
-void
-isc_thread_setname(isc_thread_t thread, const char *name) {
-#if defined(HAVE_PTHREAD_SETNAME_NP) && defined(_GNU_SOURCE)
- /*
- * macOS has pthread_setname_np but only works on the
- * current thread so it's not used here
- */
- (void)pthread_setname_np(thread, name);
-#elif defined(HAVE_PTHREAD_SET_NAME_NP)
- (void)pthread_set_name_np(thread, name);
-#else
- UNUSED(thread);
- UNUSED(name);
-#endif
-}
-
-void
-isc_thread_yield(void) {
-#if defined(HAVE_SCHED_YIELD)
- sched_yield();
-#elif defined( HAVE_PTHREAD_YIELD)
- pthread_yield();
-#elif defined( HAVE_PTHREAD_YIELD_NP)
- pthread_yield_np();
-#endif
-}
diff --git a/usr.sbin/bind/lib/isc/refcount.c b/usr.sbin/bind/lib/isc/refcount.c
index 71f7dc5c9f0..b734b99e421 100644
--- a/usr.sbin/bind/lib/isc/refcount.c
+++ b/usr.sbin/bind/lib/isc/refcount.c
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: refcount.c,v 1.3 2019/12/17 01:46:34 sthen Exp $ */
+/* $Id: refcount.c,v 1.4 2020/01/07 19:08:09 florian Exp $ */
#include <config.h>
@@ -30,9 +30,5 @@ isc_refcount_init(isc_refcount_t *ref, unsigned int n) {
REQUIRE(ref != NULL);
ref->refs = n;
-#if defined(ISC_PLATFORM_USETHREADS) && !defined(ISC_REFCOUNT_HAVEATOMIC)
- return (isc_mutex_init(&ref->lock));
-#else
return (ISC_R_SUCCESS);
-#endif
}
diff --git a/usr.sbin/bind/lib/isc/rwlock.c b/usr.sbin/bind/lib/isc/rwlock.c
index cc60c3f0e78..12fc3726336 100644
--- a/usr.sbin/bind/lib/isc/rwlock.c
+++ b/usr.sbin/bind/lib/isc/rwlock.c
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rwlock.c,v 1.7 2019/12/17 01:46:34 sthen Exp $ */
+/* $Id: rwlock.c,v 1.8 2020/01/07 19:08:09 florian Exp $ */
/*! \file */
@@ -33,799 +33,6 @@
#define RWLOCK_MAGIC ISC_MAGIC('R', 'W', 'L', 'k')
#define VALID_RWLOCK(rwl) ISC_MAGIC_VALID(rwl, RWLOCK_MAGIC)
-#ifdef ISC_PLATFORM_USETHREADS
-
-#ifndef RWLOCK_DEFAULT_READ_QUOTA
-#define RWLOCK_DEFAULT_READ_QUOTA 4
-#endif
-
-#ifndef RWLOCK_DEFAULT_WRITE_QUOTA
-#define RWLOCK_DEFAULT_WRITE_QUOTA 4
-#endif
-
-#ifdef ISC_RWLOCK_TRACE
-#include <stdio.h> /* Required for fprintf/stderr. */
-#include <isc/thread.h> /* Required for isc_thread_self(). */
-
-static void
-print_lock(const char *operation, isc_rwlock_t *rwl, isc_rwlocktype_t type) {
- fprintf(stderr,
- isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
- ISC_MSG_PRINTLOCK,
- "rwlock %p thread %lu %s(%s): %s, %u active, "
- "%u granted, %u rwaiting, %u wwaiting\n"),
- rwl, isc_thread_self(), operation,
- (type == isc_rwlocktype_read ?
- isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
- ISC_MSG_READ, "read") :
- isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
- ISC_MSG_WRITE, "write")),
- (rwl->type == isc_rwlocktype_read ?
- isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
- ISC_MSG_READING, "reading") :
- isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
- ISC_MSG_WRITING, "writing")),
- rwl->active, rwl->granted, rwl->readers_waiting,
- rwl->writers_waiting);
-}
-#endif
-
-isc_result_t
-isc_rwlock_init(isc_rwlock_t *rwl, unsigned int read_quota,
- unsigned int write_quota)
-{
- isc_result_t result;
-
- REQUIRE(rwl != NULL);
-
- /*
- * In case there's trouble initializing, we zero magic now. If all
- * goes well, we'll set it to RWLOCK_MAGIC.
- */
- rwl->magic = 0;
-
-#if defined(ISC_RWLOCK_USEATOMIC)
- rwl->write_requests = 0;
- rwl->write_completions = 0;
- rwl->cnt_and_flag = 0;
- rwl->readers_waiting = 0;
- rwl->write_granted = 0;
- if (read_quota != 0) {
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "read quota is not supported");
- }
- if (write_quota == 0)
- write_quota = RWLOCK_DEFAULT_WRITE_QUOTA;
- rwl->write_quota = write_quota;
-#else
- rwl->type = isc_rwlocktype_read;
- rwl->original = isc_rwlocktype_none;
- rwl->active = 0;
- rwl->granted = 0;
- rwl->readers_waiting = 0;
- rwl->writers_waiting = 0;
- if (read_quota == 0)
- read_quota = RWLOCK_DEFAULT_READ_QUOTA;
- rwl->read_quota = read_quota;
- if (write_quota == 0)
- write_quota = RWLOCK_DEFAULT_WRITE_QUOTA;
- rwl->write_quota = write_quota;
-#endif
-
- result = isc_mutex_init(&rwl->lock);
- if (result != ISC_R_SUCCESS)
- return (result);
-
- result = isc_condition_init(&rwl->readable);
- if (result != ISC_R_SUCCESS) {
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_condition_init(readable) %s: %s",
- isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
- ISC_MSG_FAILED, "failed"),
- isc_result_totext(result));
- result = ISC_R_UNEXPECTED;
- goto destroy_lock;
- }
- result = isc_condition_init(&rwl->writeable);
- if (result != ISC_R_SUCCESS) {
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_condition_init(writeable) %s: %s",
- isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
- ISC_MSG_FAILED, "failed"),
- isc_result_totext(result));
- result = ISC_R_UNEXPECTED;
- goto destroy_rcond;
- }
-
- rwl->magic = RWLOCK_MAGIC;
-
- return (ISC_R_SUCCESS);
-
- destroy_rcond:
- (void)isc_condition_destroy(&rwl->readable);
- destroy_lock:
- DESTROYLOCK(&rwl->lock);
-
- return (result);
-}
-
-void
-isc_rwlock_destroy(isc_rwlock_t *rwl) {
- REQUIRE(VALID_RWLOCK(rwl));
-
-#if defined(ISC_RWLOCK_USEATOMIC)
- REQUIRE(rwl->write_requests == rwl->write_completions &&
- rwl->cnt_and_flag == 0 && rwl->readers_waiting == 0);
-#else
- LOCK(&rwl->lock);
- REQUIRE(rwl->active == 0 &&
- rwl->readers_waiting == 0 &&
- rwl->writers_waiting == 0);
- UNLOCK(&rwl->lock);
-#endif
-
- rwl->magic = 0;
- (void)isc_condition_destroy(&rwl->readable);
- (void)isc_condition_destroy(&rwl->writeable);
- DESTROYLOCK(&rwl->lock);
-}
-
-#if defined(ISC_RWLOCK_USEATOMIC)
-
-/*
- * When some architecture-dependent atomic operations are available,
- * rwlock can be more efficient than the generic algorithm defined below.
- * The basic algorithm is described in the following URL:
- * http://www.cs.rochester.edu/u/scott/synchronization/pseudocode/rw.html
- *
- * The key is to use the following integer variables modified atomically:
- * write_requests, write_completions, and cnt_and_flag.
- *
- * write_requests and write_completions act as a waiting queue for writers
- * in order to ensure the FIFO order. Both variables begin with the initial
- * value of 0. When a new writer tries to get a write lock, it increments
- * write_requests and gets the previous value of the variable as a "ticket".
- * When write_completions reaches the ticket number, the new writer can start
- * writing. When the writer completes its work, it increments
- * write_completions so that another new writer can start working. If the
- * write_requests is not equal to write_completions, it means a writer is now
- * working or waiting. In this case, a new readers cannot start reading, or
- * in other words, this algorithm basically prefers writers.
- *
- * cnt_and_flag is a "lock" shared by all readers and writers. This integer
- * variable is a kind of structure with two members: writer_flag (1 bit) and
- * reader_count (31 bits). The writer_flag shows whether a writer is working,
- * and the reader_count shows the number of readers currently working or almost
- * ready for working. A writer who has the current "ticket" tries to get the
- * lock by exclusively setting the writer_flag to 1, provided that the whole
- * 32-bit is 0 (meaning no readers or writers working). On the other hand,
- * a new reader tries to increment the "reader_count" field provided that
- * the writer_flag is 0 (meaning there is no writer working).
- *
- * If some of the above operations fail, the reader or the writer sleeps
- * until the related condition changes. When a working reader or writer
- * completes its work, some readers or writers are sleeping, and the condition
- * that suspended the reader or writer has changed, it wakes up the sleeping
- * readers or writers.
- *
- * As already noted, this algorithm basically prefers writers. In order to
- * prevent readers from starving, however, the algorithm also introduces the
- * "writer quota" (Q). When Q consecutive writers have completed their work,
- * suspending readers, the last writer will wake up the readers, even if a new
- * writer is waiting.
- *
- * Implementation specific note: due to the combination of atomic operations
- * and a mutex lock, ordering between the atomic operation and locks can be
- * very sensitive in some cases. In particular, it is generally very important
- * to check the atomic variable that requires a reader or writer to sleep after
- * locking the mutex and before actually sleeping; otherwise, it could be very
- * likely to cause a deadlock. For example, assume "var" is a variable
- * atomically modified, then the corresponding code would be:
- * if (var == need_sleep) {
- * LOCK(lock);
- * if (var == need_sleep)
- * WAIT(cond, lock);
- * UNLOCK(lock);
- * }
- * The second check is important, since "var" is protected by the atomic
- * operation, not by the mutex, and can be changed just before sleeping.
- * (The first "if" could be omitted, but this is also important in order to
- * make the code efficient by avoiding the use of the mutex unless it is
- * really necessary.)
- */
-
-#define WRITER_ACTIVE 0x1
-#define READER_INCR 0x2
-
-isc_result_t
-isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
- isc_int32_t cntflag;
-
- REQUIRE(VALID_RWLOCK(rwl));
-
-#ifdef ISC_RWLOCK_TRACE
- print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
- ISC_MSG_PRELOCK, "prelock"), rwl, type);
-#endif
-
- if (type == isc_rwlocktype_read) {
- if (rwl->write_requests != rwl->write_completions) {
- /* there is a waiting or active writer */
- LOCK(&rwl->lock);
- if (rwl->write_requests != rwl->write_completions) {
- rwl->readers_waiting++;
- WAIT(&rwl->readable, &rwl->lock);
- rwl->readers_waiting--;
- }
- UNLOCK(&rwl->lock);
- }
-
-#if defined(ISC_RWLOCK_USESTDATOMIC)
- cntflag = atomic_fetch_add_explicit(&rwl->cnt_and_flag,
- READER_INCR,
- memory_order_relaxed);
-#else
- cntflag = isc_atomic_xadd(&rwl->cnt_and_flag, READER_INCR);
-#endif
- POST(cntflag);
- while (1) {
- if ((rwl->cnt_and_flag & WRITER_ACTIVE) == 0)
- break;
-
- /* A writer is still working */
- LOCK(&rwl->lock);
- rwl->readers_waiting++;
- if ((rwl->cnt_and_flag & WRITER_ACTIVE) != 0)
- WAIT(&rwl->readable, &rwl->lock);
- rwl->readers_waiting--;
- UNLOCK(&rwl->lock);
-
- /*
- * Typically, the reader should be able to get a lock
- * at this stage:
- * (1) there should have been no pending writer when
- * the reader was trying to increment the
- * counter; otherwise, the writer should be in
- * the waiting queue, preventing the reader from
- * proceeding to this point.
- * (2) once the reader increments the counter, no
- * more writer can get a lock.
- * Still, it is possible another writer can work at
- * this point, e.g. in the following scenario:
- * A previous writer unlocks the writer lock.
- * This reader proceeds to point (1).
- * A new writer appears, and gets a new lock before
- * the reader increments the counter.
- * The reader then increments the counter.
- * The previous writer notices there is a waiting
- * reader who is almost ready, and wakes it up.
- * So, the reader needs to confirm whether it can now
- * read explicitly (thus we loop). Note that this is
- * not an infinite process, since the reader has
- * incremented the counter at this point.
- */
- }
-
- /*
- * If we are temporarily preferred to writers due to the writer
- * quota, reset the condition (race among readers doesn't
- * matter).
- */
- rwl->write_granted = 0;
- } else {
- isc_int32_t prev_writer;
-
- /* enter the waiting queue, and wait for our turn */
-#if defined(ISC_RWLOCK_USESTDATOMIC)
- prev_writer = atomic_fetch_add_explicit(&rwl->write_requests, 1,
- memory_order_relaxed);
-#else
- prev_writer = isc_atomic_xadd(&rwl->write_requests, 1);
-#endif
- while (rwl->write_completions != prev_writer) {
- LOCK(&rwl->lock);
- if (rwl->write_completions != prev_writer) {
- WAIT(&rwl->writeable, &rwl->lock);
- UNLOCK(&rwl->lock);
- continue;
- }
- UNLOCK(&rwl->lock);
- break;
- }
-
- while (1) {
-#if defined(ISC_RWLOCK_USESTDATOMIC)
- int_fast32_t cntflag2 = 0;
- atomic_compare_exchange_strong_explicit
- (&rwl->cnt_and_flag, &cntflag2, WRITER_ACTIVE,
- memory_order_relaxed, memory_order_relaxed);
-#else
- isc_int32_t cntflag2;
- cntflag2 = isc_atomic_cmpxchg(&rwl->cnt_and_flag, 0,
- WRITER_ACTIVE);
-#endif
-
- if (cntflag2 == 0)
- break;
-
- /* Another active reader or writer is working. */
- LOCK(&rwl->lock);
- if (rwl->cnt_and_flag != 0)
- WAIT(&rwl->writeable, &rwl->lock);
- UNLOCK(&rwl->lock);
- }
-
- INSIST((rwl->cnt_and_flag & WRITER_ACTIVE) != 0);
- rwl->write_granted++;
- }
-
-#ifdef ISC_RWLOCK_TRACE
- print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
- ISC_MSG_POSTLOCK, "postlock"), rwl, type);
-#endif
-
- return (ISC_R_SUCCESS);
-}
-
-isc_result_t
-isc_rwlock_trylock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
- isc_int32_t cntflag;
-
- REQUIRE(VALID_RWLOCK(rwl));
-
-#ifdef ISC_RWLOCK_TRACE
- print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
- ISC_MSG_PRELOCK, "prelock"), rwl, type);
-#endif
-
- if (type == isc_rwlocktype_read) {
- /* If a writer is waiting or working, we fail. */
- if (rwl->write_requests != rwl->write_completions)
- return (ISC_R_LOCKBUSY);
-
- /* Otherwise, be ready for reading. */
-#if defined(ISC_RWLOCK_USESTDATOMIC)
- cntflag = atomic_fetch_add_explicit(&rwl->cnt_and_flag,
- READER_INCR,
- memory_order_relaxed);
-#else
- cntflag = isc_atomic_xadd(&rwl->cnt_and_flag, READER_INCR);
-#endif
- if ((cntflag & WRITER_ACTIVE) != 0) {
- /*
- * A writer is working. We lose, and cancel the read
- * request.
- */
-#if defined(ISC_RWLOCK_USESTDATOMIC)
- cntflag = atomic_fetch_sub_explicit
- (&rwl->cnt_and_flag, READER_INCR,
- memory_order_relaxed);
-#else
- cntflag = isc_atomic_xadd(&rwl->cnt_and_flag,
- -READER_INCR);
-#endif
- /*
- * If no other readers are waiting and we've suspended
- * new writers in this short period, wake them up.
- */
- if (cntflag == READER_INCR &&
- rwl->write_completions != rwl->write_requests) {
- LOCK(&rwl->lock);
- BROADCAST(&rwl->writeable);
- UNLOCK(&rwl->lock);
- }
-
- return (ISC_R_LOCKBUSY);
- }
- } else {
- /* Try locking without entering the waiting queue. */
-#if defined(ISC_RWLOCK_USESTDATOMIC)
- int_fast32_t zero = 0;
- if (!atomic_compare_exchange_strong_explicit
- (&rwl->cnt_and_flag, &zero, WRITER_ACTIVE,
- memory_order_relaxed, memory_order_relaxed))
- return (ISC_R_LOCKBUSY);
-#else
- cntflag = isc_atomic_cmpxchg(&rwl->cnt_and_flag, 0,
- WRITER_ACTIVE);
- if (cntflag != 0)
- return (ISC_R_LOCKBUSY);
-#endif
-
- /*
- * XXXJT: jump into the queue, possibly breaking the writer
- * order.
- */
-#if defined(ISC_RWLOCK_USESTDATOMIC)
- atomic_fetch_sub_explicit(&rwl->write_completions, 1,
- memory_order_relaxed);
-#else
- (void)isc_atomic_xadd(&rwl->write_completions, -1);
-#endif
-
- rwl->write_granted++;
- }
-
-#ifdef ISC_RWLOCK_TRACE
- print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
- ISC_MSG_POSTLOCK, "postlock"), rwl, type);
-#endif
-
- return (ISC_R_SUCCESS);
-}
-
-isc_result_t
-isc_rwlock_tryupgrade(isc_rwlock_t *rwl) {
- REQUIRE(VALID_RWLOCK(rwl));
-
-#if defined(ISC_RWLOCK_USESTDATOMIC)
- {
- int_fast32_t reader_incr = READER_INCR;
-
- /* Try to acquire write access. */
- atomic_compare_exchange_strong_explicit
- (&rwl->cnt_and_flag, &reader_incr, WRITER_ACTIVE,
- memory_order_relaxed, memory_order_relaxed);
- /*
- * There must have been no writer, and there must have
- * been at least one reader.
- */
- INSIST((reader_incr & WRITER_ACTIVE) == 0 &&
- (reader_incr & ~WRITER_ACTIVE) != 0);
-
- if (reader_incr == READER_INCR) {
- /*
- * We are the only reader and have been upgraded.
- * Now jump into the head of the writer waiting queue.
- */
- atomic_fetch_sub_explicit(&rwl->write_completions, 1,
- memory_order_relaxed);
- } else
- return (ISC_R_LOCKBUSY);
-
- }
-#else
- {
- isc_int32_t prevcnt;
-
- /* Try to acquire write access. */
- prevcnt = isc_atomic_cmpxchg(&rwl->cnt_and_flag,
- READER_INCR, WRITER_ACTIVE);
- /*
- * There must have been no writer, and there must have
- * been at least one reader.
- */
- INSIST((prevcnt & WRITER_ACTIVE) == 0 &&
- (prevcnt & ~WRITER_ACTIVE) != 0);
-
- if (prevcnt == READER_INCR) {
- /*
- * We are the only reader and have been upgraded.
- * Now jump into the head of the writer waiting queue.
- */
- (void)isc_atomic_xadd(&rwl->write_completions, -1);
- } else
- return (ISC_R_LOCKBUSY);
- }
-#endif
-
- return (ISC_R_SUCCESS);
-}
-
-void
-isc_rwlock_downgrade(isc_rwlock_t *rwl) {
- isc_int32_t prev_readers;
-
- REQUIRE(VALID_RWLOCK(rwl));
-
-#if defined(ISC_RWLOCK_USESTDATOMIC)
- {
- /* Become an active reader. */
- prev_readers = atomic_fetch_add_explicit(&rwl->cnt_and_flag,
- READER_INCR,
- memory_order_relaxed);
- /* We must have been a writer. */
- INSIST((prev_readers & WRITER_ACTIVE) != 0);
-
- /* Complete write */
- atomic_fetch_sub_explicit(&rwl->cnt_and_flag, WRITER_ACTIVE,
- memory_order_relaxed);
- atomic_fetch_add_explicit(&rwl->write_completions, 1,
- memory_order_relaxed);
- }
-#else
- {
- /* Become an active reader. */
- prev_readers = isc_atomic_xadd(&rwl->cnt_and_flag, READER_INCR);
- /* We must have been a writer. */
- INSIST((prev_readers & WRITER_ACTIVE) != 0);
-
- /* Complete write */
- (void)isc_atomic_xadd(&rwl->cnt_and_flag, -WRITER_ACTIVE);
- (void)isc_atomic_xadd(&rwl->write_completions, 1);
- }
-#endif
-
- /* Resume other readers */
- LOCK(&rwl->lock);
- if (rwl->readers_waiting > 0)
- BROADCAST(&rwl->readable);
- UNLOCK(&rwl->lock);
-}
-
-isc_result_t
-isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
- isc_int32_t prev_cnt;
-
- REQUIRE(VALID_RWLOCK(rwl));
-
-#ifdef ISC_RWLOCK_TRACE
- print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
- ISC_MSG_PREUNLOCK, "preunlock"), rwl, type);
-#endif
-
- if (type == isc_rwlocktype_read) {
-#if defined(ISC_RWLOCK_USESTDATOMIC)
- prev_cnt = atomic_fetch_sub_explicit(&rwl->cnt_and_flag,
- READER_INCR,
- memory_order_relaxed);
-#else
- prev_cnt = isc_atomic_xadd(&rwl->cnt_and_flag, -READER_INCR);
-#endif
- /*
- * If we're the last reader and any writers are waiting, wake
- * them up. We need to wake up all of them to ensure the
- * FIFO order.
- */
- if (prev_cnt == READER_INCR &&
- rwl->write_completions != rwl->write_requests) {
- LOCK(&rwl->lock);
- BROADCAST(&rwl->writeable);
- UNLOCK(&rwl->lock);
- }
- } else {
- isc_boolean_t wakeup_writers = ISC_TRUE;
-
- /*
- * Reset the flag, and (implicitly) tell other writers
- * we are done.
- */
-#if defined(ISC_RWLOCK_USESTDATOMIC)
- atomic_fetch_sub_explicit(&rwl->cnt_and_flag, WRITER_ACTIVE,
- memory_order_relaxed);
- atomic_fetch_add_explicit(&rwl->write_completions, 1,
- memory_order_relaxed);
-#else
- (void)isc_atomic_xadd(&rwl->cnt_and_flag, -WRITER_ACTIVE);
- (void)isc_atomic_xadd(&rwl->write_completions, 1);
-#endif
-
- if (rwl->write_granted >= rwl->write_quota ||
- rwl->write_requests == rwl->write_completions ||
- (rwl->cnt_and_flag & ~WRITER_ACTIVE) != 0) {
- /*
- * We have passed the write quota, no writer is
- * waiting, or some readers are almost ready, pending
- * possible writers. Note that the last case can
- * happen even if write_requests != write_completions
- * (which means a new writer in the queue), so we need
- * to catch the case explicitly.
- */
- LOCK(&rwl->lock);
- if (rwl->readers_waiting > 0) {
- wakeup_writers = ISC_FALSE;
- BROADCAST(&rwl->readable);
- }
- UNLOCK(&rwl->lock);
- }
-
- if (rwl->write_requests != rwl->write_completions &&
- wakeup_writers) {
- LOCK(&rwl->lock);
- BROADCAST(&rwl->writeable);
- UNLOCK(&rwl->lock);
- }
- }
-
-#ifdef ISC_RWLOCK_TRACE
- print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
- ISC_MSG_POSTUNLOCK, "postunlock"),
- rwl, type);
-#endif
-
- return (ISC_R_SUCCESS);
-}
-
-#else /* ISC_RWLOCK_USEATOMIC */
-
-static isc_result_t
-doit(isc_rwlock_t *rwl, isc_rwlocktype_t type, isc_boolean_t nonblock) {
- isc_boolean_t skip = ISC_FALSE;
- isc_boolean_t done = ISC_FALSE;
- isc_result_t result = ISC_R_SUCCESS;
-
- REQUIRE(VALID_RWLOCK(rwl));
-
- LOCK(&rwl->lock);
-
-#ifdef ISC_RWLOCK_TRACE
- print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
- ISC_MSG_PRELOCK, "prelock"), rwl, type);
-#endif
-
- if (type == isc_rwlocktype_read) {
- if (rwl->readers_waiting != 0)
- skip = ISC_TRUE;
- while (!done) {
- if (!skip &&
- ((rwl->active == 0 ||
- (rwl->type == isc_rwlocktype_read &&
- (rwl->writers_waiting == 0 ||
- rwl->granted < rwl->read_quota)))))
- {
- rwl->type = isc_rwlocktype_read;
- rwl->active++;
- rwl->granted++;
- done = ISC_TRUE;
- } else if (nonblock) {
- result = ISC_R_LOCKBUSY;
- done = ISC_TRUE;
- } else {
- skip = ISC_FALSE;
- rwl->readers_waiting++;
- WAIT(&rwl->readable, &rwl->lock);
- rwl->readers_waiting--;
- }
- }
- } else {
- if (rwl->writers_waiting != 0)
- skip = ISC_TRUE;
- while (!done) {
- if (!skip && rwl->active == 0) {
- rwl->type = isc_rwlocktype_write;
- rwl->active = 1;
- rwl->granted++;
- done = ISC_TRUE;
- } else if (nonblock) {
- result = ISC_R_LOCKBUSY;
- done = ISC_TRUE;
- } else {
- skip = ISC_FALSE;
- rwl->writers_waiting++;
- WAIT(&rwl->writeable, &rwl->lock);
- rwl->writers_waiting--;
- }
- }
- }
-
-#ifdef ISC_RWLOCK_TRACE
- print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
- ISC_MSG_POSTLOCK, "postlock"), rwl, type);
-#endif
-
- UNLOCK(&rwl->lock);
-
- return (result);
-}
-
-isc_result_t
-isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
- return (doit(rwl, type, ISC_FALSE));
-}
-
-isc_result_t
-isc_rwlock_trylock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
- return (doit(rwl, type, ISC_TRUE));
-}
-
-isc_result_t
-isc_rwlock_tryupgrade(isc_rwlock_t *rwl) {
- isc_result_t result = ISC_R_SUCCESS;
-
- REQUIRE(VALID_RWLOCK(rwl));
- LOCK(&rwl->lock);
- REQUIRE(rwl->type == isc_rwlocktype_read);
- REQUIRE(rwl->active != 0);
-
- /* If we are the only reader then succeed. */
- if (rwl->active == 1) {
- rwl->original = (rwl->original == isc_rwlocktype_none) ?
- isc_rwlocktype_read : isc_rwlocktype_none;
- rwl->type = isc_rwlocktype_write;
- } else
- result = ISC_R_LOCKBUSY;
-
- UNLOCK(&rwl->lock);
- return (result);
-}
-
-void
-isc_rwlock_downgrade(isc_rwlock_t *rwl) {
-
- REQUIRE(VALID_RWLOCK(rwl));
- LOCK(&rwl->lock);
- REQUIRE(rwl->type == isc_rwlocktype_write);
- REQUIRE(rwl->active == 1);
-
- rwl->type = isc_rwlocktype_read;
- rwl->original = (rwl->original == isc_rwlocktype_none) ?
- isc_rwlocktype_write : isc_rwlocktype_none;
- /*
- * Resume processing any read request that were blocked when
- * we upgraded.
- */
- if (rwl->original == isc_rwlocktype_none &&
- (rwl->writers_waiting == 0 || rwl->granted < rwl->read_quota) &&
- rwl->readers_waiting > 0)
- BROADCAST(&rwl->readable);
-
- UNLOCK(&rwl->lock);
-}
-
-isc_result_t
-isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
-
- REQUIRE(VALID_RWLOCK(rwl));
- LOCK(&rwl->lock);
- REQUIRE(rwl->type == type);
-
- UNUSED(type);
-
-#ifdef ISC_RWLOCK_TRACE
- print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
- ISC_MSG_PREUNLOCK, "preunlock"), rwl, type);
-#endif
-
- INSIST(rwl->active > 0);
- rwl->active--;
- if (rwl->active == 0) {
- if (rwl->original != isc_rwlocktype_none) {
- rwl->type = rwl->original;
- rwl->original = isc_rwlocktype_none;
- }
- if (rwl->type == isc_rwlocktype_read) {
- rwl->granted = 0;
- if (rwl->writers_waiting > 0) {
- rwl->type = isc_rwlocktype_write;
- SIGNAL(&rwl->writeable);
- } else if (rwl->readers_waiting > 0) {
- /* Does this case ever happen? */
- BROADCAST(&rwl->readable);
- }
- } else {
- if (rwl->readers_waiting > 0) {
- if (rwl->writers_waiting > 0 &&
- rwl->granted < rwl->write_quota) {
- SIGNAL(&rwl->writeable);
- } else {
- rwl->granted = 0;
- rwl->type = isc_rwlocktype_read;
- BROADCAST(&rwl->readable);
- }
- } else if (rwl->writers_waiting > 0) {
- rwl->granted = 0;
- SIGNAL(&rwl->writeable);
- } else {
- rwl->granted = 0;
- }
- }
- }
- INSIST(rwl->original == isc_rwlocktype_none);
-
-#ifdef ISC_RWLOCK_TRACE
- print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
- ISC_MSG_POSTUNLOCK, "postunlock"),
- rwl, type);
-#endif
-
- UNLOCK(&rwl->lock);
-
- return (ISC_R_SUCCESS);
-}
-
-#endif /* ISC_RWLOCK_USEATOMIC */
-#else /* ISC_PLATFORM_USETHREADS */
-
isc_result_t
isc_rwlock_init(isc_rwlock_t *rwl, unsigned int read_quota,
unsigned int write_quota)
@@ -911,4 +118,3 @@ isc_rwlock_destroy(isc_rwlock_t *rwl) {
rwl->magic = 0;
}
-#endif /* ISC_PLATFORM_USETHREADS */
diff --git a/usr.sbin/bind/lib/isc/task.c b/usr.sbin/bind/lib/isc/task.c
index 3c3c095fd9e..c956155a018 100644
--- a/usr.sbin/bind/lib/isc/task.c
+++ b/usr.sbin/bind/lib/isc/task.c
@@ -57,11 +57,7 @@
* is expected to have a separate manager; no "worker threads" are shared by
* the application threads.
*/
-#ifdef ISC_PLATFORM_USETHREADS
-#define USE_WORKER_THREADS
-#else
#define USE_SHARED_MANAGER
-#endif /* ISC_PLATFORM_USETHREADS */
#include "task_p.h"
@@ -137,21 +133,12 @@ struct isc__taskmgr {
isc_taskmgr_t common;
isc_mem_t * mctx;
isc_mutex_t lock;
-#ifdef ISC_PLATFORM_USETHREADS
- unsigned int workers;
- isc_thread_t * threads;
-#endif /* ISC_PLATFORM_USETHREADS */
/* Locked by task manager lock. */
unsigned int default_quantum;
LIST(isc__task_t) tasks;
isc__tasklist_t ready_tasks;
isc__tasklist_t ready_priority_tasks;
isc_taskmgrmode_t mode;
-#ifdef ISC_PLATFORM_USETHREADS
- isc_condition_t work_available;
- isc_condition_t exclusive_granted;
- isc_condition_t paused;
-#endif /* ISC_PLATFORM_USETHREADS */
unsigned int tasks_running;
unsigned int tasks_ready;
isc_boolean_t pause_requested;
@@ -167,7 +154,7 @@ struct isc__taskmgr {
isc__task_t *excl;
#ifdef USE_SHARED_MANAGER
unsigned int refs;
-#endif /* ISC_PLATFORM_USETHREADS */
+#endif /* USE_SHARED_MANAGER */
};
#define DEFAULT_TASKMGR_QUANTUM 10
@@ -1809,15 +1796,6 @@ isc_taskmgr_renderxml(isc_taskmgr_t *mgr0, xmlTextWriterPtr writer) {
* on which type is enabled.
*/
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "thread-model"));
-#ifdef ISC_PLATFORM_USETHREADS
- TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "type"));
- TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR "threaded"));
- TRY0(xmlTextWriterEndElement(writer)); /* type */
-
- TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "worker-threads"));
- TRY0(xmlTextWriterWriteFormatString(writer, "%d", mgr->workers));
- TRY0(xmlTextWriterEndElement(writer)); /* worker-threads */
-#else /* ISC_PLATFORM_USETHREADS */
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "type"));
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR "non-threaded"));
TRY0(xmlTextWriterEndElement(writer)); /* type */
@@ -1825,7 +1803,6 @@ isc_taskmgr_renderxml(isc_taskmgr_t *mgr0, xmlTextWriterPtr writer) {
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "references"));
TRY0(xmlTextWriterWriteFormatString(writer, "%d", mgr->refs));
TRY0(xmlTextWriterEndElement(writer)); /* references */
-#endif /* ISC_PLATFORM_USETHREADS */
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "default-quantum"));
TRY0(xmlTextWriterWriteFormatString(writer, "%d",
@@ -1918,15 +1895,6 @@ isc_taskmgr_renderjson(isc_taskmgr_t *mgr0, json_object *tasks) {
* Write out the thread-model, and some details about each depending
* on which type is enabled.
*/
-#ifdef ISC_PLATFORM_USETHREADS
- obj = json_object_new_string("threaded");
- CHECKMEM(obj);
- json_object_object_add(tasks, "thread-model", obj);
-
- obj = json_object_new_int(mgr->workers);
- CHECKMEM(obj);
- json_object_object_add(tasks, "worker-threads", obj);
-#else /* ISC_PLATFORM_USETHREADS */
obj = json_object_new_string("non-threaded");
CHECKMEM(obj);
json_object_object_add(tasks, "thread-model", obj);
@@ -1934,7 +1902,6 @@ isc_taskmgr_renderjson(isc_taskmgr_t *mgr0, json_object *tasks) {
obj = json_object_new_int(mgr->refs);
CHECKMEM(obj);
json_object_object_add(tasks, "references", obj);
-#endif /* ISC_PLATFORM_USETHREADS */
obj = json_object_new_int(mgr->default_quantum);
CHECKMEM(obj);
diff --git a/usr.sbin/bind/lib/isc/task_p.h b/usr.sbin/bind/lib/isc/task_p.h
index a8c3a1782fa..80d8b6fba31 100644
--- a/usr.sbin/bind/lib/isc/task_p.h
+++ b/usr.sbin/bind/lib/isc/task_p.h
@@ -14,25 +14,17 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: task_p.h,v 1.3 2019/12/17 01:46:34 sthen Exp $ */
+/* $Id: task_p.h,v 1.4 2020/01/07 19:08:09 florian Exp $ */
#ifndef ISC_TASK_P_H
#define ISC_TASK_P_H
/*! \file */
-#if defined(ISC_PLATFORM_USETHREADS)
-void
-isc__taskmgr_pause(isc_taskmgr_t *taskmgr);
-
-void
-isc__taskmgr_resume(isc_taskmgr_t *taskmgr);
-#else
isc_boolean_t
isc__taskmgr_ready(isc_taskmgr_t *taskmgr);
isc_result_t
isc__taskmgr_dispatch(isc_taskmgr_t *taskmgr);
-#endif /* !ISC_PLATFORM_USETHREADS */
#endif /* ISC_TASK_P_H */
diff --git a/usr.sbin/bind/lib/isc/timer.c b/usr.sbin/bind/lib/isc/timer.c
index 161d91cd9c9..56f389ff893 100644
--- a/usr.sbin/bind/lib/isc/timer.c
+++ b/usr.sbin/bind/lib/isc/timer.c
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: timer.c,v 1.4 2019/12/17 01:46:34 sthen Exp $ */
+/* $Id: timer.c,v 1.5 2020/01/07 19:08:09 florian Exp $ */
/*! \file */
@@ -41,11 +41,7 @@
#endif
/* See task.c about the following definition: */
-#ifdef ISC_PLATFORM_USETHREADS
-#define USE_TIMER_THREAD
-#else
#define USE_SHARED_MANAGER
-#endif /* ISC_PLATFORM_USETHREADS */
#ifndef USE_TIMER_THREAD
#include "timer_p.h"
diff --git a/usr.sbin/bind/lib/isc/unix/Makefile.in b/usr.sbin/bind/lib/isc/unix/Makefile.in
index 8659bda43aa..5194745155a 100644
--- a/usr.sbin/bind/lib/isc/unix/Makefile.in
+++ b/usr.sbin/bind/lib/isc/unix/Makefile.in
@@ -17,7 +17,7 @@ VPATH = @srcdir@
top_srcdir = @top_srcdir@
CINCLUDES = -I${srcdir}/include \
- -I${srcdir}/../@ISC_THREAD_DIR@/include \
+ -I${srcdir}/../nothreads/include \
-I../include \
-I${srcdir}/../include \
-I${srcdir}/.. @ISC_OPENSSL_INC@
diff --git a/usr.sbin/bind/lib/isc/unix/app.c b/usr.sbin/bind/lib/isc/unix/app.c
index 98bcdb4fd1d..a5725285559 100644
--- a/usr.sbin/bind/lib/isc/unix/app.c
+++ b/usr.sbin/bind/lib/isc/unix/app.c
@@ -45,25 +45,15 @@
#include <isc/time.h>
#include <isc/util.h>
-#ifdef ISC_PLATFORM_USETHREADS
-#include <pthread.h>
-#endif
-
/*%
* For BIND9 internal applications built with threads, we use a single app
* context and let multiple worker, I/O, timer threads do actual jobs.
* For other cases (including BIND9 built without threads) an app context acts
* as an event loop dispatching various events.
*/
-#ifndef ISC_PLATFORM_USETHREADS
#include "../timer_p.h"
#include "../task_p.h"
#include "socket_p.h"
-#endif /* ISC_PLATFORM_USETHREADS */
-
-#ifdef ISC_PLATFORM_USETHREADS
-static pthread_t blockedthread;
-#endif /* ISC_PLATFORM_USETHREADS */
/*%
* The following are intended for internal use (indicated by "isc__"
@@ -122,10 +112,6 @@ typedef struct isc__appctx {
isc_taskmgr_t *taskmgr;
isc_socketmgr_t *socketmgr;
isc_timermgr_t *timermgr;
-#ifdef ISC_PLATFORM_USETHREADS
- isc_mutex_t readylock;
- isc_condition_t ready;
-#endif /* ISC_PLATFORM_USETHREADS */
} isc__appctx_t;
static isc__appctx_t isc_g_appctx;
@@ -236,27 +222,9 @@ isc__app_ctxstart(isc_appctx_t *ctx0) {
}
#endif
-#ifdef ISC_PLATFORM_USETHREADS
-#ifdef HAVE_LINUXTHREADS
- main_thread = pthread_self();
-#endif /* HAVE_LINUXTHREADS */
-
- result = isc_mutex_init(&ctx->readylock);
- if (result != ISC_R_SUCCESS)
- return (result);
-
- result = isc_condition_init(&ctx->ready);
- if (result != ISC_R_SUCCESS)
- goto cleanup_rlock;
-
- result = isc_mutex_init(&ctx->lock);
- if (result != ISC_R_SUCCESS)
- goto cleanup_rcond;
-#else /* ISC_PLATFORM_USETHREADS */
result = isc_mutex_init(&ctx->lock);
if (result != ISC_R_SUCCESS)
goto cleanup;
-#endif /* ISC_PLATFORM_USETHREADS */
ISC_LIST_INIT(ctx->on_run);
@@ -311,36 +279,6 @@ isc__app_ctxstart(isc_appctx_t *ctx0) {
goto cleanup;
#endif
-#ifdef ISC_PLATFORM_USETHREADS
- /*
- * Block SIGHUP, SIGINT, SIGTERM.
- *
- * If isc_app_start() is called from the main thread before any other
- * threads have been created, then the pthread_sigmask() call below
- * will result in all threads having SIGHUP, SIGINT and SIGTERM
- * blocked by default, ensuring that only the thread that calls
- * sigwait() for them will get those signals.
- */
- if (sigemptyset(&sset) != 0 ||
- sigaddset(&sset, SIGHUP) != 0 ||
- sigaddset(&sset, SIGINT) != 0 ||
- sigaddset(&sset, SIGTERM) != 0) {
- isc__strerror(errno, strbuf, sizeof(strbuf));
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_app_start() sigsetops: %s", strbuf);
- result = ISC_R_UNEXPECTED;
- goto cleanup;
- }
- presult = pthread_sigmask(SIG_BLOCK, &sset, NULL);
- if (presult != 0) {
- isc__strerror(presult, strbuf, sizeof(strbuf));
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_app_start() pthread_sigmask: %s",
- strbuf);
- result = ISC_R_UNEXPECTED;
- goto cleanup;
- }
-#else /* ISC_PLATFORM_USETHREADS */
/*
* Unblock SIGHUP, SIGINT, SIGTERM.
*
@@ -366,18 +304,10 @@ isc__app_ctxstart(isc_appctx_t *ctx0) {
result = ISC_R_UNEXPECTED;
goto cleanup;
}
-#endif /* ISC_PLATFORM_USETHREADS */
return (ISC_R_SUCCESS);
cleanup:
-#ifdef ISC_PLATFORM_USETHREADS
- cleanup_rcond:
- (void)isc_condition_destroy(&ctx->ready);
-
- cleanup_rlock:
- (void)isc_mutex_destroy(&ctx->readylock);
-#endif /* ISC_PLATFORM_USETHREADS */
return (result);
}
@@ -439,7 +369,6 @@ isc__app_ctxonrun(isc_appctx_t *ctx0, isc_mem_t *mctx, isc_task_t *task,
return (result);
}
-#ifndef ISC_PLATFORM_USETHREADS
/*!
* Event loop for nonthreaded programs.
*/
@@ -577,7 +506,6 @@ isc__nothread_signal_hack(isc_condition_t *cp) {
signalled = ISC_TRUE;
return (ISC_R_SUCCESS);
}
-#endif /* ISC_PLATFORM_USETHREADS */
isc_result_t
isc__app_ctxrun(isc_appctx_t *ctx0) {
@@ -585,13 +513,6 @@ isc__app_ctxrun(isc_appctx_t *ctx0) {
int result;
isc_event_t *event, *next_event;
isc_task_t *task;
-#ifdef ISC_PLATFORM_USETHREADS
- sigset_t sset;
- char strbuf[ISC_STRERRORSIZE];
-#ifdef HAVE_SIGWAIT
- int sig;
-#endif /* HAVE_SIGWAIT */
-#endif /* ISC_PLATFORM_USETHREADS */
REQUIRE(VALID_APPCTX(ctx));
@@ -621,7 +542,6 @@ isc__app_ctxrun(isc_appctx_t *ctx0) {
UNLOCK(&ctx->lock);
-#ifndef ISC_PLATFORM_USETHREADS
if (isc_bind9 && ctx == &isc_g_appctx) {
result = handle_signal(SIGHUP, reload_action);
if (result != ISC_R_SUCCESS)
@@ -631,127 +551,6 @@ isc__app_ctxrun(isc_appctx_t *ctx0) {
(void) isc__taskmgr_dispatch(ctx->taskmgr);
result = evloop(ctx);
return (result);
-#else /* ISC_PLATFORM_USETHREADS */
- /*
- * BIND9 internal tools using multiple contexts do not
- * rely on signal.
- */
- if (isc_bind9 && ctx != &isc_g_appctx)
- return (ISC_R_SUCCESS);
-
- /*
- * There is no danger if isc_app_shutdown() is called before we
- * wait for signals. Signals are blocked, so any such signal will
- * simply be made pending and we will get it when we call
- * sigwait().
- */
- while (!ctx->want_shutdown) {
-#ifdef HAVE_SIGWAIT
- if (isc_bind9) {
- /*
- * BIND9 internal; single context:
- * Wait for SIGHUP, SIGINT, or SIGTERM.
- */
- if (sigemptyset(&sset) != 0 ||
- sigaddset(&sset, SIGHUP) != 0 ||
- sigaddset(&sset, SIGINT) != 0 ||
- sigaddset(&sset, SIGTERM) != 0) {
- isc__strerror(errno, strbuf, sizeof(strbuf));
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_app_run() sigsetops: %s",
- strbuf);
- return (ISC_R_UNEXPECTED);
- }
-
-#ifndef HAVE_UNIXWARE_SIGWAIT
- result = sigwait(&sset, &sig);
- if (result == 0) {
- if (sig == SIGINT || sig == SIGTERM)
- ctx->want_shutdown = ISC_TRUE;
- else if (sig == SIGHUP)
- ctx->want_reload = ISC_TRUE;
- }
-
-#else /* Using UnixWare sigwait semantics. */
- sig = sigwait(&sset);
- if (sig >= 0) {
- if (sig == SIGINT || sig == SIGTERM)
- ctx->want_shutdown = ISC_TRUE;
- else if (sig == SIGHUP)
- ctx->want_reload = ISC_TRUE;
- }
-#endif /* HAVE_UNIXWARE_SIGWAIT */
- } else {
- /*
- * External, or BIND9 using multiple contexts:
- * wait until woken up.
- */
- LOCK(&ctx->readylock);
- if (ctx->want_shutdown) {
- /* shutdown() won the race. */
- UNLOCK(&ctx->readylock);
- break;
- }
- if (!ctx->want_reload)
- WAIT(&ctx->ready, &ctx->readylock);
- UNLOCK(&ctx->readylock);
- }
-#else /* Don't have sigwait(). */
- if (isc_bind9) {
- /*
- * BIND9 internal; single context:
- * Install a signal handler for SIGHUP, then wait for
- * all signals.
- */
- result = handle_signal(SIGHUP, reload_action);
- if (result != ISC_R_SUCCESS)
- return (ISC_R_SUCCESS);
-
- if (sigemptyset(&sset) != 0) {
- isc__strerror(errno, strbuf, sizeof(strbuf));
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_app_run() sigsetops: %s",
- strbuf);
- return (ISC_R_UNEXPECTED);
- }
-#ifdef HAVE_GPERFTOOLS_PROFILER
- if (sigaddset(&sset, SIGALRM) != 0) {
- isc__strerror(errno, strbuf, sizeof(strbuf));
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_app_run() sigsetops: %s",
- strbuf);
- return (ISC_R_UNEXPECTED);
- }
-#endif
- (void)sigsuspend(&sset);
- } else {
- /*
- * External, or BIND9 using multiple contexts:
- * wait until woken up.
- */
- LOCK(&ctx->readylock);
- if (ctx->want_shutdown) {
- /* shutdown() won the race. */
- UNLOCK(&ctx->readylock);
- break;
- }
- if (!ctx->want_reload)
- WAIT(&ctx->ready, &ctx->readylock);
- UNLOCK(&ctx->readylock);
- }
-#endif /* HAVE_SIGWAIT */
-
- if (ctx->want_reload) {
- ctx->want_reload = ISC_FALSE;
- return (ISC_R_RELOAD);
- }
-
- if (ctx->want_shutdown && ctx->blocked)
- exit(1);
- }
-
- return (ISC_R_SUCCESS);
-#endif /* ISC_PLATFORM_USETHREADS */
}
isc_result_t
@@ -763,9 +562,6 @@ isc_result_t
isc__app_ctxshutdown(isc_appctx_t *ctx0) {
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
isc_boolean_t want_kill = ISC_TRUE;
-#ifdef ISC_PLATFORM_USETHREADS
- char strbuf[ISC_STRERRORSIZE];
-#endif /* ISC_PLATFORM_USETHREADS */
REQUIRE(VALID_APPCTX(ctx));
@@ -785,46 +581,7 @@ isc__app_ctxshutdown(isc_appctx_t *ctx0) {
/* BIND9 internal, but using multiple contexts */
ctx->want_shutdown = ISC_TRUE;
else {
-#ifndef ISC_PLATFORM_USETHREADS
ctx->want_shutdown = ISC_TRUE;
-#else /* ISC_PLATFORM_USETHREADS */
-#ifdef HAVE_LINUXTHREADS
- if (isc_bind9) {
- /* BIND9 internal, single context */
- int result;
-
- result = pthread_kill(main_thread, SIGTERM);
- if (result != 0) {
- isc__strerror(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) {
- isc__strerror(errno,
- strbuf, sizeof(strbuf));
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_app_shutdown() "
- "kill: %s", strbuf);
- return (ISC_R_UNEXPECTED);
- }
- }
-#endif /* HAVE_LINUXTHREADS */
- else {
- /* External, multiple contexts */
- LOCK(&ctx->readylock);
- ctx->want_shutdown = ISC_TRUE;
- UNLOCK(&ctx->readylock);
- SIGNAL(&ctx->ready);
- }
-#endif /* ISC_PLATFORM_USETHREADS */
}
}
@@ -840,9 +597,6 @@ isc_result_t
isc__app_ctxsuspend(isc_appctx_t *ctx0) {
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
isc_boolean_t want_kill = ISC_TRUE;
-#ifdef ISC_PLATFORM_USETHREADS
- char strbuf[ISC_STRERRORSIZE];
-#endif
REQUIRE(VALID_APPCTX(ctx));
@@ -863,46 +617,7 @@ isc__app_ctxsuspend(isc_appctx_t *ctx0) {
/* BIND9 internal, but using multiple contexts */
ctx->want_reload = ISC_TRUE;
else {
-#ifndef ISC_PLATFORM_USETHREADS
ctx->want_reload = ISC_TRUE;
-#else /* ISC_PLATFORM_USETHREADS */
-#ifdef HAVE_LINUXTHREADS
- if (isc_bind9) {
- /* BIND9 internal, single context */
- int result;
-
- result = pthread_kill(main_thread, SIGHUP);
- if (result != 0) {
- isc__strerror(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) {
- isc__strerror(errno,
- strbuf, sizeof(strbuf));
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_app_reload() "
- "kill: %s", strbuf);
- return (ISC_R_UNEXPECTED);
- }
- }
-#endif /* HAVE_LINUXTHREADS */
- else {
- /* External, multiple contexts */
- LOCK(&ctx->readylock);
- ctx->want_reload = ISC_TRUE;
- UNLOCK(&ctx->readylock);
- SIGNAL(&ctx->ready);
- }
-#endif /* ISC_PLATFORM_USETHREADS */
}
}
@@ -930,41 +645,20 @@ isc__app_finish(void) {
void
isc__app_block(void) {
-#ifdef ISC_PLATFORM_USETHREADS
- sigset_t sset;
-#endif /* ISC_PLATFORM_USETHREADS */
REQUIRE(isc_g_appctx.running);
REQUIRE(!isc_g_appctx.blocked);
isc_g_appctx.blocked = ISC_TRUE;
-#ifdef ISC_PLATFORM_USETHREADS
- blockedthread = pthread_self();
- RUNTIME_CHECK(sigemptyset(&sset) == 0 &&
- sigaddset(&sset, SIGINT) == 0 &&
- sigaddset(&sset, SIGTERM) == 0);
- RUNTIME_CHECK(pthread_sigmask(SIG_UNBLOCK, &sset, NULL) == 0);
-#endif /* ISC_PLATFORM_USETHREADS */
}
void
isc__app_unblock(void) {
-#ifdef ISC_PLATFORM_USETHREADS
- sigset_t sset;
-#endif /* ISC_PLATFORM_USETHREADS */
REQUIRE(isc_g_appctx.running);
REQUIRE(isc_g_appctx.blocked);
isc_g_appctx.blocked = ISC_FALSE;
-#ifdef ISC_PLATFORM_USETHREADS
- REQUIRE(blockedthread == pthread_self());
-
- RUNTIME_CHECK(sigemptyset(&sset) == 0 &&
- sigaddset(&sset, SIGINT) == 0 &&
- sigaddset(&sset, SIGTERM) == 0);
- RUNTIME_CHECK(pthread_sigmask(SIG_BLOCK, &sset, NULL) == 0);
-#endif /* ISC_PLATFORM_USETHREADS */
}
isc_result_t
diff --git a/usr.sbin/bind/lib/isc/unix/socket.c b/usr.sbin/bind/lib/isc/unix/socket.c
index 6e672d82dd1..da07dc699e4 100644
--- a/usr.sbin/bind/lib/isc/unix/socket.c
+++ b/usr.sbin/bind/lib/isc/unix/socket.c
@@ -87,11 +87,7 @@
#include "errno2result.h"
/* See task.c about the following definition: */
-#ifdef ISC_PLATFORM_USETHREADS
-#define USE_WATCHER_THREAD
-#else
#define USE_SHARED_MANAGER
-#endif /* ISC_PLATFORM_USETHREADS */
#ifndef USE_WATCHER_THREAD
#include "socket_p.h"
@@ -214,13 +210,8 @@ typedef enum { poll_idle, poll_active, poll_checking } pollstate_t;
/*%
* Size of per-FD lock buckets.
*/
-#ifdef ISC_PLATFORM_USETHREADS
-#define FDLOCK_COUNT 1024
-#define FDLOCK_ID(fd) ((fd) % FDLOCK_COUNT)
-#else
#define FDLOCK_COUNT 1
#define FDLOCK_ID(fd) 0
-#endif /* ISC_PLATFORM_USETHREADS */
/*%
* Maximum number of events communicated with the kernel. There should normally
@@ -441,9 +432,6 @@ struct isc__socketmgr {
int fd_bufsize;
#endif /* USE_SELECT */
unsigned int maxsocks;
-#ifdef ISC_PLATFORM_USETHREADS
- int pipe_fds[2];
-#endif
/* Locked by fdlock. */
isc__socket_t **fds;
@@ -2228,10 +2216,6 @@ socketclose(isc__socketmgr_t *manager, isc__socket_t *sock, int fd) {
}
UNLOCK(&manager->fdlock[lockid]);
}
-#ifdef ISC_PLATFORM_USETHREADS
- if (manager->maxfd < manager->pipe_fds[0])
- manager->maxfd = manager->pipe_fds[0];
-#endif
}
UNLOCK(&manager->lock);
@@ -2846,32 +2830,6 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock,
}
#endif
}
-#if 0 && defined(IPV6_RECVTCLASS)
- if ((sock->pf == AF_INET6)
- && (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_RECVTCLASS,
- (void *)&on, sizeof(on)) < 0)) {
- isc__strerror(errno, strbuf, sizeof(strbuf));
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "setsockopt(%d, IPV6_RECVTCLASS) "
- "%s: %s", sock->fd,
- isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
- ISC_MSG_FAILED, "failed"),
- strbuf);
- }
-#endif
-#if 0 && defined(IP_RECVTOS)
- if ((sock->pf == AF_INET)
- && (setsockopt(sock->fd, IPPROTO_IP, IP_RECVTOS,
- (void *)&on, sizeof(on)) < 0)) {
- isc__strerror(errno, strbuf, sizeof(strbuf));
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "setsockopt(%d, IP_RECVTOS) "
- "%s: %s", sock->fd,
- isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
- ISC_MSG_FAILED, "failed"),
- strbuf);
- }
-#endif
#endif /* defined(USE_CMSG) || defined(SO_RCVBUF) */
setup_done:
diff --git a/usr.sbin/bind/lib/isc/unix/time.c b/usr.sbin/bind/lib/isc/unix/time.c
index 04566e6b012..b27e3baa804 100644
--- a/usr.sbin/bind/lib/isc/unix/time.c
+++ b/usr.sbin/bind/lib/isc/unix/time.c
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: time.c,v 1.6 2019/12/17 01:46:37 sthen Exp $ */
+/* $Id: time.c,v 1.7 2020/01/07 19:08:10 florian Exp $ */
/*! \file */
@@ -384,9 +384,6 @@ void
isc_time_formattimestamp(const isc_time_t *t, char *buf, unsigned int len) {
time_t now;
unsigned int flen;
-#ifdef ISC_PLATFORM_USETHREADS
- struct tm tm;
-#endif
REQUIRE(t != NULL);
INSIST(t->nanoseconds < NS_PER_S);
@@ -394,11 +391,7 @@ isc_time_formattimestamp(const isc_time_t *t, char *buf, unsigned int len) {
REQUIRE(len > 0);
now = (time_t) t->seconds;
-#ifdef ISC_PLATFORM_USETHREADS
- flen = strftime(buf, len, "%d-%b-%Y %X", localtime_r(&now, &tm));
-#else
flen = strftime(buf, len, "%d-%b-%Y %X", localtime(&now));
-#endif
INSIST(flen < len);
if (flen != 0) {
snprintf(buf + flen, len - flen,
@@ -412,9 +405,6 @@ void
isc_time_formathttptimestamp(const isc_time_t *t, char *buf, unsigned int len) {
time_t now;
unsigned int flen;
-#ifdef ISC_PLATFORM_USETHREADS
- struct tm tm;
-#endif
REQUIRE(t != NULL);
INSIST(t->nanoseconds < NS_PER_S);
@@ -425,12 +415,7 @@ isc_time_formathttptimestamp(const isc_time_t *t, char *buf, unsigned int len) {
* 5 spaces, 1 comma, 3 GMT, 2 %d, 4 %Y, 8 %H:%M:%S, 3+ %a, 3+ %b (29+)
*/
now = (time_t)t->seconds;
-#ifdef ISC_PLATFORM_USETHREADS
- flen = strftime(buf, len, "%a, %d %b %Y %H:%M:%S GMT",
- gmtime_r(&now, &tm));
-#else
flen = strftime(buf, len, "%a, %d %b %Y %H:%M:%S GMT", gmtime(&now));
-#endif
INSIST(flen < len);
}
@@ -457,9 +442,6 @@ void
isc_time_formatISO8601(const isc_time_t *t, char *buf, unsigned int len) {
time_t now;
unsigned int flen;
-#ifdef ISC_PLATFORM_USETHREADS
- struct tm tm;
-#endif
REQUIRE(t != NULL);
INSIST(t->nanoseconds < NS_PER_S);
@@ -467,10 +449,6 @@ isc_time_formatISO8601(const isc_time_t *t, char *buf, unsigned int len) {
REQUIRE(len > 0);
now = (time_t)t->seconds;
-#ifdef ISC_PLATFORM_USETHREADS
- flen = strftime(buf, len, "%Y-%m-%dT%H:%M:%SZ", gmtime_r(&now, &tm));
-#else
flen = strftime(buf, len, "%Y-%m-%dT%H:%M:%SZ", gmtime(&now));
-#endif
INSIST(flen < len);
}
diff --git a/usr.sbin/bind/lib/isc/x86_32/include/isc/atomic.h b/usr.sbin/bind/lib/isc/x86_32/include/isc/atomic.h
index 171262c942d..a3e944519fa 100644
--- a/usr.sbin/bind/lib/isc/x86_32/include/isc/atomic.h
+++ b/usr.sbin/bind/lib/isc/x86_32/include/isc/atomic.h
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: atomic.h,v 1.3 2019/12/17 01:46:37 sthen Exp $ */
+/* $Id: atomic.h,v 1.4 2020/01/07 19:08:10 florian Exp $ */
#ifndef ISC_ATOMIC_H
#define ISC_ATOMIC_H 1
@@ -32,9 +32,6 @@ isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) {
isc_int32_t prev = val;
__asm__ volatile(
-#ifdef ISC_PLATFORM_USETHREADS
- "lock;"
-#endif
"xadd %0, %1"
:"=q"(prev)
:"m"(*p), "0"(prev)
@@ -49,9 +46,6 @@ isc_atomic_xaddq(isc_int64_t *p, isc_int64_t val) {
isc_int64_t prev = val;
__asm__ volatile(
-#ifdef ISC_PLATFORM_USETHREADS
- "lock;"
-#endif
"xaddq %0, %1"
:"=q"(prev)
:"m"(*p), "0"(prev)
@@ -67,13 +61,6 @@ isc_atomic_xaddq(isc_int64_t *p, isc_int64_t val) {
static __inline__ void
isc_atomic_store(isc_int32_t *p, isc_int32_t val) {
__asm__ volatile(
-#ifdef ISC_PLATFORM_USETHREADS
- /*
- * xchg should automatically lock memory, but we add it
- * explicitly just in case (it at least doesn't harm)
- */
- "lock;"
-#endif
"xchgl %1, %0"
:
@@ -88,13 +75,6 @@ isc_atomic_store(isc_int32_t *p, isc_int32_t val) {
static __inline__ void
isc_atomic_storeq(isc_int64_t *p, isc_int64_t val) {
__asm__ volatile(
-#ifdef ISC_PLATFORM_USETHREADS
- /*
- * xchg should automatically lock memory, but we add it
- * explicitly just in case (it at least doesn't harm)
- */
- "lock;"
-#endif
"xchgq %1, %0"
:
@@ -111,9 +91,6 @@ isc_atomic_storeq(isc_int64_t *p, isc_int64_t val) {
static __inline__ isc_int32_t
isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) {
__asm__ volatile(
-#ifdef ISC_PLATFORM_USETHREADS
- "lock;"
-#endif
"cmpxchgl %1, %2"
: "=a"(cmpval)
: "r"(val), "m"(*p), "a"(cmpval)
@@ -138,9 +115,6 @@ isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) {
__asm (
"movl 8(%ebp), %ecx\n"
"movl 12(%ebp), %edx\n"
-#ifdef ISC_PLATFORM_USETHREADS
- "lock;"
-#endif
"xadd %edx, (%ecx)\n"
/*
@@ -160,9 +134,6 @@ isc_atomic_store(isc_int32_t *p, isc_int32_t val) {
__asm (
"movl 8(%ebp), %ecx\n"
"movl 12(%ebp), %edx\n"
-#ifdef ISC_PLATFORM_USETHREADS
- "lock;"
-#endif
"xchgl (%ecx), %edx\n"
);
}
@@ -177,9 +148,6 @@ isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) {
"movl 8(%ebp), %ecx\n"
"movl 12(%ebp), %eax\n" /* must be %eax for cmpxchgl */
"movl 16(%ebp), %edx\n"
-#ifdef ISC_PLATFORM_USETHREADS
- "lock;"
-#endif
/*
* If (%ecx) == %eax then (%ecx) := %edx.
diff --git a/usr.sbin/bind/lib/isc/x86_64/include/isc/atomic.h b/usr.sbin/bind/lib/isc/x86_64/include/isc/atomic.h
index d51d05f5b24..3d6cdc8cef5 100644
--- a/usr.sbin/bind/lib/isc/x86_64/include/isc/atomic.h
+++ b/usr.sbin/bind/lib/isc/x86_64/include/isc/atomic.h
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: atomic.h,v 1.3 2019/12/17 01:46:37 sthen Exp $ */
+/* $Id: atomic.h,v 1.4 2020/01/07 19:08:10 florian Exp $ */
#ifndef ISC_ATOMIC_H
#define ISC_ATOMIC_H 1
@@ -44,9 +44,6 @@ isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) {
__asm (
"movq %rdi, %rdx\n"
"movl %esi, %eax\n"
-#ifdef ISC_PLATFORM_USETHREADS
- "lock;"
-#endif
"xadd %eax, (%rdx)\n"
/*
* XXX: assume %eax will be used as the return value.
@@ -63,9 +60,6 @@ isc_atomic_xaddq(isc_int64_t *p, isc_int64_t val) {
__asm (
"movq %rdi, %rdx\n"
"movq %rsi, %rax\n"
-#ifdef ISC_PLATFORM_USETHREADS
- "lock;"
-#endif
"xaddq %rax, (%rdx)\n"
/*
* XXX: assume %rax will be used as the return value.
@@ -82,9 +76,6 @@ isc_atomic_store(isc_int32_t *p, isc_int32_t val) {
__asm (
"movq %rdi, %rax\n"
"movl %esi, %edx\n"
-#ifdef ISC_PLATFORM_USETHREADS
- "lock;"
-#endif
"xchgl (%rax), %edx\n"
);
}
@@ -98,9 +89,6 @@ isc_atomic_storeq(isc_int64_t *p, isc_int64_t val) {
__asm (
"movq %rdi, %rax\n"
"movq %rsi, %rdx\n"
-#ifdef ISC_PLATFORM_USETHREADS
- "lock;"
-#endif
"xchgq (%rax), %rdx\n"
);
}
@@ -120,9 +108,6 @@ isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) {
"movl %esi, %eax\n"
"movq %rdi, %rdx\n"
-#ifdef ISC_PLATFORM_USETHREADS
- "lock;"
-#endif
/*
* If [%rdi] == %eax then [%rdi] := %ecx (equal to %edx
* from above), and %eax is untouched (equal to %esi)
diff --git a/usr.sbin/bind/make/includes.in b/usr.sbin/bind/make/includes.in
index 4530e3cd822..abd33c080f8 100644
--- a/usr.sbin/bind/make/includes.in
+++ b/usr.sbin/bind/make/includes.in
@@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
-# $Id: includes.in,v 1.5 2020/01/06 17:47:00 florian Exp $
+# $Id: includes.in,v 1.6 2020/01/07 19:08:10 florian Exp $
# Search for machine-generated header files in the build tree,
# and for normal headers in the source tree (${top_srcdir}).
@@ -25,7 +25,7 @@ ISC_INCLUDES = @BIND9_ISC_BUILDINCLUDE@ \
-I${top_srcdir}/lib/isc \
-I${top_srcdir}/lib/isc/include \
-I${top_srcdir}/lib/isc/unix/include \
- -I${top_srcdir}/lib/isc/@ISC_THREAD_DIR@/include \
+ -I${top_srcdir}/lib/isc/nothreads/include \
-I${top_srcdir}/lib/isc/@ISC_ARCH_DIR@/include
ISCCFG_INCLUDES = @BIND9_ISCCFG_BUILDINCLUDE@ \