Compare commits

...
Author SHA1 Message Date
Evan HuntandWitold Kręcicki 30be07abf6 style: one-line statement braces, line length, etc 2018-11-09 13:59:02 +00:00
Witold Kręcicki 83128800c1 CHANGES and release notes 2018-11-09 13:59:02 +00:00
Witold Krecicki 6510d29a87 FreeBSD fixes - proper affinity setting, don't use SO_REUSEPORT 2018-11-09 13:59:02 +00:00
Witold Krecicki 2f3546e32c Don't doublelock fdlock on Solaris 2018-11-09 13:59:02 +00:00
Witold Kręcicki b50f80d8a7 Synchronize Windows socket code with API changes. 2018-11-09 13:59:02 +00:00
Witold Kręcicki 9a100a2d6c Fix fetchlimit test to allow softquota to be overruled; Remove 'verifying that named checks for conflicting listeners' test from runtime 2018-11-09 13:59:02 +00:00
Witold Kręcicki 3aa542e02b Use multiple worker queues (using isc_task_sendto()) in unix socket code 2018-11-09 13:59:02 +00:00
Witold Kręcicki 6c7b2925d4 use REUSEPORT only for NOLISTEN dispatchers 2018-11-09 13:59:02 +00:00
Witold Kręcicki e57c34056a Make watching/unwatching sockets saner. 2018-11-09 13:59:02 +00:00
Witold Kręcicki 4a3a63fda7 Use the newly accepted FD in TCP code. 2018-11-09 13:59:02 +00:00
Witold Kręcicki 3aa3b09664 Use isc_refcount_t in socket reference counting. 2018-11-09 13:59:02 +00:00
Witold Krecicki 7285e066e3 Multiple network event loop threads support for Solarises /dev/poll. 2018-11-09 13:59:02 +00:00
Witold Kręcicki d038151863 Mangle fdlocks a bit.
Mutexes are slower if they're in the same cache line. Since
fd's come in herds, and usually our listen sockets will have nearby
fd numbers, we mangle fdlocks so that the locks are further away.
2018-11-09 13:59:02 +00:00
Witold Kręcicki 427176904f Fix a race between socket closing and incoming event. 2018-11-09 13:59:02 +00:00
Witold Kręcicki b14b16a528 Set network threads CPU affintity. 2018-11-09 13:59:02 +00:00
Witold Kręcicki be9a9d137b Add runtime detection of SO_REUSEPORT, use it instead of dup() if available. 2018-11-09 13:59:02 +00:00
Witold Kręcicki 27153b22e4 Use the same number of UDP dispatchers as CPUs. 2018-11-09 13:59:02 +00:00
Witold Krecicki f2e700bdbe Use multiple network event loop threads with separate data structures. 2018-11-09 13:59:02 +00:00
Witold Kręcicki 16a5ce5892 Do IO after event directly in the network thread, don't queue an event in a separate task. 2018-11-09 13:59:02 +00:00
Witold Kręcicki cca59c0163 Remove fdwatch sockets, those are not used anywhere. 2018-11-09 13:59:02 +00:00
Witold Kręcicki 8e8573de5e Get rid of internal allocator 2018-11-09 13:59:02 +00:00
Witold Kręcicki c3854d2b24 Get rid of isc_memmethods_t 2018-11-09 13:59:02 +00:00
Mark AndrewsandWitold Kręcicki 98697562b2 placeholder 2018-11-09 13:59:02 +00:00
Mark AndrewsandWitold Kręcicki 156ce2418b add CHANGES note 2018-11-09 13:59:02 +00:00
Mark AndrewsandWitold Kręcicki 08d538321c look in windows registry for nameservers, domainname and search list 2018-11-09 13:59:02 +00:00
Mark AndrewsandWitold Kręcicki d45c2814ef add CHANGES note 2018-11-09 13:59:02 +00:00
Mark AndrewsandWitold Kręcicki 7bb36722af log RPZ type and class 2018-11-09 13:59:02 +00:00
Mark AndrewsandWitold Kręcicki 1df5613676 isc_resource_getlimit under windows only supports isc_resource_openfiles 2018-11-09 13:59:02 +00:00
110 changed files with 1328 additions and 2245 deletions
+9
View File
@@ -1,3 +1,12 @@
5086. [func] Log of RPZ now includes the QTYPE and QCLASS. [GL #623]
5085. [func] Use multiple event loops in socket code, and
make network threads CPU-affinitive. This
significantly improves performance on large
systems. [GL #666]
5084. [func] Log of RPZ now includes the QTYPE and QCLASS. [GL #623]
5083. [func] Add autoconf macro AX_POSIX_SHELL, so we
can use POSIX-compatible shell features
in the scripts.
+1 -1
View File
@@ -129,7 +129,7 @@ add(char *key, int value) {
isc_symvalue_t symvalue;
if (sym_mctx == NULL) {
result = isc_mem_create(0, 0, &sym_mctx);
result = isc_mem_create(&sym_mctx);
if (result != ISC_R_SUCCESS)
return;
}
+1 -1
View File
@@ -583,7 +583,7 @@ main(int argc, char **argv) {
}
isc_commandline_reset = true;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
while ((c = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != EOF) {
switch (c) {
+1 -1
View File
@@ -519,7 +519,7 @@ main(int argc, char **argv) {
InitSockets();
#endif
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
if (!quiet)
RUNTIME_CHECK(setup_logging(mctx, errout, &lctx)
== ISC_R_SUCCESS);
+1 -1
View File
@@ -209,7 +209,7 @@ main(int argc, char **argv) {
/* Use canonical algorithm name */
algname = alg_totext(alg);
DO("create memory context", isc_mem_create(0, 0, &mctx));
DO("create memory context", isc_mem_create(&mctx));
if (keyname == NULL) {
const char *suffix = NULL;
+1 -1
View File
@@ -211,7 +211,7 @@ main(int argc, char **argv) {
keysize = alg_bits(alg);
algname = alg_totext(alg);
DO("create memory context", isc_mem_create(0, 0, &mctx));
DO("create memory context", isc_mem_create(&mctx));
isc_buffer_init(&key_txtbuffer, &key_txtsecret, sizeof(key_txtsecret));
generate_key(mctx, alg, keysize, &key_txtbuffer);
+1 -1
View File
@@ -1586,7 +1586,7 @@ main(int argc, char *argv[]) {
if (result != ISC_R_SUCCESS)
fatal("dns_lib_init failed: %d", result);
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS)
fatal("failed to create mctx");
+1 -1
View File
@@ -1324,7 +1324,7 @@ setup_libs(void) {
if (!have_ipv6 && !have_ipv4)
fatal("can't find either v4 or v6 networking");
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
check_result(result, "isc_mem_create");
isc_mem_setname(mctx, "dig", NULL);
+1 -1
View File
@@ -1144,7 +1144,7 @@ main(int argc, char *argv[]) {
int ch;
char *endp;
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) {
fatal("out of memory");
}
+1 -1
View File
@@ -368,7 +368,7 @@ main(int argc, char **argv) {
if (argc == 1)
usage();
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS)
fatal("out of memory");
+1 -1
View File
@@ -307,7 +307,7 @@ main(int argc, char **argv) {
if (argc == 1)
usage();
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS)
fatal("out of memory");
+1 -1
View File
@@ -166,7 +166,7 @@ main(int argc, char **argv) {
if (argc == 1)
usage();
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
#if USE_PKCS11
pk11_result_register();
+1 -1
View File
@@ -265,7 +265,7 @@ main(int argc, char **argv) {
}
isc_commandline_reset = true;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
isc_stdtime_get(&now);
+1 -1
View File
@@ -91,7 +91,7 @@ main(int argc, char **argv) {
if (argc == 1)
usage();
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS)
fatal("Out of memory");
+1 -1
View File
@@ -170,7 +170,7 @@ main(int argc, char **argv) {
if (argc == 1)
usage();
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS)
fatal("Out of memory");
+1 -1
View File
@@ -3278,7 +3278,7 @@ main(int argc, char *argv[]) {
check_result(isc_app_start(), "isc_app_start");
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS)
fatal("out of memory");
+1 -1
View File
@@ -201,7 +201,7 @@ main(int argc, char *argv[]) {
isc_commandline_reset = true;
check_result(isc_app_start(), "isc_app_start");
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS)
fatal("out of memory");
+5 -6
View File
@@ -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,7 +821,7 @@ 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",
@@ -1068,6 +1065,7 @@ setup(void) {
/*
* Get the initial resource limits.
*/
#ifndef WIN32
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_stacksize,
&named_g_initstacksize)
== ISC_R_SUCCESS);
@@ -1077,6 +1075,7 @@ setup(void) {
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_coresize,
&named_g_initcoresize)
== ISC_R_SUCCESS);
#endif
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_openfiles,
&named_g_initopenfiles)
== ISC_R_SUCCESS);
@@ -1389,7 +1388,7 @@ main(int argc, char *argv[]) {
named_g_chrootdir);
}
result = isc_mem_create(0, 0, &named_g_mctx);
result = isc_mem_create(&named_g_mctx);
if (result != ISC_R_SUCCESS)
named_main_earlyfatal("isc_mem_create() failed: %s",
isc_result_totext(result));
+2 -2
View File
@@ -4236,9 +4236,9 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
* cache, for the main cache memory and the heap
* memory.
*/
CHECK(isc_mem_create(0, 0, &cmctx));
CHECK(isc_mem_create(&cmctx));
isc_mem_setname(cmctx, "cache", NULL);
CHECK(isc_mem_create(0, 0, &hmctx));
CHECK(isc_mem_create(&hmctx));
isc_mem_setname(hmctx, "cache_heap", NULL);
CHECK(dns_cache_create(cmctx, hmctx, named_g_taskmgr,
named_g_timermgr, view->rdclass,
+1 -1
View File
@@ -226,7 +226,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
return (ISC_R_FAILURE);
}
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS)
return (result);
+1 -1
View File
@@ -227,7 +227,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
return (ISC_R_FAILURE);
}
isc_mem_create(0, 0, &mctx);
isc_mem_create(&mctx);
cd = isc_mem_get(mctx, sizeof(*cd));
if (cd == NULL) {
+1 -1
View File
@@ -3254,7 +3254,7 @@ main(int argc, char **argv) {
pre_parse_args(argc, argv);
result = isc_mem_create(0, 0, &gmctx);
result = isc_mem_create(&gmctx);
check_result(result, "isc_mem_create");
parse_args(argc, argv);
+1 -1
View File
@@ -67,7 +67,7 @@ main(int argc, char *argv[]) {
exit(1);
}
if (isc_mem_create(0, 0, &mctx) != ISC_R_SUCCESS) {
if (isc_mem_create(&mctx) != ISC_R_SUCCESS) {
fprintf(stderr, "isc_mem_create() failed\n");
exit(1);
}
+1 -1
View File
@@ -932,7 +932,7 @@ main(int argc, char **argv) {
serial = isc_random32();
DO("create memory context", isc_mem_create(0, 0, &rndc_mctx));
DO("create memory context", isc_mem_create(&rndc_mctx));
DO("create socket manager", isc_socketmgr_create(rndc_mctx, &socketmgr));
DO("create task manager", isc_taskmgr_create(rndc_mctx, 1, 0, &taskmgr));
DO("create task", isc_task_create(taskmgr, 0, &task));
+1 -1
View File
@@ -70,7 +70,7 @@ main(int argc, char **argv) {
char *filename = NULL;
unsigned int zonetype = 0;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
result = isc_log_create(mctx, &lctx, &lcfg);
check_result(result, "isc_log_create()");
+1 -1
View File
@@ -97,7 +97,7 @@ main(int argc, char **argv) {
journal = argv[4];
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
CHECK(isc_mem_create(0, 0, &mctx));
CHECK(isc_mem_create(&mctx));
CHECK(dst_lib_init(mctx, NULL));
dst_active = true;
+1 -1
View File
@@ -297,7 +297,7 @@ main(int argc, char **argv) {
/*
* EVERYTHING needs a memory context.
*/
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
cmp = NULL;
RUNTIME_CHECK(isc_mempool_create(mctx, sizeof(client_t), &cmp)
+1 -1
View File
@@ -89,7 +89,7 @@ main(int argc, char *argv[]) {
dns_result_register();
mctx = NULL;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
while ((ch = isc_commandline_parse(argc, argv, "nvw:")) != -1) {
switch (ch) {
+1 -1
View File
@@ -203,7 +203,7 @@ main(int argc, char *argv[]) {
dns_result_register();
mctx = NULL;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
while ((ch = isc_commandline_parse(argc, argv, "d:vw:")) != -1) {
switch (ch) {
+2 -7
View File
@@ -359,7 +359,6 @@ main(int argc, char *argv[]) {
dbinfo *dbi;
dns_dbversion_t *version;
const dns_name_t *origin;
size_t memory_quota = 0;
dns_trust_t trust = 0;
unsigned int addopts;
isc_log_t *lctx = NULL;
@@ -367,12 +366,12 @@ main(int argc, char *argv[]) {
dns_result_register();
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(dns_dbtable_create(mctx, dns_rdataclass_in, &dbtable) ==
ISC_R_SUCCESS);
snprintf(dbtype, sizeof(dbtype), "rbt");
while ((ch = isc_commandline_parse(argc, argv, "c:d:t:z:P:Q:glpqvT"))
while ((ch = isc_commandline_parse(argc, argv, "c:d:t:z:P:glpqvT"))
!= -1) {
switch (ch) {
case 'c':
@@ -411,10 +410,6 @@ main(int argc, char *argv[]) {
case 'P':
pause_every = atoi(isc_commandline_argument);
break;
case 'Q':
memory_quota = atoi(isc_commandline_argument);
isc_mem_setquota(mctx, memory_quota);
break;
case 't':
type = atoi(isc_commandline_argument);
break;
+1 -1
View File
@@ -232,7 +232,7 @@ main(void) {
dns_name_t *name;
isc_result_t result;
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS)
return (1);
+1 -1
View File
@@ -447,7 +447,7 @@ main(int argc, char *argv[]) {
dns_result_register();
mctx = NULL;
RUNCHECK(isc_mem_create(0, 0, &mctx));
RUNCHECK(isc_mem_create(&mctx));
RUNCHECK(isc_log_create(mctx, &lctx, &lcfg));
isc_log_setcontext(lctx);
+1 -1
View File
@@ -31,7 +31,7 @@ main(int argc, char **argv) {
UNUSED(argc);
UNUSED(argv);
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
result = isc_interfaceiter_create(mctx, &iter);
if (result != ISC_R_SUCCESS)
goto cleanup;
+1 -1
View File
@@ -91,7 +91,7 @@ main(int argc, char *argv[]) {
}
}
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_lex_create(mctx, 256, &lex) == ISC_R_SUCCESS);
if (masterfile) {
+1 -1
View File
@@ -108,7 +108,7 @@ main(int argc, char **argv) {
lctx = NULL;
lcfg = NULL;
CHECK(isc_mem_create(0, 0, &mctx));
CHECK(isc_mem_create(&mctx));
CHECK(isc_log_create(mctx, &lctx, &lcfg));
CHECK(isc_log_settag(lcfg, progname));
+1 -1
View File
@@ -59,7 +59,7 @@ main(int argc, char *argv[]) {
UNUSED(argc);
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
if (argv[1]) {
isc_buffer_init(&source, argv[1], strlen(argv[1]));
+1 -1
View File
@@ -33,7 +33,7 @@ main(int argc, char *argv[]) {
RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS);
mctx = NULL;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
mp1 = NULL;
RUNTIME_CHECK(isc_mempool_create(mctx, 24, &mp1) == ISC_R_SUCCESS);
+1 -1
View File
@@ -192,7 +192,7 @@ main(int argc, char *argv[]) {
dns_result_register();
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
check_result(result, "isc_mem_create()");
argc--;
+1 -1
View File
@@ -103,7 +103,7 @@ main(int argc, char *argv[]) {
isc_app_start();
isc_interval_set(&linterval, 1, 0);
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_taskmgr_create(mctx, 3, 0, &taskmgr) ==
ISC_R_SUCCESS);
RUNTIME_CHECK(isc_timermgr_create(mctx, &timermgr) ==
+1 -1
View File
@@ -283,7 +283,7 @@ main(int argc, char **argv) {
*/
isc_mem_debugging = ISC_MEM_DEBUGRECORD;
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) {
printf("isc_mem_create: %s: exiting\n",
dns_result_totext(result));
+2 -2
View File
@@ -180,9 +180,9 @@ main(int argc, char *argv[]) {
printf("%u workers\n", workers);
mctx = NULL;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
mctx2 = NULL;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx2) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx2) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_taskmgr_create(mctx, workers, 0, &task_manager) ==
ISC_R_SUCCESS);
RUNTIME_CHECK(isc_timermgr_create(mctx, &timer_manager) ==
+1 -1
View File
@@ -209,7 +209,7 @@ main(int argc, char *argv[]) {
RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS);
mctx = NULL;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
while ((ch = isc_commandline_parse(argc, argv, "vp:")) != -1) {
switch (ch) {
+1 -1
View File
@@ -291,7 +291,7 @@ main(int argc, char *argv[]) {
* EVERYTHING needs a memory context.
*/
mctx = NULL;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
/*
* The task manager is independent (other than memory context)
+1 -1
View File
@@ -61,7 +61,7 @@ main(int argc, char *argv[]) {
}
}
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_symtab_create(mctx, 691, undefine_action, NULL,
case_sensitive, &st) == ISC_R_SUCCESS);
+1 -1
View File
@@ -79,7 +79,7 @@ main(int argc, char *argv[]) {
workers = 2;
printf("%u workers\n", workers);
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_taskmgr_create(mctx, workers, 0, &manager) ==
ISC_R_SUCCESS);
+1 -1
View File
@@ -109,7 +109,7 @@ main(int argc, char *argv[]) {
workers = 2;
printf("%u workers\n", workers);
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx1) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx1) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_taskmgr_create(mctx1, workers, 0, &manager) ==
ISC_R_SUCCESS);
RUNTIME_CHECK(isc_timermgr_create(mctx1, &timgr) == ISC_R_SUCCESS);
+1 -1
View File
@@ -283,7 +283,7 @@ main(int argc, char **argv) {
usage();
RUNTIME_CHECK(isc_app_start() == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_taskmgr_create(mctx, 2, 0, &taskmgr) ==
ISC_R_SUCCESS);
RUNTIME_CHECK(isc_timermgr_create(mctx, &timermgr) == ISC_R_SUCCESS);
+1 -1
View File
@@ -157,7 +157,7 @@ status=`expr $status + $ret`
copy_setports ns3/named3.conf.in ns3/named.conf
$RNDCCMD reconfig 2>&1 | sed 's/^/ns3 /' | cat_i
echo_i "checking lame server clients are dropped at the soft limit"
echo_i "checking lame server clients are dropped near the soft limit"
ret=0
fail=0
exceeded=0
+1 -1
View File
@@ -270,7 +270,7 @@ main(int argc, char *argv[]) {
isc_sockaddr_fromin(&dstaddr, &inaddr, port);
mctx = NULL;
RUNCHECK(isc_mem_create(0, 0, &mctx));
RUNCHECK(isc_mem_create(&mctx));
lctx = NULL;
lcfg = NULL;
+3 -3
View File
@@ -413,15 +413,15 @@ for mode in native dnsrps; do
$DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p ${PORT} -b 10.53.0.4 > dig.out.${t}
$DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p ${PORT} -b 10.53.0.3 >> dig.out.${t}
$DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p ${PORT} -b 10.53.0.2 >> dig.out.${t}
sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0 via 32.4.0.53.10.rpz-client-ip.log1" > /dev/null && {
sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0/A/IN via 32.4.0.53.10.rpz-client-ip.log1" > /dev/null && {
echo_i " failed: unexpected rewrite message for policy zone log1 was logged"
status=1
}
sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0 via 32.3.0.53.10.rpz-client-ip.log2" > /dev/null || {
sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0/A/IN via 32.3.0.53.10.rpz-client-ip.log2" > /dev/null || {
echo_i " failed: expected rewrite message for policy zone log2 was not logged"
status=1
}
sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0 via 32.2.0.53.10.rpz-client-ip.log3" > /dev/null || {
sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0/A/IN via 32.2.0.53.10.rpz-client-ip.log3" > /dev/null || {
echo_i " failed: expected rewrite message for policy zone log3 was not logged"
status=1
}
+1 -1
View File
@@ -104,7 +104,7 @@ main(int argc, char **argv) {
dns_result_register();
CHECK(isc_mem_create(0, 0, &mctx), "isc_mem_create()");
CHECK(isc_mem_create(&mctx), "isc_mem_create()");
CHECK(dst_lib_init(mctx, NULL), "dst_lib_init()");
CHECK(isc_log_create(mctx, &log_, &logconfig), "isc_log_create()");
isc_log_setcontext(log_);
-22
View File
@@ -24,28 +24,6 @@ grep "another named process" ns2/named.run > /dev/null && ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
if [ ! "$CYGWIN" ]; then
n=`expr $n + 1`
echo_i "verifying that named checks for conflicting listeners ($n)"
ret=0
(cd ns2; $NAMED -c named-alt1.conf -D ns2-extra-1 -X other.lock -m record,size,mctx -d 99 -g -U 4 >> named2.run 2>&1 & )
for i in 1 2 3 4 5 6 7 8 9
do
grep "unable to listen on any configured interface" ns2/named2.run > /dev/null && break
sleep 1
done
grep "unable to listen on any configured interface" ns2/named2.run > /dev/null || ret=1
for i in 1 2 3 4 5 6 7 8 9
do
grep "exiting (due to fatal error)" ns2/named2.run > /dev/null && break
sleep 1
done
pid=`cat ns2/named2.pid 2>/dev/null`
test "${pid:+set}" = set && $KILL -15 ${pid} >/dev/null 2>&1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
fi
n=`expr $n + 1`
echo_i "verifying that named checks for conflicting named processes ($n)"
ret=0
+1 -1
View File
@@ -230,7 +230,7 @@ main(int argc, char *argv[]) {
mctx = NULL;
isc_mem_debugging = ISC_MEM_DEBUGRECORD;
RUNCHECK(isc_mem_create(0, 0, &mctx));
RUNCHECK(isc_mem_create(&mctx));
log = NULL;
logconfig = NULL;
+1 -1
View File
@@ -169,7 +169,7 @@ main(int argc, char **argv) {
dns_result_register();
mctx = NULL;
RUNCHECK(isc_mem_create(0, 0, &mctx));
RUNCHECK(isc_mem_create(&mctx));
log = NULL;
logconfig = NULL;
+1 -1
View File
@@ -138,7 +138,7 @@ main(int argc, char *argv[]) {
}
isc_commandline_reset = true;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (ch) {
+1 -1
View File
@@ -340,7 +340,7 @@ main(int argc, char *argv[]) {
if (argc < 1)
fatal("no file specified");
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
dns_result_register();
+1 -1
View File
@@ -1935,7 +1935,7 @@ main(int argc, char *argv[]) {
preparse_args(argc, argv);
mctx = NULL;
RUNCHECK(isc_mem_create(0, 0, &mctx));
RUNCHECK(isc_mem_create(&mctx));
lctx = NULL;
lcfg = NULL;
+1 -1
View File
@@ -68,7 +68,7 @@ main(int argc, char **argv) {
file = argv[1];
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(setup_logging(mctx, stderr, &lctx) == ISC_R_SUCCESS);
result = dns_journal_print(mctx, file, stdout);
+1 -1
View File
@@ -148,7 +148,7 @@ main(int argc, char *argv[]) {
if (doexit)
exit(0);
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_lex_create(mctx, 256, &lex) == ISC_R_SUCCESS);
/*
+1 -1
View File
@@ -670,7 +670,7 @@ open_lexer(void) {
return ISC_R_SUCCESS;
/* allocate memory for lexer, and verify it was allocated */
result = isc_mem_create(0, 0, &lex_mctx);
result = isc_mem_create(&lex_mctx);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "unexpected error creating lexer\n");
return result;
+1 -1
View File
@@ -127,7 +127,7 @@ main(int argc, char *argv[])
if (argc != 4) usage(*argv);
REQUIRE(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
REQUIRE(isc_mem_create(&mctx) == ISC_R_SUCCESS);
n = strlen(argv[1]);
isc_buffer_init(&b, argv[1], n);
+1 -1
View File
@@ -152,7 +152,7 @@ main(int argc, char **argv) {
dns_result_register();
mctx = NULL;
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
check_result(result, "isc_mem_create");
isc_buffer_init(&b, porigin, strlen(porigin));
+1 -1
View File
@@ -163,7 +163,7 @@ main(int argc, char *argv[])
dns_result_register();
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
check_result(result, "isc_mem_create");
isc_buffer_init(&b, porigin, strlen(porigin));
+9
View File
@@ -131,6 +131,15 @@
<section xml:id="relnotes_features"><info><title>New Features</title></info>
<itemizedlist>
<listitem>
<para>
Task manager and socket code have been substantially modified.
The manager uses per-cpu queues for tasks and network stack runs
multiple event loops in CPU-affinitive threads. This greatly
improves performance on large systems, especially when using
multi-queue NICs.
</para>
</listitem>
<listitem>
<para>
A new secondary zone option, <command>mirror</command>,
+1 -1
View File
@@ -30,7 +30,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
static isc_mem_t *mctx = NULL;
static void __attribute__((constructor)) init(void) {
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(dst_lib_init(mctx, NULL) == ISC_R_SUCCESS);
}
+1 -1
View File
@@ -370,7 +370,7 @@ dns_client_create(dns_client_t **clientp, unsigned int options) {
unsigned int logdebuglevel = 0;
#endif
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS)
return (result);
result = isc_appctx_create(mctx, &actx);
+51 -29
View File
@@ -299,7 +299,8 @@ static isc_result_t get_udpsocket(dns_dispatchmgr_t *mgr,
isc_socketmgr_t *sockmgr,
const isc_sockaddr_t *localaddr,
isc_socket_t **sockp,
isc_socket_t *dup_socket);
isc_socket_t *dup_socket,
bool duponly);
static isc_result_t dispatch_createudp(dns_dispatchmgr_t *mgr,
isc_socketmgr_t *sockmgr,
isc_taskmgr_t *taskmgr,
@@ -317,7 +318,7 @@ static void qid_destroy(isc_mem_t *mctx, dns_qid_t **qidp);
static isc_result_t open_socket(isc_socketmgr_t *mgr,
const isc_sockaddr_t *local,
unsigned int options, isc_socket_t **sockp,
isc_socket_t *dup_socket);
isc_socket_t *dup_socket, bool duponly);
static bool portavailable(dns_dispatchmgr_t *mgr, isc_socket_t *sock,
isc_sockaddr_t *sockaddrp);
@@ -728,7 +729,7 @@ get_dispsocket(dns_dispatch_t *disp, const isc_sockaddr_t *dest,
if (portentry != NULL)
bindoptions |= ISC_SOCKET_REUSEADDRESS;
result = open_socket(sockmgr, &localaddr, bindoptions, &sock,
NULL);
NULL, false);
if (result == ISC_R_SUCCESS) {
if (portentry == NULL) {
portentry = new_portentry(disp, port);
@@ -1667,7 +1668,7 @@ destroy_mgr(dns_dispatchmgr_t **mgrp) {
static isc_result_t
open_socket(isc_socketmgr_t *mgr, const isc_sockaddr_t *local,
unsigned int options, isc_socket_t **sockp,
isc_socket_t *dup_socket)
isc_socket_t *dup_socket, bool duponly)
{
isc_socket_t *sock;
isc_result_t result;
@@ -1675,12 +1676,16 @@ open_socket(isc_socketmgr_t *mgr, const isc_sockaddr_t *local,
sock = *sockp;
if (sock != NULL) {
result = isc_socket_open(sock);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
return (result);
} else if (dup_socket != NULL) {
}
} else if (dup_socket != NULL &&
(!isc_socket_hasreuseport() || duponly))
{
result = isc_socket_dup(dup_socket, &sock);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
return (result);
}
isc_socket_setname(sock, "dispatcher", NULL);
*sockp = sock;
@@ -1688,8 +1693,9 @@ open_socket(isc_socketmgr_t *mgr, const isc_sockaddr_t *local,
} else {
result = isc_socket_create(mgr, isc_sockaddr_pf(local),
isc_sockettype_udp, &sock);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
return (result);
}
}
isc_socket_setname(sock, "dispatcher", NULL);
@@ -1699,9 +1705,9 @@ open_socket(isc_socketmgr_t *mgr, const isc_sockaddr_t *local,
#endif
result = isc_socket_bind(sock, local, options);
if (result != ISC_R_SUCCESS) {
if (*sockp == NULL)
if (*sockp == NULL) {
isc_socket_detach(&sock);
else {
} else {
isc_socket_close(sock);
}
return (result);
@@ -2757,7 +2763,7 @@ dns_dispatch_getudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
static isc_result_t
get_udpsocket(dns_dispatchmgr_t *mgr, dns_dispatch_t *disp,
isc_socketmgr_t *sockmgr, const isc_sockaddr_t *localaddr,
isc_socket_t **sockp, isc_socket_t *dup_socket)
isc_socket_t **sockp, isc_socket_t *dup_socket, bool duponly)
{
unsigned int i, j;
isc_socket_t *held[DNS_DISPATCH_HELD];
@@ -2795,7 +2801,7 @@ get_udpsocket(dns_dispatchmgr_t *mgr, dns_dispatch_t *disp,
prt = ports[isc_random_uniform(nports)];
isc_sockaddr_setport(&localaddr_bound, prt);
result = open_socket(sockmgr, &localaddr_bound,
0, &sock, NULL);
0, &sock, NULL, false);
/*
* Continue if the port choosen is already in use
* or the OS has reserved it.
@@ -2816,7 +2822,7 @@ get_udpsocket(dns_dispatchmgr_t *mgr, dns_dispatch_t *disp,
/* Allow to reuse address for non-random ports. */
result = open_socket(sockmgr, localaddr,
ISC_SOCKET_REUSEADDRESS, &sock,
dup_socket);
dup_socket, duponly);
if (result == ISC_R_SUCCESS)
*sockp = sock;
@@ -2828,7 +2834,7 @@ get_udpsocket(dns_dispatchmgr_t *mgr, dns_dispatch_t *disp,
i = 0;
for (j = 0; j < 0xffffU; j++) {
result = open_socket(sockmgr, localaddr, 0, &sock, NULL);
result = open_socket(sockmgr, localaddr, 0, &sock, NULL, false);
if (result != ISC_R_SUCCESS)
goto end;
else if (portavailable(mgr, sock, NULL))
@@ -2872,22 +2878,27 @@ dispatch_createudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
dns_dispatch_t *disp;
isc_socket_t *sock = NULL;
int i = 0;
bool duponly = ((attributes & DNS_DISPATCHATTR_CANREUSE) == 0);
/* This is an attribute needed only at creation time */
attributes &= ~DNS_DISPATCHATTR_CANREUSE;
/*
* dispatch_allocate() checks mgr for us.
*/
disp = NULL;
result = dispatch_allocate(mgr, maxrequests, &disp);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
return (result);
}
disp->socktype = isc_sockettype_udp;
if ((attributes & DNS_DISPATCHATTR_EXCLUSIVE) == 0) {
result = get_udpsocket(mgr, disp, sockmgr, localaddr, &sock,
dup_socket);
if (result != ISC_R_SUCCESS)
dup_socket, duponly);
if (result != ISC_R_SUCCESS) {
goto deallocate_dispatch;
}
if (isc_log_wouldlog(dns_lctx, 90)) {
char addrbuf[ISC_SOCKADDR_FORMATSIZE];
@@ -2910,35 +2921,42 @@ dispatch_createudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
*/
isc_sockaddr_anyofpf(&sa_any, isc_sockaddr_pf(localaddr));
if (!isc_sockaddr_eqaddr(&sa_any, localaddr)) {
result = open_socket(sockmgr, localaddr, 0, &sock, NULL);
if (sock != NULL)
result = open_socket(sockmgr, localaddr, 0,
&sock, NULL, false);
if (sock != NULL) {
isc_socket_detach(&sock);
if (result != ISC_R_SUCCESS)
}
if (result != ISC_R_SUCCESS) {
goto deallocate_dispatch;
}
}
disp->port_table = isc_mem_get(mgr->mctx,
sizeof(disp->port_table[0]) *
DNS_DISPATCH_PORTTABLESIZE);
if (disp->port_table == NULL)
if (disp->port_table == NULL) {
goto deallocate_dispatch;
for (i = 0; i < DNS_DISPATCH_PORTTABLESIZE; i++)
}
for (i = 0; i < DNS_DISPATCH_PORTTABLESIZE; i++) {
ISC_LIST_INIT(disp->port_table[i]);
}
result = isc_mempool_create(mgr->mctx, sizeof(dispportentry_t),
&disp->portpool);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
goto deallocate_dispatch;
}
isc_mempool_setname(disp->portpool, "disp_portpool");
isc_mempool_setfreemax(disp->portpool, 128);
}
disp->socket = sock;
disp->local = *localaddr;
if ((attributes & DNS_DISPATCHATTR_EXCLUSIVE) != 0)
if ((attributes & DNS_DISPATCHATTR_EXCLUSIVE) != 0) {
disp->ntasks = MAX_INTERNAL_TASKS;
else
} else {
disp->ntasks = 1;
}
for (i = 0; i < disp->ntasks; i++) {
disp->task[i] = NULL;
result = isc_task_create(taskmgr, 50, &disp->task[i]);
@@ -2970,8 +2988,9 @@ dispatch_createudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
}
result = isc_mutex_init(&disp->sepool_lock);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
goto kill_sepool;
}
isc_mempool_setname(disp->sepool, "disp_sepool");
isc_mempool_setmaxalloc(disp->sepool, 32768);
@@ -2990,8 +3009,9 @@ dispatch_createudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
mgr_log(mgr, LVL(90), "created UDP dispatcher %p", disp);
dispatch_log(disp, LVL(90), "created task %p", disp->task[0]); /* XXX */
if (disp->socket != NULL)
if (disp->socket != NULL) {
dispatch_log(disp, LVL(90), "created socket %p", disp->socket);
}
*dispp = disp;
@@ -3005,11 +3025,13 @@ dispatch_createudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
kill_ctlevent:
isc_event_free(&disp->ctlevent);
kill_task:
for (i = 0; i < disp->ntasks; i++)
for (i = 0; i < disp->ntasks; i++) {
isc_task_detach(&disp->task[i]);
}
kill_socket:
if (disp->socket != NULL)
if (disp->socket != NULL) {
isc_socket_detach(&disp->socket);
}
deallocate_dispatch:
dispatch_free(&disp);
+1 -1
View File
@@ -167,7 +167,7 @@ dt_init(void) {
int ret;
if (dt_mctx == NULL)
result = isc_mem_create(0, 0, &dt_mctx);
result = isc_mem_create(&dt_mctx);
if (result != ISC_R_SUCCESS)
goto unlock;
isc_mem_setname(dt_mctx, "dt", NULL);
+1 -1
View File
@@ -114,7 +114,7 @@ state_key_init(void) {
int ret;
if (state_mctx == NULL)
result = isc_mem_create(0, 0, &state_mctx);
result = isc_mem_create(&state_mctx);
if (result != ISC_R_SUCCESS)
goto unlock;
isc_mem_setname(state_mctx, "geoip_state", NULL);
+1
View File
@@ -140,6 +140,7 @@ struct dns_dispatchset {
#define DNS_DISPATCHATTR_CONNECTED 0x00000080U
#define DNS_DISPATCHATTR_FIXEDID 0x00000100U
#define DNS_DISPATCHATTR_EXCLUSIVE 0x00000200U
#define DNS_DISPATCHATTR_CANREUSE 0x00000400U
/*@}*/
/*
+1 -1
View File
@@ -79,7 +79,7 @@ initialize(void) {
REQUIRE(initialize_done == false);
result = isc_mem_create(0, 0, &dns_g_mctx);
result = isc_mem_create(&dns_g_mctx);
if (result != ISC_R_SUCCESS)
return;
dns_result_register();
+1 -1
View File
@@ -1301,7 +1301,7 @@ totext_filter_proc_key_init(void) {
if (!thread_key_initialized) {
LOCK(&thread_key_mutex);
if (thread_key_mctx == NULL)
result = isc_mem_create(0, 0, &thread_key_mctx);
result = isc_mem_create( &thread_key_mctx);
if (result != ISC_R_SUCCESS)
goto unlock;
isc_mem_setname(thread_key_mctx, "threadkey", NULL);
+1 -1
View File
@@ -9910,7 +9910,7 @@ dns_resolver_create(dns_view_t *view,
* contention among multiple threads. Do this only when
* enabling threads because it will be require more memory.
*/
result = isc_mem_create(0, 0, &res->buckets[i].mctx);
result = isc_mem_create(&res->buckets[i].mctx);
if (result != ISC_R_SUCCESS) {
isc_task_detach(&res->buckets[i].task);
DESTROYLOCK(&res->buckets[i].lock);
+3 -3
View File
@@ -49,7 +49,7 @@ ATF_TC_BODY(getoriginnode, tc) {
isc_mem_t *mymctx = NULL;
isc_result_t result;
result = isc_mem_create(0, 0, &mymctx);
result = isc_mem_create(&mymctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_zone,
@@ -79,7 +79,7 @@ ATF_TC_BODY(getsetservestalettl, tc) {
isc_result_t result;
dns_ttl_t ttl;
result = isc_mem_create(0, 0, &mymctx);
result = isc_mem_create(&mymctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_cache,
@@ -124,7 +124,7 @@ ATF_TC_BODY(dns_dbfind_staleok, tc) {
isc_result_t result;
unsigned char data[] = { 0x0a, 0x00, 0x00, 0x01 };
result = isc_mem_create(0, 0, &mymctx);
result = isc_mem_create(&mymctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_cache,
+1 -1
View File
@@ -113,7 +113,7 @@ dns_test_begin(FILE *logfile, bool start_managers) {
CHECK(isc_app_start());
if (debug_mem_record)
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
CHECK(isc_mem_create(0, 0, &mctx));
CHECK(isc_mem_create(&mctx));
CHECK(dst_lib_init(mctx, NULL));
dst_active = true;
+1 -1
View File
@@ -818,7 +818,7 @@ dns_view_createresolver(dns_view_t *view,
dns_resolver_whenshutdown(view->resolver, view->task, &event);
view->attributes &= ~DNS_VIEWATTR_RESSHUTDOWN;
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) {
dns_resolver_shutdown(view->resolver);
return (result);
+1 -1
View File
@@ -16442,7 +16442,7 @@ mctxinit(void **target, void *arg) {
REQUIRE(target != NULL && *target == NULL);
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS)
return (result);
isc_mem_setname(mctx, "zonemgr-pool", NULL);
+1 -1
View File
@@ -96,7 +96,7 @@ ctxs_init(isc_mem_t **mctxp, isc_appctx_t **actxp,
{
isc_result_t result;
result = isc_mem_create(0, 0, mctxp);
result = isc_mem_create(mctxp);
if (result != ISC_R_SUCCESS)
goto fail;
+20 -9
View File
@@ -126,6 +126,10 @@ resconf_parsesortlist(irs_resconf_t *conf, FILE *fp);
static isc_result_t
resconf_parseoption(irs_resconf_t *ctx, FILE *fp);
#if HAVE_GET_WIN32_NAMESERVERS
static isc_result_t get_win32_nameservers(irs_resconf_t *conf);
#endif
/*!
* Eat characters from FP until EOL or EOF. Returns EOF or '\n'
*/
@@ -562,15 +566,6 @@ irs_resconf_load(isc_mem_t *mctx, const char *filename, irs_resconf_t **confp)
goto error;
}
/* If we don't find a nameserver fall back to localhost */
if (conf->numns == 0U) {
INSIST(ISC_LIST_EMPTY(conf->nameservers));
/* XXX: should we catch errors? */
(void)add_server(conf->mctx, "::1", &conf->nameservers);
(void)add_server(conf->mctx, "127.0.0.1", &conf->nameservers);
}
/*
* Construct unified search list from domain or configured
* search list
@@ -585,6 +580,22 @@ irs_resconf_load(isc_mem_t *mctx, const char *filename, irs_resconf_t **confp)
}
}
#if HAVE_GET_WIN32_NAMESERVERS
ret = get_win32_nameservers(conf);
if (ret != ISC_R_SUCCESS) {
goto error;
}
#endif
/* If we don't find a nameserver fall back to localhost */
if (conf->numns == 0U) {
INSIST(ISC_LIST_EMPTY(conf->nameservers));
/* XXX: should we catch errors? */
(void)add_server(conf->mctx, "::1", &conf->nameservers);
(void)add_server(conf->mctx, "127.0.0.1", &conf->nameservers);
}
error:
conf->magic = IRS_RESCONF_MAGIC;
+1 -1
View File
@@ -30,7 +30,7 @@ static void
setup_test() {
isc_result_t result;
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
/*
+2 -2
View File
@@ -39,7 +39,7 @@
<ClCompile Include="..\getnameinfo.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\resconf.c">
<ClCompile Include="resconf.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
@@ -66,4 +66,4 @@
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
</Project>
+3 -3
View File
@@ -67,7 +67,7 @@
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>..\..\isc\win32\$(Configuration);..\..\dns\win32\$(Configuration);..\..\isccfg\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>@OPENSSL_LIB@libisc.lib;libdns.lib;libisccfg.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>@OPENSSL_LIB@libisc.lib;libdns.lib;libisccfg.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>.\libirs.def</ModuleDefinitionFile>
<ImportLibrary>.\$(Configuration)\$(ProjectName).lib</ImportLibrary>
<OutputFile>..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt)</OutputFile>
@@ -98,7 +98,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>..\..\isc\win32\$(Configuration);..\..\dns\win32\$(Configuration);..\..\isccfg\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>@OPENSSL_LIB@libisc.lib;libdns.lib;libisccfg.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>@OPENSSL_LIB@libisc.lib;libdns.lib;libisccfg.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>.\libirs.def</ModuleDefinitionFile>
<ImportLibrary>.\$(Configuration)\$(ProjectName).lib</ImportLibrary>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
@@ -114,8 +114,8 @@
<ClCompile Include="..\gai_strerror.c" />
<ClCompile Include="..\getaddrinfo.c" />
<ClCompile Include="..\getnameinfo.c" />
<ClCompile Include="..\resconf.c" />
<ClCompile Include="DLLMain.c" />
<ClCompile Include="resconf.c" />
<ClCompile Include="version.c" />
</ItemGroup>
<ItemGroup>
+131
View File
@@ -0,0 +1,131 @@
/*
* 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.
*/
/*
* Note that on Win32 there is normally no resolv.conf since all information
* is stored in the registry. Therefore there is no ordering like the
* contents of resolv.conf. Since the "search" or "domain" keyword, on
* Win32 if a search list is found it is used, otherwise the domain name
* is used since they are mutually exclusive. The search list can be entered
* in the DNS tab of the "Advanced TCP/IP settings" window under the same place
* that you add your nameserver list.
*/
#define HAVE_GET_WIN32_NAMESERVERS 1
#include "../resconf.c"
#include <iphlpapi.h>
#define TCPIP_SUBKEY \
"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
isc_result_t
get_win32_searchlist(irs_resconf_t *conf) {
isc_result_t result = ISC_R_SUCCESS;
HKEY hKey;
BOOL keyFound = TRUE;
char searchlist[MAX_PATH];
DWORD searchlen = MAX_PATH;
LSTATUS status;
char *cp;
REQUIRE(conf != NULL);
memset(searchlist, 0, MAX_PATH);
status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, TCPIP_SUBKEY, 0, KEY_READ,
&hKey);
if (status != ERROR_SUCCESS) {
return (ISC_R_SUCCESS);
}
status = RegQueryValueEx(hKey, "SearchList", NULL, NULL,
(LPBYTE)searchlist, &searchlen);
RegCloseKey(hKey);
if (status != ERROR_SUCCESS) {
return (ISC_R_SUCCESS);
}
cp = strtok((char *)searchlist, ", \0");
while (cp != NULL) {
result = add_search(conf, cp);
if (result != ISC_R_SUCCESS) {
break;
}
cp = strtok(NULL, ", \0");
}
return (result);
}
isc_result_t
get_win32_nameservers(irs_resconf_t *conf) {
isc_result_t result;
FIXED_INFO *FixedInfo;
ULONG BufLen = sizeof(FIXED_INFO);
DWORD dwRetVal;
IP_ADDR_STRING *pIPAddr;
REQUIRE(conf != NULL);
FixedInfo = (FIXED_INFO *) GlobalAlloc(GPTR, BufLen);
if (FixedInfo == NULL) {
return (ISC_R_NOMEMORY);
}
dwRetVal = GetNetworkParams(FixedInfo, &BufLen);
if (dwRetVal == ERROR_BUFFER_OVERFLOW) {
GlobalFree(FixedInfo);
FixedInfo = GlobalAlloc(GPTR, BufLen);
if (FixedInfo == NULL) {
return (ISC_R_NOMEMORY);
}
dwRetVal = GetNetworkParams(FixedInfo, &BufLen);
}
if (dwRetVal != ERROR_SUCCESS) {
GlobalFree(FixedInfo);
return (ISC_R_FAILURE);
}
result = get_win32_searchlist(conf);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
if (ISC_LIST_EMPTY(conf->searchlist) &&
strlen(FixedInfo->DomainName) > 0)
{
result = add_search(conf, FixedInfo->DomainName);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
}
/* Get the list of nameservers */
pIPAddr = &FixedInfo->DnsServerList;
while (pIPAddr) {
if (conf->numns >= RESCONFMAXNAMESERVERS) {
break;
}
result = add_server(conf->mctx, pIPAddr->IpAddress.String,
&conf->nameservers);
if (result != ISC_R_SUCCESS) {
break;
}
conf->numns++;
pIPAddr = pIPAddr->Next;
}
cleanup:
if (FixedInfo != NULL) {
GlobalFree(FixedInfo);
}
return (result);
}
+3 -42
View File
@@ -111,19 +111,6 @@ LIBISC_EXTERNAL_DATA extern unsigned int isc_mem_defaultflags;
#define _ISC_MEM_FLARG
#endif
/*!
* Define ISC_MEM_USE_INTERNAL_MALLOC=1 to use the internal malloc()
* implementation in preference to the system one. The internal malloc()
* is very space-efficient, and quite fast on uniprocessor systems. It
* performs poorly on multiprocessor machines.
* JT: we can overcome the performance issue on multiprocessor machines
* by carefully separating memory contexts.
*/
#ifndef ISC_MEM_USE_INTERNAL_MALLOC
#define ISC_MEM_USE_INTERNAL_MALLOC 1
#endif
/*
* Flags for isc_mem_createx() calls.
*/
@@ -131,11 +118,7 @@ LIBISC_EXTERNAL_DATA extern unsigned int isc_mem_defaultflags;
#define ISC_MEMFLAG_INTERNAL 0x00000002 /* use internal malloc */
#define ISC_MEMFLAG_FILL 0x00000004 /* fill with pattern after alloc and frees */
#if !ISC_MEM_USE_INTERNAL_MALLOC
#define ISC_MEMFLAG_DEFAULT 0
#else
#define ISC_MEMFLAG_DEFAULT ISC_MEMFLAG_INTERNAL|ISC_MEMFLAG_FILL
#endif
#define ISC_MEMFLAG_DEFAULT ISC_MEMFLAG_FILL
/*%
* isc_mem_putanddetach() is a convenience function for use where you
@@ -166,19 +149,6 @@ LIBISC_EXTERNAL_DATA extern unsigned int isc_mem_defaultflags;
* \endcode
*/
/*% memory and memory pool methods */
typedef struct isc_memmethods {
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);
} isc_memmethods_t;
/*%
* This structure is actually just the common prefix of a memory context
* implementation's version of an isc_mem_t.
@@ -191,7 +161,6 @@ typedef struct isc_memmethods {
struct isc_mem {
unsigned int impmagic;
unsigned int magic;
isc_memmethods_t *methods;
};
#define ISCAPI_MCTX_MAGIC ISC_MAGIC('A','m','c','x')
@@ -216,11 +185,6 @@ struct isc_mempool {
* (two underscores). The single-underscore macros are used to pass
* __FILE__ and __LINE__, and in the case of the put functions, to
* set the pointer being freed to NULL in the calling function.
*
* Many of these functions have a further isc___mem_<function>
* (three underscores) implementation, which is called indirectly
* via the isc_memmethods structure in the mctx so that dynamically
* loaded modules can use them even if named is statically linked.
*/
#define ISCMEMFUNC(sfx) isc__mem_ ## sfx
@@ -255,13 +219,10 @@ struct isc_mempool {
/*@{*/
isc_result_t
isc_mem_create(size_t max_size, size_t target_size,
isc_mem_t **mctxp);
isc_mem_create(isc_mem_t **mctxp);
isc_result_t
isc_mem_createx(size_t max_size, size_t target_size,
isc_memalloc_t memalloc, isc_memfree_t memfree,
void *arg, isc_mem_t **mctxp, unsigned int flags);
isc_mem_createx(isc_mem_t **mctxp, unsigned int flags);
/*!<
* \brief Create a memory context.
+8 -96
View File
@@ -243,8 +243,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;
/*@{*/
@@ -275,14 +274,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 */
/*@}*/
/*%
* This structure is actually just the common prefix of a socket manager
* object implementation's version of an isc_socketmgr_t.
@@ -329,76 +320,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,
@@ -407,9 +328,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.
@@ -420,8 +338,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
@@ -551,17 +467,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
@@ -577,9 +488,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.
@@ -588,8 +496,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
*/
@@ -907,7 +813,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.
@@ -1104,6 +1010,12 @@ 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);
+84 -691
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -110,7 +110,8 @@ isc_thread_setaffinity(int cpu) {
CPU_ZERO(&cpuset);
CPU_SET(cpu, &cpuset);
if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1,
&cpuset, sizeof(cpuset)) != 0) {
sizeof(cpuset), &cpuset) != 0)
{
return (ISC_R_FAILURE);
}
#elif defined(HAVE_PTHREAD_SETAFFINITY_NP)
@@ -118,7 +119,8 @@ isc_thread_setaffinity(int cpu) {
CPU_ZERO(&set);
CPU_SET(cpu, &set);
if (pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t),
&set) != 0) {
&set) != 0)
{
return (ISC_R_FAILURE);
}
#elif defined(HAVE_PROCESSOR_BIND)
+48 -32
View File
@@ -205,7 +205,7 @@ wake_all_queues(isc__taskmgr_t *manager);
static inline void
wake_all_queues(isc__taskmgr_t *manager) {
for (unsigned i=0; i < manager->workers; i++) {
for (unsigned int i = 0; i < manager->workers; i++) {
LOCK(&manager->queues[i].lock);
BROADCAST(&manager->queues[i].work_available);
UNLOCK(&manager->queues[i].lock);
@@ -379,8 +379,9 @@ task_ready(isc__task_t *task) {
XTRACE("task_ready");
LOCK(&manager->queues[task->threadid].lock);
push_readyq(manager, task, task->threadid);
if (manager->mode == isc_taskmgrmode_normal || has_privilege)
if (manager->mode == isc_taskmgrmode_normal || has_privilege) {
SIGNAL(&manager->queues[task->threadid].work_available);
}
UNLOCK(&manager->queues[task->threadid].lock);
}
@@ -898,16 +899,18 @@ static inline isc__task_t *
pop_readyq(isc__taskmgr_t *manager, int c) {
isc__task_t *task;
if (manager->mode == isc_taskmgrmode_normal)
if (manager->mode == isc_taskmgrmode_normal) {
task = HEAD(manager->queues[c].ready_tasks);
else
} else {
task = HEAD(manager->queues[c].ready_priority_tasks);
}
if (task != NULL) {
DEQUEUE(manager->queues[c].ready_tasks, task, ready_link);
if (ISC_LINK_LINKED(task, ready_priority_link))
if (ISC_LINK_LINKED(task, ready_priority_link)) {
DEQUEUE(manager->queues[c].ready_priority_tasks, task,
ready_priority_link);
}
}
return (task);
@@ -922,9 +925,10 @@ pop_readyq(isc__taskmgr_t *manager, int c) {
static inline void
push_readyq(isc__taskmgr_t *manager, isc__task_t *task, int c) {
ENQUEUE(manager->queues[c].ready_tasks, task, ready_link);
if ((task->flags & TASK_F_PRIVILEGED) != 0)
if ((task->flags & TASK_F_PRIVILEGED) != 0) {
ENQUEUE(manager->queues[c].ready_priority_tasks, task,
ready_priority_link);
}
atomic_fetch_add_explicit(&manager->tasks_ready, 1,
memory_order_acquire);
}
@@ -1001,19 +1005,26 @@ dispatch(isc__taskmgr_t *manager, unsigned int threadid) {
* If a pause has been requested, don't do any work
* until it's been released.
*/
while ((empty_readyq(manager, threadid) && !manager->pause_requested &&
!manager->exclusive_requested) && !FINISHED(manager))
while ((empty_readyq(manager, threadid) &&
!manager->pause_requested &&
!manager->exclusive_requested) &&
!FINISHED(manager))
{
XTHREADTRACE(isc_msgcat_get(isc_msgcat,
ISC_MSGSET_GENERAL,
ISC_MSG_WAIT, "wait"));
XTHREADTRACE(isc_msgcat_get(isc_msgcat,
ISC_MSGSET_GENERAL,
ISC_MSG_WAIT, manager->pause_requested ? "paused" : "notpaused"));
ISC_MSG_WAIT,
manager->pause_requested
? "paused" : "notpaused"));
XTHREADTRACE(isc_msgcat_get(isc_msgcat,
ISC_MSGSET_GENERAL,
ISC_MSG_WAIT, manager->exclusive_requested ? "excreq" : "notexcreq"));
WAIT(&manager->queues[threadid].work_available, &manager->queues[threadid].lock);
ISC_MSG_WAIT,
manager->exclusive_requested
? "excreq" : "notexcreq"));
WAIT(&manager->queues[threadid].work_available,
&manager->queues[threadid].lock);
XTHREADTRACE(isc_msgcat_get(isc_msgcat,
ISC_MSGSET_TASK,
ISC_MSG_AWAKE, "awake"));
@@ -1027,19 +1038,24 @@ dispatch(isc__taskmgr_t *manager, unsigned int threadid) {
ISC_MSG_WORKING, "halting"));
/*
* Switching to exclusive mode is done as a 2-phase-lock,
* checking if we have to switch is done without any locks
* on pause_requested and exclusive_requested to save time -
* the worst thing that can happen is that we'll launch one task
* more and exclusive task will be postponed a bit.
* Switching to exclusive mode is done as a
* 2-phase-lock, checking if we have to switch is
* done without any locks on pause_requested and
* exclusive_requested to save time - the worst
* thing that can happen is that we'll launch one
* task more and exclusive task will be postponed a
* bit.
*
* Broadcasting on halt_cond seems suboptimal, but exclusive tasks
* are rare enought that we don't care.
* Broadcasting on halt_cond seems suboptimal, but
* exclusive tasks are rare enought that we don't
* care.
*/
LOCK(&manager->halt_lock);
manager->halted++;
BROADCAST(&manager->halt_cond);
while (manager->pause_requested || manager->exclusive_requested) {
while (manager->pause_requested ||
manager->exclusive_requested)
{
WAIT(&manager->halt_cond, &manager->halt_lock);
}
manager->halted--;
@@ -1067,8 +1083,9 @@ dispatch(isc__taskmgr_t *manager, unsigned int threadid) {
* lock before exiting the 'if (task != NULL)' block.
*/
UNLOCK(&manager->queues[threadid].lock);
RUNTIME_CHECK(atomic_fetch_sub_explicit(&manager->tasks_ready,
1, memory_order_release) > 0);
RUNTIME_CHECK(
atomic_fetch_sub_explicit(&manager->tasks_ready,
1, memory_order_release) > 0);
atomic_fetch_add_explicit(&manager->tasks_running, 1,
memory_order_acquire);
@@ -1184,7 +1201,8 @@ dispatch(isc__taskmgr_t *manager, unsigned int threadid) {
if (finished)
task_finished(task);
RUNTIME_CHECK(atomic_fetch_sub_explicit(&manager->tasks_running,
RUNTIME_CHECK(
atomic_fetch_sub_explicit(&manager->tasks_running,
1, memory_order_release) > 0);
LOCK(&manager->queues[threadid].lock);
if (requeue) {
@@ -1236,7 +1254,7 @@ dispatch(isc__taskmgr_t *manager, unsigned int threadid) {
{
bool empty = true;
unsigned int i;
for (i=0; i<manager->workers && empty; i++)
for (i = 0; i < manager->workers && empty; i++)
{
LOCK(&manager->queues[i].lock);
empty &= empty_readyq(manager, i);
@@ -1286,7 +1304,7 @@ run(void *queuep) {
static void
manager_free(isc__taskmgr_t *manager) {
for (unsigned int i=0; i < manager->workers; i++) {
for (unsigned int i = 0; i < manager->workers; i++) {
DESTROYLOCK(&manager->queues[i].lock);
}
DESTROYLOCK(&manager->lock);
@@ -1321,19 +1339,17 @@ isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers,
RUNTIME_CHECK(isc_mutex_init(&manager->lock) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mutex_init(&manager->excl_lock) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mutex_init(&manager->halt_lock)
== ISC_R_SUCCESS);
RUNTIME_CHECK(isc_condition_init(&manager->halt_cond)
== ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mutex_init(&manager->halt_lock) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_condition_init(&manager->halt_cond) == ISC_R_SUCCESS);
manager->workers = workers;
if (default_quantum == 0)
if (default_quantum == 0) {
default_quantum = DEFAULT_DEFAULT_QUANTUM;
}
manager->default_quantum = default_quantum;
INIT_LIST(manager->tasks);
manager->queues = isc_mem_get(mctx, workers *
sizeof(isc__taskqueue_t));
manager->queues = isc_mem_get(mctx, workers * sizeof(isc__taskqueue_t));
RUNTIME_CHECK(manager->queues != NULL);
manager->tasks_running = 0;
@@ -1357,7 +1373,7 @@ isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers,
RUNTIME_CHECK(isc_mutex_init(&manager->queues[i].lock)
== ISC_R_SUCCESS);
RUNTIME_CHECK(isc_condition_init(
&manager->queues[i].work_available)
&manager->queues[i].work_available)
== ISC_R_SUCCESS);
manager->queues[i].manager = manager;
manager->queues[i].threadid = i;
+1 -1
View File
@@ -56,7 +56,7 @@ ATF_TC_BODY(isc_heap_delete, tc) {
UNUSED(tc);
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_heap_create(mctx, compare, idx, 0, &heap);
+2 -18
View File
@@ -27,28 +27,13 @@
#include <isc/string.h>
#include <isc/util.h>
static void *
default_memalloc(void *arg, size_t size) {
UNUSED(arg);
if (size == 0U)
size = 1;
return (malloc(size));
}
static void
default_memfree(void *arg, void *ptr) {
UNUSED(arg);
free(ptr);
}
static void test_ht_full(int bits, uintptr_t count) {
isc_ht_t *ht = NULL;
isc_result_t result;
isc_mem_t *mctx = NULL;
uintptr_t i;
result = isc_mem_createx(0, 0, default_memalloc, default_memfree,
NULL, &mctx, 0);
result = isc_mem_createx(&mctx, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_ht_init(&ht, mctx, bits);
@@ -200,8 +185,7 @@ static void test_ht_iterator() {
unsigned char *tkey;
size_t tksize;
result = isc_mem_createx(0, 0, default_memalloc, default_memfree,
NULL, &mctx, 0);
result = isc_mem_createx(&mctx, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_ht_init(&ht, mctx, 16);
+1 -1
View File
@@ -100,7 +100,7 @@ isc_test_begin(FILE *logfile, bool start_managers,
isc_result_t result;
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
CHECK(isc_mem_create(0, 0, &mctx));
CHECK(isc_mem_create(&mctx));
if (logfile != NULL) {
isc_logdestination_t destination;
+2 -2
View File
@@ -38,7 +38,7 @@ ATF_TC_BODY(lex_0xff, tc) {
UNUSED(tc);
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_lex_create(mctx, 1024, &lex);
@@ -70,7 +70,7 @@ ATF_TC_BODY(lex_setline, tc) {
UNUSED(tc);
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_lex_create(mctx, 1024, &lex);
+7 -27
View File
@@ -26,20 +26,6 @@
#include "isctest.h"
static void *
default_memalloc(void *arg, size_t size) {
UNUSED(arg);
if (size == 0U)
size = 1;
return (malloc(size));
}
static void
default_memfree(void *arg, void *ptr) {
UNUSED(arg);
free(ptr);
}
ATF_TC(isc_mem);
ATF_TC_HEAD(isc_mem, tc) {
atf_tc_set_md_var(tc, "descr", "general memory system tests");
@@ -65,7 +51,7 @@ ATF_TC_BODY(isc_mem, tc) {
result = isc_test_begin(NULL, true, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_mem_create(0, 0, &localmctx);
result = isc_mem_create(&localmctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_mempool_create(localmctx, 24, &mp1);
@@ -139,8 +125,7 @@ ATF_TC_BODY(isc_mem, tc) {
isc_mem_destroy(&localmctx);
result = isc_mem_createx(0, 0, default_memalloc, default_memfree,
NULL, &localmctx,
result = isc_mem_createx(&localmctx,
ISC_MEMFLAG_FILL | ISC_MEMFLAG_INTERNAL);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
@@ -174,8 +159,7 @@ ATF_TC_BODY(isc_mem_total, tc) {
/* Local alloc, free */
mctx2 = NULL;
result = isc_mem_createx(0, 0, default_memalloc, default_memfree,
NULL, &mctx2, 0);
result = isc_mem_createx(&mctx2, 0);
if (result != ISC_R_SUCCESS)
goto out;
@@ -240,8 +224,7 @@ ATF_TC_BODY(isc_mem_inuse, tc) {
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
mctx2 = NULL;
result = isc_mem_createx(0, 0, default_memalloc, default_memfree,
NULL, &mctx2, 0);
result = isc_mem_createx(&mctx2, 0);
if (result != ISC_R_SUCCESS)
goto out;
@@ -284,8 +267,7 @@ ATF_TC_BODY(isc_mem_noflags, tc) {
result = isc_test_begin(NULL, true, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_mem_createx(0, 0, default_memalloc, default_memfree,
NULL, &mctx2, 0);
result = isc_mem_createx(&mctx2, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
isc_mem_debugging = 0;
ptr = isc_mem_get(mctx2, 2048);
@@ -336,8 +318,7 @@ ATF_TC_BODY(isc_mem_recordflag, tc) {
result = isc_test_begin(NULL, false, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_mem_createx(0, 0, default_memalloc, default_memfree,
NULL, &mctx2, 0);
result = isc_mem_createx(&mctx2, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
ptr = isc_mem_get(mctx2, 2048);
ATF_CHECK(ptr != NULL);
@@ -386,8 +367,7 @@ ATF_TC_BODY(isc_mem_traceflag, tc) {
result = isc_test_begin(NULL, true, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_mem_createx(0, 0, default_memalloc, default_memfree,
NULL, &mctx2, 0);
result = isc_mem_createx(&mctx2, 0);
isc_mem_debugging = ISC_MEM_DEBUGTRACE;
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
ptr = isc_mem_get(mctx2, 2048);
+1 -1
View File
@@ -276,7 +276,7 @@ random_test(pvalue_func_t *func, isc_random_func test_func) {
tables_init();
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
m = 1000;
+1 -1
View File
@@ -691,7 +691,7 @@ ATF_TC_BODY(manytasks, tc) {
result = isc_condition_init(&cv);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_mem_create(0, 0, &mctx);
result = isc_mem_create(&mctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_taskmgr_create(mctx, 4, 0, &taskmgr);
+806 -1145
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -78,6 +78,7 @@ isc_socket_getpeername
isc_socket_getsockname
isc_socket_gettag
isc_socket_gettype
isc_socket_hasreuseport
isc_socket_ipv6only
isc_socket_listen
isc_socket_open
+16 -14
View File
@@ -508,8 +508,6 @@ iocompletionport_init(isc_socketmgr_t *manager) {
strbuf);
}
manager->maxIOCPThreads = min(isc_os_ncpus() + 1, MAX_IOCPTHREADS);
/* Now Create the Completion Port */
manager->hIoCompletionPort = CreateIoCompletionPort(
INVALID_HANDLE_VALUE, NULL,
@@ -1551,7 +1549,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)
@@ -1757,7 +1754,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);
}
@@ -1789,7 +1785,6 @@ isc_socket_detach(isc_socket_t **socketp) {
REQUIRE(socketp != NULL);
sock = *socketp;
REQUIRE(VALID_SOCKET(sock));
REQUIRE(sock->type != isc_sockettype_fdwatch);
LOCK(&sock->lock);
CONSISTENT(sock);
@@ -1815,7 +1810,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);
}
@@ -2542,7 +2536,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)
{
isc_socketmgr_t *manager;
isc_result_t result;
@@ -2578,6 +2572,10 @@ isc_socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp,
}
isc_mem_attach(mctx, &manager->mctx);
if (nthreads == 0) {
nthreads = isc_os_ncpus() + 1;
}
manager->maxIOCPThreads = min(nthreads, MAX_IOCPTHREADS);
iocompletionport_init(manager); /* Create the Completion Ports */
@@ -2903,7 +2901,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);
@@ -3696,20 +3693,25 @@ 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 *
_socktype(isc_sockettype_t type) {
if (type == isc_sockettype_udp)
switch (type) {
case isc_sockettype_udp:
return ("udp");
else if (type == isc_sockettype_tcp)
case isc_sockettype_tcp:
return ("tcp");
else if (type == isc_sockettype_unix)
case isc_sockettype_unix:
return ("unix");
else if (type == isc_sockettype_fdwatch)
return ("fdwatch");
else
default:
return ("not-initialized");
}
}
#define TRY0(a) do { xmlrc = (a); if (xmlrc < 0) goto error; } while(0)
+1 -1
View File
@@ -63,7 +63,7 @@ setup() {
isc_result_t result;
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
CHECK(isc_mem_create(0, 0, &mctx));
CHECK(isc_mem_create(&mctx));
isc_logdestination_t destination;
isc_logconfig_t *logconfig = NULL;
+2 -2
View File
@@ -2903,7 +2903,7 @@ get_clientmctx(ns_clientmgr_t *manager, isc_mem_t **mctxp) {
* Caller must be holding the manager lock.
*/
if ((manager->sctx->options & NS_SERVER_CLIENTTEST) != 0) {
result = isc_mem_create(0, 0, mctxp);
result = isc_mem_create(mctxp);
if (result == ISC_R_SUCCESS)
isc_mem_setname(*mctxp, "client", NULL);
return (result);
@@ -2917,7 +2917,7 @@ get_clientmctx(ns_clientmgr_t *manager, isc_mem_t **mctxp) {
clientmctx = manager->mctxpool[nextmctx];
if (clientmctx == NULL) {
result = isc_mem_create(0, 0, &clientmctx);
result = isc_mem_create(&clientmctx);
if (result != ISC_R_SUCCESS)
return (result);
isc_mem_setname(clientmctx, "client", NULL);

Some files were not shown because too many files have changed in this diff Show More