diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2020-01-26 11:25:31 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2020-01-26 11:25:31 +0000 |
commit | e2d5bd31e440a18fac8f5317a2a627c4f0a149b3 (patch) | |
tree | b2df8977835e8235a8ad09a6c5ccf429eccd4092 /usr.sbin | |
parent | 6120f98c44a00b22cb69a6b77eaa609917b38185 (diff) |
get rid of lib/isc/nothreads
OK tedu
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bind/lib/isc/nothreads/include/isc/Makefile.in | 41 | ||||
-rw-r--r-- | usr.sbin/bind/lib/isc/nothreads/include/isc/condition.h | 56 | ||||
-rw-r--r-- | usr.sbin/bind/lib/isc/nothreads/include/isc/once.h | 31 | ||||
-rw-r--r-- | usr.sbin/bind/lib/isc/nothreads/include/isc/thread.h | 46 | ||||
-rw-r--r-- | usr.sbin/bind/lib/isc/unix/app.c | 57 | ||||
-rw-r--r-- | usr.sbin/bind/lib/isc/unix/socket.c | 3 |
6 files changed, 1 insertions, 233 deletions
diff --git a/usr.sbin/bind/lib/isc/nothreads/include/isc/Makefile.in b/usr.sbin/bind/lib/isc/nothreads/include/isc/Makefile.in deleted file mode 100644 index ec56e0d6e02..00000000000 --- a/usr.sbin/bind/lib/isc/nothreads/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.4 2020/01/21 23:59:20 tedu Exp $ - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -VERSION=@BIND9_VERSION@ - -HEADERS = condition.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/nothreads/include/isc/condition.h b/usr.sbin/bind/lib/isc/nothreads/include/isc/condition.h deleted file mode 100644 index 81da3f636c5..00000000000 --- a/usr.sbin/bind/lib/isc/nothreads/include/isc/condition.h +++ /dev/null @@ -1,56 +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.4 2020/01/21 23:59:20 tedu Exp $ */ - -/* - * This provides a limited subset of the isc_condition_t - * functionality for use by single-threaded programs that - * need to block waiting for events. Only a single - * call to isc_condition_wait() may be blocked at any given - * time, and the _waituntil and _broadcast functions are not - * supported. This is intended primarily for use by the omapi - * library, and may go away once omapi goes away. Use for - * other purposes is strongly discouraged. - */ - -#ifndef ISC_CONDITION_H -#define ISC_CONDITION_H 1 - -typedef int isc_condition_t; - -isc_result_t isc__nothread_wait_hack(isc_condition_t *cp); -isc_result_t isc__nothread_signal_hack(isc_condition_t *cp); - -#define isc_condition_init(cp) \ - (*(cp) = 0, ISC_R_SUCCESS) - -#define isc_condition_wait(cp, mp) \ - isc__nothread_wait_hack(cp) - -#define isc_condition_waituntil(cp, mp, tp) \ - ((void)(cp), (void)(mp), (void)(tp), ISC_R_NOTIMPLEMENTED) - -#define isc_condition_signal(cp) \ - isc__nothread_signal_hack(cp) - -#define isc_condition_broadcast(cp) \ - ((void)(cp), ISC_R_NOTIMPLEMENTED) - -#define isc_condition_destroy(cp) \ - (*(cp) == 0 ? (*(cp) = -1, ISC_R_SUCCESS) : ISC_R_UNEXPECTED) - -#endif /* ISC_CONDITION_H */ diff --git a/usr.sbin/bind/lib/isc/nothreads/include/isc/once.h b/usr.sbin/bind/lib/isc/nothreads/include/isc/once.h deleted file mode 100644 index 4bae083818a..00000000000 --- a/usr.sbin/bind/lib/isc/nothreads/include/isc/once.h +++ /dev/null @@ -1,31 +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 - -#include <isc/result.h> - -typedef isc_boolean_t isc_once_t; - -#define ISC_ONCE_INIT ISC_FALSE - -#define isc_once_do(op, f) \ - (!*(op) ? (f(), *(op) = ISC_TRUE, ISC_R_SUCCESS) : ISC_R_SUCCESS) - -#endif /* ISC_ONCE_H */ diff --git a/usr.sbin/bind/lib/isc/nothreads/include/isc/thread.h b/usr.sbin/bind/lib/isc/nothreads/include/isc/thread.h deleted file mode 100644 index fc3e6dfda88..00000000000 --- a/usr.sbin/bind/lib/isc/nothreads/include/isc/thread.h +++ /dev/null @@ -1,46 +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 - -#include <isc/lang.h> -#include <isc/result.h> - -ISC_LANG_BEGINDECLS - -/* Placeholder types (they are not accessed) */ - -typedef void * isc_thread_t; -typedef void * isc_threadresult_t; -typedef void * isc_threadarg_t; -typedef void * isc_threadfunc_t; -typedef void * isc_thread_key_t; - -void -isc_thread_setconcurrency(unsigned int level); - -void -isc_thread_setname(isc_thread_t thread, const char *name); - -#define isc_thread_self() ((unsigned long)0) -#define isc_thread_yield() ((void)0) - -ISC_LANG_ENDDECLS - -#endif /* ISC_THREAD_H */ diff --git a/usr.sbin/bind/lib/isc/unix/app.c b/usr.sbin/bind/lib/isc/unix/app.c index d188990d624..555a81340e8 100644 --- a/usr.sbin/bind/lib/isc/unix/app.c +++ b/usr.sbin/bind/lib/isc/unix/app.c @@ -30,7 +30,7 @@ #include <isc/app.h> #include <isc/boolean.h> -#include <isc/condition.h> + #include <isc/msgs.h> #include <isc/event.h> @@ -376,61 +376,6 @@ evloop(isc__appctx_t *ctx) { return (ISC_R_SUCCESS); } -/* - * This is a gross hack to support waiting for condition - * variables in nonthreaded programs in a limited way; - * see lib/isc/nothreads/include/isc/condition.h. - * We implement isc_condition_wait() by entering the - * event loop recursively until the want_shutdown flag - * is set by isc_condition_signal(). - */ - -/*! - * \brief True if we are currently executing in the recursive - * event loop. - */ -static isc_boolean_t in_recursive_evloop = ISC_FALSE; - -/*! - * \brief True if we are exiting the event loop as the result of - * a call to isc_condition_signal() rather than a shutdown - * or reload. - */ -static isc_boolean_t signalled = ISC_FALSE; - -isc_result_t -isc__nothread_wait_hack(isc_condition_t *cp) { - isc_result_t result; - - UNUSED(cp); - - INSIST(!in_recursive_evloop); - in_recursive_evloop = ISC_TRUE; - - result = evloop(&isc_g_appctx); - if (result == ISC_R_RELOAD) - isc_g_appctx.want_reload = ISC_TRUE; - if (signalled) { - isc_g_appctx.want_shutdown = ISC_FALSE; - signalled = ISC_FALSE; - } - - in_recursive_evloop = ISC_FALSE; - return (ISC_R_SUCCESS); -} - -isc_result_t -isc__nothread_signal_hack(isc_condition_t *cp) { - - UNUSED(cp); - - INSIST(in_recursive_evloop); - - isc_g_appctx.want_shutdown = ISC_TRUE; - signalled = ISC_TRUE; - return (ISC_R_SUCCESS); -} - isc_result_t isc__app_ctxrun(isc_appctx_t *ctx0) { isc__appctx_t *ctx = (isc__appctx_t *)ctx0; diff --git a/usr.sbin/bind/lib/isc/unix/socket.c b/usr.sbin/bind/lib/isc/unix/socket.c index 95322c83e3d..2c18d2b2cad 100644 --- a/usr.sbin/bind/lib/isc/unix/socket.c +++ b/usr.sbin/bind/lib/isc/unix/socket.c @@ -37,18 +37,15 @@ #include <isc/buffer.h> #include <isc/bufferlist.h> -#include <isc/condition.h> #include <isc/formatcheck.h> #include <isc/list.h> #include <isc/log.h> #include <isc/msgs.h> #include <isc/net.h> -#include <isc/once.h> #include <isc/region.h> #include <isc/socket.h> #include <isc/strerror.h> #include <isc/task.h> -#include <isc/thread.h> #include <isc/util.h> #include "errno2result.h" |