Compare commits
45
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ace8431261 | ||
|
|
31e43242fc | ||
|
|
4ee10b9c6c | ||
|
|
120da95365 | ||
|
|
919ae44f67 | ||
|
|
6324a0cec9 | ||
|
|
2a50b2e553 | ||
|
|
6c7821bd7f | ||
|
|
c4e8425859 | ||
|
|
ccc2677f91 | ||
|
|
3c8b81c56c | ||
|
|
ec70c77469 | ||
|
|
214ef6b5f2 | ||
|
|
b32c412516 | ||
|
|
64737509ff | ||
|
|
c1aea5c753 | ||
|
|
c3118d49fd | ||
|
|
c151c4ab15 | ||
|
|
9666a82680 | ||
|
|
f956da9d2c | ||
|
|
24303542d6 | ||
|
|
fc22b6946c | ||
|
|
5ebbadea33 | ||
|
|
ddba8a53d3 | ||
|
|
32f01b92ed | ||
|
|
b54db86872 | ||
|
|
4444713685 | ||
|
|
9f093cdc0a | ||
|
|
bad159f588 | ||
|
|
39cc064238 | ||
|
|
b630c22f20 | ||
|
|
9fddb5e7e4 | ||
|
|
d3b1634cc4 | ||
|
|
008b195280 | ||
|
|
6e3fef916c | ||
|
|
c342b72849 | ||
|
|
cb44b07acc | ||
|
|
ad49f7a7c1 | ||
|
|
9a4509331b | ||
|
|
b9199418c5 | ||
|
|
3c9ed6a0d8 | ||
|
|
72ef4697cc | ||
|
|
2c5d86c89c | ||
|
|
68e9479f41 | ||
|
|
72bb25cbad |
+3
-6
@@ -793,10 +793,7 @@ create_managers(void) {
|
||||
named_g_udpdisp = 1;
|
||||
#else
|
||||
if (named_g_udpdisp == 0) {
|
||||
if (named_g_cpus_detected == 1)
|
||||
named_g_udpdisp = 1;
|
||||
else
|
||||
named_g_udpdisp = named_g_cpus_detected - 1;
|
||||
named_g_udpdisp = named_g_cpus_detected;
|
||||
}
|
||||
if (named_g_udpdisp > named_g_cpus)
|
||||
named_g_udpdisp = named_g_cpus;
|
||||
@@ -824,14 +821,14 @@ create_managers(void) {
|
||||
}
|
||||
|
||||
result = isc_socketmgr_create2(named_g_mctx, &named_g_socketmgr,
|
||||
maxsocks);
|
||||
maxsocks, named_g_udpdisp);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_socketmgr_create() failed: %s",
|
||||
isc_result_totext(result));
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
isc__socketmgr_maxudp(named_g_socketmgr, maxudp);
|
||||
isc_socketmgr_maxudp(named_g_socketmgr, maxudp);
|
||||
result = isc_socketmgr_getmaxsockets(named_g_socketmgr, &socks);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
|
||||
+1
-1
@@ -8054,7 +8054,7 @@ load_configuration(const char *filename, named_server_t *server,
|
||||
"less than 128 UDP sockets available after "
|
||||
"applying 'reserved-sockets' and 'maxsockets'");
|
||||
}
|
||||
isc__socketmgr_setreserved(named_g_socketmgr, reserved);
|
||||
isc_socketmgr_setreserved(named_g_socketmgr, reserved);
|
||||
|
||||
#ifdef HAVE_GEOIP
|
||||
/*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/sh -x
|
||||
#
|
||||
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/sh -x
|
||||
#
|
||||
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
|
||||
+18
@@ -146,6 +146,9 @@
|
||||
/* Define to 1 if you have the <cmocka.h> header file. */
|
||||
#undef HAVE_CMOCKA_H
|
||||
|
||||
/* Define to 1 if you have the `cpuset_setaffinity' function. */
|
||||
#undef HAVE_CPUSET_SETAFFINITY
|
||||
|
||||
/* Define to 1 if you have the <devpoll.h> header file. */
|
||||
#undef HAVE_DEVPOLL_H
|
||||
|
||||
@@ -320,6 +323,9 @@
|
||||
/* define if OpenSSL supports Ed25519 */
|
||||
#undef HAVE_OPENSSL_ED25519
|
||||
|
||||
/* Define to 1 if you have the `processor_bind' function. */
|
||||
#undef HAVE_PROCESSOR_BIND
|
||||
|
||||
/* Define if you have POSIX threads libraries and header files. */
|
||||
#undef HAVE_PTHREAD
|
||||
|
||||
@@ -338,6 +344,9 @@
|
||||
/* Have PTHREAD_PRIO_INHERIT. */
|
||||
#undef HAVE_PTHREAD_PRIO_INHERIT
|
||||
|
||||
/* Define to 1 if you have the `pthread_setaffinity_np' function. */
|
||||
#undef HAVE_PTHREAD_SETAFFINITY_NP
|
||||
|
||||
/* Define to 1 if you have the `pthread_setname_np' function. */
|
||||
#undef HAVE_PTHREAD_SETNAME_NP
|
||||
|
||||
@@ -368,6 +377,9 @@
|
||||
/* Define to 1 if you have the <sched.h> header file. */
|
||||
#undef HAVE_SCHED_H
|
||||
|
||||
/* Define to 1 if you have the `sched_setaffinity' function. */
|
||||
#undef HAVE_SCHED_SETAFFINITY
|
||||
|
||||
/* Define to 1 if you have the `sched_yield' function. */
|
||||
#undef HAVE_SCHED_YIELD
|
||||
|
||||
@@ -407,6 +419,9 @@
|
||||
/* Define to 1 if you have the <sys/capability.h> header file. */
|
||||
#undef HAVE_SYS_CAPABILITY_H
|
||||
|
||||
/* Define to 1 if you have the <sys/cpuset.h> header file. */
|
||||
#undef HAVE_SYS_CPUSET_H
|
||||
|
||||
/* Define to 1 if you have the <sys/devpoll.h> header file. */
|
||||
#undef HAVE_SYS_DEVPOLL_H
|
||||
|
||||
@@ -419,6 +434,9 @@
|
||||
/* Define to 1 if you have the <sys/prctl.h> header file. */
|
||||
#undef HAVE_SYS_PRCTL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/procset.h> header file. */
|
||||
#undef HAVE_SYS_PROCSET_H
|
||||
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
|
||||
@@ -863,6 +863,7 @@ infodir
|
||||
docdir
|
||||
oldincludedir
|
||||
includedir
|
||||
runstatedir
|
||||
localstatedir
|
||||
sharedstatedir
|
||||
sysconfdir
|
||||
@@ -1021,6 +1022,7 @@ datadir='${datarootdir}'
|
||||
sysconfdir='${prefix}/etc'
|
||||
sharedstatedir='${prefix}/com'
|
||||
localstatedir='${prefix}/var'
|
||||
runstatedir='${localstatedir}/run'
|
||||
includedir='${prefix}/include'
|
||||
oldincludedir='/usr/include'
|
||||
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
|
||||
@@ -1273,6 +1275,15 @@ do
|
||||
| -silent | --silent | --silen | --sile | --sil)
|
||||
silent=yes ;;
|
||||
|
||||
-runstatedir | --runstatedir | --runstatedi | --runstated \
|
||||
| --runstate | --runstat | --runsta | --runst | --runs \
|
||||
| --run | --ru | --r)
|
||||
ac_prev=runstatedir ;;
|
||||
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
|
||||
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
|
||||
| --run=* | --ru=* | --r=*)
|
||||
runstatedir=$ac_optarg ;;
|
||||
|
||||
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
||||
ac_prev=sbindir ;;
|
||||
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
||||
@@ -1410,7 +1421,7 @@ fi
|
||||
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
||||
datadir sysconfdir sharedstatedir localstatedir includedir \
|
||||
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
||||
libdir localedir mandir
|
||||
libdir localedir mandir runstatedir
|
||||
do
|
||||
eval ac_val=\$$ac_var
|
||||
# Remove trailing slashes.
|
||||
@@ -1563,6 +1574,7 @@ Fine tuning of the installation directories:
|
||||
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
||||
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
||||
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
||||
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
|
||||
--libdir=DIR object code libraries [EPREFIX/lib]
|
||||
--includedir=DIR C header files [PREFIX/include]
|
||||
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
||||
@@ -15415,6 +15427,43 @@ fi
|
||||
done
|
||||
|
||||
|
||||
for ac_header in sys/cpuset.h
|
||||
do :
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "sys/cpuset.h" "ac_cv_header_sys_cpuset_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_sys_cpuset_h" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_SYS_CPUSET_H 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
for ac_header in sys/procset.h
|
||||
do :
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "sys/procset.h" "ac_cv_header_sys_procset_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_sys_procset_h" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_SYS_PROCSET_H 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
for ac_func in pthread_setaffinity_np cpuset_setaffinity processor_bind sched_setaffinity
|
||||
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.
|
||||
#
|
||||
|
||||
@@ -834,6 +834,10 @@ AC_CHECK_HEADERS([sched.h])
|
||||
AC_SEARCH_LIBS([sched_yield],[rt])
|
||||
AC_CHECK_FUNCS([sched_yield pthread_yield pthread_yield_np])
|
||||
|
||||
AC_CHECK_HEADERS([sys/cpuset.h])
|
||||
AC_CHECK_HEADERS([sys/procset.h])
|
||||
AC_CHECK_FUNCS([pthread_setaffinity_np cpuset_setaffinity processor_bind sched_setaffinity])
|
||||
|
||||
#
|
||||
# Additional OS-specific issues related to pthreads and sigwait.
|
||||
#
|
||||
|
||||
+2
-2
@@ -1678,7 +1678,7 @@ open_socket(isc_socketmgr_t *mgr, const isc_sockaddr_t *local,
|
||||
result = isc_socket_open(sock);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
} else if (dup_socket != NULL) {
|
||||
} else if (dup_socket != NULL && !isc_socket_hasreuseport()) {
|
||||
result = isc_socket_dup(dup_socket, &sock);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
@@ -2950,7 +2950,7 @@ dispatch_createudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
|
||||
}
|
||||
goto kill_socket;
|
||||
}
|
||||
isc_task_setname(disp->task[i], "udpdispatch", disp);
|
||||
isc_task_setname(disp->task[i], "UDPDISPATCH", disp);
|
||||
}
|
||||
|
||||
disp->ctlevent = isc_event_allocate(mgr->mctx, disp,
|
||||
|
||||
@@ -1,253 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/magic.h>
|
||||
#include <isc/mutex.h>
|
||||
#include <isc/once.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
static isc_mutex_t createlock;
|
||||
static isc_once_t once = ISC_ONCE_INIT;
|
||||
static isc_appctxcreatefunc_t appctx_createfunc = NULL;
|
||||
static bool is_running = false;
|
||||
|
||||
#define ISCAPI_APPMETHODS_VALID(m) ISC_MAGIC_VALID(m, ISCAPI_APPMETHODS_MAGIC)
|
||||
|
||||
static void
|
||||
initialize(void) {
|
||||
RUNTIME_CHECK(isc_mutex_init(&createlock) == ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_app_register(isc_appctxcreatefunc_t createfunc) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
|
||||
RUNTIME_CHECK(isc_once_do(&once, initialize) == ISC_R_SUCCESS);
|
||||
|
||||
LOCK(&createlock);
|
||||
if (appctx_createfunc == NULL)
|
||||
appctx_createfunc = createfunc;
|
||||
else
|
||||
result = ISC_R_EXISTS;
|
||||
UNLOCK(&createlock);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_appctx_create(isc_mem_t *mctx, isc_appctx_t **ctxp) {
|
||||
isc_result_t result;
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__appctx_create(mctx, ctxp));
|
||||
|
||||
LOCK(&createlock);
|
||||
|
||||
REQUIRE(appctx_createfunc != NULL);
|
||||
result = (*appctx_createfunc)(mctx, ctxp);
|
||||
|
||||
UNLOCK(&createlock);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
void
|
||||
isc_appctx_destroy(isc_appctx_t **ctxp) {
|
||||
REQUIRE(ctxp != NULL && ISCAPI_APPCTX_VALID(*ctxp));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__appctx_destroy(ctxp);
|
||||
else
|
||||
(*ctxp)->methods->ctxdestroy(ctxp);
|
||||
|
||||
ENSURE(*ctxp == NULL);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_app_ctxstart(isc_appctx_t *ctx) {
|
||||
REQUIRE(ISCAPI_APPCTX_VALID(ctx));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__app_ctxstart(ctx));
|
||||
|
||||
return (ctx->methods->ctxstart(ctx));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_app_ctxrun(isc_appctx_t *ctx) {
|
||||
REQUIRE(ISCAPI_APPCTX_VALID(ctx));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__app_ctxrun(ctx));
|
||||
|
||||
return (ctx->methods->ctxrun(ctx));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_app_ctxonrun(isc_appctx_t *ctx, isc_mem_t *mctx,
|
||||
isc_task_t *task, isc_taskaction_t action,
|
||||
void *arg)
|
||||
{
|
||||
REQUIRE(ISCAPI_APPCTX_VALID(ctx));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__app_ctxonrun(ctx, mctx, task, action, arg));
|
||||
|
||||
return (ctx->methods->ctxonrun(ctx, mctx, task, action, arg));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_app_ctxsuspend(isc_appctx_t *ctx) {
|
||||
REQUIRE(ISCAPI_APPCTX_VALID(ctx));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__app_ctxsuspend(ctx));
|
||||
|
||||
return (ctx->methods->ctxsuspend(ctx));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_app_ctxshutdown(isc_appctx_t *ctx) {
|
||||
REQUIRE(ISCAPI_APPCTX_VALID(ctx));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__app_ctxshutdown(ctx));
|
||||
|
||||
return (ctx->methods->ctxshutdown(ctx));
|
||||
}
|
||||
|
||||
void
|
||||
isc_app_ctxfinish(isc_appctx_t *ctx) {
|
||||
REQUIRE(ISCAPI_APPCTX_VALID(ctx));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__app_ctxfinish(ctx);
|
||||
|
||||
ctx->methods->ctxfinish(ctx);
|
||||
}
|
||||
|
||||
void
|
||||
isc_appctx_settaskmgr(isc_appctx_t *ctx, isc_taskmgr_t *taskmgr) {
|
||||
REQUIRE(ISCAPI_APPCTX_VALID(ctx));
|
||||
REQUIRE(taskmgr != NULL);
|
||||
|
||||
if (isc_bind9)
|
||||
isc__appctx_settaskmgr(ctx, taskmgr);
|
||||
|
||||
ctx->methods->settaskmgr(ctx, taskmgr);
|
||||
}
|
||||
|
||||
void
|
||||
isc_appctx_setsocketmgr(isc_appctx_t *ctx, isc_socketmgr_t *socketmgr) {
|
||||
REQUIRE(ISCAPI_APPCTX_VALID(ctx));
|
||||
REQUIRE(socketmgr != NULL);
|
||||
|
||||
if (isc_bind9)
|
||||
isc__appctx_setsocketmgr(ctx, socketmgr);
|
||||
|
||||
ctx->methods->setsocketmgr(ctx, socketmgr);
|
||||
}
|
||||
|
||||
void
|
||||
isc_appctx_settimermgr(isc_appctx_t *ctx, isc_timermgr_t *timermgr) {
|
||||
REQUIRE(ISCAPI_APPCTX_VALID(ctx));
|
||||
REQUIRE(timermgr != NULL);
|
||||
|
||||
if (isc_bind9)
|
||||
isc__appctx_settimermgr(ctx, timermgr);
|
||||
|
||||
ctx->methods->settimermgr(ctx, timermgr);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_app_start(void) {
|
||||
if (isc_bind9)
|
||||
return (isc__app_start());
|
||||
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_app_onrun(isc_mem_t *mctx, isc_task_t *task,
|
||||
isc_taskaction_t action, void *arg)
|
||||
{
|
||||
if (isc_bind9)
|
||||
return (isc__app_onrun(mctx, task, action, arg));
|
||||
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_app_run() {
|
||||
if (isc_bind9) {
|
||||
isc_result_t result;
|
||||
|
||||
is_running = true;
|
||||
result = isc__app_run();
|
||||
is_running = false;
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
|
||||
bool
|
||||
isc_app_isrunning() {
|
||||
return (is_running);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_app_shutdown(void) {
|
||||
if (isc_bind9)
|
||||
return (isc__app_shutdown());
|
||||
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_app_reload(void) {
|
||||
if (isc_bind9)
|
||||
return (isc__app_reload());
|
||||
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
|
||||
void
|
||||
isc_app_finish(void) {
|
||||
if (!isc_bind9)
|
||||
return;
|
||||
|
||||
isc__app_finish();
|
||||
}
|
||||
|
||||
void
|
||||
isc_app_block(void) {
|
||||
if (!isc_bind9)
|
||||
return;
|
||||
|
||||
isc__app_block();
|
||||
}
|
||||
|
||||
void
|
||||
isc_app_unblock(void) {
|
||||
if (!isc_bind9)
|
||||
return;
|
||||
|
||||
isc__app_unblock();
|
||||
}
|
||||
@@ -94,29 +94,6 @@ typedef isc_event_t isc_appevent_t;
|
||||
#define ISC_APPEVENT_SHUTDOWN (ISC_EVENTCLASS_APP + 1)
|
||||
#define ISC_APPEVENT_LASTEVENT (ISC_EVENTCLASS_APP + 65535)
|
||||
|
||||
/*%
|
||||
* app module methods. Only app driver implementations use this structure.
|
||||
* Other clients should use the top-level interfaces (i.e., isc_app_xxx
|
||||
* functions). magic must be ISCAPI_APPMETHODS_MAGIC.
|
||||
*/
|
||||
typedef struct isc_appmethods {
|
||||
void (*ctxdestroy)(isc_appctx_t **ctxp);
|
||||
isc_result_t (*ctxstart)(isc_appctx_t *ctx);
|
||||
isc_result_t (*ctxrun)(isc_appctx_t *ctx);
|
||||
isc_result_t (*ctxsuspend)(isc_appctx_t *ctx);
|
||||
isc_result_t (*ctxshutdown)(isc_appctx_t *ctx);
|
||||
void (*ctxfinish)(isc_appctx_t *ctx);
|
||||
void (*settaskmgr)(isc_appctx_t *ctx,
|
||||
isc_taskmgr_t *timermgr);
|
||||
void (*setsocketmgr)(isc_appctx_t *ctx,
|
||||
isc_socketmgr_t *timermgr);
|
||||
void (*settimermgr)(isc_appctx_t *ctx,
|
||||
isc_timermgr_t *timermgr);
|
||||
isc_result_t (*ctxonrun)(isc_appctx_t *ctx, isc_mem_t *mctx,
|
||||
isc_task_t *task, isc_taskaction_t action,
|
||||
void *arg);
|
||||
} isc_appmethods_t;
|
||||
|
||||
/*%
|
||||
* This structure is actually just the common prefix of an application context
|
||||
* implementation's version of an isc_appctx_t.
|
||||
@@ -129,7 +106,6 @@ typedef struct isc_appmethods {
|
||||
struct isc_appctx {
|
||||
unsigned int impmagic;
|
||||
unsigned int magic;
|
||||
isc_appmethods_t *methods;
|
||||
};
|
||||
|
||||
#define ISCAPI_APPCTX_MAGIC ISC_MAGIC('A','a','p','c')
|
||||
|
||||
@@ -181,44 +181,6 @@ LIBISC_EXTERNAL_DATA extern unsigned int isc_mem_defaultflags;
|
||||
* \endcode
|
||||
*/
|
||||
|
||||
/*% memory and memory pool methods */
|
||||
typedef struct isc_memmethods {
|
||||
void (*attach)(isc_mem_t *source, isc_mem_t **targetp);
|
||||
void (*detach)(isc_mem_t **mctxp);
|
||||
void (*destroy)(isc_mem_t **mctxp);
|
||||
void *(*memget)(isc_mem_t *mctx, size_t size _ISC_MEM_FLARG);
|
||||
void (*memput)(isc_mem_t *mctx, void *ptr, size_t size _ISC_MEM_FLARG);
|
||||
void (*memputanddetach)(isc_mem_t **mctxp, void *ptr,
|
||||
size_t size _ISC_MEM_FLARG);
|
||||
void *(*memallocate)(isc_mem_t *mctx, size_t size _ISC_MEM_FLARG);
|
||||
void *(*memreallocate)(isc_mem_t *mctx, void *ptr,
|
||||
size_t size _ISC_MEM_FLARG);
|
||||
char *(*memstrdup)(isc_mem_t *mctx, const char *s _ISC_MEM_FLARG);
|
||||
void (*memfree)(isc_mem_t *mctx, void *ptr _ISC_MEM_FLARG);
|
||||
void (*setdestroycheck)(isc_mem_t *mctx, bool flag);
|
||||
void (*setwater)(isc_mem_t *ctx, isc_mem_water_t water,
|
||||
void *water_arg, size_t hiwater, size_t lowater);
|
||||
void (*waterack)(isc_mem_t *ctx, int flag);
|
||||
size_t (*inuse)(isc_mem_t *mctx);
|
||||
size_t (*maxinuse)(isc_mem_t *mctx);
|
||||
size_t (*total)(isc_mem_t *mctx);
|
||||
bool (*isovermem)(isc_mem_t *mctx);
|
||||
isc_result_t (*mpcreate)(isc_mem_t *mctx, size_t size,
|
||||
isc_mempool_t **mpctxp);
|
||||
} isc_memmethods_t;
|
||||
|
||||
typedef struct isc_mempoolmethods {
|
||||
void (*destroy)(isc_mempool_t **mpctxp);
|
||||
void *(*get)(isc_mempool_t *mpctx _ISC_MEM_FLARG);
|
||||
void (*put)(isc_mempool_t *mpctx, void *mem _ISC_MEM_FLARG);
|
||||
unsigned int (*getallocated)(isc_mempool_t *mpctx);
|
||||
void (*setmaxalloc)(isc_mempool_t *mpctx, unsigned int limit);
|
||||
void (*setfreemax)(isc_mempool_t *mpctx, unsigned int limit);
|
||||
void (*setname)(isc_mempool_t *mpctx, const char *name);
|
||||
void (*associatelock)(isc_mempool_t *mpctx, isc_mutex_t *lock);
|
||||
void (*setfillcount)(isc_mempool_t *mpctx, unsigned int limit);
|
||||
} isc_mempoolmethods_t;
|
||||
|
||||
/*%
|
||||
* This structure is actually just the common prefix of a memory context
|
||||
* implementation's version of an isc_mem_t.
|
||||
@@ -231,7 +193,6 @@ typedef struct isc_mempoolmethods {
|
||||
struct isc_mem {
|
||||
unsigned int impmagic;
|
||||
unsigned int magic;
|
||||
isc_memmethods_t *methods;
|
||||
};
|
||||
|
||||
#define ISCAPI_MCTX_MAGIC ISC_MAGIC('A','m','c','x')
|
||||
@@ -245,7 +206,6 @@ struct isc_mem {
|
||||
struct isc_mempool {
|
||||
unsigned int impmagic;
|
||||
unsigned int magic;
|
||||
isc_mempoolmethods_t *methods;
|
||||
};
|
||||
|
||||
#define ISCAPI_MPOOL_MAGIC ISC_MAGIC('A','m','p','l')
|
||||
@@ -702,30 +662,6 @@ ISCMEMPOOLFUNC(get)(isc_mempool_t * _ISC_MEM_FLARG);
|
||||
void
|
||||
ISCMEMPOOLFUNC(put)(isc_mempool_t *, void * _ISC_MEM_FLARG);
|
||||
|
||||
/*%<
|
||||
* See isc_mem_create2() above.
|
||||
*/
|
||||
typedef isc_result_t
|
||||
(*isc_memcreatefunc_t)(size_t init_max_size, size_t target_size,
|
||||
isc_mem_t **ctxp, unsigned int flags);
|
||||
|
||||
isc_result_t
|
||||
isc_mem_register(isc_memcreatefunc_t createfunc);
|
||||
/*%<
|
||||
* Register a new memory management implementation and add it to the list of
|
||||
* supported implementations. This function must be called when a different
|
||||
* memory management library is used than the one contained in the ISC library.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
isc__mem_register(void);
|
||||
/*%<
|
||||
* A short cut function that specifies the memory management module in the ISC
|
||||
* library for isc_mem_register(). An application that uses the ISC library
|
||||
* usually do not have to care about this function: it would call
|
||||
* isc_lib_register(), which internally calls this function.
|
||||
*/
|
||||
|
||||
void
|
||||
isc__mem_printactive(isc_mem_t *mctx, FILE *file);
|
||||
/*%<
|
||||
|
||||
+15
-221
@@ -62,55 +62,6 @@
|
||||
#include <isc/types.h>
|
||||
#include <isc/xml.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
/* from the old namespace.h */
|
||||
|
||||
#define isc_socket_create isc__socket_create
|
||||
#define isc_socket_dup isc__socket_dup
|
||||
#define isc_socket_attach isc__socket_attach
|
||||
#define isc_socket_detach isc__socket_detach
|
||||
#define isc_socketmgr_create isc__socketmgr_create
|
||||
#define isc_socketmgr_create2 isc__socketmgr_create2
|
||||
#define isc_socketmgr_destroy isc__socketmgr_destroy
|
||||
#define isc_socket_open isc__socket_open
|
||||
#define isc_socket_close isc__socket_close
|
||||
#define isc_socket_recvv isc__socket_recvv
|
||||
#define isc_socket_recv isc__socket_recv
|
||||
#define isc_socket_recv2 isc__socket_recv2
|
||||
#define isc_socket_send isc__socket_send
|
||||
#define isc_socket_sendto isc__socket_sendto
|
||||
#define isc_socket_sendv isc__socket_sendv
|
||||
#define isc_socket_sendtov isc__socket_sendtov
|
||||
#define isc_socket_sendtov2 isc__socket_sendtov2
|
||||
#define isc_socket_sendto2 isc__socket_sendto2
|
||||
#define isc_socket_cleanunix isc__socket_cleanunix
|
||||
#define isc_socket_permunix isc__socket_permunix
|
||||
#define isc_socket_bind isc__socket_bind
|
||||
#define isc_socket_filter isc__socket_filter
|
||||
#define isc_socket_listen isc__socket_listen
|
||||
#define isc_socket_accept isc__socket_accept
|
||||
#define isc_socket_connect isc__socket_connect
|
||||
#define isc_socket_getfd isc__socket_getfd
|
||||
#define isc_socket_getname isc__socket_getname
|
||||
#define isc_socket_gettag isc__socket_gettag
|
||||
#define isc_socket_getpeername isc__socket_getpeername
|
||||
#define isc_socket_getsockname isc__socket_getsockname
|
||||
#define isc_socket_cancel isc__socket_cancel
|
||||
#define isc_socket_gettype isc__socket_gettype
|
||||
#define isc_socket_isbound isc__socket_isbound
|
||||
#define isc_socket_ipv6only isc__socket_ipv6only
|
||||
#define isc_socket_setname isc__socket_setname
|
||||
#define isc_socketmgr_getmaxsockets isc__socketmgr_getmaxsockets
|
||||
#define isc_socketmgr_setstats isc__socketmgr_setstats
|
||||
#define isc_socketmgr_setreserved isc__socketmgr_setreserved
|
||||
#define isc__socketmgr_maxudp isc___socketmgr_maxudp
|
||||
#define isc_socket_fdwatchcreate isc__socket_fdwatchcreate
|
||||
#define isc_socket_fdwatchpoke isc__socket_fdwatchpoke
|
||||
#define isc_socket_dscp isc__socket_dscp
|
||||
|
||||
#endif
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
/***
|
||||
@@ -261,6 +212,7 @@ struct isc_socketevent {
|
||||
enum */
|
||||
isc_eventdestructor_t destroy; /*%< original destructor */
|
||||
unsigned int dscp; /*%< UDP dscp value */
|
||||
isc_taskaction_t action;
|
||||
};
|
||||
|
||||
typedef struct isc_socket_newconnev isc_socket_newconnev_t;
|
||||
@@ -293,8 +245,7 @@ typedef enum {
|
||||
isc_sockettype_udp = 1,
|
||||
isc_sockettype_tcp = 2,
|
||||
isc_sockettype_unix = 3,
|
||||
isc_sockettype_fdwatch = 4,
|
||||
isc_sockettype_raw = 5
|
||||
isc_sockettype_raw = 4
|
||||
} isc_sockettype_t;
|
||||
|
||||
/*@{*/
|
||||
@@ -325,68 +276,6 @@ typedef enum {
|
||||
#define ISC_SOCKFLAG_NORETRY 0x00000002 /*%< drop failed UDP sends */
|
||||
/*@}*/
|
||||
|
||||
/*@{*/
|
||||
/*!
|
||||
* Flags for fdwatchcreate.
|
||||
*/
|
||||
#define ISC_SOCKFDWATCH_READ 0x00000001 /*%< watch for readable */
|
||||
#define ISC_SOCKFDWATCH_WRITE 0x00000002 /*%< watch for writable */
|
||||
/*@}*/
|
||||
|
||||
/*% Socket and socket manager methods */
|
||||
typedef struct isc_socketmgrmethods {
|
||||
void (*destroy)(isc_socketmgr_t **managerp);
|
||||
isc_result_t (*socketcreate)(isc_socketmgr_t *manager, int pf,
|
||||
isc_sockettype_t type,
|
||||
isc_socket_t **socketp);
|
||||
isc_result_t (*fdwatchcreate)(isc_socketmgr_t *manager, int fd,
|
||||
int flags,
|
||||
isc_sockfdwatch_t callback,
|
||||
void *cbarg, isc_task_t *task,
|
||||
isc_socket_t **socketp);
|
||||
} isc_socketmgrmethods_t;
|
||||
|
||||
typedef struct isc_socketmethods {
|
||||
void (*attach)(isc_socket_t *socket,
|
||||
isc_socket_t **socketp);
|
||||
void (*detach)(isc_socket_t **socketp);
|
||||
isc_result_t (*bind)(isc_socket_t *sock,
|
||||
const isc_sockaddr_t *sockaddr,
|
||||
isc_socket_options_t options);
|
||||
isc_result_t (*sendto)(isc_socket_t *sock, isc_region_t *region,
|
||||
isc_task_t *task, isc_taskaction_t action,
|
||||
void *arg,
|
||||
const isc_sockaddr_t *address,
|
||||
struct in6_pktinfo *pktinfo);
|
||||
isc_result_t (*sendto2)(isc_socket_t *sock, isc_region_t *region,
|
||||
isc_task_t *task,
|
||||
const isc_sockaddr_t *address,
|
||||
struct in6_pktinfo *pktinfo,
|
||||
isc_socketevent_t *event,
|
||||
unsigned int flags);
|
||||
isc_result_t (*connect)(isc_socket_t *sock,
|
||||
const isc_sockaddr_t *addr,
|
||||
isc_task_t *task, isc_taskaction_t action,
|
||||
void *arg);
|
||||
isc_result_t (*recv)(isc_socket_t *sock, isc_region_t *region,
|
||||
unsigned int minimum, isc_task_t *task,
|
||||
isc_taskaction_t action, void *arg);
|
||||
isc_result_t (*recv2)(isc_socket_t *sock, isc_region_t *region,
|
||||
unsigned int minimum, isc_task_t *task,
|
||||
isc_socketevent_t *event, unsigned int flags);
|
||||
void (*cancel)(isc_socket_t *sock, isc_task_t *task,
|
||||
unsigned int how);
|
||||
isc_result_t (*getsockname)(isc_socket_t *sock,
|
||||
isc_sockaddr_t *addressp);
|
||||
isc_sockettype_t (*gettype)(isc_socket_t *sock);
|
||||
void (*ipv6only)(isc_socket_t *sock, bool yes);
|
||||
isc_result_t (*fdwatchpoke)(isc_socket_t *sock, int flags);
|
||||
isc_result_t (*dup)(isc_socket_t *socket,
|
||||
isc_socket_t **socketp);
|
||||
int (*getfd)(isc_socket_t *socket);
|
||||
void (*dscp)(isc_socket_t *socket, isc_dscp_t dscp);
|
||||
} isc_socketmethods_t;
|
||||
|
||||
/*%
|
||||
* This structure is actually just the common prefix of a socket manager
|
||||
* object implementation's version of an isc_socketmgr_t.
|
||||
@@ -404,7 +293,6 @@ typedef struct isc_socketmethods {
|
||||
struct isc_socketmgr {
|
||||
unsigned int impmagic;
|
||||
unsigned int magic;
|
||||
isc_socketmgrmethods_t *methods;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -420,7 +308,6 @@ struct isc_socketmgr {
|
||||
struct isc_socket {
|
||||
unsigned int impmagic;
|
||||
unsigned int magic;
|
||||
isc_socketmethods_t *methods;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -435,76 +322,6 @@ struct isc_socket {
|
||||
*** those functions which return an isc_result.
|
||||
***/
|
||||
|
||||
isc_result_t
|
||||
isc_socket_fdwatchcreate(isc_socketmgr_t *manager,
|
||||
int fd,
|
||||
int flags,
|
||||
isc_sockfdwatch_t callback,
|
||||
void *cbarg,
|
||||
isc_task_t *task,
|
||||
isc_socket_t **socketp);
|
||||
/*%<
|
||||
* Create a new file descriptor watch socket managed by 'manager'.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
*\li 'fd' is the already-opened file descriptor (must be less
|
||||
* than maxsockets).
|
||||
*\li This function is not available on Windows.
|
||||
*\li The callback function is called "in-line" - this means the function
|
||||
* needs to return as fast as possible, as all other I/O will be suspended
|
||||
* until the callback completes.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li 'manager' is a valid manager
|
||||
*
|
||||
*\li 'socketp' is a valid pointer, and *socketp == NULL
|
||||
*
|
||||
*\li 'fd' be opened.
|
||||
*
|
||||
* Ensures:
|
||||
*
|
||||
* '*socketp' is attached to the newly created fdwatch socket
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
*\li #ISC_R_SUCCESS
|
||||
*\li #ISC_R_NOMEMORY
|
||||
*\li #ISC_R_NORESOURCES
|
||||
*\li #ISC_R_UNEXPECTED
|
||||
*\li #ISC_R_RANGE
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
isc_socket_fdwatchpoke(isc_socket_t *sock,
|
||||
int flags);
|
||||
/*%<
|
||||
* Poke a file descriptor watch socket informing the manager that it
|
||||
* should restart watching the socket
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
*\li 'sock' is the socket returned by isc_socket_fdwatchcreate
|
||||
*
|
||||
*\li 'flags' indicates what the manager should watch for on the socket
|
||||
* in addition to what it may already be watching. It can be one or
|
||||
* both of ISC_SOCKFDWATCH_READ and ISC_SOCKFDWATCH_WRITE. To
|
||||
* temporarily disable watching on a socket the value indicating
|
||||
* no more data should be returned from the call back routine.
|
||||
*
|
||||
*\li This function is not available on Windows.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li 'sock' is a valid isc socket
|
||||
*
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
*\li #ISC_R_SUCCESS
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
isc_socket_create(isc_socketmgr_t *manager,
|
||||
int pf,
|
||||
@@ -513,9 +330,6 @@ isc_socket_create(isc_socketmgr_t *manager,
|
||||
/*%<
|
||||
* Create a new 'type' socket managed by 'manager'.
|
||||
*
|
||||
* For isc_sockettype_fdwatch sockets you should use isc_socket_fdwatchcreate()
|
||||
* rather than isc_socket_create().
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
*\li 'pf' is the desired protocol family, e.g. PF_INET or PF_INET6.
|
||||
@@ -526,8 +340,6 @@ isc_socket_create(isc_socketmgr_t *manager,
|
||||
*
|
||||
*\li 'socketp' is a valid pointer, and *socketp == NULL
|
||||
*
|
||||
*\li 'type' is not isc_sockettype_fdwatch
|
||||
*
|
||||
* Ensures:
|
||||
*
|
||||
* '*socketp' is attached to the newly created socket
|
||||
@@ -657,17 +469,12 @@ isc_socket_open(isc_socket_t *sock);
|
||||
* one. This optimization may not be available for some systems, in which
|
||||
* case this function will return ISC_R_NOTIMPLEMENTED and must not be used.
|
||||
*
|
||||
* isc_socket_open() should not be called on sockets created by
|
||||
* isc_socket_fdwatchcreate().
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
* \li there must be no other reference to this socket.
|
||||
*
|
||||
* \li 'socket' is a valid and previously closed by isc_socket_close()
|
||||
*
|
||||
* \li 'sock->type' is not isc_sockettype_fdwatch
|
||||
*
|
||||
* Returns:
|
||||
* Same as isc_socket_create().
|
||||
* \li ISC_R_NOTIMPLEMENTED
|
||||
@@ -683,9 +490,6 @@ isc_socket_close(isc_socket_t *sock);
|
||||
* systems, in which case this function will return ISC_R_NOTIMPLEMENTED and
|
||||
* must not be used.
|
||||
*
|
||||
* isc_socket_close() should not be called on sockets created by
|
||||
* isc_socket_fdwatchcreate().
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
* \li The socket must have a valid descriptor.
|
||||
@@ -694,8 +498,6 @@ isc_socket_close(isc_socket_t *sock);
|
||||
*
|
||||
* \li There must be no pending I/O requests.
|
||||
*
|
||||
* \li 'sock->type' is not isc_sockettype_fdwatch
|
||||
*
|
||||
* Returns:
|
||||
* \li #ISC_R_NOTIMPLEMENTED
|
||||
*/
|
||||
@@ -1039,7 +841,7 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp);
|
||||
|
||||
isc_result_t
|
||||
isc_socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp,
|
||||
unsigned int maxsocks);
|
||||
unsigned int maxsocks, int nthreads);
|
||||
/*%<
|
||||
* Create a socket manager. If "maxsocks" is non-zero, it specifies the
|
||||
* maximum number of sockets that the created manager should handle.
|
||||
@@ -1138,7 +940,7 @@ isc_socket_gettype(isc_socket_t *sock);
|
||||
|
||||
/*@{*/
|
||||
bool
|
||||
isc__socket_isbound(isc_socket_t *sock);
|
||||
isc_socket_isbound(isc_socket_t *sock);
|
||||
/*%
|
||||
* Intended for internal use in BIND9 only
|
||||
*/
|
||||
@@ -1231,17 +1033,23 @@ int isc_socket_getfd(isc_socket_t *socket);
|
||||
*/
|
||||
|
||||
void
|
||||
isc__socketmgr_setreserved(isc_socketmgr_t *mgr, uint32_t);
|
||||
isc_socketmgr_setreserved(isc_socketmgr_t *mgr, uint32_t);
|
||||
/*%<
|
||||
* Temporary. For use by named only.
|
||||
*/
|
||||
|
||||
void
|
||||
isc__socketmgr_maxudp(isc_socketmgr_t *mgr, int maxudp);
|
||||
isc_socketmgr_maxudp(isc_socketmgr_t *mgr, int maxudp);
|
||||
/*%<
|
||||
* Test interface. Drop UDP packet > 'maxudp'.
|
||||
*/
|
||||
|
||||
bool
|
||||
isc_socket_hasreuseport(void);
|
||||
/*%<
|
||||
* Return true if there is SO_REUSEPORT support
|
||||
*/
|
||||
|
||||
#ifdef HAVE_LIBXML2
|
||||
int
|
||||
isc_socketmgr_renderxml(isc_socketmgr_t *mgr, xmlTextWriterPtr writer);
|
||||
@@ -1264,23 +1072,9 @@ isc_socketmgr_renderjson(isc_socketmgr_t *mgr, json_object *stats);
|
||||
typedef isc_result_t
|
||||
(*isc_socketmgrcreatefunc_t)(isc_mem_t *mctx, isc_socketmgr_t **managerp);
|
||||
|
||||
isc_result_t
|
||||
isc_socket_register(isc_socketmgrcreatefunc_t createfunc);
|
||||
/*%<
|
||||
* Register a new socket I/O implementation and add it to the list of
|
||||
* supported implementations. This function must be called when a different
|
||||
* event library is used than the one contained in the ISC library.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
isc__socket_register(void);
|
||||
/*%<
|
||||
* A short cut function that specifies the socket I/O module in the ISC
|
||||
* library for isc_socket_register(). An application that uses the ISC library
|
||||
* usually do not have to care about this function: it would call
|
||||
* isc_lib_register(), which internally calls this function.
|
||||
*/
|
||||
typedef isc_socketevent_t* (*isc_socketevent_factory_t)(void*);
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
isc_result_t
|
||||
isc_socket_udpsubscribe(isc_socket_t *sock, isc_socketevent_factory_t evf, void* arg);
|
||||
#endif /* ISC_SOCKET_H */
|
||||
|
||||
@@ -102,42 +102,6 @@ typedef enum {
|
||||
isc_taskmgrmode_privileged
|
||||
} isc_taskmgrmode_t;
|
||||
|
||||
/*% Task and task manager methods */
|
||||
typedef struct isc_taskmgrmethods {
|
||||
void (*destroy)(isc_taskmgr_t **managerp);
|
||||
void (*setmode)(isc_taskmgr_t *manager,
|
||||
isc_taskmgrmode_t mode);
|
||||
isc_taskmgrmode_t (*mode)(isc_taskmgr_t *manager);
|
||||
isc_result_t (*taskcreate)(isc_taskmgr_t *manager,
|
||||
unsigned int quantum,
|
||||
isc_task_t **taskp);
|
||||
void (*setexcltask)(isc_taskmgr_t *mgr, isc_task_t *task);
|
||||
isc_result_t (*excltask)(isc_taskmgr_t *mgr, isc_task_t **taskp);
|
||||
} isc_taskmgrmethods_t;
|
||||
|
||||
typedef struct isc_taskmethods {
|
||||
void (*attach)(isc_task_t *source, isc_task_t **targetp);
|
||||
void (*detach)(isc_task_t **taskp);
|
||||
void (*destroy)(isc_task_t **taskp);
|
||||
void (*send)(isc_task_t *task, isc_event_t **eventp);
|
||||
void (*sendanddetach)(isc_task_t **taskp, isc_event_t **eventp);
|
||||
unsigned int (*unsend)(isc_task_t *task, void *sender, isc_eventtype_t type,
|
||||
void *tag, isc_eventlist_t *events);
|
||||
isc_result_t (*onshutdown)(isc_task_t *task, isc_taskaction_t action,
|
||||
void *arg);
|
||||
void (*shutdown)(isc_task_t *task);
|
||||
void (*setname)(isc_task_t *task, const char *name, void *tag);
|
||||
unsigned int (*purgeevents)(isc_task_t *task, void *sender,
|
||||
isc_eventtype_t type, void *tag);
|
||||
unsigned int (*purgerange)(isc_task_t *task, void *sender,
|
||||
isc_eventtype_t first, isc_eventtype_t last,
|
||||
void *tag);
|
||||
isc_result_t (*beginexclusive)(isc_task_t *task);
|
||||
void (*endexclusive)(isc_task_t *task);
|
||||
void (*setprivilege)(isc_task_t *task, bool priv);
|
||||
bool (*privilege)(isc_task_t *task);
|
||||
} isc_taskmethods_t;
|
||||
|
||||
/*%
|
||||
* This structure is actually just the common prefix of a task manager
|
||||
* object implementation's version of an isc_taskmgr_t.
|
||||
@@ -150,7 +114,6 @@ typedef struct isc_taskmethods {
|
||||
struct isc_taskmgr {
|
||||
unsigned int impmagic;
|
||||
unsigned int magic;
|
||||
isc_taskmgrmethods_t *methods;
|
||||
};
|
||||
|
||||
#define ISCAPI_TASKMGR_MAGIC ISC_MAGIC('A','t','m','g')
|
||||
@@ -164,7 +127,6 @@ struct isc_taskmgr {
|
||||
struct isc_task {
|
||||
unsigned int impmagic;
|
||||
unsigned int magic;
|
||||
isc_taskmethods_t *methods;
|
||||
};
|
||||
|
||||
#define ISCAPI_TASK_MAGIC ISC_MAGIC('A','t','s','t')
|
||||
@@ -244,6 +206,11 @@ isc_task_detach(isc_task_t **taskp);
|
||||
* all resources used by the task will be freed.
|
||||
*/
|
||||
|
||||
void
|
||||
isc_task_sendto(isc_task_t *task, isc_event_t **eventp, int c);
|
||||
void
|
||||
isc_task_sendanddetachto(isc_task_t **taskp, isc_event_t **eventp, int c);
|
||||
|
||||
void
|
||||
isc_task_send(isc_task_t *task, isc_event_t **eventp);
|
||||
/*%<
|
||||
|
||||
@@ -99,29 +99,6 @@ typedef struct isc_timerevent {
|
||||
#define ISC_TIMEREVENT_LIFE (ISC_EVENTCLASS_TIMER + 3)
|
||||
#define ISC_TIMEREVENT_LASTEVENT (ISC_EVENTCLASS_TIMER + 65535)
|
||||
|
||||
/*% Timer and timer manager methods */
|
||||
typedef struct {
|
||||
void (*destroy)(isc_timermgr_t **managerp);
|
||||
isc_result_t (*timercreate)(isc_timermgr_t *manager,
|
||||
isc_timertype_t type,
|
||||
const isc_time_t *expires,
|
||||
const isc_interval_t *interval,
|
||||
isc_task_t *task,
|
||||
isc_taskaction_t action,
|
||||
void *arg,
|
||||
isc_timer_t **timerp);
|
||||
} isc_timermgrmethods_t;
|
||||
|
||||
typedef struct {
|
||||
void (*attach)(isc_timer_t *timer, isc_timer_t **timerp);
|
||||
void (*detach)(isc_timer_t **timerp);
|
||||
isc_result_t (*reset)(isc_timer_t *timer, isc_timertype_t type,
|
||||
const isc_time_t *expires,
|
||||
const isc_interval_t *interval,
|
||||
bool purge);
|
||||
isc_result_t (*touch)(isc_timer_t *timer);
|
||||
} isc_timermethods_t;
|
||||
|
||||
/*%
|
||||
* This structure is actually just the common prefix of a timer manager
|
||||
* object implementation's version of an isc_timermgr_t.
|
||||
@@ -134,7 +111,6 @@ typedef struct {
|
||||
struct isc_timermgr {
|
||||
unsigned int impmagic;
|
||||
unsigned int magic;
|
||||
isc_timermgrmethods_t *methods;
|
||||
};
|
||||
|
||||
#define ISCAPI_TIMERMGR_MAGIC ISC_MAGIC('A','t','m','g')
|
||||
@@ -148,7 +124,6 @@ struct isc_timermgr {
|
||||
struct isc_timer {
|
||||
unsigned int impmagic;
|
||||
unsigned int magic;
|
||||
isc_timermethods_t *methods;
|
||||
};
|
||||
|
||||
#define ISCAPI_TIMER_MAGIC ISC_MAGIC('A','t','m','r')
|
||||
|
||||
+1
-15
@@ -77,21 +77,7 @@ isc_lib_initmsgcat(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static isc_once_t register_once = ISC_ONCE_INIT;
|
||||
|
||||
static void
|
||||
do_register(void) {
|
||||
isc_bind9 = false;
|
||||
|
||||
RUNTIME_CHECK(isc__mem_register() == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc__app_register() == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc__task_register() == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc__socket_register() == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc__timer_register() == ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
void
|
||||
isc_lib_register(void) {
|
||||
RUNTIME_CHECK(isc_once_do(®ister_once, do_register)
|
||||
== ISC_R_SUCCESS);
|
||||
isc_bind9 = false;
|
||||
}
|
||||
|
||||
+31
-531
@@ -111,7 +111,6 @@ static ISC_LIST(isc__mem_t) contexts;
|
||||
|
||||
static isc_once_t once = ISC_ONCE_INIT;
|
||||
static isc_mutex_t contextslock;
|
||||
static isc_mutex_t createlock;
|
||||
|
||||
/*%
|
||||
* Total size of lost memory due to a bug of external library.
|
||||
@@ -218,163 +217,6 @@ struct isc__mempool {
|
||||
static void
|
||||
print_active(isc__mem_t *ctx, FILE *out);
|
||||
|
||||
#endif /* ISC_MEM_TRACKLINES */
|
||||
|
||||
/*%
|
||||
* The following are intended for internal use (indicated by "isc__"
|
||||
* prefix) but are not declared as static, allowing direct access
|
||||
* from unit tests, etc.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
isc__mem_create2(size_t init_max_size, size_t target_size,
|
||||
isc_mem_t **ctxp, unsigned int flags);
|
||||
void
|
||||
isc__mem_attach(isc_mem_t *source, isc_mem_t **targetp);
|
||||
void
|
||||
isc__mem_detach(isc_mem_t **ctxp);
|
||||
void
|
||||
isc___mem_putanddetach(isc_mem_t **ctxp, void *ptr, size_t size FLARG);
|
||||
void
|
||||
isc__mem_destroy(isc_mem_t **ctxp);
|
||||
void *
|
||||
isc___mem_get(isc_mem_t *ctx, size_t size FLARG);
|
||||
void
|
||||
isc___mem_put(isc_mem_t *ctx, void *ptr, size_t size FLARG);
|
||||
void
|
||||
isc__mem_stats(isc_mem_t *ctx, FILE *out);
|
||||
void *
|
||||
isc___mem_allocate(isc_mem_t *ctx, size_t size FLARG);
|
||||
void *
|
||||
isc___mem_reallocate(isc_mem_t *ctx, void *ptr, size_t size FLARG);
|
||||
void
|
||||
isc___mem_free(isc_mem_t *ctx, void *ptr FLARG);
|
||||
char *
|
||||
isc___mem_strdup(isc_mem_t *mctx, const char *s FLARG);
|
||||
void
|
||||
isc__mem_setdestroycheck(isc_mem_t *ctx, bool flag);
|
||||
void
|
||||
isc__mem_setquota(isc_mem_t *ctx, size_t quota);
|
||||
size_t
|
||||
isc__mem_getquota(isc_mem_t *ctx);
|
||||
size_t
|
||||
isc__mem_inuse(isc_mem_t *ctx);
|
||||
size_t
|
||||
isc__mem_maxinuse(isc_mem_t *ctx);
|
||||
size_t
|
||||
isc__mem_total(isc_mem_t *ctx);
|
||||
bool
|
||||
isc__mem_isovermem(isc_mem_t *ctx);
|
||||
void
|
||||
isc__mem_setwater(isc_mem_t *ctx, isc_mem_water_t water, void *water_arg,
|
||||
size_t hiwater, size_t lowater);
|
||||
void
|
||||
isc__mem_waterack(isc_mem_t *ctx0, int flag);
|
||||
void
|
||||
isc__mem_setname(isc_mem_t *ctx, const char *name, void *tag);
|
||||
const char *
|
||||
isc__mem_getname(isc_mem_t *ctx);
|
||||
void *
|
||||
isc__mem_gettag(isc_mem_t *ctx);
|
||||
isc_result_t
|
||||
isc__mempool_create(isc_mem_t *mctx, size_t size, isc_mempool_t **mpctxp);
|
||||
void
|
||||
isc__mempool_setname(isc_mempool_t *mpctx, const char *name);
|
||||
void
|
||||
isc__mempool_destroy(isc_mempool_t **mpctxp);
|
||||
void
|
||||
isc__mempool_associatelock(isc_mempool_t *mpctx, isc_mutex_t *lock);
|
||||
void *
|
||||
isc___mempool_get(isc_mempool_t *mpctx FLARG);
|
||||
void
|
||||
isc___mempool_put(isc_mempool_t *mpctx, void *mem FLARG);
|
||||
void
|
||||
isc__mempool_setfreemax(isc_mempool_t *mpctx, unsigned int limit);
|
||||
unsigned int
|
||||
isc__mempool_getfreemax(isc_mempool_t *mpctx);
|
||||
unsigned int
|
||||
isc__mempool_getfreecount(isc_mempool_t *mpctx);
|
||||
void
|
||||
isc__mempool_setmaxalloc(isc_mempool_t *mpctx, unsigned int limit);
|
||||
unsigned int
|
||||
isc__mempool_getmaxalloc(isc_mempool_t *mpctx);
|
||||
unsigned int
|
||||
isc__mempool_getallocated(isc_mempool_t *mpctx);
|
||||
void
|
||||
isc__mempool_setfillcount(isc_mempool_t *mpctx, unsigned int limit);
|
||||
unsigned int
|
||||
isc__mempool_getfillcount(isc_mempool_t *mpctx);
|
||||
void
|
||||
isc__mem_printactive(isc_mem_t *ctx0, FILE *file);
|
||||
unsigned int
|
||||
isc__mem_references(isc_mem_t *ctx0);
|
||||
|
||||
static struct isc__memmethods {
|
||||
isc_memmethods_t methods;
|
||||
|
||||
/*%
|
||||
* The following are defined just for avoiding unused static functions.
|
||||
*/
|
||||
void *createx, *create, *create2, *stats,
|
||||
*setquota, *getquota, *setname, *getname, *gettag;
|
||||
} memmethods = {
|
||||
{
|
||||
isc__mem_attach,
|
||||
isc__mem_detach,
|
||||
isc__mem_destroy,
|
||||
isc___mem_get,
|
||||
isc___mem_put,
|
||||
isc___mem_putanddetach,
|
||||
isc___mem_allocate,
|
||||
isc___mem_reallocate,
|
||||
isc___mem_strdup,
|
||||
isc___mem_free,
|
||||
isc__mem_setdestroycheck,
|
||||
isc__mem_setwater,
|
||||
isc__mem_waterack,
|
||||
isc__mem_inuse,
|
||||
isc__mem_maxinuse,
|
||||
isc__mem_total,
|
||||
isc__mem_isovermem,
|
||||
isc__mempool_create
|
||||
},
|
||||
(void *)isc_mem_createx,
|
||||
(void *)isc_mem_create,
|
||||
(void *)isc_mem_create2,
|
||||
(void *)isc_mem_stats,
|
||||
(void *)isc_mem_setquota,
|
||||
(void *)isc_mem_getquota,
|
||||
(void *)isc_mem_setname,
|
||||
(void *)isc_mem_getname,
|
||||
(void *)isc_mem_gettag
|
||||
};
|
||||
|
||||
static struct isc__mempoolmethods {
|
||||
isc_mempoolmethods_t methods;
|
||||
|
||||
/*%
|
||||
* The following are defined just for avoiding unused static functions.
|
||||
*/
|
||||
void *getfreemax, *getfreecount, *getmaxalloc, *getfillcount;
|
||||
} mempoolmethods = {
|
||||
{
|
||||
isc__mempool_destroy,
|
||||
isc___mempool_get,
|
||||
isc___mempool_put,
|
||||
isc__mempool_getallocated,
|
||||
isc__mempool_setmaxalloc,
|
||||
isc__mempool_setfreemax,
|
||||
isc__mempool_setname,
|
||||
isc__mempool_associatelock,
|
||||
isc__mempool_setfillcount
|
||||
},
|
||||
(void *)isc_mempool_getfreemax,
|
||||
(void *)isc_mempool_getfreecount,
|
||||
(void *)isc_mempool_getmaxalloc,
|
||||
(void *)isc_mempool_getfillcount
|
||||
};
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
/*!
|
||||
* mctx must be locked.
|
||||
*/
|
||||
@@ -853,7 +695,6 @@ default_memfree(void *arg, void *ptr) {
|
||||
|
||||
static void
|
||||
initialize_action(void) {
|
||||
RUNTIME_CHECK(isc_mutex_init(&createlock) == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_mutex_init(&contextslock) == ISC_R_SUCCESS);
|
||||
ISC_LIST_INIT(contexts);
|
||||
totallost = 0;
|
||||
@@ -923,7 +764,6 @@ isc_mem_createx2(size_t init_max_size, size_t target_size,
|
||||
ctx->water_arg = NULL;
|
||||
ctx->common.impmagic = MEM_MAGIC;
|
||||
ctx->common.magic = ISCAPI_MCTX_MAGIC;
|
||||
ctx->common.methods = (isc_memmethods_t *)&memmethods;
|
||||
ctx->memalloc = memalloc;
|
||||
ctx->memfree = memfree;
|
||||
ctx->arg = arg;
|
||||
@@ -1092,7 +932,7 @@ destroy(isc__mem_t *ctx) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__mem_attach(isc_mem_t *source0, isc_mem_t **targetp) {
|
||||
isc_mem_attach(isc_mem_t *source0, isc_mem_t **targetp) {
|
||||
isc__mem_t *source = (isc__mem_t *)source0;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(source));
|
||||
@@ -1104,7 +944,7 @@ isc__mem_attach(isc_mem_t *source0, isc_mem_t **targetp) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__mem_detach(isc_mem_t **ctxp) {
|
||||
isc_mem_detach(isc_mem_t **ctxp) {
|
||||
REQUIRE(ctxp != NULL && VALID_CONTEXT(*ctxp));
|
||||
isc__mem_t *ctx = (isc__mem_t *)*ctxp;
|
||||
*ctxp = NULL;
|
||||
@@ -1126,7 +966,7 @@ isc__mem_detach(isc_mem_t **ctxp) {
|
||||
*/
|
||||
|
||||
void
|
||||
isc___mem_putanddetach(isc_mem_t **ctxp, void *ptr, size_t size FLARG) {
|
||||
isc__mem_putanddetach(isc_mem_t **ctxp, void *ptr, size_t size FLARG) {
|
||||
REQUIRE(ctxp != NULL && VALID_CONTEXT(*ctxp));
|
||||
REQUIRE(ptr != NULL);
|
||||
isc__mem_t *ctx = (isc__mem_t *)*ctxp;
|
||||
@@ -1167,7 +1007,7 @@ destroy:
|
||||
}
|
||||
|
||||
void
|
||||
isc__mem_destroy(isc_mem_t **ctxp) {
|
||||
isc_mem_destroy(isc_mem_t **ctxp) {
|
||||
isc__mem_t *ctx;
|
||||
|
||||
/*
|
||||
@@ -1193,7 +1033,7 @@ isc__mem_destroy(isc_mem_t **ctxp) {
|
||||
}
|
||||
|
||||
void *
|
||||
isc___mem_get(isc_mem_t *ctx0, size_t size FLARG) {
|
||||
isc__mem_get(isc_mem_t *ctx0, size_t size FLARG) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
void *ptr;
|
||||
bool call_water = false;
|
||||
@@ -1237,7 +1077,7 @@ isc___mem_get(isc_mem_t *ctx0, size_t size FLARG) {
|
||||
}
|
||||
|
||||
void
|
||||
isc___mem_put(isc_mem_t *ctx0, void *ptr, size_t size FLARG) {
|
||||
isc__mem_put(isc_mem_t *ctx0, void *ptr, size_t size FLARG) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
bool call_water = false;
|
||||
size_info *si;
|
||||
@@ -1289,7 +1129,7 @@ isc___mem_put(isc_mem_t *ctx0, void *ptr, size_t size FLARG) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__mem_waterack(isc_mem_t *ctx0, int flag) {
|
||||
isc_mem_waterack(isc_mem_t *ctx0, int flag) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
@@ -1451,7 +1291,7 @@ mem_allocateunlocked(isc_mem_t *ctx0, size_t size) {
|
||||
}
|
||||
|
||||
void *
|
||||
isc___mem_allocate(isc_mem_t *ctx0, size_t size FLARG) {
|
||||
isc__mem_allocate(isc_mem_t *ctx0, size_t size FLARG) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
size_info *si;
|
||||
bool call_water = false;
|
||||
@@ -1491,7 +1331,7 @@ isc___mem_allocate(isc_mem_t *ctx0, size_t size FLARG) {
|
||||
}
|
||||
|
||||
void *
|
||||
isc___mem_reallocate(isc_mem_t *ctx0, void *ptr, size_t size FLARG) {
|
||||
isc__mem_reallocate(isc_mem_t *ctx0, void *ptr, size_t size FLARG) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
void *new_ptr = NULL;
|
||||
size_t oldsize, copysize;
|
||||
@@ -1532,7 +1372,7 @@ isc___mem_reallocate(isc_mem_t *ctx0, void *ptr, size_t size FLARG) {
|
||||
}
|
||||
|
||||
void
|
||||
isc___mem_free(isc_mem_t *ctx0, void *ptr FLARG) {
|
||||
isc__mem_free(isc_mem_t *ctx0, void *ptr FLARG) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
size_info *si;
|
||||
size_t size;
|
||||
@@ -1590,7 +1430,7 @@ isc___mem_free(isc_mem_t *ctx0, void *ptr FLARG) {
|
||||
*/
|
||||
|
||||
char *
|
||||
isc___mem_strdup(isc_mem_t *mctx0, const char *s FLARG) {
|
||||
isc__mem_strdup(isc_mem_t *mctx0, const char *s FLARG) {
|
||||
isc__mem_t *mctx = (isc__mem_t *)mctx0;
|
||||
size_t len;
|
||||
char *ns;
|
||||
@@ -1609,7 +1449,7 @@ isc___mem_strdup(isc_mem_t *mctx0, const char *s FLARG) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__mem_setdestroycheck(isc_mem_t *ctx0, bool flag) {
|
||||
isc_mem_setdestroycheck(isc_mem_t *ctx0, bool flag) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
@@ -1652,7 +1492,7 @@ isc_mem_getquota(isc_mem_t *ctx0) {
|
||||
}
|
||||
|
||||
size_t
|
||||
isc__mem_inuse(isc_mem_t *ctx0) {
|
||||
isc_mem_inuse(isc_mem_t *ctx0) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
size_t inuse;
|
||||
|
||||
@@ -1667,7 +1507,7 @@ isc__mem_inuse(isc_mem_t *ctx0) {
|
||||
}
|
||||
|
||||
size_t
|
||||
isc__mem_maxinuse(isc_mem_t *ctx0) {
|
||||
isc_mem_maxinuse(isc_mem_t *ctx0) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
size_t maxinuse;
|
||||
|
||||
@@ -1682,7 +1522,7 @@ isc__mem_maxinuse(isc_mem_t *ctx0) {
|
||||
}
|
||||
|
||||
size_t
|
||||
isc__mem_total(isc_mem_t *ctx0) {
|
||||
isc_mem_total(isc_mem_t *ctx0) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
size_t total;
|
||||
|
||||
@@ -1697,7 +1537,7 @@ isc__mem_total(isc_mem_t *ctx0) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__mem_setwater(isc_mem_t *ctx0, isc_mem_water_t water, void *water_arg,
|
||||
isc_mem_setwater(isc_mem_t *ctx0, isc_mem_water_t water, void *water_arg,
|
||||
size_t hiwater, size_t lowater)
|
||||
{
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
@@ -1734,7 +1574,7 @@ isc__mem_setwater(isc_mem_t *ctx0, isc_mem_water_t water, void *water_arg,
|
||||
}
|
||||
|
||||
bool
|
||||
isc__mem_isovermem(isc_mem_t *ctx0) {
|
||||
isc_mem_isovermem(isc_mem_t *ctx0) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
@@ -1785,7 +1625,7 @@ isc_mem_gettag(isc_mem_t *ctx0) {
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
isc__mempool_create(isc_mem_t *mctx0, size_t size, isc_mempool_t **mpctxp) {
|
||||
isc_mempool_create(isc_mem_t *mctx0, size_t size, isc_mempool_t **mpctxp) {
|
||||
isc__mem_t *mctx = (isc__mem_t *)mctx0;
|
||||
isc__mempool_t *mpctx;
|
||||
|
||||
@@ -1801,7 +1641,6 @@ isc__mempool_create(isc_mem_t *mctx0, size_t size, isc_mempool_t **mpctxp) {
|
||||
if (mpctx == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
mpctx->common.methods = (isc_mempoolmethods_t *)&mempoolmethods;
|
||||
mpctx->common.impmagic = MEMPOOL_MAGIC;
|
||||
mpctx->common.magic = ISCAPI_MPOOL_MAGIC;
|
||||
mpctx->lock = NULL;
|
||||
@@ -1835,7 +1674,7 @@ isc__mempool_create(isc_mem_t *mctx0, size_t size, isc_mempool_t **mpctxp) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__mempool_setname(isc_mempool_t *mpctx0, const char *name) {
|
||||
isc_mempool_setname(isc_mempool_t *mpctx0, const char *name) {
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
|
||||
REQUIRE(name != NULL);
|
||||
@@ -1856,7 +1695,7 @@ isc__mempool_setname(isc_mempool_t *mpctx0, const char *name) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__mempool_destroy(isc_mempool_t **mpctxp) {
|
||||
isc_mempool_destroy(isc_mempool_t **mpctxp) {
|
||||
isc__mempool_t *mpctx;
|
||||
isc__mem_t *mctx;
|
||||
isc_mutex_t *lock;
|
||||
@@ -1920,7 +1759,7 @@ isc__mempool_destroy(isc_mempool_t **mpctxp) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__mempool_associatelock(isc_mempool_t *mpctx0, isc_mutex_t *lock) {
|
||||
isc_mempool_associatelock(isc_mempool_t *mpctx0, isc_mutex_t *lock) {
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
|
||||
REQUIRE(VALID_MEMPOOL(mpctx));
|
||||
@@ -1931,7 +1770,7 @@ isc__mempool_associatelock(isc_mempool_t *mpctx0, isc_mutex_t *lock) {
|
||||
}
|
||||
|
||||
void *
|
||||
isc___mempool_get(isc_mempool_t *mpctx0 FLARG) {
|
||||
isc__mempool_get(isc_mempool_t *mpctx0 FLARG) {
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
element *item;
|
||||
isc__mem_t *mctx;
|
||||
@@ -2007,7 +1846,7 @@ isc___mempool_get(isc_mempool_t *mpctx0 FLARG) {
|
||||
|
||||
/* coverity[+free : arg-1] */
|
||||
void
|
||||
isc___mempool_put(isc_mempool_t *mpctx0, void *mem FLARG) {
|
||||
isc__mempool_put(isc_mempool_t *mpctx0, void *mem FLARG) {
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
isc__mem_t *mctx;
|
||||
element *item;
|
||||
@@ -2065,7 +1904,7 @@ isc___mempool_put(isc_mempool_t *mpctx0, void *mem FLARG) {
|
||||
*/
|
||||
|
||||
void
|
||||
isc__mempool_setfreemax(isc_mempool_t *mpctx0, unsigned int limit) {
|
||||
isc_mempool_setfreemax(isc_mempool_t *mpctx0, unsigned int limit) {
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
|
||||
REQUIRE(VALID_MEMPOOL(mpctx));
|
||||
@@ -2116,7 +1955,7 @@ isc_mempool_getfreecount(isc_mempool_t *mpctx0) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__mempool_setmaxalloc(isc_mempool_t *mpctx0, unsigned int limit) {
|
||||
isc_mempool_setmaxalloc(isc_mempool_t *mpctx0, unsigned int limit) {
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
|
||||
REQUIRE(limit > 0);
|
||||
@@ -2151,7 +1990,7 @@ isc_mempool_getmaxalloc(isc_mempool_t *mpctx0) {
|
||||
}
|
||||
|
||||
unsigned int
|
||||
isc__mempool_getallocated(isc_mempool_t *mpctx0) {
|
||||
isc_mempool_getallocated(isc_mempool_t *mpctx0) {
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
unsigned int allocated;
|
||||
|
||||
@@ -2169,7 +2008,7 @@ isc__mempool_getallocated(isc_mempool_t *mpctx0) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__mempool_setfillcount(isc_mempool_t *mpctx0, unsigned int limit) {
|
||||
isc_mempool_setfillcount(isc_mempool_t *mpctx0, unsigned int limit) {
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
|
||||
REQUIRE(limit > 0);
|
||||
@@ -2203,13 +2042,8 @@ isc_mempool_getfillcount(isc_mempool_t *mpctx0) {
|
||||
return (fillcount);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__mem_register(void) {
|
||||
return (isc_mem_register(isc_mem_create2));
|
||||
}
|
||||
|
||||
void
|
||||
isc__mem_printactive(isc_mem_t *ctx0, FILE *file) {
|
||||
isc_mem_printactive(isc_mem_t *ctx0, FILE *file) {
|
||||
#if ISC_MEM_TRACKLINES
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
|
||||
@@ -2647,352 +2481,18 @@ isc_mem_renderjson(json_object *memobj) {
|
||||
}
|
||||
#endif /* HAVE_JSON */
|
||||
|
||||
static isc_memcreatefunc_t mem_createfunc = NULL;
|
||||
|
||||
isc_result_t
|
||||
isc_mem_register(isc_memcreatefunc_t createfunc) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
|
||||
RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS);
|
||||
|
||||
LOCK(&createlock);
|
||||
if (mem_createfunc == NULL)
|
||||
mem_createfunc = createfunc;
|
||||
else
|
||||
result = ISC_R_EXISTS;
|
||||
UNLOCK(&createlock);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
isc_result_t
|
||||
isc__mem_create2(size_t init_max_size, size_t target_size, isc_mem_t **mctxp,
|
||||
unsigned int flags)
|
||||
{
|
||||
isc_result_t result;
|
||||
|
||||
LOCK(&createlock);
|
||||
|
||||
REQUIRE(mem_createfunc != NULL);
|
||||
result = (*mem_createfunc)(init_max_size, target_size, mctxp, flags);
|
||||
|
||||
UNLOCK(&createlock);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_mem_create(size_t init_max_size, size_t target_size, isc_mem_t **mctxp) {
|
||||
isc_result_t result;
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc_mem_createx2(init_max_size, target_size,
|
||||
default_memalloc, default_memfree,
|
||||
NULL, mctxp, isc_mem_defaultflags));
|
||||
LOCK(&createlock);
|
||||
|
||||
REQUIRE(mem_createfunc != NULL);
|
||||
result = (*mem_createfunc)(init_max_size, target_size, mctxp,
|
||||
isc_mem_defaultflags);
|
||||
|
||||
UNLOCK(&createlock);
|
||||
|
||||
return (result);
|
||||
return (isc_mem_createx2(init_max_size, target_size,
|
||||
default_memalloc, default_memfree,
|
||||
NULL, mctxp, isc_mem_defaultflags));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_mem_create2(size_t init_max_size, size_t target_size, isc_mem_t **mctxp,
|
||||
unsigned int flags)
|
||||
{
|
||||
if (isc_bind9)
|
||||
return (isc_mem_createx2(init_max_size, target_size,
|
||||
default_memalloc, default_memfree,
|
||||
NULL, mctxp, flags));
|
||||
|
||||
return (isc_mem_createx2(init_max_size, target_size,
|
||||
default_memalloc, default_memfree,
|
||||
NULL, mctxp, flags));
|
||||
}
|
||||
|
||||
void
|
||||
isc_mem_attach(isc_mem_t *source, isc_mem_t **targetp) {
|
||||
REQUIRE(ISCAPI_MCTX_VALID(source));
|
||||
REQUIRE(targetp != NULL && *targetp == NULL);
|
||||
|
||||
if (isc_bind9)
|
||||
isc__mem_attach(source, targetp);
|
||||
else
|
||||
source->methods->attach(source, targetp);
|
||||
|
||||
ENSURE(*targetp == source);
|
||||
}
|
||||
|
||||
void
|
||||
isc_mem_detach(isc_mem_t **mctxp) {
|
||||
REQUIRE(mctxp != NULL && ISCAPI_MCTX_VALID(*mctxp));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__mem_detach(mctxp);
|
||||
else
|
||||
(*mctxp)->methods->detach(mctxp);
|
||||
|
||||
ENSURE(*mctxp == NULL);
|
||||
}
|
||||
|
||||
void
|
||||
isc_mem_destroy(isc_mem_t **mctxp) {
|
||||
REQUIRE(mctxp != NULL && ISCAPI_MCTX_VALID(*mctxp));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__mem_destroy(mctxp);
|
||||
else
|
||||
(*mctxp)->methods->destroy(mctxp);
|
||||
|
||||
ENSURE(*mctxp == NULL);
|
||||
}
|
||||
|
||||
void
|
||||
isc_mem_setdestroycheck(isc_mem_t *mctx, bool flag) {
|
||||
REQUIRE(ISCAPI_MCTX_VALID(mctx));
|
||||
|
||||
mctx->methods->setdestroycheck(mctx, flag);
|
||||
}
|
||||
|
||||
void
|
||||
isc_mem_setwater(isc_mem_t *ctx, isc_mem_water_t water, void *water_arg,
|
||||
size_t hiwater, size_t lowater)
|
||||
{
|
||||
REQUIRE(ISCAPI_MCTX_VALID(ctx));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__mem_setwater(ctx, water, water_arg, hiwater, lowater);
|
||||
else
|
||||
ctx->methods->setwater(ctx, water, water_arg, hiwater, lowater);
|
||||
}
|
||||
|
||||
void
|
||||
isc_mem_waterack(isc_mem_t *ctx, int flag) {
|
||||
REQUIRE(ISCAPI_MCTX_VALID(ctx));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__mem_waterack(ctx, flag);
|
||||
else
|
||||
ctx->methods->waterack(ctx, flag);
|
||||
}
|
||||
|
||||
size_t
|
||||
isc_mem_inuse(isc_mem_t *mctx) {
|
||||
REQUIRE(ISCAPI_MCTX_VALID(mctx));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__mem_inuse(mctx));
|
||||
|
||||
return (mctx->methods->inuse(mctx));
|
||||
}
|
||||
|
||||
size_t
|
||||
isc_mem_maxinuse(isc_mem_t *mctx) {
|
||||
REQUIRE(ISCAPI_MCTX_VALID(mctx));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__mem_maxinuse(mctx));
|
||||
|
||||
return (mctx->methods->maxinuse(mctx));
|
||||
}
|
||||
|
||||
size_t
|
||||
isc_mem_total(isc_mem_t *mctx) {
|
||||
REQUIRE(ISCAPI_MCTX_VALID(mctx));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__mem_total(mctx));
|
||||
|
||||
return (mctx->methods->total(mctx));
|
||||
}
|
||||
|
||||
bool
|
||||
isc_mem_isovermem(isc_mem_t *mctx) {
|
||||
REQUIRE(ISCAPI_MCTX_VALID(mctx));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__mem_isovermem(mctx));
|
||||
|
||||
return (mctx->methods->isovermem(mctx));
|
||||
}
|
||||
|
||||
|
||||
isc_result_t
|
||||
isc_mempool_create(isc_mem_t *mctx, size_t size, isc_mempool_t **mpctxp) {
|
||||
REQUIRE(ISCAPI_MCTX_VALID(mctx));
|
||||
|
||||
return (mctx->methods->mpcreate(mctx, size, mpctxp));
|
||||
}
|
||||
|
||||
void
|
||||
isc_mempool_destroy(isc_mempool_t **mpctxp) {
|
||||
REQUIRE(mpctxp != NULL && ISCAPI_MPOOL_VALID(*mpctxp));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__mempool_destroy(mpctxp);
|
||||
else
|
||||
(*mpctxp)->methods->destroy(mpctxp);
|
||||
|
||||
ENSURE(*mpctxp == NULL);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
isc_mempool_getallocated(isc_mempool_t *mpctx) {
|
||||
REQUIRE(ISCAPI_MPOOL_VALID(mpctx));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__mempool_getallocated(mpctx));
|
||||
|
||||
return (mpctx->methods->getallocated(mpctx));
|
||||
}
|
||||
|
||||
void
|
||||
isc_mempool_setmaxalloc(isc_mempool_t *mpctx, unsigned int limit) {
|
||||
REQUIRE(ISCAPI_MPOOL_VALID(mpctx));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__mempool_setmaxalloc(mpctx, limit);
|
||||
else
|
||||
mpctx->methods->setmaxalloc(mpctx, limit);
|
||||
}
|
||||
|
||||
void
|
||||
isc_mempool_setfreemax(isc_mempool_t *mpctx, unsigned int limit) {
|
||||
REQUIRE(ISCAPI_MPOOL_VALID(mpctx));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__mempool_setfreemax(mpctx, limit);
|
||||
else
|
||||
mpctx->methods->setfreemax(mpctx, limit);
|
||||
}
|
||||
|
||||
void
|
||||
isc_mempool_setname(isc_mempool_t *mpctx, const char *name) {
|
||||
REQUIRE(ISCAPI_MPOOL_VALID(mpctx));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__mempool_setname(mpctx, name);
|
||||
else
|
||||
mpctx->methods->setname(mpctx, name);
|
||||
}
|
||||
|
||||
void
|
||||
isc_mempool_associatelock(isc_mempool_t *mpctx, isc_mutex_t *lock) {
|
||||
REQUIRE(ISCAPI_MPOOL_VALID(mpctx));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__mempool_associatelock(mpctx, lock);
|
||||
else
|
||||
mpctx->methods->associatelock(mpctx, lock);
|
||||
}
|
||||
|
||||
void
|
||||
isc_mempool_setfillcount(isc_mempool_t *mpctx, unsigned int limit) {
|
||||
REQUIRE(ISCAPI_MPOOL_VALID(mpctx));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__mempool_setfillcount(mpctx, limit);
|
||||
else
|
||||
mpctx->methods->setfillcount(mpctx, limit);
|
||||
}
|
||||
|
||||
void *
|
||||
isc__mem_get(isc_mem_t *mctx, size_t size FLARG) {
|
||||
REQUIRE(ISCAPI_MCTX_VALID(mctx));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc___mem_get(mctx, size FLARG_PASS));
|
||||
|
||||
return (mctx->methods->memget(mctx, size FLARG_PASS));
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
isc__mem_put(isc_mem_t *mctx, void *ptr, size_t size FLARG) {
|
||||
REQUIRE(ISCAPI_MCTX_VALID(mctx));
|
||||
|
||||
if (isc_bind9)
|
||||
isc___mem_put(mctx, ptr, size FLARG_PASS);
|
||||
else
|
||||
mctx->methods->memput(mctx, ptr, size FLARG_PASS);
|
||||
}
|
||||
|
||||
void
|
||||
isc__mem_putanddetach(isc_mem_t **mctxp, void *ptr, size_t size FLARG) {
|
||||
REQUIRE(mctxp != NULL && ISCAPI_MCTX_VALID(*mctxp));
|
||||
|
||||
if (isc_bind9)
|
||||
isc___mem_putanddetach(mctxp, ptr, size FLARG_PASS);
|
||||
else
|
||||
(*mctxp)->methods->memputanddetach(mctxp, ptr, size FLARG_PASS);
|
||||
|
||||
/*
|
||||
* XXX: We cannot always ensure *mctxp == NULL here
|
||||
* (see lib/isc/mem.c).
|
||||
*/
|
||||
}
|
||||
|
||||
void *
|
||||
isc__mem_allocate(isc_mem_t *mctx, size_t size FLARG) {
|
||||
REQUIRE(ISCAPI_MCTX_VALID(mctx));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc___mem_allocate(mctx, size FLARG_PASS));
|
||||
|
||||
return (mctx->methods->memallocate(mctx, size FLARG_PASS));
|
||||
}
|
||||
|
||||
void *
|
||||
isc__mem_reallocate(isc_mem_t *mctx, void *ptr, size_t size FLARG) {
|
||||
REQUIRE(ISCAPI_MCTX_VALID(mctx));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc___mem_reallocate(mctx, ptr, size FLARG_PASS));
|
||||
|
||||
return (mctx->methods->memreallocate(mctx, ptr, size FLARG_PASS));
|
||||
}
|
||||
|
||||
char *
|
||||
isc__mem_strdup(isc_mem_t *mctx, const char *s FLARG) {
|
||||
REQUIRE(ISCAPI_MCTX_VALID(mctx));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc___mem_strdup(mctx, s FLARG_PASS));
|
||||
|
||||
return (mctx->methods->memstrdup(mctx, s FLARG_PASS));
|
||||
}
|
||||
|
||||
void
|
||||
isc__mem_free(isc_mem_t *mctx, void *ptr FLARG) {
|
||||
REQUIRE(ISCAPI_MCTX_VALID(mctx));
|
||||
|
||||
if (isc_bind9)
|
||||
isc___mem_free(mctx, ptr FLARG_PASS);
|
||||
else
|
||||
mctx->methods->memfree(mctx, ptr FLARG_PASS);
|
||||
}
|
||||
|
||||
void *
|
||||
isc__mempool_get(isc_mempool_t *mpctx FLARG) {
|
||||
REQUIRE(ISCAPI_MPOOL_VALID(mpctx));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc___mempool_get(mpctx FLARG_PASS));
|
||||
|
||||
return (mpctx->methods->get(mpctx FLARG_PASS));
|
||||
}
|
||||
|
||||
void
|
||||
isc__mempool_put(isc_mempool_t *mpctx, void *mem FLARG) {
|
||||
REQUIRE(ISCAPI_MPOOL_VALID(mpctx));
|
||||
|
||||
if (isc_bind9)
|
||||
isc___mempool_put(mpctx, mem FLARG_PASS);
|
||||
else
|
||||
mpctx->methods->put(mpctx, mem FLARG_PASS);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ isc_thread_yield(void);
|
||||
void
|
||||
isc_thread_setname(isc_thread_t thread, const char *name);
|
||||
|
||||
isc_result_t
|
||||
isc_thread_setaffinity(int cpu);
|
||||
|
||||
/* XXX We could do fancier error handling... */
|
||||
|
||||
#define isc_thread_join(t, rp) \
|
||||
|
||||
@@ -18,6 +18,17 @@
|
||||
#include <sched.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_CPUSET_H)
|
||||
#include <sys/param.h>
|
||||
#include <sys/cpuset.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SYS_PROCESET_H)
|
||||
#include <sys/types.h>
|
||||
#include <sys/processor.h>
|
||||
#include <sys/procset.h>
|
||||
#endif
|
||||
|
||||
#include <isc/thread.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
@@ -101,3 +112,31 @@ isc_thread_yield(void) {
|
||||
pthread_yield_np();
|
||||
#endif
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_thread_setaffinity(int cpu) {
|
||||
#if defined(HAVE_CPUSET_SETAFFINITY)
|
||||
cpuset_t cpuset;
|
||||
CPU_ZERO(&cpuset);
|
||||
CPU_SET(cpu, &cpuset);
|
||||
if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1,
|
||||
&cpuset, sizeof(cpuset)) != 0) {
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
#elif defined(HAVE_PTHREAD_SETAFFINITY_NP)
|
||||
cpu_set_t set;
|
||||
CPU_ZERO(&set);
|
||||
CPU_SET(cpu, &set);
|
||||
if (pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t),
|
||||
&set) != 0) {
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
#elif defined(HAVE_PROCESSOR_BIND)
|
||||
if (processor_bind(P_LWPID, P_MYID, cpu, NULL) != 0) {
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
#else
|
||||
UNUSED(cpu);
|
||||
#endif
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
@@ -1,400 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <isc/app.h>
|
||||
#include <isc/magic.h>
|
||||
#include <isc/mutex.h>
|
||||
#include <isc/once.h>
|
||||
#include <isc/socket.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
static isc_mutex_t createlock;
|
||||
static isc_once_t once = ISC_ONCE_INIT;
|
||||
static isc_socketmgrcreatefunc_t socketmgr_createfunc = NULL;
|
||||
|
||||
static void
|
||||
initialize(void) {
|
||||
RUNTIME_CHECK(isc_mutex_init(&createlock) == ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_register(isc_socketmgrcreatefunc_t createfunc) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
|
||||
RUNTIME_CHECK(isc_once_do(&once, initialize) == ISC_R_SUCCESS);
|
||||
|
||||
LOCK(&createlock);
|
||||
if (socketmgr_createfunc == NULL)
|
||||
socketmgr_createfunc = createfunc;
|
||||
else
|
||||
result = ISC_R_EXISTS;
|
||||
UNLOCK(&createlock);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socketmgr_createinctx(isc_mem_t *mctx, isc_appctx_t *actx,
|
||||
isc_socketmgr_t **managerp)
|
||||
{
|
||||
isc_result_t result;
|
||||
|
||||
LOCK(&createlock);
|
||||
|
||||
REQUIRE(socketmgr_createfunc != NULL);
|
||||
result = (*socketmgr_createfunc)(mctx, managerp);
|
||||
|
||||
UNLOCK(&createlock);
|
||||
|
||||
if (result == ISC_R_SUCCESS)
|
||||
isc_appctx_setsocketmgr(actx, *managerp);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
||||
isc_result_t result;
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__socketmgr_create(mctx, managerp));
|
||||
|
||||
LOCK(&createlock);
|
||||
|
||||
REQUIRE(socketmgr_createfunc != NULL);
|
||||
result = (*socketmgr_createfunc)(mctx, managerp);
|
||||
|
||||
UNLOCK(&createlock);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
void
|
||||
isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
|
||||
REQUIRE(managerp != NULL && ISCAPI_SOCKETMGR_VALID(*managerp));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__socketmgr_destroy(managerp);
|
||||
else
|
||||
(*managerp)->methods->destroy(managerp);
|
||||
|
||||
ENSURE(*managerp == NULL);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
isc_socket_t **socketp)
|
||||
{
|
||||
REQUIRE(ISCAPI_SOCKETMGR_VALID(manager));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__socket_create(manager, pf, type, socketp));
|
||||
|
||||
return (manager->methods->socketcreate(manager, pf, type, socketp));
|
||||
}
|
||||
|
||||
void
|
||||
isc_socket_attach(isc_socket_t *sock, isc_socket_t **socketp) {
|
||||
REQUIRE(ISCAPI_SOCKET_VALID(sock));
|
||||
REQUIRE(socketp != NULL && *socketp == NULL);
|
||||
|
||||
if (isc_bind9)
|
||||
isc__socket_attach(sock, socketp);
|
||||
else
|
||||
sock->methods->attach(sock, socketp);
|
||||
|
||||
ENSURE(*socketp == sock);
|
||||
}
|
||||
|
||||
void
|
||||
isc_socket_detach(isc_socket_t **socketp) {
|
||||
REQUIRE(socketp != NULL && ISCAPI_SOCKET_VALID(*socketp));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__socket_detach(socketp);
|
||||
else
|
||||
(*socketp)->methods->detach(socketp);
|
||||
|
||||
ENSURE(*socketp == NULL);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_bind(isc_socket_t *sock, const isc_sockaddr_t *sockaddr,
|
||||
isc_socket_options_t options)
|
||||
{
|
||||
REQUIRE(ISCAPI_SOCKET_VALID(sock));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__socket_bind(sock, sockaddr, options));
|
||||
|
||||
return (sock->methods->bind(sock, sockaddr, options));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_sendto(isc_socket_t *sock, isc_region_t *region, isc_task_t *task,
|
||||
isc_taskaction_t action, void *arg,
|
||||
const isc_sockaddr_t *address, struct in6_pktinfo *pktinfo)
|
||||
{
|
||||
REQUIRE(ISCAPI_SOCKET_VALID(sock));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__socket_sendto(sock, region, task,
|
||||
action, arg, address, pktinfo));
|
||||
|
||||
return (sock->methods->sendto(sock, region, task, action, arg, address,
|
||||
pktinfo));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_connect(isc_socket_t *sock, const isc_sockaddr_t *addr,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg)
|
||||
{
|
||||
REQUIRE(ISCAPI_SOCKET_VALID(sock));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__socket_connect(sock, addr, task, action, arg));
|
||||
|
||||
return (sock->methods->connect(sock, addr, task, action, arg));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_recv(isc_socket_t *sock, isc_region_t *region, unsigned int minimum,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg)
|
||||
{
|
||||
REQUIRE(ISCAPI_SOCKET_VALID(sock));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__socket_recv(sock, region, minimum,
|
||||
task, action, arg));
|
||||
|
||||
return (sock->methods->recv(sock, region, minimum, task, action, arg));
|
||||
}
|
||||
|
||||
void
|
||||
isc_socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how) {
|
||||
REQUIRE(ISCAPI_SOCKET_VALID(sock));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__socket_cancel(sock, task, how);
|
||||
else
|
||||
sock->methods->cancel(sock, task, how);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) {
|
||||
REQUIRE(ISCAPI_SOCKET_VALID(sock));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__socket_getsockname(sock, addressp));
|
||||
|
||||
return (sock->methods->getsockname(sock, addressp));
|
||||
}
|
||||
|
||||
void
|
||||
isc_socket_ipv6only(isc_socket_t *sock, bool yes) {
|
||||
REQUIRE(ISCAPI_SOCKET_VALID(sock));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__socket_ipv6only(sock, yes);
|
||||
else
|
||||
sock->methods->ipv6only(sock, yes);
|
||||
}
|
||||
|
||||
void
|
||||
isc_socket_dscp(isc_socket_t *sock, isc_dscp_t dscp) {
|
||||
REQUIRE(ISCAPI_SOCKET_VALID(sock));
|
||||
|
||||
sock->methods->dscp(sock, dscp);
|
||||
}
|
||||
|
||||
isc_sockettype_t
|
||||
isc_socket_gettype(isc_socket_t *sock) {
|
||||
REQUIRE(ISCAPI_SOCKET_VALID(sock));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__socket_gettype(sock));
|
||||
|
||||
return (sock->methods->gettype(sock));
|
||||
}
|
||||
|
||||
void
|
||||
isc_socket_setname(isc_socket_t *sock, const char *name, void *tag) {
|
||||
REQUIRE(ISCAPI_SOCKET_VALID(sock));
|
||||
|
||||
UNUSED(sock); /* in case REQUIRE() is empty */
|
||||
UNUSED(name);
|
||||
UNUSED(tag);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_fdwatchcreate(isc_socketmgr_t *manager, int fd, int flags,
|
||||
isc_sockfdwatch_t callback, void *cbarg,
|
||||
isc_task_t *task, isc_socket_t **socketp)
|
||||
{
|
||||
REQUIRE(ISCAPI_SOCKETMGR_VALID(manager));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__socket_fdwatchcreate(manager, fd, flags,
|
||||
callback, cbarg,
|
||||
task, socketp));
|
||||
|
||||
return (manager->methods->fdwatchcreate(manager, fd, flags,
|
||||
callback, cbarg, task,
|
||||
socketp));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_fdwatchpoke(isc_socket_t *sock, int flags)
|
||||
{
|
||||
REQUIRE(ISCAPI_SOCKET_VALID(sock));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__socket_fdwatchpoke(sock, flags));
|
||||
|
||||
return (sock->methods->fdwatchpoke(sock, flags));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_dup(isc_socket_t *sock, isc_socket_t **socketp) {
|
||||
REQUIRE(ISCAPI_SOCKET_VALID(sock));
|
||||
REQUIRE(socketp != NULL && *socketp == NULL);
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__socket_dup(sock, socketp));
|
||||
|
||||
return (sock->methods->dup(sock, socketp));
|
||||
}
|
||||
|
||||
int
|
||||
isc_socket_getfd(isc_socket_t *sock) {
|
||||
REQUIRE(ISCAPI_SOCKET_VALID(sock));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__socket_getfd(sock));
|
||||
|
||||
return (sock->methods->getfd(sock));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_open(isc_socket_t *sock) {
|
||||
return (isc__socket_open(sock));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_close(isc_socket_t *sock) {
|
||||
return (isc__socket_close(sock));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp,
|
||||
unsigned int maxsocks)
|
||||
{
|
||||
return (isc__socketmgr_create2(mctx, managerp, maxsocks));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_recvv(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
unsigned int minimum, isc_task_t *task,
|
||||
isc_taskaction_t action, void *arg)
|
||||
{
|
||||
return (isc__socket_recvv(sock, buflist, minimum, task, action, arg));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_recv2(isc_socket_t *sock, isc_region_t *region,
|
||||
unsigned int minimum, isc_task_t *task,
|
||||
isc_socketevent_t *event, unsigned int flags)
|
||||
{
|
||||
return (isc__socket_recv2(sock, region, minimum, task, event, flags));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_send(isc_socket_t *sock, isc_region_t *region,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg)
|
||||
{
|
||||
return (isc__socket_send(sock, region, task, action, arg));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_sendv(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg)
|
||||
{
|
||||
return (isc__socket_sendv(sock, buflist, task, action, arg));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg,
|
||||
const isc_sockaddr_t *address, struct in6_pktinfo *pktinfo)
|
||||
{
|
||||
return (isc__socket_sendtov(sock, buflist, task, action, arg,
|
||||
address, pktinfo));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_sendtov2(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg,
|
||||
const isc_sockaddr_t *address, struct in6_pktinfo *pktinfo,
|
||||
unsigned int flags)
|
||||
{
|
||||
return (isc__socket_sendtov2(sock, buflist, task, action, arg,
|
||||
address, pktinfo, flags));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_sendto2(isc_socket_t *sock, isc_region_t *region,
|
||||
isc_task_t *task,
|
||||
const isc_sockaddr_t *address, struct in6_pktinfo *pktinfo,
|
||||
isc_socketevent_t *event, unsigned int flags)
|
||||
{
|
||||
return (isc__socket_sendto2(sock, region, task, address, pktinfo,
|
||||
event, flags));
|
||||
}
|
||||
|
||||
void
|
||||
isc_socket_cleanunix(const isc_sockaddr_t *sockaddr, bool active) {
|
||||
isc__socket_cleanunix(sockaddr, active);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_permunix(const isc_sockaddr_t *sockaddr, uint32_t perm,
|
||||
uint32_t owner, uint32_t group)
|
||||
{
|
||||
return (isc__socket_permunix(sockaddr, perm, owner, group));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_filter(isc_socket_t *sock, const char *filter) {
|
||||
return (isc__socket_filter(sock, filter));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_listen(isc_socket_t *sock, unsigned int backlog) {
|
||||
return (isc__socket_listen(sock, backlog));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_accept(isc_socket_t *sock, isc_task_t *task,
|
||||
isc_taskaction_t action, void *arg)
|
||||
{
|
||||
return (isc__socket_accept(sock, task, action, arg));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socket_getpeername(isc_socket_t *sock, isc_sockaddr_t *addressp) {
|
||||
return (isc__socket_getpeername(sock, addressp));
|
||||
}
|
||||
+266
-506
File diff suppressed because it is too large
Load Diff
@@ -288,7 +288,7 @@ ATF_TC_BODY(isc_mem_noflags, tc) {
|
||||
isc_mem_debugging = 0;
|
||||
ptr = isc_mem_get(mctx2, 2048);
|
||||
ATF_CHECK(ptr != NULL);
|
||||
isc__mem_printactive(mctx2, f);
|
||||
isc_mem_printactive(mctx2, f);
|
||||
isc_mem_put(mctx2, ptr, 2048);
|
||||
isc_mem_destroy(&mctx2);
|
||||
isc_stdio_close(f);
|
||||
@@ -339,7 +339,7 @@ ATF_TC_BODY(isc_mem_recordflag, tc) {
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
ptr = isc_mem_get(mctx2, 2048);
|
||||
ATF_CHECK(ptr != NULL);
|
||||
isc__mem_printactive(mctx2, f);
|
||||
isc_mem_printactive(mctx2, f);
|
||||
isc_mem_put(mctx2, ptr, 2048);
|
||||
isc_mem_destroy(&mctx2);
|
||||
isc_stdio_close(f);
|
||||
@@ -390,7 +390,7 @@ ATF_TC_BODY(isc_mem_traceflag, tc) {
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
ptr = isc_mem_get(mctx2, 2048);
|
||||
ATF_CHECK(ptr != NULL);
|
||||
isc__mem_printactive(mctx2, f);
|
||||
isc_mem_printactive(mctx2, f);
|
||||
isc_mem_put(mctx2, ptr, 2048);
|
||||
isc_mem_destroy(&mctx2);
|
||||
isc_stdio_close(f);
|
||||
|
||||
+11
-198
@@ -97,63 +97,8 @@ struct isc__timermgr {
|
||||
isc_heap_t * heap;
|
||||
};
|
||||
|
||||
/*%
|
||||
* The following are intended for internal use (indicated by "isc__"
|
||||
* prefix) but are not declared as static, allowing direct access from
|
||||
* unit tests etc.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
isc__timer_create(isc_timermgr_t *manager, isc_timertype_t type,
|
||||
const isc_time_t *expires, const isc_interval_t *interval,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg,
|
||||
isc_timer_t **timerp);
|
||||
isc_result_t
|
||||
isc__timer_reset(isc_timer_t *timer, isc_timertype_t type,
|
||||
const isc_time_t *expires, const isc_interval_t *interval,
|
||||
bool purge);
|
||||
isc_timertype_t
|
||||
isc_timer_gettype(isc_timer_t *timer);
|
||||
isc_result_t
|
||||
isc__timer_touch(isc_timer_t *timer);
|
||||
void
|
||||
isc__timer_attach(isc_timer_t *timer0, isc_timer_t **timerp);
|
||||
void
|
||||
isc__timer_detach(isc_timer_t **timerp);
|
||||
isc_result_t
|
||||
isc__timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp);
|
||||
void
|
||||
isc_timermgr_poke(isc_timermgr_t *manager0);
|
||||
void
|
||||
isc__timermgr_destroy(isc_timermgr_t **managerp);
|
||||
|
||||
static struct isc__timermethods {
|
||||
isc_timermethods_t methods;
|
||||
|
||||
/*%
|
||||
* The following are defined just for avoiding unused static functions.
|
||||
*/
|
||||
void *gettype;
|
||||
} timermethods = {
|
||||
{
|
||||
isc__timer_attach,
|
||||
isc__timer_detach,
|
||||
isc__timer_reset,
|
||||
isc__timer_touch
|
||||
},
|
||||
(void *)isc_timer_gettype
|
||||
};
|
||||
|
||||
static struct isc__timermgrmethods {
|
||||
isc_timermgrmethods_t methods;
|
||||
void *poke; /* see above */
|
||||
} timermgrmethods = {
|
||||
{
|
||||
isc__timermgr_destroy,
|
||||
isc__timer_create
|
||||
},
|
||||
(void *)isc_timermgr_poke
|
||||
};
|
||||
|
||||
static inline isc_result_t
|
||||
schedule(isc__timer_t *timer, isc_time_t *now, bool signal_ok) {
|
||||
@@ -296,10 +241,10 @@ destroy(isc__timer_t *timer) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__timer_create(isc_timermgr_t *manager0, isc_timertype_t type,
|
||||
const isc_time_t *expires, const isc_interval_t *interval,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg,
|
||||
isc_timer_t **timerp)
|
||||
isc_timer_create(isc_timermgr_t *manager0, isc_timertype_t type,
|
||||
const isc_time_t *expires, const isc_interval_t *interval,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg,
|
||||
isc_timer_t **timerp)
|
||||
{
|
||||
isc__timermgr_t *manager = (isc__timermgr_t *)manager0;
|
||||
isc__timer_t *timer;
|
||||
@@ -385,7 +330,6 @@ isc__timer_create(isc_timermgr_t *manager0, isc_timertype_t type,
|
||||
ISC_LINK_INIT(timer, link);
|
||||
timer->common.impmagic = TIMER_MAGIC;
|
||||
timer->common.magic = ISCAPI_TIMER_MAGIC;
|
||||
timer->common.methods = (isc_timermethods_t *)&timermethods;
|
||||
|
||||
LOCK(&manager->lock);
|
||||
|
||||
@@ -418,7 +362,7 @@ isc__timer_create(isc_timermgr_t *manager0, isc_timertype_t type,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__timer_reset(isc_timer_t *timer0, isc_timertype_t type,
|
||||
isc_timer_reset(isc_timer_t *timer0, isc_timertype_t type,
|
||||
const isc_time_t *expires, const isc_interval_t *interval,
|
||||
bool purge)
|
||||
{
|
||||
@@ -508,7 +452,7 @@ isc_timer_gettype(isc_timer_t *timer0) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__timer_touch(isc_timer_t *timer0) {
|
||||
isc_timer_touch(isc_timer_t *timer0) {
|
||||
isc__timer_t *timer = (isc__timer_t *)timer0;
|
||||
isc_result_t result;
|
||||
isc_time_t now;
|
||||
@@ -539,7 +483,7 @@ isc__timer_touch(isc_timer_t *timer0) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__timer_attach(isc_timer_t *timer0, isc_timer_t **timerp) {
|
||||
isc_timer_attach(isc_timer_t *timer0, isc_timer_t **timerp) {
|
||||
isc__timer_t *timer = (isc__timer_t *)timer0;
|
||||
|
||||
/*
|
||||
@@ -557,7 +501,7 @@ isc__timer_attach(isc_timer_t *timer0, isc_timer_t **timerp) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__timer_detach(isc_timer_t **timerp) {
|
||||
isc_timer_detach(isc_timer_t **timerp) {
|
||||
isc__timer_t *timer;
|
||||
bool free_timer = false;
|
||||
|
||||
@@ -771,7 +715,7 @@ set_index(void *what, unsigned int index) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) {
|
||||
isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) {
|
||||
isc__timermgr_t *manager;
|
||||
isc_result_t result;
|
||||
|
||||
@@ -787,7 +731,6 @@ isc__timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) {
|
||||
|
||||
manager->common.impmagic = TIMER_MANAGER_MAGIC;
|
||||
manager->common.magic = ISCAPI_TIMERMGR_MAGIC;
|
||||
manager->common.methods = (isc_timermgrmethods_t *)&timermgrmethods;
|
||||
manager->mctx = NULL;
|
||||
manager->done = false;
|
||||
INIT_LIST(manager->timers);
|
||||
@@ -848,7 +791,7 @@ isc_timermgr_poke(isc_timermgr_t *manager0) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__timermgr_destroy(isc_timermgr_t **managerp) {
|
||||
isc_timermgr_destroy(isc_timermgr_t **managerp) {
|
||||
isc__timermgr_t *manager;
|
||||
isc_mem_t *mctx;
|
||||
|
||||
@@ -896,146 +839,16 @@ isc__timermgr_destroy(isc_timermgr_t **managerp) {
|
||||
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__timer_register(void) {
|
||||
return (isc_timer_register(isc__timermgr_create));
|
||||
}
|
||||
|
||||
static isc_mutex_t createlock;
|
||||
static isc_once_t once = ISC_ONCE_INIT;
|
||||
static isc_timermgrcreatefunc_t timermgr_createfunc = NULL;
|
||||
|
||||
static void
|
||||
initialize(void) {
|
||||
RUNTIME_CHECK(isc_mutex_init(&createlock) == ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_timer_register(isc_timermgrcreatefunc_t createfunc) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
|
||||
RUNTIME_CHECK(isc_once_do(&once, initialize) == ISC_R_SUCCESS);
|
||||
|
||||
LOCK(&createlock);
|
||||
if (timermgr_createfunc == NULL)
|
||||
timermgr_createfunc = createfunc;
|
||||
else
|
||||
result = ISC_R_EXISTS;
|
||||
UNLOCK(&createlock);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_timermgr_createinctx(isc_mem_t *mctx, isc_appctx_t *actx,
|
||||
isc_timermgr_t **managerp)
|
||||
{
|
||||
isc_result_t result;
|
||||
|
||||
LOCK(&createlock);
|
||||
|
||||
REQUIRE(timermgr_createfunc != NULL);
|
||||
result = (*timermgr_createfunc)(mctx, managerp);
|
||||
|
||||
UNLOCK(&createlock);
|
||||
result = isc_timermgr_create(mctx, managerp);
|
||||
|
||||
if (result == ISC_R_SUCCESS)
|
||||
isc_appctx_settimermgr(actx, *managerp);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) {
|
||||
isc_result_t result;
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__timermgr_create(mctx, managerp));
|
||||
|
||||
LOCK(&createlock);
|
||||
|
||||
REQUIRE(timermgr_createfunc != NULL);
|
||||
result = (*timermgr_createfunc)(mctx, managerp);
|
||||
|
||||
UNLOCK(&createlock);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
void
|
||||
isc_timermgr_destroy(isc_timermgr_t **managerp) {
|
||||
REQUIRE(*managerp != NULL && ISCAPI_TIMERMGR_VALID(*managerp));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__timermgr_destroy(managerp);
|
||||
else
|
||||
(*managerp)->methods->destroy(managerp);
|
||||
|
||||
ENSURE(*managerp == NULL);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type,
|
||||
const isc_time_t *expires, const isc_interval_t *interval,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg,
|
||||
isc_timer_t **timerp)
|
||||
{
|
||||
REQUIRE(ISCAPI_TIMERMGR_VALID(manager));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__timer_create(manager, type, expires, interval,
|
||||
task, action, arg, timerp));
|
||||
|
||||
return (manager->methods->timercreate(manager, type, expires,
|
||||
interval, task, action, arg,
|
||||
timerp));
|
||||
}
|
||||
|
||||
void
|
||||
isc_timer_attach(isc_timer_t *timer, isc_timer_t **timerp) {
|
||||
REQUIRE(ISCAPI_TIMER_VALID(timer));
|
||||
REQUIRE(timerp != NULL && *timerp == NULL);
|
||||
|
||||
if (isc_bind9)
|
||||
isc__timer_attach(timer, timerp);
|
||||
else
|
||||
timer->methods->attach(timer, timerp);
|
||||
|
||||
ENSURE(*timerp == timer);
|
||||
}
|
||||
|
||||
void
|
||||
isc_timer_detach(isc_timer_t **timerp) {
|
||||
REQUIRE(timerp != NULL && ISCAPI_TIMER_VALID(*timerp));
|
||||
|
||||
if (isc_bind9)
|
||||
isc__timer_detach(timerp);
|
||||
else
|
||||
(*timerp)->methods->detach(timerp);
|
||||
|
||||
ENSURE(*timerp == NULL);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_timer_reset(isc_timer_t *timer, isc_timertype_t type,
|
||||
const isc_time_t *expires, const isc_interval_t *interval,
|
||||
bool purge)
|
||||
{
|
||||
REQUIRE(ISCAPI_TIMER_VALID(timer));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__timer_reset(timer, type, expires,
|
||||
interval, purge));
|
||||
|
||||
return (timer->methods->reset(timer, type, expires, interval, purge));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_timer_touch(isc_timer_t *timer) {
|
||||
REQUIRE(ISCAPI_TIMER_VALID(timer));
|
||||
|
||||
if (isc_bind9)
|
||||
return (isc__timer_touch(timer));
|
||||
|
||||
return (timer->methods->touch(timer));
|
||||
}
|
||||
|
||||
+35
-91
@@ -51,34 +51,7 @@
|
||||
* as an event loop dispatching various events.
|
||||
*/
|
||||
static pthread_t blockedthread;
|
||||
|
||||
/*%
|
||||
* The following are intended for internal use (indicated by "isc__"
|
||||
* prefix) but are not declared as static, allowing direct access from
|
||||
* unit tests etc.
|
||||
*/
|
||||
isc_result_t isc__app_start(void);
|
||||
isc_result_t isc__app_ctxstart(isc_appctx_t *ctx);
|
||||
isc_result_t isc__app_onrun(isc_mem_t *mctx, isc_task_t *task,
|
||||
isc_taskaction_t action, void *arg);
|
||||
isc_result_t isc__app_ctxrun(isc_appctx_t *ctx);
|
||||
isc_result_t isc__app_run(void);
|
||||
isc_result_t isc__app_ctxshutdown(isc_appctx_t *ctx);
|
||||
isc_result_t isc__app_shutdown(void);
|
||||
isc_result_t isc__app_reload(void);
|
||||
isc_result_t isc__app_ctxsuspend(isc_appctx_t *ctx);
|
||||
void isc__app_ctxfinish(isc_appctx_t *ctx);
|
||||
void isc__app_finish(void);
|
||||
void isc__app_block(void);
|
||||
void isc__app_unblock(void);
|
||||
isc_result_t isc__appctx_create(isc_mem_t *mctx, isc_appctx_t **ctxp);
|
||||
void isc__appctx_destroy(isc_appctx_t **ctxp);
|
||||
void isc__appctx_settaskmgr(isc_appctx_t *ctx, isc_taskmgr_t *taskmgr);
|
||||
void isc__appctx_setsocketmgr(isc_appctx_t *ctx, isc_socketmgr_t *socketmgr);
|
||||
void isc__appctx_settimermgr(isc_appctx_t *ctx, isc_timermgr_t *timermgr);
|
||||
isc_result_t isc__app_ctxonrun(isc_appctx_t *ctx, isc_mem_t *mctx,
|
||||
isc_task_t *task, isc_taskaction_t action,
|
||||
void *arg);
|
||||
static bool is_running;
|
||||
|
||||
/*
|
||||
* The application context of this module. This implementation actually
|
||||
@@ -115,35 +88,6 @@ typedef struct isc__appctx {
|
||||
|
||||
static isc__appctx_t isc_g_appctx;
|
||||
|
||||
static struct {
|
||||
isc_appmethods_t methods;
|
||||
|
||||
/*%
|
||||
* The following are defined just for avoiding unused static functions.
|
||||
*/
|
||||
void *run, *shutdown, *start, *reload, *finish, *block, *unblock;
|
||||
} appmethods = {
|
||||
{
|
||||
isc__appctx_destroy,
|
||||
isc__app_ctxstart,
|
||||
isc__app_ctxrun,
|
||||
isc__app_ctxsuspend,
|
||||
isc__app_ctxshutdown,
|
||||
isc__app_ctxfinish,
|
||||
isc__appctx_settaskmgr,
|
||||
isc__appctx_setsocketmgr,
|
||||
isc__appctx_settimermgr,
|
||||
isc__app_ctxonrun
|
||||
},
|
||||
(void *)isc__app_run,
|
||||
(void *)isc__app_shutdown,
|
||||
(void *)isc__app_start,
|
||||
(void *)isc__app_reload,
|
||||
(void *)isc__app_finish,
|
||||
(void *)isc__app_block,
|
||||
(void *)isc__app_unblock
|
||||
};
|
||||
|
||||
#ifdef HAVE_LINUXTHREADS
|
||||
/*!
|
||||
* Linux has sigwait(), but it appears to prevent signal handlers from
|
||||
@@ -195,7 +139,7 @@ handle_signal(int sig, void (*handler)(int)) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_ctxstart(isc_appctx_t *ctx0) {
|
||||
isc_app_ctxstart(isc_appctx_t *ctx0) {
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
isc_result_t result;
|
||||
int presult;
|
||||
@@ -330,26 +274,25 @@ isc__app_ctxstart(isc_appctx_t *ctx0) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_start(void) {
|
||||
isc_app_start(void) {
|
||||
isc_g_appctx.common.impmagic = APPCTX_MAGIC;
|
||||
isc_g_appctx.common.magic = ISCAPI_APPCTX_MAGIC;
|
||||
isc_g_appctx.common.methods = &appmethods.methods;
|
||||
isc_g_appctx.mctx = NULL;
|
||||
/* The remaining members will be initialized in ctxstart() */
|
||||
|
||||
return (isc__app_ctxstart((isc_appctx_t *)&isc_g_appctx));
|
||||
return (isc_app_ctxstart((isc_appctx_t *)&isc_g_appctx));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_onrun(isc_mem_t *mctx, isc_task_t *task, isc_taskaction_t action,
|
||||
isc_app_onrun(isc_mem_t *mctx, isc_task_t *task, isc_taskaction_t action,
|
||||
void *arg)
|
||||
{
|
||||
return (isc__app_ctxonrun((isc_appctx_t *)&isc_g_appctx, mctx,
|
||||
return (isc_app_ctxonrun((isc_appctx_t *)&isc_g_appctx, mctx,
|
||||
task, action, arg));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_ctxonrun(isc_appctx_t *ctx0, isc_mem_t *mctx, isc_task_t *task,
|
||||
isc_app_ctxonrun(isc_appctx_t *ctx0, isc_mem_t *mctx, isc_task_t *task,
|
||||
isc_taskaction_t action, void *arg)
|
||||
{
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
@@ -388,7 +331,7 @@ isc__app_ctxonrun(isc_appctx_t *ctx0, isc_mem_t *mctx, isc_task_t *task,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_ctxrun(isc_appctx_t *ctx0) {
|
||||
isc_app_ctxrun(isc_appctx_t *ctx0) {
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
int result;
|
||||
isc_event_t *event, *next_event;
|
||||
@@ -549,12 +492,21 @@ isc__app_ctxrun(isc_appctx_t *ctx0) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_run(void) {
|
||||
return (isc__app_ctxrun((isc_appctx_t *)&isc_g_appctx));
|
||||
isc_app_run(void) {
|
||||
isc_result_t result;
|
||||
is_running = true;
|
||||
result = isc_app_ctxrun((isc_appctx_t *)&isc_g_appctx);
|
||||
is_running = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool
|
||||
isc_app_isrunning() {
|
||||
return (is_running);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_ctxshutdown(isc_appctx_t *ctx0) {
|
||||
isc_app_ctxshutdown(isc_appctx_t *ctx0) {
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
bool want_kill = true;
|
||||
char strbuf[ISC_STRERRORSIZE];
|
||||
@@ -620,12 +572,12 @@ isc__app_ctxshutdown(isc_appctx_t *ctx0) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_shutdown(void) {
|
||||
return (isc__app_ctxshutdown((isc_appctx_t *)&isc_g_appctx));
|
||||
isc_app_shutdown(void) {
|
||||
return (isc_app_ctxshutdown((isc_appctx_t *)&isc_g_appctx));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_ctxsuspend(isc_appctx_t *ctx0) {
|
||||
isc_app_ctxsuspend(isc_appctx_t *ctx0) {
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
bool want_kill = true;
|
||||
char strbuf[ISC_STRERRORSIZE];
|
||||
@@ -693,12 +645,12 @@ isc__app_ctxsuspend(isc_appctx_t *ctx0) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_reload(void) {
|
||||
return (isc__app_ctxsuspend((isc_appctx_t *)&isc_g_appctx));
|
||||
isc_app_reload(void) {
|
||||
return (isc_app_ctxsuspend((isc_appctx_t *)&isc_g_appctx));
|
||||
}
|
||||
|
||||
void
|
||||
isc__app_ctxfinish(isc_appctx_t *ctx0) {
|
||||
isc_app_ctxfinish(isc_appctx_t *ctx0) {
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
|
||||
REQUIRE(VALID_APPCTX(ctx));
|
||||
@@ -707,12 +659,12 @@ isc__app_ctxfinish(isc_appctx_t *ctx0) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__app_finish(void) {
|
||||
isc__app_ctxfinish((isc_appctx_t *)&isc_g_appctx);
|
||||
isc_app_finish(void) {
|
||||
isc_app_ctxfinish((isc_appctx_t *)&isc_g_appctx);
|
||||
}
|
||||
|
||||
void
|
||||
isc__app_block(void) {
|
||||
isc_app_block(void) {
|
||||
sigset_t sset;
|
||||
REQUIRE(isc_g_appctx.running);
|
||||
REQUIRE(!isc_g_appctx.blocked);
|
||||
@@ -726,7 +678,7 @@ isc__app_block(void) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__app_unblock(void) {
|
||||
isc_app_unblock(void) {
|
||||
sigset_t sset;
|
||||
|
||||
REQUIRE(isc_g_appctx.running);
|
||||
@@ -743,7 +695,7 @@ isc__app_unblock(void) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__appctx_create(isc_mem_t *mctx, isc_appctx_t **ctxp) {
|
||||
isc_appctx_create(isc_mem_t *mctx, isc_appctx_t **ctxp) {
|
||||
isc__appctx_t *ctx;
|
||||
|
||||
REQUIRE(mctx != NULL);
|
||||
@@ -755,7 +707,6 @@ isc__appctx_create(isc_mem_t *mctx, isc_appctx_t **ctxp) {
|
||||
|
||||
ctx->common.impmagic = APPCTX_MAGIC;
|
||||
ctx->common.magic = ISCAPI_APPCTX_MAGIC;
|
||||
ctx->common.methods = &appmethods.methods;
|
||||
|
||||
ctx->mctx = NULL;
|
||||
isc_mem_attach(mctx, &ctx->mctx);
|
||||
@@ -770,7 +721,7 @@ isc__appctx_create(isc_mem_t *mctx, isc_appctx_t **ctxp) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__appctx_destroy(isc_appctx_t **ctxp) {
|
||||
isc_appctx_destroy(isc_appctx_t **ctxp) {
|
||||
isc__appctx_t *ctx;
|
||||
|
||||
REQUIRE(ctxp != NULL);
|
||||
@@ -783,7 +734,7 @@ isc__appctx_destroy(isc_appctx_t **ctxp) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__appctx_settaskmgr(isc_appctx_t *ctx0, isc_taskmgr_t *taskmgr) {
|
||||
isc_appctx_settaskmgr(isc_appctx_t *ctx0, isc_taskmgr_t *taskmgr) {
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
|
||||
REQUIRE(VALID_APPCTX(ctx));
|
||||
@@ -792,7 +743,7 @@ isc__appctx_settaskmgr(isc_appctx_t *ctx0, isc_taskmgr_t *taskmgr) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__appctx_setsocketmgr(isc_appctx_t *ctx0, isc_socketmgr_t *socketmgr) {
|
||||
isc_appctx_setsocketmgr(isc_appctx_t *ctx0, isc_socketmgr_t *socketmgr) {
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
|
||||
REQUIRE(VALID_APPCTX(ctx));
|
||||
@@ -801,17 +752,10 @@ isc__appctx_setsocketmgr(isc_appctx_t *ctx0, isc_socketmgr_t *socketmgr) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__appctx_settimermgr(isc_appctx_t *ctx0, isc_timermgr_t *timermgr) {
|
||||
isc_appctx_settimermgr(isc_appctx_t *ctx0, isc_timermgr_t *timermgr) {
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
|
||||
REQUIRE(VALID_APPCTX(ctx));
|
||||
|
||||
ctx->timermgr = timermgr;
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_register(void) {
|
||||
return (isc_app_register(isc__appctx_create));
|
||||
}
|
||||
|
||||
#include "../app_api.c"
|
||||
|
||||
+568
-1027
File diff suppressed because it is too large
Load Diff
+36
-87
@@ -40,39 +40,8 @@
|
||||
*/
|
||||
|
||||
static isc_thread_t blockedthread;
|
||||
static bool is_running;
|
||||
|
||||
/*%
|
||||
* The following are intended for internal use (indicated by "isc__"
|
||||
* prefix) but are not declared as static, allowing direct access from
|
||||
* unit tests etc.
|
||||
*/
|
||||
isc_result_t isc__app_start(void);
|
||||
isc_result_t isc__app_ctxstart(isc_appctx_t *ctx);
|
||||
isc_result_t isc__app_onrun(isc_mem_t *mctx, isc_task_t *task,
|
||||
isc_taskaction_t action, void *arg);
|
||||
isc_result_t isc__app_ctxrun(isc_appctx_t *ctx);
|
||||
isc_result_t isc__app_run(void);
|
||||
isc_result_t isc__app_ctxshutdown(isc_appctx_t *ctx);
|
||||
isc_result_t isc__app_shutdown(void);
|
||||
isc_result_t isc__app_reload(void);
|
||||
isc_result_t isc__app_ctxsuspend(isc_appctx_t *ctx);
|
||||
void isc__app_ctxfinish(isc_appctx_t *ctx);
|
||||
void isc__app_finish(void);
|
||||
void isc__app_block(void);
|
||||
void isc__app_unblock(void);
|
||||
isc_result_t isc__appctx_create(isc_mem_t *mctx, isc_appctx_t **ctxp);
|
||||
void isc__appctx_destroy(isc_appctx_t **ctxp);
|
||||
void isc__appctx_settaskmgr(isc_appctx_t *ctx, isc_taskmgr_t *taskmgr);
|
||||
void isc__appctx_setsocketmgr(isc_appctx_t *ctx, isc_socketmgr_t *socketmgr);
|
||||
void isc__appctx_settimermgr(isc_appctx_t *ctx, isc_timermgr_t *timermgr);
|
||||
isc_result_t isc__app_ctxonrun(isc_appctx_t *ctx, isc_mem_t *mctx,
|
||||
isc_task_t *task, isc_taskaction_t action,
|
||||
void *arg);
|
||||
|
||||
/*
|
||||
* The application context of this module. This implementation actually
|
||||
* doesn't use it. (This may change in the future).
|
||||
*/
|
||||
#define APPCTX_MAGIC ISC_MAGIC('A', 'p', 'c', 'x')
|
||||
#define VALID_APPCTX(c) ISC_MAGIC_VALID(c, APPCTX_MAGIC)
|
||||
|
||||
@@ -112,42 +81,13 @@ typedef struct isc__appctx {
|
||||
|
||||
static isc__appctx_t isc_g_appctx;
|
||||
|
||||
static struct {
|
||||
isc_appmethods_t methods;
|
||||
|
||||
/*%
|
||||
* The following are defined just for avoiding unused static functions.
|
||||
*/
|
||||
void *run, *shutdown, *start, *reload, *finish, *block, *unblock;
|
||||
} appmethods = {
|
||||
{
|
||||
isc__appctx_destroy,
|
||||
isc__app_ctxstart,
|
||||
isc__app_ctxrun,
|
||||
isc__app_ctxsuspend,
|
||||
isc__app_ctxshutdown,
|
||||
isc__app_ctxfinish,
|
||||
isc__appctx_settaskmgr,
|
||||
isc__appctx_setsocketmgr,
|
||||
isc__appctx_settimermgr,
|
||||
isc__app_ctxonrun
|
||||
},
|
||||
(void *)isc__app_run,
|
||||
(void *)isc__app_shutdown,
|
||||
(void *)isc__app_start,
|
||||
(void *)isc__app_reload,
|
||||
(void *)isc__app_finish,
|
||||
(void *)isc__app_block,
|
||||
(void *)isc__app_unblock
|
||||
};
|
||||
|
||||
/*
|
||||
* We need to remember which thread is the main thread...
|
||||
*/
|
||||
static isc_thread_t main_thread;
|
||||
|
||||
isc_result_t
|
||||
isc__app_ctxstart(isc_appctx_t *ctx0) {
|
||||
isc_app_ctxstart(isc_appctx_t *ctx0) {
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
isc_result_t result;
|
||||
|
||||
@@ -180,26 +120,26 @@ isc__app_ctxstart(isc_appctx_t *ctx0) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_start(void) {
|
||||
isc_app_start(void) {
|
||||
isc_g_appctx.common.impmagic = APPCTX_MAGIC;
|
||||
isc_g_appctx.common.magic = ISCAPI_APPCTX_MAGIC;
|
||||
isc_g_appctx.common.methods = &appmethods.methods;
|
||||
isc_g_appctx.mctx = NULL;
|
||||
/* The remaining members will be initialized in ctxstart() */
|
||||
|
||||
return (isc__app_ctxstart((isc_appctx_t *)&isc_g_appctx));
|
||||
return (isc_app_ctxstart((isc_appctx_t *)&isc_g_appctx));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_onrun(isc_mem_t *mctx, isc_task_t *task, isc_taskaction_t action,
|
||||
isc_app_onrun(isc_mem_t *mctx, isc_task_t *task, isc_taskaction_t action,
|
||||
void *arg)
|
||||
{
|
||||
return (isc__app_ctxonrun((isc_appctx_t *)&isc_g_appctx, mctx,
|
||||
return (isc_app_ctxonrun((isc_appctx_t *)&isc_g_appctx, mctx,
|
||||
task, action, arg));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_ctxonrun(isc_appctx_t *ctx0, isc_mem_t *mctx, isc_task_t *task,
|
||||
isc_app_ctxonrun(isc_appctx_t *ctx0, isc_mem_t *mctx, isc_task_t *task,
|
||||
isc_taskaction_t action, void *arg)
|
||||
{
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
@@ -238,7 +178,7 @@ isc__app_ctxonrun(isc_appctx_t *ctx0, isc_mem_t *mctx, isc_task_t *task,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_ctxrun(isc_appctx_t *ctx0) {
|
||||
isc_app_ctxrun(isc_appctx_t *ctx0) {
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
isc_event_t *event, *next_event;
|
||||
isc_task_t *task;
|
||||
@@ -311,12 +251,21 @@ isc__app_ctxrun(isc_appctx_t *ctx0) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_run(void) {
|
||||
return (isc__app_ctxrun((isc_appctx_t *)&isc_g_appctx));
|
||||
isc_app_run(void) {
|
||||
isc_result_t result;
|
||||
is_running = ISC_TRUE;
|
||||
result = isc_app_ctxrun((isc_appctx_t *)&isc_g_appctx);
|
||||
is_running = ISC_FALSE;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool
|
||||
isc_app_isrunning() {
|
||||
return (is_running);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_ctxshutdown(isc_appctx_t *ctx0) {
|
||||
isc_app_ctxshutdown(isc_appctx_t *ctx0) {
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
bool want_kill = true;
|
||||
|
||||
@@ -340,12 +289,12 @@ isc__app_ctxshutdown(isc_appctx_t *ctx0) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_shutdown(void) {
|
||||
return (isc__app_ctxshutdown((isc_appctx_t *)&isc_g_appctx));
|
||||
isc_app_shutdown(void) {
|
||||
return (isc_app_ctxshutdown((isc_appctx_t *)&isc_g_appctx));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_ctxsuspend(isc_appctx_t *ctx0) {
|
||||
isc_app_ctxsuspend(isc_appctx_t *ctx0) {
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
bool want_kill = true;
|
||||
|
||||
@@ -370,12 +319,12 @@ isc__app_ctxsuspend(isc_appctx_t *ctx0) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_reload(void) {
|
||||
return (isc__app_ctxsuspend((isc_appctx_t *)&isc_g_appctx));
|
||||
isc_app_reload(void) {
|
||||
return (isc_app_ctxsuspend((isc_appctx_t *)&isc_g_appctx));
|
||||
}
|
||||
|
||||
void
|
||||
isc__app_ctxfinish(isc_appctx_t *ctx0) {
|
||||
isc_app_ctxfinish(isc_appctx_t *ctx0) {
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
|
||||
REQUIRE(VALID_APPCTX(ctx));
|
||||
@@ -384,12 +333,12 @@ isc__app_ctxfinish(isc_appctx_t *ctx0) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__app_finish(void) {
|
||||
isc__app_ctxfinish((isc_appctx_t *)&isc_g_appctx);
|
||||
isc_app_finish(void) {
|
||||
isc_app_ctxfinish((isc_appctx_t *)&isc_g_appctx);
|
||||
}
|
||||
|
||||
void
|
||||
isc__app_block(void) {
|
||||
isc_app_block(void) {
|
||||
REQUIRE(isc_g_appctx.running);
|
||||
REQUIRE(!isc_g_appctx.blocked);
|
||||
|
||||
@@ -398,7 +347,7 @@ isc__app_block(void) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__app_unblock(void) {
|
||||
isc_app_unblock(void) {
|
||||
REQUIRE(isc_g_appctx.running);
|
||||
REQUIRE(isc_g_appctx.blocked);
|
||||
|
||||
@@ -407,7 +356,7 @@ isc__app_unblock(void) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__appctx_create(isc_mem_t *mctx, isc_appctx_t **ctxp) {
|
||||
isc_appctx_create(isc_mem_t *mctx, isc_appctx_t **ctxp) {
|
||||
isc__appctx_t *ctx;
|
||||
|
||||
REQUIRE(mctx != NULL);
|
||||
@@ -434,7 +383,7 @@ isc__appctx_create(isc_mem_t *mctx, isc_appctx_t **ctxp) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__appctx_destroy(isc_appctx_t **ctxp) {
|
||||
isc_appctx_destroy(isc_appctx_t **ctxp) {
|
||||
isc__appctx_t *ctx;
|
||||
|
||||
REQUIRE(ctxp != NULL);
|
||||
@@ -447,7 +396,7 @@ isc__appctx_destroy(isc_appctx_t **ctxp) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__appctx_settaskmgr(isc_appctx_t *ctx0, isc_taskmgr_t *taskmgr) {
|
||||
isc_appctx_settaskmgr(isc_appctx_t *ctx0, isc_taskmgr_t *taskmgr) {
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
|
||||
REQUIRE(VALID_APPCTX(ctx));
|
||||
@@ -456,7 +405,7 @@ isc__appctx_settaskmgr(isc_appctx_t *ctx0, isc_taskmgr_t *taskmgr) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__appctx_setsocketmgr(isc_appctx_t *ctx0, isc_socketmgr_t *socketmgr) {
|
||||
isc_appctx_setsocketmgr(isc_appctx_t *ctx0, isc_socketmgr_t *socketmgr) {
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
|
||||
REQUIRE(VALID_APPCTX(ctx));
|
||||
@@ -465,7 +414,7 @@ isc__appctx_setsocketmgr(isc_appctx_t *ctx0, isc_socketmgr_t *socketmgr) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__appctx_settimermgr(isc_appctx_t *ctx0, isc_timermgr_t *timermgr) {
|
||||
isc_appctx_settimermgr(isc_appctx_t *ctx0, isc_timermgr_t *timermgr) {
|
||||
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
|
||||
|
||||
REQUIRE(VALID_APPCTX(ctx));
|
||||
@@ -474,7 +423,7 @@ isc__appctx_settimermgr(isc_appctx_t *ctx0, isc_timermgr_t *timermgr) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__app_register(void) {
|
||||
isc_app_register(void) {
|
||||
return (isc_app_register(isc__appctx_create));
|
||||
}
|
||||
|
||||
|
||||
+75
-73
@@ -9,25 +9,25 @@ closelog
|
||||
getpassphrase
|
||||
@END PKCS11
|
||||
isc___socketmgr_maxudp
|
||||
isc__app_block
|
||||
isc__app_ctxfinish
|
||||
isc__app_ctxonrun
|
||||
isc__app_ctxrun
|
||||
isc__app_ctxshutdown
|
||||
isc__app_ctxstart
|
||||
isc__app_ctxsuspend
|
||||
isc__app_finish
|
||||
isc__app_onrun
|
||||
isc__app_reload
|
||||
isc__app_run
|
||||
isc__app_shutdown
|
||||
isc__app_start
|
||||
isc__app_unblock
|
||||
isc__appctx_create
|
||||
isc__appctx_destroy
|
||||
isc__appctx_setsocketmgr
|
||||
isc__appctx_settaskmgr
|
||||
isc__appctx_settimermgr
|
||||
isc_app_block
|
||||
isc_app_ctxfinish
|
||||
isc_app_ctxonrun
|
||||
isc_app_ctxrun
|
||||
isc_app_ctxshutdown
|
||||
isc_app_ctxstart
|
||||
isc_app_ctxsuspend
|
||||
isc_app_finish
|
||||
isc_app_onrun
|
||||
isc_app_reload
|
||||
isc_app_run
|
||||
isc_app_shutdown
|
||||
isc_app_start
|
||||
isc_app_unblock
|
||||
isc_appctx_create
|
||||
isc_appctx_destroy
|
||||
isc_appctx_setsocketmgr
|
||||
isc_appctx_settaskmgr
|
||||
isc_appctx_settimermgr
|
||||
isc__buffer_activeregion
|
||||
isc__buffer_add
|
||||
isc__buffer_availableregion
|
||||
@@ -51,60 +51,62 @@ isc__buffer_remainingregion
|
||||
isc__buffer_setactive
|
||||
isc__buffer_subtract
|
||||
isc__buffer_usedregion
|
||||
isc__mem_allocate
|
||||
isc__mem_free
|
||||
isc__mem_get
|
||||
isc__mem_printactive
|
||||
isc__mem_put
|
||||
isc__mem_putanddetach
|
||||
isc__mem_reallocate
|
||||
isc__mem_strdup
|
||||
isc__mempool_get
|
||||
isc__mempool_put
|
||||
isc__socket_accept
|
||||
isc__socket_attach
|
||||
isc__socket_bind
|
||||
isc__socket_cancel
|
||||
isc__socket_cleanunix
|
||||
isc__socket_close
|
||||
isc__socket_connect
|
||||
isc__socket_create
|
||||
isc__socket_detach
|
||||
isc__socket_dscp
|
||||
isc__socket_dup
|
||||
isc__socket_filter
|
||||
isc__socket_getfd
|
||||
isc__socket_getname
|
||||
isc__socket_getpeername
|
||||
isc__socket_getsockname
|
||||
isc__socket_gettag
|
||||
isc__socket_gettype
|
||||
isc__socket_ipv6only
|
||||
isc__socket_isbound
|
||||
isc__socket_listen
|
||||
isc__socket_open
|
||||
isc__socket_permunix
|
||||
isc__socket_recv
|
||||
isc__socket_recv2
|
||||
isc__socket_recvv
|
||||
isc__socket_register
|
||||
isc__socket_send
|
||||
isc__socket_sendto
|
||||
isc__socket_sendto2
|
||||
isc__socket_sendtov
|
||||
isc__socket_sendtov2
|
||||
isc__socket_sendv
|
||||
isc__socket_setname
|
||||
isc__socketmgr_create
|
||||
isc__socketmgr_create2
|
||||
isc__socketmgr_destroy
|
||||
isc__socketmgr_getmaxsockets
|
||||
isc__socketmgr_setreserved
|
||||
isc__socketmgr_setstats
|
||||
isc__task_getname
|
||||
isc__task_gettag
|
||||
isc__task_unsendrange
|
||||
isc__taskmgr_mode
|
||||
isc_mem_allocate
|
||||
isc_mem_free
|
||||
isc_mem_get
|
||||
isc_mem_printactive
|
||||
isc_mem_put
|
||||
isc_mem_putanddetach
|
||||
isc_mem_reallocate
|
||||
isc_mem_strdup
|
||||
isc_mempool_get
|
||||
isc_mempool_put
|
||||
isc_socket_accept
|
||||
isc_socket_attach
|
||||
isc_socket_bind
|
||||
isc_socket_cancel
|
||||
isc_socket_cleanunix
|
||||
isc_socket_close
|
||||
isc_socket_connect
|
||||
isc_socket_create
|
||||
isc_socket_detach
|
||||
isc_socket_dscp
|
||||
isc_socket_dup
|
||||
isc_socket_filter
|
||||
isc_socket_getfd
|
||||
isc_socket_getname
|
||||
isc_socket_getpeername
|
||||
isc_socket_getsockname
|
||||
isc_socket_gettag
|
||||
isc_socket_gettype
|
||||
isc_socket_hasreuseport
|
||||
isc_socket_ipv6only
|
||||
isc_socket_isbound
|
||||
isc_socket_listen
|
||||
isc_socket_open
|
||||
isc_socket_permunix
|
||||
isc_socket_recv
|
||||
isc_socket_recv2
|
||||
isc_socket_recvv
|
||||
isc_socket_register
|
||||
isc_socket_send
|
||||
isc_socket_sendto
|
||||
isc_socket_sendto2
|
||||
isc_socket_sendtov
|
||||
isc_socket_sendtov2
|
||||
isc_socket_sendv
|
||||
isc_socket_setname
|
||||
isc_socketmgr_create
|
||||
isc_socketmgr_create2
|
||||
isc_socketmgr_destroy
|
||||
isc_socketmgr_getmaxsockets
|
||||
isc_socketmgr_setreserved
|
||||
isc_socketmgr_setstats
|
||||
isc__strerror
|
||||
isc_task_getname
|
||||
isc_task_gettag
|
||||
isc_task_unsendrange
|
||||
isc_taskmgr_mode
|
||||
isc__taskmgr_pause
|
||||
isc__taskmgr_resume
|
||||
isc_aes128_crypt
|
||||
|
||||
+52
-93
@@ -1657,7 +1657,6 @@ socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
|
||||
REQUIRE(VALID_MANAGER(manager));
|
||||
REQUIRE(socketp != NULL && *socketp == NULL);
|
||||
REQUIRE(type != isc_sockettype_fdwatch);
|
||||
|
||||
#ifndef SOCK_RAW
|
||||
if (type == isc_sockettype_raw)
|
||||
@@ -1807,19 +1806,19 @@ socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
|
||||
if (dup_socket) {
|
||||
#ifndef ISC_ALLOW_MAPPED
|
||||
isc__socket_ipv6only(sock, true);
|
||||
isc_socket_ipv6only(sock, true);
|
||||
#endif
|
||||
|
||||
if (dup_socket->bound) {
|
||||
isc_sockaddr_t local;
|
||||
|
||||
result = isc__socket_getsockname(dup_socket, &local);
|
||||
result = isc_socket_getsockname(dup_socket, &local);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_socket_close(sock);
|
||||
return (result);
|
||||
}
|
||||
result = isc__socket_bind(sock, &local,
|
||||
ISC_SOCKET_REUSEADDRESS);
|
||||
result = isc_socket_bind(sock, &local,
|
||||
ISC_SOCKET_REUSEADDRESS);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_socket_close(sock);
|
||||
return (result);
|
||||
@@ -1845,14 +1844,14 @@ socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
||||
isc_socket_t **socketp)
|
||||
{
|
||||
return (socket_create(manager, pf, type, socketp, NULL));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socket_dup(isc_socket_t *sock, isc_socket_t **socketp) {
|
||||
isc_socket_dup(isc_socket_t *sock, isc_socket_t **socketp) {
|
||||
REQUIRE(VALID_SOCKET(sock));
|
||||
REQUIRE(socketp != NULL && *socketp == NULL);
|
||||
|
||||
@@ -1863,7 +1862,6 @@ isc__socket_dup(isc_socket_t *sock, isc_socket_t **socketp) {
|
||||
isc_result_t
|
||||
isc_socket_open(isc_socket_t *sock) {
|
||||
REQUIRE(VALID_SOCKET(sock));
|
||||
REQUIRE(sock->type != isc_sockettype_fdwatch);
|
||||
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
@@ -1872,7 +1870,7 @@ isc_socket_open(isc_socket_t *sock) {
|
||||
* Attach to a socket. Caller must explicitly detach when it is done.
|
||||
*/
|
||||
void
|
||||
isc__socket_attach(isc_socket_t *sock, isc_socket_t **socketp) {
|
||||
isc_socket_attach(isc_socket_t *sock, isc_socket_t **socketp) {
|
||||
REQUIRE(VALID_SOCKET(sock));
|
||||
REQUIRE(socketp != NULL && *socketp == NULL);
|
||||
|
||||
@@ -1889,13 +1887,12 @@ isc__socket_attach(isc_socket_t *sock, isc_socket_t **socketp) {
|
||||
* up by destroying the socket.
|
||||
*/
|
||||
void
|
||||
isc__socket_detach(isc_socket_t **socketp) {
|
||||
isc_socket_detach(isc_socket_t **socketp) {
|
||||
isc_socket_t *sock;
|
||||
|
||||
REQUIRE(socketp != NULL);
|
||||
sock = *socketp;
|
||||
REQUIRE(VALID_SOCKET(sock));
|
||||
REQUIRE(sock->type != isc_sockettype_fdwatch);
|
||||
|
||||
LOCK(&sock->lock);
|
||||
CONSISTENT(sock);
|
||||
@@ -1921,7 +1918,6 @@ isc__socket_detach(isc_socket_t **socketp) {
|
||||
isc_result_t
|
||||
isc_socket_close(isc_socket_t *sock) {
|
||||
REQUIRE(VALID_SOCKET(sock));
|
||||
REQUIRE(sock->type != isc_sockettype_fdwatch);
|
||||
|
||||
return (ISC_R_NOTIMPLEMENTED);
|
||||
}
|
||||
@@ -2647,12 +2643,12 @@ SocketIoThread(LPVOID ThreadContext) {
|
||||
* Create a new socket manager.
|
||||
*/
|
||||
isc_result_t
|
||||
isc__socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
||||
isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
|
||||
return (isc_socketmgr_create2(mctx, managerp, 0));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp,
|
||||
isc_socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp,
|
||||
unsigned int maxsocks)
|
||||
{
|
||||
isc_socketmgr_t *manager;
|
||||
@@ -2720,7 +2716,7 @@ isc_socketmgr_setstats(isc_socketmgr_t *manager, isc_stats_t *stats) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__socketmgr_destroy(isc_socketmgr_t **managerp) {
|
||||
isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
|
||||
isc_socketmgr_t *manager;
|
||||
int i;
|
||||
isc_mem_t *mctx;
|
||||
@@ -2845,7 +2841,7 @@ socket_recv(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socket_recvv(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
isc;_socket_recvv(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
unsigned int minimum, isc_task_t *task,
|
||||
isc_taskaction_t action, void *arg)
|
||||
{
|
||||
@@ -2916,7 +2912,7 @@ isc__socket_recvv(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socket_recv(isc_socket_t *sock, isc_region_t *region,
|
||||
isc_socket_recv(isc_socket_t *sock, isc_region_t *region,
|
||||
unsigned int minimum, isc_task_t *task,
|
||||
isc_taskaction_t action, void *arg)
|
||||
{
|
||||
@@ -2955,7 +2951,7 @@ isc__socket_recv(isc_socket_t *sock, isc_region_t *region,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socket_recv2(isc_socket_t *sock, isc_region_t *region,
|
||||
isc_socket_recv2(isc_socket_t *sock, isc_region_t *region,
|
||||
unsigned int minimum, isc_task_t *task,
|
||||
isc_socketevent_t *event, unsigned int flags)
|
||||
{
|
||||
@@ -3066,7 +3062,7 @@ socket_send(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socket_send(isc_socket_t *sock, isc_region_t *region,
|
||||
isc_socket_send(isc_socket_t *sock, isc_region_t *region,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg)
|
||||
{
|
||||
/*
|
||||
@@ -3077,7 +3073,7 @@ isc__socket_send(isc_socket_t *sock, isc_region_t *region,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socket_sendto(isc_socket_t *sock, isc_region_t *region,
|
||||
isc_socket_sendto(isc_socket_t *sock, isc_region_t *region,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg,
|
||||
const isc_sockaddr_t *address, struct in6_pktinfo *pktinfo)
|
||||
{
|
||||
@@ -3086,7 +3082,6 @@ isc__socket_sendto(isc_socket_t *sock, isc_region_t *region,
|
||||
isc_result_t ret;
|
||||
|
||||
REQUIRE(VALID_SOCKET(sock));
|
||||
REQUIRE(sock->type != isc_sockettype_fdwatch);
|
||||
|
||||
LOCK(&sock->lock);
|
||||
CONSISTENT(sock);
|
||||
@@ -3121,7 +3116,7 @@ isc__socket_sendto(isc_socket_t *sock, isc_region_t *region,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socket_sendv(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
isc_socket_sendv(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg)
|
||||
{
|
||||
return (isc_socket_sendtov2(sock, buflist, task, action, arg, NULL,
|
||||
@@ -3129,8 +3124,8 @@ isc__socket_sendv(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg,
|
||||
isc_socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg,
|
||||
const isc_sockaddr_t *address, struct in6_pktinfo *pktinfo)
|
||||
{
|
||||
return (isc_socket_sendtov2(sock, buflist, task, action, arg, address,
|
||||
@@ -3138,10 +3133,10 @@ isc__socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socket_sendtov2(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg,
|
||||
isc_socket_sendtov2(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg,
|
||||
const isc_sockaddr_t *address, struct in6_pktinfo *pktinfo,
|
||||
unsigned int flags)
|
||||
unsigned int flags)
|
||||
{
|
||||
isc_socketevent_t *dev;
|
||||
isc_socketmgr_t *manager;
|
||||
@@ -3195,9 +3190,9 @@ isc__socket_sendtov2(isc_socket_t *sock, isc_bufferlist_t *buflist,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socket_sendto2(isc_socket_t *sock, isc_region_t *region, isc_task_t *task,
|
||||
const isc_sockaddr_t *address, struct in6_pktinfo *pktinfo,
|
||||
isc_socketevent_t *event, unsigned int flags)
|
||||
isc_socket_sendto2(isc_socket_t *sock, isc_region_t *region, isc_task_t *task,
|
||||
const isc_sockaddr_t *address, struct in6_pktinfo *pktinfo,
|
||||
isc_socketevent_t *event, unsigned int flags)
|
||||
{
|
||||
isc_result_t ret;
|
||||
|
||||
@@ -3229,8 +3224,8 @@ isc__socket_sendto2(isc_socket_t *sock, isc_region_t *region, isc_task_t *task,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socket_bind(isc_socket_t *sock, const isc_sockaddr_t *sockaddr,
|
||||
isc_socket_options_t options)
|
||||
isc_socket_bind(isc_socket_t *sock, const isc_sockaddr_t *sockaddr,
|
||||
isc_socket_options_t options)
|
||||
{
|
||||
int bind_errno;
|
||||
char strbuf[ISC_STRERRORSIZE];
|
||||
@@ -3297,7 +3292,7 @@ isc__socket_bind(isc_socket_t *sock, const isc_sockaddr_t *sockaddr,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socket_filter(isc_socket_t *sock, const char *filter) {
|
||||
isc_socket_filter(isc_socket_t *sock, const char *filter) {
|
||||
UNUSED(sock);
|
||||
UNUSED(filter);
|
||||
|
||||
@@ -3316,7 +3311,7 @@ isc__socket_filter(isc_socket_t *sock, const char *filter) {
|
||||
* as well keep things simple rather than having to track them.
|
||||
*/
|
||||
isc_result_t
|
||||
isc__socket_listen(isc_socket_t *sock, unsigned int backlog) {
|
||||
isc_socket_listen(isc_socket_t *sock, unsigned int backlog) {
|
||||
char strbuf[ISC_STRERRORSIZE];
|
||||
#if defined(ISC_PLATFORM_HAVETFO) && defined(TCP_FASTOPEN)
|
||||
char on = 1;
|
||||
@@ -3375,8 +3370,8 @@ isc__socket_listen(isc_socket_t *sock, unsigned int backlog) {
|
||||
* This should try to do aggressive accept() XXXMLG
|
||||
*/
|
||||
isc_result_t
|
||||
isc__socket_accept(isc_socket_t *sock,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg)
|
||||
isc_socket_accept(isc_socket_t *sock,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg)
|
||||
{
|
||||
isc_socket_newconnev_t *adev;
|
||||
isc_socketmgr_t *manager;
|
||||
@@ -3493,8 +3488,8 @@ isc__socket_accept(isc_socket_t *sock,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socket_connect(isc_socket_t *sock, const isc_sockaddr_t *addr,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg)
|
||||
isc_socket_connect(isc_socket_t *sock, const isc_sockaddr_t *addr,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg)
|
||||
{
|
||||
char strbuf[ISC_STRERRORSIZE];
|
||||
isc_socket_connev_t *cdev;
|
||||
@@ -3624,7 +3619,7 @@ isc__socket_connect(isc_socket_t *sock, const isc_sockaddr_t *addr,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socket_getpeername(isc_socket_t *sock, isc_sockaddr_t *addressp) {
|
||||
isc_socket_getpeername(isc_socket_t *sock, isc_sockaddr_t *addressp) {
|
||||
isc_result_t result;
|
||||
|
||||
REQUIRE(VALID_SOCKET(sock));
|
||||
@@ -3654,7 +3649,7 @@ isc__socket_getpeername(isc_socket_t *sock, isc_sockaddr_t *addressp) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) {
|
||||
isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) {
|
||||
ISC_SOCKADDR_LEN_T len;
|
||||
isc_result_t result;
|
||||
char strbuf[ISC_STRERRORSIZE];
|
||||
@@ -3701,7 +3696,7 @@ isc__socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) {
|
||||
* queued for task "task" of type "how". "how" is a bitmask.
|
||||
*/
|
||||
void
|
||||
isc__socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how) {
|
||||
isc_socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how) {
|
||||
|
||||
REQUIRE(VALID_SOCKET(sock));
|
||||
|
||||
@@ -3827,7 +3822,7 @@ isc__socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how) {
|
||||
}
|
||||
|
||||
isc_sockettype_t
|
||||
isc__socket_gettype(isc_socket_t *sock) {
|
||||
isc_socket_gettype(isc_socket_t *sock) {
|
||||
isc_sockettype_t type;
|
||||
|
||||
REQUIRE(VALID_SOCKET(sock));
|
||||
@@ -3847,31 +3842,8 @@ isc__socket_gettype(isc_socket_t *sock) {
|
||||
return (type);
|
||||
}
|
||||
|
||||
bool
|
||||
isc__socket_isbound(isc_socket_t *sock) {
|
||||
bool val;
|
||||
|
||||
REQUIRE(VALID_SOCKET(sock));
|
||||
|
||||
LOCK(&sock->lock);
|
||||
CONSISTENT(sock);
|
||||
|
||||
/*
|
||||
* make sure that the socket's not closed
|
||||
*/
|
||||
if (sock->fd == INVALID_SOCKET) {
|
||||
UNLOCK(&sock->lock);
|
||||
return (false);
|
||||
}
|
||||
|
||||
val = ((sock->bound) ? true : false);
|
||||
UNLOCK(&sock->lock);
|
||||
|
||||
return (val);
|
||||
}
|
||||
|
||||
void
|
||||
isc__socket_ipv6only(isc_socket_t *sock, bool yes) {
|
||||
isc_socket_ipv6only(isc_socket_t *sock, bool yes) {
|
||||
#if defined(IPV6_V6ONLY)
|
||||
int onoff = yes ? 1 : 0;
|
||||
#else
|
||||
@@ -3889,7 +3861,7 @@ isc__socket_ipv6only(isc_socket_t *sock, bool yes) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__socket_dscp(isc_socket_t *sock, isc_dscp_t dscp) {
|
||||
isc_socket_dscp(isc_socket_t *sock, isc_dscp_t dscp) {
|
||||
#if !defined(IP_TOS) && !defined(IPV6_TCLASS)
|
||||
UNUSED(dscp);
|
||||
#else
|
||||
@@ -3917,14 +3889,14 @@ isc__socket_dscp(isc_socket_t *sock, isc_dscp_t dscp) {
|
||||
}
|
||||
|
||||
void
|
||||
isc__socket_cleanunix(const isc_sockaddr_t *addr, bool active) {
|
||||
isc_socket_cleanunix(const isc_sockaddr_t *addr, bool active) {
|
||||
UNUSED(addr);
|
||||
UNUSED(active);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__socket_permunix(const isc_sockaddr_t *addr, uint32_t perm,
|
||||
uint32_t owner, uint32_t group)
|
||||
isc_socket_permunix(const isc_sockaddr_t *addr, uint32_t perm,
|
||||
uint32_t owner, uint32_t group)
|
||||
{
|
||||
UNUSED(addr);
|
||||
UNUSED(perm);
|
||||
@@ -3934,7 +3906,7 @@ isc__socket_permunix(const isc_sockaddr_t *addr, uint32_t perm,
|
||||
}
|
||||
|
||||
void
|
||||
isc__socket_setname(isc_socket_t *socket, const char *name, void *tag) {
|
||||
isc_socket_setname(isc_socket_t *socket, const char *name, void *tag) {
|
||||
|
||||
/*
|
||||
* Name 'socket'.
|
||||
@@ -3949,33 +3921,26 @@ isc__socket_setname(isc_socket_t *socket, const char *name, void *tag) {
|
||||
}
|
||||
|
||||
const char *
|
||||
isc__socket_getname(isc_socket_t *socket) {
|
||||
isc_socket_getname(isc_socket_t *socket) {
|
||||
return (socket->name);
|
||||
}
|
||||
|
||||
void *
|
||||
isc__socket_gettag(isc_socket_t *socket) {
|
||||
isc_socket_gettag(isc_socket_t *socket) {
|
||||
return (socket->tag);
|
||||
}
|
||||
|
||||
int
|
||||
isc__socket_getfd(isc_socket_t *socket) {
|
||||
isc_socket_getfd(isc_socket_t *socket) {
|
||||
return ((short) socket->fd);
|
||||
}
|
||||
|
||||
void
|
||||
isc__socketmgr_setreserved(isc_socketmgr_t *manager, uint32_t reserved) {
|
||||
isc_socketmgr_setreserved(isc_socketmgr_t *manager, uint32_t reserved) {
|
||||
UNUSED(manager);
|
||||
UNUSED(reserved);
|
||||
}
|
||||
|
||||
void
|
||||
isc___socketmgr_maxudp(isc_socketmgr_t *manager, int maxudp) {
|
||||
|
||||
UNUSED(manager);
|
||||
UNUSED(maxudp);
|
||||
}
|
||||
|
||||
isc_socketevent_t *
|
||||
isc_socket_socketevent(isc_mem_t *mctx, void *sender,
|
||||
isc_eventtype_t eventtype, isc_taskaction_t action,
|
||||
@@ -3984,6 +3949,11 @@ isc_socket_socketevent(isc_mem_t *mctx, void *sender,
|
||||
return (allocate_socketevent(mctx, sender, eventtype, action, arg));
|
||||
}
|
||||
|
||||
bool
|
||||
isc_socket_hasreuseport() {
|
||||
return (false);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBXML2
|
||||
|
||||
static const char *
|
||||
@@ -3994,8 +3964,6 @@ _socktype(isc_sockettype_t type) {
|
||||
return ("tcp");
|
||||
else if (type == isc_sockettype_unix)
|
||||
return ("unix");
|
||||
else if (type == isc_sockettype_fdwatch)
|
||||
return ("fdwatch");
|
||||
else
|
||||
return ("not-initialized");
|
||||
}
|
||||
@@ -4243,15 +4211,6 @@ isc_socketmgr_renderjson(isc_socketmgr_t *mgr, json_object *stats) {
|
||||
}
|
||||
#endif /* HAVE_JSON */
|
||||
|
||||
/*
|
||||
* Replace ../socket_api.c
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
isc__socket_register(void) {
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_socketmgr_createinctx(isc_mem_t *mctx, isc_appctx_t *actx,
|
||||
isc_socketmgr_t **managerp)
|
||||
|
||||
+166
-5
@@ -78,7 +78,6 @@
|
||||
* If a routine is ever created that allows someone other than the client's
|
||||
* task to change the client, then the client will have to be locked.
|
||||
*/
|
||||
|
||||
#define NS_CLIENT_TRACE
|
||||
#ifdef NS_CLIENT_TRACE
|
||||
#define CTRACE(m) ns_client_log(client, \
|
||||
@@ -127,7 +126,7 @@ struct ns_clientmgr {
|
||||
|
||||
/* The queue object has its own locks */
|
||||
client_queue_t inactive; /*%< To be recycled */
|
||||
|
||||
unsigned int nclients;
|
||||
isc_mem_t * mctx;
|
||||
ns_server_t * sctx;
|
||||
isc_taskmgr_t * taskmgr;
|
||||
@@ -156,6 +155,12 @@ struct ns_clientmgr {
|
||||
#define MANAGER_MAGIC ISC_MAGIC('N', 'S', 'C', 'm')
|
||||
#define VALID_MANAGER(m) ISC_MAGIC_VALID(m, MANAGER_MAGIC)
|
||||
|
||||
typedef struct create_udp_socketevent_arg {
|
||||
ns_clientmgr_t *manager;
|
||||
isc_socket_t *socket;
|
||||
ns_interface_t *interface;
|
||||
} create_udp_socketevent_arg_t;
|
||||
|
||||
/*!
|
||||
* Client object states. Ordering is significant: higher-numbered
|
||||
* states are generally "more active", meaning that the client can
|
||||
@@ -247,6 +252,7 @@ static isc_result_t get_worker(ns_clientmgr_t *manager, ns_interface_t *ifp,
|
||||
static void compute_cookie(ns_client_t *client, uint32_t when,
|
||||
uint32_t nonce, const unsigned char *secret,
|
||||
isc_buffer_t *buf);
|
||||
static isc_socketevent_t *ns__create_udp_socketevent(void* argp);
|
||||
|
||||
void
|
||||
ns_client_recursing(ns_client_t *client) {
|
||||
@@ -592,6 +598,7 @@ exit_check(ns_client_t *client) {
|
||||
if (manager != NULL) {
|
||||
LOCK(&manager->listlock);
|
||||
ISC_LIST_UNLINK(manager->clients, client, link);
|
||||
manager->nclients--;
|
||||
LOCK(&manager->lock);
|
||||
if (manager->exiting &&
|
||||
ISC_LIST_EMPTY(manager->clients))
|
||||
@@ -1048,6 +1055,51 @@ ns_client_sendraw(ns_client_t *client, dns_message_t *message) {
|
||||
ns_client_next(client, result);
|
||||
}
|
||||
|
||||
#ifdef PSEUDOSEND
|
||||
static void
|
||||
client_pseudosend(ns_client_t *client, uint16_t id) {
|
||||
isc_result_t result;
|
||||
unsigned char *data;
|
||||
isc_buffer_t buffer;
|
||||
isc_buffer_t tcpbuffer;
|
||||
isc_region_t r;
|
||||
unsigned char sendbuf[SEND_BUFFER_SIZE];
|
||||
result = client_allocsendbuf(client, &buffer, &tcpbuffer, 0,
|
||||
sendbuf, &data);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
isc_buffer_putuint16(&buffer, id);
|
||||
isc_buffer_putuint8(&buffer, 0x81);
|
||||
isc_buffer_putuint8(&buffer, 0x80);
|
||||
isc_buffer_putuint16(&buffer, 0);
|
||||
isc_buffer_putuint16(&buffer, 0);
|
||||
isc_buffer_putuint16(&buffer, 0);
|
||||
isc_buffer_putuint16(&buffer, 0);
|
||||
if (client->sendcb != NULL) {
|
||||
client->sendcb(&buffer);
|
||||
} else if (TCP_CLIENT(client)) {
|
||||
isc_buffer_usedregion(&buffer, &r);
|
||||
isc_buffer_putuint16(&tcpbuffer, (uint16_t) r.length);
|
||||
isc_buffer_add(&tcpbuffer, r.length);
|
||||
result = client_sendpkg(client, &tcpbuffer);
|
||||
} else {
|
||||
result = client_sendpkg(client, &buffer);
|
||||
}
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
done:
|
||||
if (client->tcpbuf != NULL) {
|
||||
isc_mem_put(client->mctx, client->tcpbuf, TCP_BUFFER_SIZE);
|
||||
client->tcpbuf = NULL;
|
||||
}
|
||||
ns_client_next(client, result);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
client_send(ns_client_t *client) {
|
||||
isc_result_t result;
|
||||
@@ -2236,6 +2288,7 @@ process_opt(ns_client_t *client, dns_rdataset_t *opt) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle an incoming request event from the socket (UDP case)
|
||||
* or tcpmsg (TCP case).
|
||||
@@ -2275,7 +2328,7 @@ ns__client_request(isc_task_t *task, isc_event_t *event) {
|
||||
|
||||
ns_client_requests++;
|
||||
|
||||
if (event->ev_type == ISC_SOCKEVENT_RECVDONE) {
|
||||
if (event->ev_type == ISC_SOCKEVENT_RECVDONE) {
|
||||
INSIST(!TCP_CLIENT(client));
|
||||
sevent = (isc_socketevent_t *)event;
|
||||
REQUIRE(sevent == client->recvevent);
|
||||
@@ -2344,6 +2397,19 @@ ns__client_request(isc_task_t *task, isc_event_t *event) {
|
||||
}
|
||||
return;
|
||||
}
|
||||
#ifdef PSEUDOSEND
|
||||
result = dns_message_peekheader(buffer, &id, &flags);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
/*
|
||||
* There isn't enough header to determine whether
|
||||
* this was a request or a response. Drop it.
|
||||
*/
|
||||
ns_client_next(client, result);
|
||||
return;
|
||||
}
|
||||
client_pseudosend(client, id);
|
||||
return;
|
||||
#endif
|
||||
|
||||
isc_netaddr_fromsockaddr(&netaddr, &client->peeraddr);
|
||||
|
||||
@@ -2403,7 +2469,6 @@ ns__client_request(isc_task_t *task, isc_event_t *event) {
|
||||
ns_client_next(client, result);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* The client object handles requests, not responses.
|
||||
* If this is a UDP response, forward it to the dispatcher.
|
||||
@@ -2953,7 +3018,10 @@ client_create(ns_clientmgr_t *manager, ns_client_t **clientp) {
|
||||
*/
|
||||
|
||||
REQUIRE(clientp != NULL && *clientp == NULL);
|
||||
|
||||
if (manager->nclients > 10000) {
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
manager->nclients++;
|
||||
result = get_clientmctx(manager, &mctx);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
@@ -3439,6 +3507,7 @@ ns_clientmgr_create(isc_mem_t *mctx, ns_server_t *sctx, isc_taskmgr_t *taskmgr,
|
||||
goto cleanup_listlock;
|
||||
|
||||
manager->excl = NULL;
|
||||
manager->nclients = 0;
|
||||
result = isc_taskmgr_excltask(taskmgr, &manager->excl);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup_reclock;
|
||||
@@ -3524,6 +3593,7 @@ ns_clientmgr_destroy(ns_clientmgr_t **managerp) {
|
||||
*managerp = NULL;
|
||||
}
|
||||
|
||||
|
||||
static isc_result_t
|
||||
get_client(ns_clientmgr_t *manager, ns_interface_t *ifp,
|
||||
dns_dispatch_t *disp, bool tcp)
|
||||
@@ -3728,6 +3798,24 @@ ns_clientmgr_createclients(ns_clientmgr_t *manager, unsigned int n,
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
ns_clientmgr_subscribe_clients(ns_clientmgr_t *manager, unsigned int n, ns_interface_t *ifp) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
unsigned int disp;
|
||||
create_udp_socketevent_arg_t *arg;
|
||||
for (disp = 0; disp < n; disp++) {
|
||||
arg = malloc(sizeof(*arg));
|
||||
arg->manager = manager;
|
||||
arg->socket = dns_dispatch_getsocket(ifp->udpdispatch[disp]);
|
||||
arg->interface = ifp;
|
||||
result = isc_socket_udpsubscribe(arg->socket, &ns__create_udp_socketevent, arg);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_sockaddr_t *
|
||||
ns_client_getsockaddr(ns_client_t *client) {
|
||||
return (&client->peeraddr);
|
||||
@@ -4015,3 +4103,76 @@ ns_client_sourceip(dns_clientinfo_t *ci, isc_sockaddr_t **addrp) {
|
||||
*addrp = &client->peeraddr;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_socketevent_t *
|
||||
ns__create_udp_socketevent(void* argp) {
|
||||
create_udp_socketevent_arg_t *arg = (create_udp_socketevent_arg_t*)argp;
|
||||
ns_clientmgr_t *manager = arg->manager;
|
||||
isc_socket_t *sock = arg->socket;
|
||||
isc_socketevent_t *sev;
|
||||
ns_client_t *client;
|
||||
isc_result_t result;
|
||||
MTRACE("create_udp_socketevent");
|
||||
|
||||
REQUIRE(manager != NULL);
|
||||
|
||||
if (manager->exiting) {
|
||||
return (NULL);
|
||||
}
|
||||
/*
|
||||
* Allocate a client. First try to get a recycled one;
|
||||
* if that fails, make a new one.
|
||||
*/
|
||||
client = NULL;
|
||||
if ((manager->sctx->options & NS_SERVER_CLIENTTEST) == 0)
|
||||
ISC_QUEUE_POP(manager->inactive, ilink, client);
|
||||
|
||||
if (client != NULL) {
|
||||
MTRACE("recycle");
|
||||
} else {
|
||||
MTRACE("create new");
|
||||
LOCK(&manager->lock);
|
||||
result = client_create(manager, &client);
|
||||
UNLOCK(&manager->lock);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (NULL);
|
||||
|
||||
LOCK(&manager->listlock);
|
||||
ISC_LIST_APPEND(manager->clients, client, link);
|
||||
UNLOCK(&manager->listlock);
|
||||
}
|
||||
|
||||
// client->interface = arg->interface;
|
||||
ns_interface_attach(arg->interface, &client->interface);
|
||||
client->manager = manager;
|
||||
client->mortal = true;
|
||||
client->state = NS_CLIENTSTATE_READY;
|
||||
client->sctx = manager->sctx;
|
||||
INSIST(client->recursionquota == NULL);
|
||||
|
||||
// client->dscp = ifp->dscp;
|
||||
client->mortal = true;
|
||||
|
||||
// client->udpsocket = sock;
|
||||
isc_socket_attach(sock, &client->udpsocket);
|
||||
|
||||
INSIST(client->nctls == 0);
|
||||
|
||||
if (exit_check(client))
|
||||
return (NULL);
|
||||
|
||||
sev = client->recvevent;
|
||||
sev->ev_sender = client->task;
|
||||
sev->ev_arg = client;
|
||||
sev->result = ISC_R_UNSET;
|
||||
ISC_LIST_INIT(sev->bufferlist);
|
||||
sev->n = 0;
|
||||
sev->offset = 0;
|
||||
sev->action = ns__client_request;
|
||||
|
||||
sev->region.base = client->recvbuf;
|
||||
sev->region.length = RECV_BUFFER_SIZE;
|
||||
sev->minimum = 1;
|
||||
client->nrecvs++;
|
||||
return (sev);
|
||||
}
|
||||
|
||||
@@ -420,6 +420,8 @@ ns__clientmgr_getclient(ns_clientmgr_t *manager, ns_interface_t *ifp,
|
||||
* Get a client object from the inactive queue, or create one, as needed.
|
||||
* (Not intended for use outside this module and associated tests.)
|
||||
*/
|
||||
isc_result_t
|
||||
ns_clientmgr_subscribe_clients(ns_clientmgr_t *manager, unsigned int n, ns_interface_t *ifp);
|
||||
|
||||
void
|
||||
ns__client_request(isc_task_t *task, isc_event_t *event);
|
||||
|
||||
@@ -495,8 +495,8 @@ ns_interface_listenudp(ns_interface_t *ifp) {
|
||||
|
||||
}
|
||||
|
||||
result = ns_clientmgr_createclients(ifp->clientmgr, ifp->nudpdispatch,
|
||||
ifp, false);
|
||||
result = ns_clientmgr_subscribe_clients(ifp->clientmgr, ifp->nudpdispatch,
|
||||
ifp);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"UDP ns_clientmgr_createclients(): %s",
|
||||
|
||||
@@ -3295,7 +3295,6 @@
|
||||
./lib/isc/Kyuafile X 2017,2018
|
||||
./lib/isc/aes.c C 2014,2016,2017,2018
|
||||
./lib/isc/api X 1999,2000,2001,2006,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018
|
||||
./lib/isc/app_api.c C 2009,2013,2014,2015,2016,2018
|
||||
./lib/isc/assertions.c C 1997,1998,1999,2000,2001,2004,2005,2007,2008,2009,2015,2016,2018
|
||||
./lib/isc/backtrace-emptytbl.c C 2009,2016,2018
|
||||
./lib/isc/backtrace.c C 2009,2013,2014,2015,2016,2018
|
||||
@@ -3456,7 +3455,6 @@
|
||||
./lib/isc/sha1.c C 2000,2001,2003,2004,2005,2007,2009,2011,2012,2014,2016,2017,2018
|
||||
./lib/isc/sha2.c C 2005,2006,2007,2009,2011,2012,2014,2016,2017,2018
|
||||
./lib/isc/sockaddr.c C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2010,2011,2012,2014,2015,2016,2017,2018
|
||||
./lib/isc/socket_api.c C 2009,2011,2012,2013,2014,2015,2016,2018
|
||||
./lib/isc/stats.c C 2009,2012,2013,2014,2015,2016,2017,2018
|
||||
./lib/isc/string.c C 1999,2000,2001,2003,2004,2005,2006,2007,2011,2012,2014,2015,2016,2018
|
||||
./lib/isc/symtab.c C 1996,1997,1998,1999,2000,2001,2004,2005,2007,2011,2012,2013,2016,2018
|
||||
|
||||
Reference in New Issue
Block a user