summaryrefslogtreecommitdiff
path: root/lib/isc
diff options
context:
space:
mode:
authorInternet Software Consortium, Inc <@isc.org>2007-09-07 14:08:38 -0600
committerLaMont Jones <lamont@debian.org>2007-09-07 14:08:38 -0600
commit1430f0bc941f5280d1359e99a8db3f8cddf028ef (patch)
treedfde1f88900db0e15b72a37fe3f34a9c308402ba /lib/isc
parent59cfa71487b8acf6ca955d054a2e6cbe7db482ac (diff)
downloadbind9-1430f0bc941f5280d1359e99a8db3f8cddf028ef.tar.gz
9.1.0b1
Diffstat (limited to 'lib/isc')
-rw-r--r--lib/isc/Makefile.in44
-rw-r--r--lib/isc/api4
-rw-r--r--lib/isc/assertions.c22
-rw-r--r--lib/isc/base64.c243
-rw-r--r--lib/isc/bitstring.c29
-rw-r--r--lib/isc/buffer.c28
-rw-r--r--lib/isc/bufferlist.c22
-rw-r--r--lib/isc/commandline.c22
-rw-r--r--lib/isc/error.c22
-rw-r--r--lib/isc/event.c30
-rw-r--r--lib/isc/fsaccess.c22
-rw-r--r--lib/isc/heap.c34
-rw-r--r--lib/isc/hex.c199
-rw-r--r--lib/isc/hmacmd5.c113
-rw-r--r--lib/isc/include/Makefile.in22
-rw-r--r--lib/isc/include/isc/Makefile.in37
-rw-r--r--lib/isc/include/isc/assertions.h22
-rw-r--r--lib/isc/include/isc/base64.h26
-rw-r--r--lib/isc/include/isc/bitstring.h63
-rw-r--r--lib/isc/include/isc/boolean.h22
-rw-r--r--lib/isc/include/isc/buffer.h26
-rw-r--r--lib/isc/include/isc/bufferlist.h22
-rw-r--r--lib/isc/include/isc/commandline.h22
-rw-r--r--lib/isc/include/isc/entropy.h24
-rw-r--r--lib/isc/include/isc/error.h22
-rw-r--r--lib/isc/include/isc/event.h49
-rw-r--r--lib/isc/include/isc/eventclass.h22
-rw-r--r--lib/isc/include/isc/file.h48
-rw-r--r--lib/isc/include/isc/formatcheck.h22
-rw-r--r--lib/isc/include/isc/fsaccess.h26
-rw-r--r--lib/isc/include/isc/heap.h24
-rw-r--r--lib/isc/include/isc/hex.h97
-rw-r--r--lib/isc/include/isc/hmacmd5.h60
-rw-r--r--lib/isc/include/isc/interfaceiter.h28
-rw-r--r--lib/isc/include/isc/ipv6.h22
-rw-r--r--lib/isc/include/isc/lang.h22
-rw-r--r--lib/isc/include/isc/lex.h43
-rw-r--r--lib/isc/include/isc/lfsr.h22
-rw-r--r--lib/isc/include/isc/lib.h22
-rw-r--r--lib/isc/include/isc/list.h75
-rw-r--r--lib/isc/include/isc/log.h35
-rw-r--r--lib/isc/include/isc/magic.h22
-rw-r--r--lib/isc/include/isc/md5.h22
-rw-r--r--lib/isc/include/isc/mem.h245
-rw-r--r--lib/isc/include/isc/msgcat.h22
-rw-r--r--lib/isc/include/isc/mutexblock.h22
-rw-r--r--lib/isc/include/isc/netaddr.h24
-rw-r--r--lib/isc/include/isc/ondestroy.h28
-rw-r--r--lib/isc/include/isc/os.h22
-rw-r--r--lib/isc/include/isc/platform.h.in27
-rw-r--r--lib/isc/include/isc/print.h31
-rw-r--r--lib/isc/include/isc/quota.h24
-rw-r--r--lib/isc/include/isc/random.h77
-rw-r--r--lib/isc/include/isc/ratelimiter.h26
-rw-r--r--lib/isc/include/isc/region.h27
-rw-r--r--lib/isc/include/isc/resource.h85
-rw-r--r--lib/isc/include/isc/result.h31
-rw-r--r--lib/isc/include/isc/resultclass.h22
-rw-r--r--lib/isc/include/isc/rwlock.h43
-rw-r--r--lib/isc/include/isc/serial.h22
-rw-r--r--lib/isc/include/isc/sha1.h26
-rw-r--r--lib/isc/include/isc/sockaddr.h62
-rw-r--r--lib/isc/include/isc/socket.h32
-rw-r--r--lib/isc/include/isc/stdio.h22
-rw-r--r--lib/isc/include/isc/string.h28
-rw-r--r--lib/isc/include/isc/symtab.h22
-rw-r--r--lib/isc/include/isc/task.h56
-rw-r--r--lib/isc/include/isc/taskpool.h30
-rw-r--r--lib/isc/include/isc/timer.h28
-rw-r--r--lib/isc/include/isc/types.h36
-rw-r--r--lib/isc/include/isc/util.h23
-rw-r--r--lib/isc/inet_aton.c32
-rw-r--r--lib/isc/inet_ntop.c26
-rw-r--r--lib/isc/inet_pton.c22
-rw-r--r--lib/isc/lex.c218
-rw-r--r--lib/isc/lfsr.c22
-rw-r--r--lib/isc/lib.c22
-rw-r--r--lib/isc/log.c62
-rw-r--r--lib/isc/md5.c24
-rw-r--r--lib/isc/mem.c609
-rw-r--r--lib/isc/mutexblock.c25
-rw-r--r--lib/isc/netaddr.c32
-rw-r--r--lib/isc/nls/Makefile.in24
-rw-r--r--lib/isc/nls/msgcat.c22
-rw-r--r--lib/isc/nothreads/Makefile.in38
-rw-r--r--lib/isc/nothreads/condition.c20
-rw-r--r--lib/isc/nothreads/include/Makefile.in25
-rw-r--r--lib/isc/nothreads/include/isc/Makefile.in37
-rw-r--r--lib/isc/nothreads/include/isc/condition.h59
-rw-r--r--lib/isc/nothreads/include/isc/mutex.h38
-rw-r--r--lib/isc/nothreads/include/isc/once.h32
-rw-r--r--lib/isc/nothreads/include/isc/thread.h35
-rw-r--r--lib/isc/nothreads/thread.c28
-rw-r--r--lib/isc/ondestroy.c30
-rw-r--r--lib/isc/print.c69
-rw-r--r--lib/isc/pthreads/Makefile.in24
-rw-r--r--lib/isc/pthreads/condition.c22
-rw-r--r--lib/isc/pthreads/include/Makefile.in22
-rw-r--r--lib/isc/pthreads/include/isc/Makefile.in31
-rw-r--r--lib/isc/pthreads/include/isc/condition.h22
-rw-r--r--lib/isc/pthreads/include/isc/mutex.h22
-rw-r--r--lib/isc/pthreads/include/isc/once.h22
-rw-r--r--lib/isc/pthreads/include/isc/thread.h22
-rw-r--r--lib/isc/pthreads/thread.c22
-rw-r--r--lib/isc/quota.c28
-rw-r--r--lib/isc/random.c92
-rw-r--r--lib/isc/ratelimiter.c36
-rw-r--r--lib/isc/result.c28
-rw-r--r--lib/isc/rwlock.c92
-rw-r--r--lib/isc/serial.c22
-rw-r--r--lib/isc/sha1.c22
-rw-r--r--lib/isc/sockaddr.c46
-rw-r--r--lib/isc/string.c26
-rw-r--r--lib/isc/symtab.c23
-rw-r--r--lib/isc/task.c220
-rw-r--r--lib/isc/task_p.h31
-rw-r--r--lib/isc/taskpool.c28
-rw-r--r--lib/isc/timer.c144
-rw-r--r--lib/isc/timer_p.h31
-rw-r--r--lib/isc/unix/Makefile.in30
-rw-r--r--lib/isc/unix/app.c266
-rw-r--r--lib/isc/unix/dir.c103
-rw-r--r--lib/isc/unix/entropy.c57
-rw-r--r--lib/isc/unix/errno2result.c30
-rw-r--r--lib/isc/unix/errno2result.h24
-rw-r--r--lib/isc/unix/file.c87
-rw-r--r--lib/isc/unix/fsaccess.c22
-rw-r--r--lib/isc/unix/ifiter_ioctl.c78
-rw-r--r--lib/isc/unix/ifiter_sysctl.c70
-rw-r--r--lib/isc/unix/include/Makefile.in22
-rw-r--r--lib/isc/unix/include/isc/Makefile.in31
-rw-r--r--lib/isc/unix/include/isc/app.h53
-rw-r--r--lib/isc/unix/include/isc/dir.h31
-rw-r--r--lib/isc/unix/include/isc/int.h43
-rw-r--r--lib/isc/unix/include/isc/keyboard.h22
-rw-r--r--lib/isc/unix/include/isc/net.h22
-rw-r--r--lib/isc/unix/include/isc/netdb.h22
-rw-r--r--lib/isc/unix/include/isc/offset.h22
-rw-r--r--lib/isc/unix/include/isc/stdtime.h22
-rw-r--r--lib/isc/unix/include/isc/time.h27
-rw-r--r--lib/isc/unix/interfaceiter.c32
-rw-r--r--lib/isc/unix/ipv6.c22
-rw-r--r--lib/isc/unix/keyboard.c22
-rw-r--r--lib/isc/unix/net.c24
-rw-r--r--lib/isc/unix/os.c22
-rw-r--r--lib/isc/unix/resource.c196
-rw-r--r--lib/isc/unix/socket.c533
-rw-r--r--lib/isc/unix/socket_p.h31
-rw-r--r--lib/isc/unix/stdio.c32
-rw-r--r--lib/isc/unix/stdtime.c26
-rw-r--r--lib/isc/unix/time.c34
-rw-r--r--lib/isc/version.c22
-rw-r--r--lib/isc/win32/Makefile.in22
-rw-r--r--lib/isc/win32/condition.c30
-rw-r--r--lib/isc/win32/dir.c30
-rw-r--r--lib/isc/win32/file.c22
-rw-r--r--lib/isc/win32/fsaccess.c26
-rw-r--r--lib/isc/win32/include/Makefile.in22
-rw-r--r--lib/isc/win32/include/isc/Makefile.in31
-rw-r--r--lib/isc/win32/include/isc/condition.h24
-rw-r--r--lib/isc/win32/include/isc/dir.h22
-rw-r--r--lib/isc/win32/include/isc/int.h22
-rw-r--r--lib/isc/win32/include/isc/mutex.h22
-rw-r--r--lib/isc/win32/include/isc/net.h22
-rw-r--r--lib/isc/win32/include/isc/netdb.h22
-rw-r--r--lib/isc/win32/include/isc/once.h22
-rw-r--r--lib/isc/win32/include/isc/stdtime.h22
-rw-r--r--lib/isc/win32/include/isc/thread.h22
-rw-r--r--lib/isc/win32/include/isc/time.h25
-rw-r--r--lib/isc/win32/once.c26
-rw-r--r--lib/isc/win32/stdtime.c22
-rw-r--r--lib/isc/win32/thread.c24
-rw-r--r--lib/isc/win32/time.c28
173 files changed, 5250 insertions, 2913 deletions
diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in
index 42b9fead..20a8ca50 100644
--- a/lib/isc/Makefile.in
+++ b/lib/isc/Makefile.in
@@ -1,19 +1,19 @@
# Copyright (C) 1998-2000 Internet Software Consortium.
-#
+#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
-# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
-# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-# SOFTWARE.
-
-# $Id: Makefile.in,v 1.61 2000/06/22 21:56:48 tale Exp $
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+# $Id: Makefile.in,v 1.68 2000/11/14 23:43:36 tale Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@@ -24,7 +24,7 @@ top_srcdir = @top_srcdir@
@LIBISC_API@
CINCLUDES = -I${srcdir}/unix/include \
- -I${srcdir}/pthreads/include \
+ -I${srcdir}/@ISC_THREAD_DIR@/include \
-I./include \
-I${srcdir}/include
CDEFINES =
@@ -35,13 +35,13 @@ UNIXOBJS = @ISC_ISCIPV6_O@ \
unix/app.@O@ unix/dir.@O@ unix/entropy.@O@ \
unix/errno2result.@O@ unix/file.@O@ unix/fsaccess.@O@ \
unix/interfaceiter.@O@ unix/keyboard.@O@ unix/net.@O@ \
- unix/os.@O@ unix/socket.@O@ unix/time.@O@ \
+ unix/os.@O@ unix/resource.@O@ unix/socket.@O@ unix/time.@O@ \
unix/stdio.@O@ unix/stdtime.@O@
NLSOBJS = nls/msgcat.@O@
-PTHREADOBJS = pthreads/condition.@O@ pthreads/thread.@O@
+THREADOBJS = @ISC_THREAD_DIR@/condition.@O@ @ISC_THREAD_DIR@/thread.@O@
WIN32OBJS = win32/condition.@O@ win32/dir.@O@ win32/file.@O@ \
win32/fsaccess.@O@ win32/once.@O@ win32/stdtime.@O@ \
@@ -50,19 +50,21 @@ WIN32OBJS = win32/condition.@O@ win32/dir.@O@ win32/file.@O@ \
# Alphabetically
OBJS = @ISC_EXTRA_OBJS@ \
assertions.@O@ base64.@O@ bitstring.@O@ buffer.@O@ \
- bufferlist.@O@ commandline.@O@ error.@O@ event.@O@ heap.@O@ \
+ bufferlist.@O@ commandline.@O@ error.@O@ event.@O@ \
+ heap.@O@ hex.@O@ hmacmd5.@O@ \
lex.@O@ lfsr.@O@ lib.@O@ log.@O@ \
md5.@O@ mem.@O@ mutexblock.@O@ netaddr.@O@ ondestroy.@O@ \
quota.@O@ random.@O@ \
ratelimiter.@O@ result.@O@ rwlock.@O@ \
serial.@O@ sha1.@O@ sockaddr.@O@ string.@O@ symtab.@O@ \
task.@O@ taskpool.@O@ timer.@O@ version.@O@ \
- ${UNIXOBJS} ${NLSOBJS} ${PTHREADOBJS}
+ ${UNIXOBJS} ${NLSOBJS} ${THREADOBJS}
# Alphabetically
SRCS = @ISC_EXTRA_SRCS@ \
assertions.c base64.c bitstring.c buffer.c \
- bufferlist.c commandline.c error.c event.c heap.c \
+ bufferlist.c commandline.c error.c event.c \
+ heap.c hex.c hmacmd5.c \
lex.c lfsr.c lib.c log.c \
md5.c mem.c mutexblock.c netaddr.c ondestroy.c \
quota.c random.c \
@@ -72,7 +74,7 @@ SRCS = @ISC_EXTRA_SRCS@ \
LIBS = @LIBS@
-SUBDIRS = include unix nls pthreads
+SUBDIRS = include unix nls @ISC_THREAD_DIR@
TARGETS = timestamp
@BIND9_MAKE_RULES@
@@ -99,9 +101,7 @@ timestamp: libisc.@A@
touch timestamp
installdirs:
- if [ ! -d ${DESTDIR}${libdir} ]; then \
- mkdir ${DESTDIR}${libdir}; \
- fi
+ $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
install:: timestamp installdirs
${LIBTOOL} ${INSTALL_DATA} libisc.@A@ ${DESTDIR}${libdir}
diff --git a/lib/isc/api b/lib/isc/api
index f8694703..e164af24 100644
--- a/lib/isc/api
+++ b/lib/isc/api
@@ -1,3 +1,3 @@
-LIBINTERFACE = 2
+LIBINTERFACE = 3
LIBREVISION = 0
-LIBAGE = 1
+LIBAGE = 0
diff --git a/lib/isc/assertions.c b/lib/isc/assertions.c
index 436b5924..8011ca9d 100644
--- a/lib/isc/assertions.c
+++ b/lib/isc/assertions.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1997-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: assertions.c,v 1.10 2000/06/22 21:56:49 tale Exp $ */
+/* $Id: assertions.c,v 1.12 2000/08/01 01:29:13 tale Exp $ */
#include <config.h>
diff --git a/lib/isc/base64.c b/lib/isc/base64.c
index 5083c451..bc87d626 100644
--- a/lib/isc/base64.c
+++ b/lib/isc/base64.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: base64.c,v 1.15.2.1 2000/07/11 23:11:15 gson Exp $ */
+/* $Id: base64.c,v 1.20 2000/11/08 01:55:26 bwelling Exp $ */
#include <config.h>
@@ -40,10 +40,6 @@ static isc_result_t
str_totext(const char *source, isc_buffer_t *target);
static isc_result_t
-gettoken(isc_lex_t *lexer, isc_token_t *token, isc_tokentype_t expect,
- isc_boolean_t eol);
-
-static isc_result_t
mem_tobuffer(isc_buffer_t *target, void *base, unsigned int length);
static const char base64[] =
@@ -94,105 +90,124 @@ isc_base64_totext(isc_region_t *source, int wordlength,
return (ISC_R_SUCCESS);
}
+/*
+ * State of a base64 decoding process in progress.
+ */
+typedef struct {
+ int length; /* Desired length of binary data or -1 */
+ isc_buffer_t *target; /* Buffer for resulting binary data */
+ int digits; /* Number of buffered base64 digits */
+ isc_boolean_t seen_end; /* True if "=" end marker seen */
+ int val[4];
+} base64_decode_ctx_t;
+
+static inline void
+base64_decode_init(base64_decode_ctx_t *ctx, int length, isc_buffer_t *target)
+{
+ ctx->digits = 0;
+ ctx->seen_end = ISC_FALSE;
+ ctx->length = length;
+ ctx->target = target;
+}
+
+static inline isc_result_t
+base64_decode_char(base64_decode_ctx_t *ctx, int c) {
+ char *s;
+
+ if (ctx->seen_end)
+ return (ISC_R_BADBASE64);
+ if ((s = strchr(base64, c)) == NULL)
+ return (ISC_R_BADBASE64);
+ ctx->val[ctx->digits++] = s - base64;
+ if (ctx->digits == 4) {
+ int n;
+ unsigned char buf[3];
+ if (ctx->val[0] == 64 || ctx->val[1] == 64)
+ return (ISC_R_BADBASE64);
+ if (ctx->val[2] == 64 && ctx->val[3] != 64)
+ return (ISC_R_BADBASE64);
+ n = (ctx->val[2] == 64) ? 1 :
+ (ctx->val[3] == 64) ? 2 : 3;
+ if (n != 3) {
+ ctx->seen_end = ISC_TRUE;
+ if (ctx->val[2] == 64)
+ ctx->val[2] = 0;
+ if (ctx->val[3] == 64)
+ ctx->val[3] = 0;
+ }
+ buf[0] = (ctx->val[0]<<2)|(ctx->val[1]>>4);
+ buf[1] = (ctx->val[1]<<4)|(ctx->val[2]>>2);
+ buf[2] = (ctx->val[2]<<6)|(ctx->val[3]);
+ RETERR(mem_tobuffer(ctx->target, buf, n));
+ if (ctx->length >= 0) {
+ if (n > ctx->length)
+ return (ISC_R_BADBASE64);
+ else
+ ctx->length -= n;
+ }
+ ctx->digits = 0;
+ }
+ return (ISC_R_SUCCESS);
+}
+
+static inline isc_result_t
+base64_decode_finish(base64_decode_ctx_t *ctx) {
+ if (ctx->length > 0)
+ return (ISC_R_UNEXPECTEDEND);
+ if (ctx->digits != 0)
+ return (ISC_R_BADBASE64);
+ return (ISC_R_SUCCESS);
+}
+
isc_result_t
isc_base64_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length) {
- int digits = 0;
+ base64_decode_ctx_t ctx;
isc_textregion_t *tr;
- int val[4];
- unsigned char buf[3];
- int seen_end = 0;
- unsigned int i;
isc_token_t token;
- char *s;
- int n;
+ isc_boolean_t eol;
+
+ base64_decode_init(&ctx, length, target);
+
+ while (!ctx.seen_end && (ctx.length != 0)) {
+ unsigned int i;
-
- while (!seen_end && (length != 0)) {
if (length > 0)
- RETERR(gettoken(lexer, &token, isc_tokentype_string,
- ISC_FALSE));
+ eol = ISC_FALSE;
else
- RETERR(gettoken(lexer, &token, isc_tokentype_string,
- ISC_TRUE));
+ eol = ISC_TRUE;
+ RETERR(isc_lex_getmastertoken(lexer, &token,
+ isc_tokentype_string, eol));
if (token.type != isc_tokentype_string)
break;
tr = &token.value.as_textregion;
- for (i = 0 ;i < tr->length; i++) {
- if (seen_end)
- return (ISC_R_BADBASE64);
- if ((s = strchr(base64, tr->base[i])) == NULL)
- return (ISC_R_BADBASE64);
- val[digits++] = s - base64;
- if (digits == 4) {
- if (val[0] == 64 || val[1] == 64)
- return (ISC_R_BADBASE64);
- if (val[2] == 64 && val[3] != 64)
- return (ISC_R_BADBASE64);
- n = (val[2] == 64) ? 1 :
- (val[3] == 64) ? 2 : 3;
- if (n != 3) {
- seen_end = 1;
- if (val[2] == 64)
- val[2] = 0;
- if (val[3] == 64)
- val[3] = 0;
- }
- buf[0] = (val[0]<<2)|(val[1]>>4);
- buf[1] = (val[1]<<4)|(val[2]>>2);
- buf[2] = (val[2]<<6)|(val[3]);
- RETERR(mem_tobuffer(target, buf, n));
- if (length >= 0) {
- if (n > length)
- return (ISC_R_BADBASE64);
- else
- length -= n;
- }
- digits = 0;
- }
- }
+ for (i = 0 ;i < tr->length; i++)
+ RETERR(base64_decode_char(&ctx, tr->base[i]));
}
- if (length < 0 && !seen_end)
+ if (ctx.length < 0 && !ctx.seen_end)
isc_lex_ungettoken(lexer, &token);
- if (length > 0)
- return (ISC_R_UNEXPECTEDEND);
- if (digits != 0)
- return (ISC_R_BADBASE64);
+ RETERR(base64_decode_finish(&ctx));
return (ISC_R_SUCCESS);
}
isc_result_t
isc_base64_decodestring(isc_mem_t *mctx, char *cstr, isc_buffer_t *target) {
- isc_result_t result;
- isc_buffer_t source;
- isc_lex_t *lex = NULL;
- isc_boolean_t isopen = ISC_FALSE;
-
- REQUIRE(mctx != NULL);
- REQUIRE(cstr != NULL);
- REQUIRE(ISC_BUFFER_VALID(target));
-
- isc_buffer_init(&source, cstr, strlen(cstr));
- isc_buffer_add(&source, strlen(cstr));
-
- result = isc_lex_create(mctx, 256, &lex);
-
- if (result == ISC_R_SUCCESS)
- result = isc_lex_openbuffer(lex, &source);
-
- if (result == ISC_R_SUCCESS) {
- isopen = ISC_TRUE;
- result = isc_base64_tobuffer(lex, target, -1);
- }
+ base64_decode_ctx_t ctx;
- if (isopen)
- (void)isc_lex_close(lex);
- if (lex != NULL)
- isc_lex_destroy(&lex);
+ UNUSED(mctx);
- return (result);
+ base64_decode_init(&ctx, -1, target);
+ for (;;) {
+ int c = *cstr++;
+ if (c == '\0')
+ break;
+ if (c == ' ' || c == '\t' || c == '\n' || c== '\r')
+ continue;
+ RETERR(base64_decode_char(&ctx, c));
+ }
+ RETERR(base64_decode_finish(&ctx));
+ return (ISC_R_SUCCESS);
}
-
static isc_result_t
str_totext(const char *source, isc_buffer_t *target) {
unsigned int l;
@@ -220,45 +235,3 @@ mem_tobuffer(isc_buffer_t *target, void *base, unsigned int length) {
isc_buffer_add(target, length);
return (ISC_R_SUCCESS);
}
-
-static isc_result_t
-gettoken(isc_lex_t *lexer, isc_token_t *token, isc_tokentype_t expect,
- isc_boolean_t eol)
-{
- unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF |
- ISC_LEXOPT_DNSMULTILINE | ISC_LEXOPT_ESCAPE;
- isc_result_t result;
-
- if (expect == isc_tokentype_qstring)
- options |= ISC_LEXOPT_QSTRING;
- else if (expect == isc_tokentype_number)
- options |= ISC_LEXOPT_NUMBER;
- result = isc_lex_gettoken(lexer, options, token);
- switch (result) {
- case ISC_R_SUCCESS:
- break;
- case ISC_R_NOMEMORY:
- return (ISC_R_NOMEMORY);
- case ISC_R_NOSPACE:
- return (ISC_R_NOSPACE);
- default:
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_lex_gettoken() failed: %s",
- isc_result_totext(result));
- return (ISC_R_UNEXPECTED);
- }
- if (eol && ((token->type == isc_tokentype_eol) ||
- (token->type == isc_tokentype_eof)))
- return (ISC_R_SUCCESS);
- if (token->type == isc_tokentype_string &&
- expect == isc_tokentype_qstring)
- return (ISC_R_SUCCESS);
- if (token->type != expect) {
- isc_lex_ungettoken(lexer, token);
- if (token->type == isc_tokentype_eol ||
- token->type == isc_tokentype_eof)
- return (ISC_R_UNEXPECTEDEND);
- return (ISC_R_UNEXPECTEDTOKEN);
- }
- return (ISC_R_SUCCESS);
-}
diff --git a/lib/isc/bitstring.c b/lib/isc/bitstring.c
index d87e68f5..d7ba4fbf 100644
--- a/lib/isc/bitstring.c
+++ b/lib/isc/bitstring.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: bitstring.c,v 1.5.2.1 2000/09/12 23:29:25 gson Exp $ */
+/* $Id: bitstring.c,v 1.10 2000/09/13 00:11:29 halley Exp $ */
#include <config.h>
@@ -26,8 +26,8 @@
#define DIV8(x) ((x) >> 3)
#define MOD8(x) ((x) & 0x00000007U)
-#define OCTETS(n) ((n + 7) >> 3)
-#define PADDED(n) (((n + 7) >> 3) << 3)
+#define OCTETS(n) (((n) + 7) >> 3)
+#define PADDED(n) ((((n) + 7) >> 3) << 3)
#define BITSET(bs, n) (((bs)->data[DIV8(n)] & \
(1 << (7 - MOD8(n)))) != 0)
#define SETBIT(bs, n) (bs)->data[DIV8(n)] |= (1 << (7 - MOD8(n)))
@@ -89,6 +89,7 @@ isc_bitstring_copy(isc_bitstring_t *source, unsigned int sbitpos,
REQUIRE(VALID_BITSTRING(source));
REQUIRE(VALID_BITSTRING(target));
+ REQUIRE(source->lsb0 == target->lsb0);
if (source->lsb0) {
REQUIRE(sbitpos <= source->length);
sbitpos = PADDED(source->size) - sbitpos;
@@ -102,7 +103,7 @@ isc_bitstring_copy(isc_bitstring_t *source, unsigned int sbitpos,
tbitpos = PADDED(target->size) - tbitpos;
REQUIRE(tbitpos >= n);
tbitpos -= n;
- } else
+ } else
REQUIRE(tlast <= target->size);
if (tlast > target->length)
diff --git a/lib/isc/buffer.c b/lib/isc/buffer.c
index 1c832efd..c6179667 100644
--- a/lib/isc/buffer.c
+++ b/lib/isc/buffer.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: buffer.c,v 1.32 2000/06/22 21:56:51 tale Exp $ */
+/* $Id: buffer.c,v 1.35 2000/08/17 02:09:11 bwelling Exp $ */
#include <config.h>
@@ -46,7 +46,7 @@ isc__buffer_invalidate(isc_buffer_t *b) {
REQUIRE(ISC_BUFFER_VALID(b));
REQUIRE(!ISC_LINK_LINKED(b, link));
REQUIRE(b->mctx == NULL);
-
+
ISC__BUFFER_INVALIDATE(b);
}
@@ -347,7 +347,7 @@ isc__buffer_putstr(isc_buffer_t *b, const char *source) {
}
isc_result_t
-isc_buffer_copyregion(isc_buffer_t *b, isc_region_t *r) {
+isc_buffer_copyregion(isc_buffer_t *b, const isc_region_t *r) {
unsigned char *base;
unsigned int available;
@@ -355,7 +355,7 @@ isc_buffer_copyregion(isc_buffer_t *b, isc_region_t *r) {
REQUIRE(r != NULL);
/*
- * XXXDCL
+ * XXXDCL
*/
base = isc_buffer_used(b);
available = isc_buffer_availablelength(b);
diff --git a/lib/isc/bufferlist.c b/lib/isc/bufferlist.c
index 57d9daa7..73b91f30 100644
--- a/lib/isc/bufferlist.c
+++ b/lib/isc/bufferlist.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: bufferlist.c,v 1.9 2000/06/22 21:56:52 tale Exp $ */
+/* $Id: bufferlist.c,v 1.11 2000/08/01 01:29:18 tale Exp $ */
#include <config.h>
diff --git a/lib/isc/commandline.c b/lib/isc/commandline.c
index e4427e59..62bda7ac 100644
--- a/lib/isc/commandline.c
+++ b/lib/isc/commandline.c
@@ -1,18 +1,18 @@
/*
* Portions Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
@@ -48,7 +48,7 @@
* SUCH DAMAGE.
*/
-/* $Id: commandline.c,v 1.8 2000/06/21 21:56:31 tale Exp $ */
+/* $Id: commandline.c,v 1.10 2000/08/01 01:29:19 tale Exp $ */
/*
* This file was adapted from the NetBSD project's source tree, RCS ID:
diff --git a/lib/isc/error.c b/lib/isc/error.c
index 02e25f3b..3f58a57c 100644
--- a/lib/isc/error.c
+++ b/lib/isc/error.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: error.c,v 1.11 2000/06/22 21:56:53 tale Exp $ */
+/* $Id: error.c,v 1.13 2000/08/01 01:29:20 tale Exp $ */
#include <config.h>
diff --git a/lib/isc/event.c b/lib/isc/event.c
index 86dc6f2a..c1aedbaf 100644
--- a/lib/isc/event.c
+++ b/lib/isc/event.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: event.c,v 1.11 2000/06/22 21:56:54 tale Exp $ */
+/* $Id: event.c,v 1.14 2000/09/27 22:53:31 marka Exp $ */
/*
* Principal Author: Bob Halley
@@ -45,10 +45,8 @@ isc_event_allocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type,
isc_event_t *event;
void *deconst_arg;
- if (size < sizeof (struct isc_event))
- return (NULL);
- if (action == NULL)
- return (NULL);
+ REQUIRE(size >= sizeof (struct isc_event));
+ REQUIRE(action != NULL);
event = isc_mem_get(mctx, size);
if (event == NULL)
@@ -77,7 +75,7 @@ isc_event_allocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type,
void
isc_event_free(isc_event_t **eventp) {
isc_event_t *event;
-
+
REQUIRE(eventp != NULL);
event = *eventp;
REQUIRE(event != NULL);
diff --git a/lib/isc/fsaccess.c b/lib/isc/fsaccess.c
index 7976b136..a713d879 100644
--- a/lib/isc/fsaccess.c
+++ b/lib/isc/fsaccess.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: fsaccess.c,v 1.2 2000/06/21 21:56:34 tale Exp $ */
+/* $Id: fsaccess.c,v 1.4 2000/08/01 01:29:22 tale Exp $ */
/*
* This file contains the OS-independent functionality of the API.
diff --git a/lib/isc/heap.c b/lib/isc/heap.c
index 4e8c02bd..9c724f3d 100644
--- a/lib/isc/heap.c
+++ b/lib/isc/heap.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1997-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: heap.c,v 1.24 2000/06/22 21:56:56 tale Exp $ */
+/* $Id: heap.c,v 1.26 2000/08/01 01:29:23 tale Exp $ */
/*
* Heap implementation of priority queues adapted from the following:
@@ -94,7 +94,7 @@ isc_heap_create(isc_mem_t *mctx, isc_heapcompare_t compare,
heap->index = index;
*heapp = heap;
-
+
return (ISC_R_SUCCESS);
}
@@ -128,7 +128,7 @@ resize(isc_heap_t *heap) {
return (ISC_FALSE);
if (heap->array != NULL) {
memcpy(new_array, heap->array, heap->size * sizeof (void *));
- isc_mem_put(heap->mctx, heap->array,
+ isc_mem_put(heap->mctx, heap->array,
heap->size * sizeof (void *));
}
heap->size = new_size;
@@ -141,7 +141,7 @@ static void
float_up(isc_heap_t *heap, unsigned int i, void *elt) {
unsigned int p;
- for (p = heap_parent(i);
+ for (p = heap_parent(i);
i > 1 && heap->compare(elt, heap->array[p]);
i = p, p = heap_parent(i)) {
heap->array[i] = heap->array[p];
@@ -189,7 +189,7 @@ isc_heap_insert(isc_heap_t *heap, void *elt) {
i = ++heap->last;
if (heap->last >= heap->size && !resize(heap))
return (ISC_R_NOMEMORY);
-
+
float_up(heap, i, elt);
return (ISC_R_SUCCESS);
@@ -220,7 +220,7 @@ void
isc_heap_increased(isc_heap_t *heap, unsigned int i) {
REQUIRE(VALID_HEAP(heap));
REQUIRE(i >= 1 && i <= heap->last);
-
+
float_up(heap, i, heap->array[i]);
}
@@ -228,7 +228,7 @@ void
isc_heap_decreased(isc_heap_t *heap, unsigned int i) {
REQUIRE(VALID_HEAP(heap));
REQUIRE(i >= 1 && i <= heap->last);
-
+
sink_down(heap, i, heap->array[i]);
}
diff --git a/lib/isc/hex.c b/lib/isc/hex.c
new file mode 100644
index 00000000..e8861bc3
--- /dev/null
+++ b/lib/isc/hex.c
@@ -0,0 +1,199 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: hex.c,v 1.6 2000/11/19 22:10:03 bwelling Exp $ */
+
+#include <config.h>
+
+#include <ctype.h>
+
+#include <isc/buffer.h>
+#include <isc/hex.h>
+#include <isc/lex.h>
+#include <isc/string.h>
+#include <isc/util.h>
+
+#define RETERR(x) do { \
+ isc_result_t _r = (x); \
+ if (_r != ISC_R_SUCCESS) \
+ return (_r); \
+ } while (0)
+
+
+/*
+ * BEW: These static functions are copied from lib/dns/rdata.c.
+ */
+static isc_result_t
+str_totext(const char *source, isc_buffer_t *target);
+
+static isc_result_t
+mem_tobuffer(isc_buffer_t *target, void *base, unsigned int length);
+
+static const char hex[] = "0123456789ABCDEF";
+
+isc_result_t
+isc_hex_totext(isc_region_t *source, int wordlength,
+ const char *wordbreak, isc_buffer_t *target)
+{
+ char buf[3];
+ unsigned int loops = 0;
+
+ if (wordlength < 2)
+ wordlength = 2;
+
+ memset(buf, 0, sizeof buf);
+ while (source->length > 0) {
+ buf[0] = hex[(source->base[0] >> 4) & 0xf];
+ buf[1] = hex[(source->base[0]) & 0xf];
+ RETERR(str_totext(buf, target));
+ isc_region_consume(source, 1);
+
+ loops++;
+ if (source->length != 0 &&
+ (int)((loops + 1) * 2) >= wordlength)
+ {
+ loops = 0;
+ RETERR(str_totext(wordbreak, target));
+ }
+ }
+ return (ISC_R_SUCCESS);
+}
+
+/*
+ * State of a hex decoding process in progress.
+ */
+typedef struct {
+ int length; /* Desired length of binary data or -1 */
+ isc_buffer_t *target; /* Buffer for resulting binary data */
+ int digits; /* Number of buffered hex digits */
+ int val[2];
+} hex_decode_ctx_t;
+
+static inline void
+hex_decode_init(hex_decode_ctx_t *ctx, int length, isc_buffer_t *target)
+{
+ ctx->digits = 0;
+ ctx->length = length;
+ ctx->target = target;
+}
+
+static inline isc_result_t
+hex_decode_char(hex_decode_ctx_t *ctx, int c) {
+ char *s;
+
+ if ((s = strchr(hex, toupper(c))) == NULL)
+ return (ISC_R_BADHEX);
+ ctx->val[ctx->digits++] = s - hex;
+ if (ctx->digits == 2) {
+ unsigned char num;
+
+ num = (ctx->val[0] << 4) + (ctx->val[1]);
+ RETERR(mem_tobuffer(ctx->target, &num, 1));
+ if (ctx->length >= 0) {
+ if (ctx->length == 0)
+ return (ISC_R_BADHEX);
+ else
+ ctx->length -= 1;
+ }
+ ctx->digits = 0;
+ }
+ return (ISC_R_SUCCESS);
+}
+
+static inline isc_result_t
+hex_decode_finish(hex_decode_ctx_t *ctx) {
+ if (ctx->length > 0)
+ return (ISC_R_UNEXPECTEDEND);
+ if (ctx->digits != 0)
+ return (ISC_R_BADHEX);
+ return (ISC_R_SUCCESS);
+}
+
+isc_result_t
+isc_hex_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length) {
+ hex_decode_ctx_t ctx;
+ isc_textregion_t *tr;
+ isc_token_t token;
+ isc_boolean_t eol;
+
+ hex_decode_init(&ctx, length, target);
+
+ while (ctx.length != 0) {
+ unsigned int i;
+
+ if (length > 0)
+ eol = ISC_FALSE;
+ else
+ eol = ISC_TRUE;
+ RETERR(isc_lex_getmastertoken(lexer, &token,
+ isc_tokentype_string, eol));
+ if (token.type != isc_tokentype_string)
+ break;
+ tr = &token.value.as_textregion;
+ for (i = 0 ;i < tr->length; i++)
+ RETERR(hex_decode_char(&ctx, tr->base[i]));
+ }
+ RETERR(hex_decode_finish(&ctx));
+ return (ISC_R_SUCCESS);
+}
+
+isc_result_t
+isc_hex_decodestring(isc_mem_t *mctx, char *cstr, isc_buffer_t *target) {
+ hex_decode_ctx_t ctx;
+
+ UNUSED(mctx);
+
+ hex_decode_init(&ctx, -1, target);
+ for (;;) {
+ int c = *cstr++;
+ if (c == '\0')
+ break;
+ if (c == ' ' || c == '\t' || c == '\n' || c== '\r')
+ continue;
+ RETERR(hex_decode_char(&ctx, c));
+ }
+ RETERR(hex_decode_finish(&ctx));
+ return (ISC_R_SUCCESS);
+}
+
+static isc_result_t
+str_totext(const char *source, isc_buffer_t *target) {
+ unsigned int l;
+ isc_region_t region;
+
+ isc_buffer_availableregion(target, &region);
+ l = strlen(source);
+
+ if (l > region.length)
+ return (ISC_R_NOSPACE);
+
+ memcpy(region.base, source, l);
+ isc_buffer_add(target, l);
+ return (ISC_R_SUCCESS);
+}
+
+static isc_result_t
+mem_tobuffer(isc_buffer_t *target, void *base, unsigned int length) {
+ isc_region_t tr;
+
+ isc_buffer_availableregion(target, &tr);
+ if (length > tr.length)
+ return (ISC_R_NOSPACE);
+ memcpy(tr.base, base, length);
+ isc_buffer_add(target, length);
+ return (ISC_R_SUCCESS);
+}
diff --git a/lib/isc/hmacmd5.c b/lib/isc/hmacmd5.c
new file mode 100644
index 00000000..3341ba4f
--- /dev/null
+++ b/lib/isc/hmacmd5.c
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: hmacmd5.c,v 1.4 2000/08/01 01:29:24 tale Exp $ */
+
+/*
+ * This code implements the HMAC-MD5 keyed hash algorithm
+ * described in RFC 2104.
+ */
+
+#include "config.h"
+
+#include <isc/assertions.h>
+#include <isc/hmacmd5.h>
+#include <isc/md5.h>
+#include <isc/string.h>
+#include <isc/types.h>
+#include <isc/util.h>
+
+#define PADLEN 64
+#define IPAD 0x36
+#define OPAD 0x5C
+
+/*
+ * Start HMAC-MD5 process. Initialize an md5 context and digest the key.
+ */
+void
+isc_hmacmd5_init(isc_hmacmd5_t *ctx, const unsigned char *key,
+ unsigned int len)
+{
+ unsigned char ipad[PADLEN];
+ int i;
+
+ memset(ctx->key, 0, sizeof (ctx->key));
+ if (len > sizeof(ctx->key)) {
+ isc_md5_t md5ctx;
+ isc_md5_init(&md5ctx);
+ isc_md5_update(&md5ctx, key, len);
+ isc_md5_final(&md5ctx, ctx->key);
+ } else
+ memcpy(ctx->key, key, len);
+
+ isc_md5_init(&ctx->md5ctx);
+ memset(ipad, IPAD, sizeof (ipad));
+ for (i = 0; i < PADLEN; i++)
+ ipad[i] ^= ctx->key[i];
+ isc_md5_update(&ctx->md5ctx, ipad, sizeof(ipad));
+}
+
+void
+isc_hmacmd5_invalidate(isc_hmacmd5_t *ctx) {
+ isc_md5_invalidate(&ctx->md5ctx);
+ memset(ctx->key, 0, sizeof (ctx->key));
+ memset(ctx, 0, sizeof (ctx));
+}
+
+/*
+ * Update context to reflect the concatenation of another buffer full
+ * of bytes.
+ */
+void
+isc_hmacmd5_update(isc_hmacmd5_t *ctx, const unsigned char *buf,
+ unsigned int len)
+{
+ isc_md5_update(&ctx->md5ctx, buf, len);
+}
+
+/*
+ * Compute signature - finalize MD5 operation and reapply MD5.
+ */
+void
+isc_hmacmd5_sign(isc_hmacmd5_t *ctx, unsigned char *digest) {
+ unsigned char opad[PADLEN];
+ int i;
+
+ isc_md5_final(&ctx->md5ctx, digest);
+
+ memset(opad, OPAD, sizeof (opad));
+ for (i = 0; i < PADLEN; i++)
+ opad[i] ^= ctx->key[i];
+
+ isc_md5_init(&ctx->md5ctx);
+ isc_md5_update(&ctx->md5ctx, opad, sizeof(opad));
+ isc_md5_update(&ctx->md5ctx, digest, ISC_MD5_DIGESTLENGTH);
+ isc_md5_final(&ctx->md5ctx, digest);
+ isc_hmacmd5_invalidate(ctx);
+}
+
+/*
+ * Verify signature - finalize MD5 operation and reapply MD5, then
+ * compare to the supplied digest.
+ */
+isc_boolean_t
+isc_hmacmd5_verify(isc_hmacmd5_t *ctx, unsigned char *digest) {
+ unsigned char newdigest[ISC_MD5_DIGESTLENGTH];
+
+ isc_hmacmd5_sign(ctx, newdigest);
+ return (ISC_TF(memcmp(digest, newdigest, ISC_MD5_DIGESTLENGTH) == 0));
+}
diff --git a/lib/isc/include/Makefile.in b/lib/isc/include/Makefile.in
index 8f9b42aa..ccab7ff1 100644
--- a/lib/isc/include/Makefile.in
+++ b/lib/isc/include/Makefile.in
@@ -1,19 +1,19 @@
# Copyright (C) 1998-2000 Internet Software Consortium.
-#
+#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
-# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
-# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-# SOFTWARE.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.7 2000/06/22 21:57:20 tale Exp $
+# $Id: Makefile.in,v 1.9 2000/08/01 01:29:56 tale Exp $
srcdir = @srcdir@
VPATH = @srcdir@
diff --git a/lib/isc/include/isc/Makefile.in b/lib/isc/include/isc/Makefile.in
index e31da0f4..d55e02bc 100644
--- a/lib/isc/include/isc/Makefile.in
+++ b/lib/isc/include/isc/Makefile.in
@@ -1,19 +1,19 @@
# Copyright (C) 1998-2000 Internet Software Consortium.
-#
+#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
-# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
-# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-# SOFTWARE.
-
-# $Id: Makefile.in,v 1.38.2.2 2000/08/17 00:25:25 gson Exp $
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+# $Id: Makefile.in,v 1.46 2000/11/14 23:39:14 tale Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@@ -29,11 +29,11 @@ top_srcdir = @top_srcdir@
HEADERS = assertions.h base64.h bitstring.h boolean.h buffer.h \
bufferlist.h commandline.h entropy.h error.h event.h \
eventclass.h \
- file.h formatcheck.h fsaccess.h heap.h interfaceiter.h \
- @ISC_IPV6_H@ lang.h lex.h \
+ file.h formatcheck.h fsaccess.h heap.h hex.h hmacmd5.h \
+ interfaceiter.h @ISC_IPV6_H@ lang.h lex.h \
lfsr.h lib.h list.h log.h magic.h md5.h mem.h msgcat.h \
mutexblock.h netaddr.h ondestroy.h os.h \
- print.h quota.h random.h ratelimiter.h region.h \
+ print.h quota.h random.h ratelimiter.h region.h resource.h \
result.h resultclass.h rwlock.h serial.h sha1.h sockaddr.h \
socket.h stdio.h string.h symtab.h task.h taskpool.h timer.h \
types.h util.h
@@ -44,12 +44,7 @@ TARGETS =
@BIND9_MAKE_RULES@
installdirs:
- if [ ! -d ${DESTDIR}${includedir} ]; then \
- mkdir ${DESTDIR}${includedir} ; \
- fi
- if [ ! -d ${DESTDIR}${includedir}/isc ]; then \
- mkdir ${DESTDIR}${includedir}/isc ; \
- fi
+ $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}/isc
install:: installdirs
for i in ${HEADERS}; do \
diff --git a/lib/isc/include/isc/assertions.h b/lib/isc/include/isc/assertions.h
index efa1e978..fbe31be2 100644
--- a/lib/isc/include/isc/assertions.h
+++ b/lib/isc/include/isc/assertions.h
@@ -1,22 +1,22 @@
/*
* Copyright (C) 1997-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
- * $Id: assertions.h,v 1.11 2000/06/21 21:56:53 tale Exp $
+ * $Id: assertions.h,v 1.13 2000/08/01 01:29:58 tale Exp $
*/
#ifndef ISC_ASSERTIONS_H
diff --git a/lib/isc/include/isc/base64.h b/lib/isc/include/isc/base64.h
index 5162dc6f..b8b7a0a0 100644
--- a/lib/isc/include/isc/base64.h
+++ b/lib/isc/include/isc/base64.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: base64.h,v 1.9.2.1 2000/07/11 23:11:16 gson Exp $ */
+/* $Id: base64.h,v 1.12 2000/08/01 01:29:59 tale Exp $ */
#ifndef ISC_BASE64_H
#define ISC_BASE64_H 1
@@ -36,7 +36,7 @@ isc_base64_totext(isc_region_t *source, int wordlength,
* Convert data into base64 encoded text.
*
* Notes:
- * The base64 encoded text in 'target' will be divided into
+ * The base64 encoded text in 'target' will be divided into
* words of at most 'wordlength' characters, separated by
* the 'wordbreak' string. No parentheses will surround
* the text.
@@ -85,7 +85,7 @@ isc_base64_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length);
* 'length' is an integer
*
* Ensures:
- * target will contain the data represented by the base64 encoded
+ * target will contain the data represented by the base64 encoded
* string parsed by the lexer. No more than length bytes will be read,
* if length is positive. The 'used' pointer in target will be
* advanced as necessary.
diff --git a/lib/isc/include/isc/bitstring.h b/lib/isc/include/isc/bitstring.h
index 4b17ce33..d8b6086f 100644
--- a/lib/isc/include/isc/bitstring.h
+++ b/lib/isc/include/isc/bitstring.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: bitstring.h,v 1.3 2000/06/22 21:57:23 tale Exp $ */
+/* $Id: bitstring.h,v 1.6 2000/09/13 00:11:30 halley Exp $ */
#ifndef ISC_BITSTRING_H
#define ISC_BITSTRING_H 1
@@ -24,6 +24,45 @@
***** Module Info
*****/
+/*
+ * Bitstring
+ *
+ * A bitstring is a packed array of bits, stored in a contiguous
+ * sequence of octets. The "most significant bit" (msb) of a bitstring
+ * is the high bit of the first octet. The "least significant bit" of a
+ * bitstring is the low bit of the last octet.
+ *
+ * Two bit numbering schemes are supported, "msb0" and "lsb0".
+ *
+ * In the "msb0" scheme, bit number 0 designates the most significant bit,
+ * and any padding bits required to make the bitstring a multiple of 8 bits
+ * long are added to the least significant end of the last octet.
+ *
+ * In the "lsb0" scheme, bit number 0 designates the least significant bit,
+ * and any padding bits required to make the bitstring a multiple of 8 bits
+ * long are added to the most significant end of the first octet.
+ *
+ * E.g., consider the bitstring "11010001111". This bitstring is 11 bits
+ * long and will take two octets. Let "p" denote a pad bit. In the msb0
+ * encoding, it would be
+ *
+ * Octet 0 Octet 1
+ * |
+ * 1 1 0 1 0 0 0 1 | 1 1 1 p p p p p
+ * ^ | ^
+ * | |
+ * bit 0 bit 15
+ *
+ * In the lsb0 encoding, it would be
+ *
+ * Octet 0 Octet 1
+ * |
+ * p p p p p 1 1 0 | 1 0 0 0 1 1 1 1
+ * ^ | ^
+ * | |
+ * bit 15 bit 0
+ */
+
/***
*** Imports
***/
@@ -96,7 +135,7 @@ isc_bitstring_copy(isc_bitstring_t *source, unsigned int sbitpos,
*
* Requires:
*
- * 'source' and target are valid bitstring.
+ * 'source' and target are valid bitstrings with the same lsb0 setting.
*
* 'sbitpos' + 'n' is less than or equal to the length of 'source'.
*
diff --git a/lib/isc/include/isc/boolean.h b/lib/isc/include/isc/boolean.h
index bdc6f182..4d53ff9b 100644
--- a/lib/isc/include/isc/boolean.h
+++ b/lib/isc/include/isc/boolean.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: boolean.h,v 1.9 2000/06/22 21:57:24 tale Exp $ */
+/* $Id: boolean.h,v 1.11 2000/08/01 01:30:01 tale Exp $ */
#ifndef ISC_BOOLEAN_H
#define ISC_BOOLEAN_H 1
diff --git a/lib/isc/include/isc/buffer.h b/lib/isc/include/isc/buffer.h
index 19d5f132..6e174836 100644
--- a/lib/isc/include/isc/buffer.h
+++ b/lib/isc/include/isc/buffer.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: buffer.h,v 1.33 2000/06/22 21:57:25 tale Exp $ */
+/* $Id: buffer.h,v 1.36 2000/08/17 02:09:12 bwelling Exp $ */
#ifndef ISC_BUFFER_H
#define ISC_BUFFER_H 1
@@ -237,7 +237,7 @@ isc__buffer_invalidate(isc_buffer_t *b);
* If assertion checking is enabled, future attempts to use 'b' without
* calling isc_buffer_init() on it will cause an assertion failure.
*/
-
+
void
isc__buffer_region(isc_buffer_t *b, isc_region_t *r);
/*
@@ -557,7 +557,7 @@ isc__buffer_putstr(isc_buffer_t *b, const char *source);
*/
isc_result_t
-isc_buffer_copyregion(isc_buffer_t *b, isc_region_t *r);
+isc_buffer_copyregion(isc_buffer_t *b, const isc_region_t *r);
/*
* Copy the contents of 'r' into 'b'.
*
diff --git a/lib/isc/include/isc/bufferlist.h b/lib/isc/include/isc/bufferlist.h
index bcf9efe8..92f8f2ae 100644
--- a/lib/isc/include/isc/bufferlist.h
+++ b/lib/isc/include/isc/bufferlist.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: bufferlist.h,v 1.7 2000/06/22 21:57:26 tale Exp $ */
+/* $Id: bufferlist.h,v 1.9 2000/08/01 01:30:04 tale Exp $ */
#ifndef ISC_BUFFERLIST_H
#define ISC_BUFFERLIST_H 1
diff --git a/lib/isc/include/isc/commandline.h b/lib/isc/include/isc/commandline.h
index e37aad97..4171ff8e 100644
--- a/lib/isc/include/isc/commandline.h
+++ b/lib/isc/include/isc/commandline.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: commandline.h,v 1.4 2000/04/28 22:13:14 tale Exp $ */
+/* $Id: commandline.h,v 1.6 2000/08/01 01:30:05 tale Exp $ */
#ifndef ISC_COMMANDLINE_H
#define ISC_COMMANDLINE_H 1
diff --git a/lib/isc/include/isc/entropy.h b/lib/isc/include/isc/entropy.h
index e68c7112..375bb904 100644
--- a/lib/isc/include/isc/entropy.h
+++ b/lib/isc/include/isc/entropy.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: entropy.h,v 1.19 2000/06/23 03:01:12 tale Exp $ */
+/* $Id: entropy.h,v 1.21 2000/08/01 01:30:06 tale Exp $ */
#ifndef ISC_ENTROPY_H
#define ISC_ENTROPY_H 1
@@ -27,7 +27,7 @@
/*
* Entropy
*
- * The entropy API
+ * The entropy API
*
* MP:
* The entropy object is locked internally. All callbacks into
diff --git a/lib/isc/include/isc/error.h b/lib/isc/include/isc/error.h
index 84cf4c72..3eb28400 100644
--- a/lib/isc/include/isc/error.h
+++ b/lib/isc/include/isc/error.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: error.h,v 1.10 2000/06/22 21:57:28 tale Exp $ */
+/* $Id: error.h,v 1.12 2000/08/01 01:30:07 tale Exp $ */
#ifndef ISC_ERROR_H
#define ISC_ERROR_H 1
diff --git a/lib/isc/include/isc/event.h b/lib/isc/include/isc/event.h
index 8f734cd7..e6cf8a34 100644
--- a/lib/isc/include/isc/event.h
+++ b/lib/isc/include/isc/event.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: event.h,v 1.20 2000/06/22 21:57:30 tale Exp $ */
+/* $Id: event.h,v 1.23 2000/09/27 22:53:33 marka Exp $ */
#ifndef ISC_EVENT_H
#define ISC_EVENT_H 1
@@ -52,7 +52,7 @@ typedef void (*isc_eventdestructor_t)(isc_event_t *);
* The ISC_EVENTATTR_CANCELED attribute is intended to indicate
* that an event is delivered as a result of a canceled operation
* rather than successful completion, by mutual agreement
- * between the sender and receiver. It is not set or used by
+ * between the sender and receiver. It is not set or used by
* the task system.
*/
#define ISC_EVENTATTR_CANCELED 0x00000002
@@ -70,11 +70,11 @@ do { \
(event)->ev_destroy_arg = (da); \
ISC_LINK_INIT((event), ev_link); \
} while (0)
-
+
/*
* This structure is public because "subclassing" it may be useful when
* defining new event types.
- */
+ */
struct isc_event {
ISC_EVENT_COMMON(struct isc_event);
};
@@ -85,8 +85,25 @@ struct isc_event {
ISC_LANG_BEGINDECLS
isc_event_t *
-isc_event_allocate(isc_mem_t *, void *, isc_eventtype_t, isc_taskaction_t,
- const void *arg, size_t);
+isc_event_allocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type,
+ isc_taskaction_t action, const void *arg, size_t size);
+/*
+ * Allocate and initalise in a structure with initial elements
+ * defined by:
+ *
+ * struct {
+ * ISC_EVENT_COMMON(struct isc_event);
+ * ...
+ * };
+ *
+ * Requires:
+ * 'size' >= sizeof(struct isc_event)
+ * 'action' to be non NULL
+ *
+ * Returns:
+ * a pointer to a initalised structure of the requested size.
+ * NULL if unable to allocate memory.
+ */
void
isc_event_free(isc_event_t **);
diff --git a/lib/isc/include/isc/eventclass.h b/lib/isc/include/isc/eventclass.h
index 009fe0df..8d1ebad7 100644
--- a/lib/isc/include/isc/eventclass.h
+++ b/lib/isc/include/isc/eventclass.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: eventclass.h,v 1.9 2000/06/22 21:57:31 tale Exp $ */
+/* $Id: eventclass.h,v 1.11 2000/08/01 01:30:09 tale Exp $ */
#ifndef ISC_EVENTCLASS_H
#define ISC_EVENTCLASS_H 1
diff --git a/lib/isc/include/isc/file.h b/lib/isc/include/isc/file.h
index 3b5caa2c..25d1f64c 100644
--- a/lib/isc/include/isc/file.h
+++ b/lib/isc/include/isc/file.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: file.h,v 1.7.2.1 2000/09/11 19:27:50 explorer Exp $ */
+/* $Id: file.h,v 1.13 2000/10/20 22:09:00 gson Exp $ */
#ifndef ISC_FILE_H
#define ISC_FILE_H 1
@@ -60,7 +60,7 @@ isc_file_getmodtime(const char *file, isc_time_t *time);
* Hardware error interacting with the filesystem.
* ISC_R_UNEXPECTED
* Something totally unexpected happened.
- *
+ *
*/
isc_result_t
@@ -100,7 +100,7 @@ isc_result_t
isc_file_openunique(char *templet, FILE **fp);
/*
* Create and open a file with a unique name based on 'templet'.
- *
+ *
* Notes:
* 'template' is a reserved work in C++. If you want to complain
* about the spelling of 'templet', first look it up in the
@@ -165,13 +165,33 @@ isc_file_rename(const char *oldname, const char *newname);
* Rename the file 'oldname' to 'newname'.
*/
+isc_boolean_t
+isc_file_isabsolute(const char *filename);
+/*
+ * Return ISC_TRUE iff the given file name is absolute.
+ */
+
+isc_result_t
+isc_file_template(const char *path, const char *templet, char *buf,
+ size_t buflen);
+/*
+ * Create an OS specific template using 'path' to define the directory
+ * 'templet' to describe the filename and store the result in 'buf'
+ * such that path can be renamed to buf atomically.
+ */
+
+isc_result_t
+isc_file_renameunique(const char *file, char *templet);
+/*
+ * Rename 'file' using 'templet' as a template for the new file name.
+ */
+
/*
* XXX We should also have a isc_file_writeeopen() function
* for safely open a file in a publicly writable directory
* (see write_open() in BIND 8's ns_config.c).
*/
-
ISC_LANG_ENDDECLS
#endif /* ISC_FILE_H */
diff --git a/lib/isc/include/isc/formatcheck.h b/lib/isc/include/isc/formatcheck.h
index ce7c404a..ffb8aa9d 100644
--- a/lib/isc/include/isc/formatcheck.h
+++ b/lib/isc/include/isc/formatcheck.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: formatcheck.h,v 1.3 2000/06/22 21:57:33 tale Exp $ */
+/* $Id: formatcheck.h,v 1.5 2000/08/01 01:30:11 tale Exp $ */
#ifndef ISC_FORMATCHECK_H
#define ISC_FORMATCHECK_H 1
diff --git a/lib/isc/include/isc/fsaccess.h b/lib/isc/include/isc/fsaccess.h
index 66abbed7..16d383cf 100644
--- a/lib/isc/include/isc/fsaccess.h
+++ b/lib/isc/include/isc/fsaccess.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: fsaccess.h,v 1.4 2000/06/23 03:01:46 tale Exp $ */
+/* $Id: fsaccess.h,v 1.6 2000/08/01 01:30:12 tale Exp $ */
#ifndef ISC_FSACCESS_H
#define ISC_FSACCESS_H 1
@@ -38,7 +38,7 @@
* in BIND9, and so resolving how to handle the various incompatibilities has
* been a purely theoretical exercise with no operational experience to
* indicate how flawed the thinking may be.
- *
+ *
* Some of the more notable dumbing down of NT for this API includes:
*
* o Each of FILE_READ_DATA and FILE_READ_EA are set with ISC_FSACCESS_READ.
@@ -92,7 +92,7 @@
*
* The Windows standard access right "DELETE" doesn't have a direct
* equivalent in the Unix world, so it isn't clear what should be done
- * with it.
+ * with it.
*
* The Unix sticky bit is not supported. While NT does have a concept
* of allowing users to create files in a directory but not delete or
diff --git a/lib/isc/include/isc/heap.h b/lib/isc/include/isc/heap.h
index 9366e9cd..b7a8c60a 100644
--- a/lib/isc/include/isc/heap.h
+++ b/lib/isc/include/isc/heap.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1997-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: heap.h,v 1.13 2000/06/22 21:57:35 tale Exp $ */
+/* $Id: heap.h,v 1.15 2000/08/01 01:30:14 tale Exp $ */
#ifndef ISC_HEAP_H
#define ISC_HEAP_H 1
@@ -25,7 +25,7 @@
ISC_LANG_BEGINDECLS
-/*
+/*
* The comparision function returns ISC_TRUE if the first argument has
* higher priority than the second argument, and ISC_FALSE otherwise.
*/
diff --git a/lib/isc/include/isc/hex.h b/lib/isc/include/isc/hex.h
new file mode 100644
index 00000000..67e53cba
--- /dev/null
+++ b/lib/isc/include/isc/hex.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: hex.h,v 1.2 2000/11/18 03:01:13 bwelling Exp $ */
+
+#ifndef ISC_HEX_H
+#define ISC_HEX_H 1
+
+#include <isc/lang.h>
+#include <isc/types.h>
+
+ISC_LANG_BEGINDECLS
+
+/***
+ *** Functions
+ ***/
+
+isc_result_t
+isc_hex_totext(isc_region_t *source, int wordlength,
+ const char *wordbreak, isc_buffer_t *target);
+/*
+ * Convert data into hex encoded text.
+ *
+ * Notes:
+ * The hex encoded text in 'target' will be divided into
+ * words of at most 'wordlength' characters, separated by
+ * the 'wordbreak' string. No parentheses will surround
+ * the text.
+ *
+ * Requires:
+ * 'source' is a region containing binary data
+ * 'target' is a text buffer containing available space
+ * 'wordbreak' points to a null-terminated string of
+ * zero or more whitespace characters
+ *
+ * Ensures:
+ * target will contain the hex encoded version of the data
+ * in source. The 'used' pointer in target will be advanced as
+ * necessary.
+ */
+
+isc_result_t
+isc_hex_decodestring(isc_mem_t *mctx, char *cstr, isc_buffer_t *target);
+/*
+ * Decode a null-terminated hex string.
+ *
+ * Requires:
+ * 'mctx' is non-null.
+ * 'cstr' is non-null.
+ * 'target' is a valid buffer.
+ *
+ * Returns:
+ * ISC_R_SUCCESS -- the entire decoded representation of 'cstring'
+ * fit in 'target'.
+ * ISC_R_BADHEX -- 'cstr' is not a valid hex encoding.
+ *
+ * Other error returns are any possible error code from:
+ * isc_lex_create(),
+ * isc_lex_openbuffer(),
+ * isc_hex_tobuffer().
+ */
+
+isc_result_t
+isc_hex_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length);
+/*
+ * Convert hex encoded text from a lexer context into data.
+ *
+ * Requires:
+ * 'lex' is a valid lexer context
+ * 'target' is a buffer containing binary data
+ * 'length' is an integer
+ *
+ * Ensures:
+ * target will contain the data represented by the hex encoded
+ * string parsed by the lexer. No more than length bytes will be read,
+ * if length is positive. The 'used' pointer in target will be
+ * advanced as necessary.
+ */
+
+
+ISC_LANG_ENDDECLS
+
+#endif /* ISC_HEX_H */
diff --git a/lib/isc/include/isc/hmacmd5.h b/lib/isc/include/isc/hmacmd5.h
new file mode 100644
index 00000000..31f1abfc
--- /dev/null
+++ b/lib/isc/include/isc/hmacmd5.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: hmacmd5.h,v 1.3 2000/08/01 01:30:15 tale Exp $ */
+
+/*
+ * This is the header file for the HMAC-MD5 keyed hash algorithm
+ * described in RFC 2104.
+ */
+
+#ifndef ISC_HMACMD5_H
+#define ISC_HMACMD5_H 1
+
+#include <isc/lang.h>
+#include <isc/md5.h>
+#include <isc/types.h>
+
+#define ISC_HMACMD5_KEYLENGTH 64
+
+typedef struct {
+ isc_md5_t md5ctx;
+ unsigned char key[ISC_HMACMD5_KEYLENGTH];
+} isc_hmacmd5_t;
+
+ISC_LANG_BEGINDECLS
+
+void
+isc_hmacmd5_init(isc_hmacmd5_t *ctx, const unsigned char *key,
+ unsigned int len);
+
+void
+isc_hmacmd5_invalidate(isc_hmacmd5_t *ctx);
+
+void
+isc_hmacmd5_update(isc_hmacmd5_t *ctx, const unsigned char *buf,
+ unsigned int len);
+
+void
+isc_hmacmd5_sign(isc_hmacmd5_t *ctx, unsigned char *digest);
+
+isc_boolean_t
+isc_hmacmd5_verify(isc_hmacmd5_t *ctx, unsigned char *digest);
+
+ISC_LANG_ENDDECLS
+
+#endif /* ISC_HMACMD5_H */
diff --git a/lib/isc/include/isc/interfaceiter.h b/lib/isc/include/isc/interfaceiter.h
index 9c571c8a..a09835f1 100644
--- a/lib/isc/include/isc/interfaceiter.h
+++ b/lib/isc/include/isc/interfaceiter.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: interfaceiter.h,v 1.7 2000/06/22 21:57:36 tale Exp $ */
+/* $Id: interfaceiter.h,v 1.9 2000/08/01 01:30:16 tale Exp $ */
#ifndef ISC_INTERFACEITER_H
#define ISC_INTERFACEITER_H 1
@@ -52,7 +52,7 @@
struct isc_interface {
char name[32]; /* Interface name, null-terminated. */
- unsigned int af; /* Address family. */
+ unsigned int af; /* Address family. */
isc_netaddr_t address; /* Local address. */
isc_netaddr_t netmask; /* Network mask. */
isc_netaddr_t dstaddress; /* Destination address
@@ -93,7 +93,7 @@ isc_interfaceiter_first(isc_interfaceiter_t *iter);
* ISC_R_SUCCESS Success.
* ISC_R_NOMORE There are no interfaces.
*/
-
+
isc_result_t
isc_interfaceiter_current(isc_interfaceiter_t *iter,
isc_interface_t *ifdata);
@@ -108,7 +108,7 @@ isc_interfaceiter_current(isc_interfaceiter_t *iter,
* Returns:
* ISC_R_SUCCESS Success.
*/
-
+
isc_result_t
isc_interfaceiter_next(isc_interfaceiter_t *iter);
/*
diff --git a/lib/isc/include/isc/ipv6.h b/lib/isc/include/isc/ipv6.h
index 565bba1a..65680c47 100644
--- a/lib/isc/include/isc/ipv6.h
+++ b/lib/isc/include/isc/ipv6.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: ipv6.h,v 1.13.2.1 2000/07/03 21:57:55 gson Exp $ */
+/* $Id: ipv6.h,v 1.16 2000/08/01 01:30:17 tale Exp $ */
#ifndef ISC_IPV6_H
#define ISC_IPV6_H 1
diff --git a/lib/isc/include/isc/lang.h b/lib/isc/include/isc/lang.h
index 50d8e419..e35a9d79 100644
--- a/lib/isc/include/isc/lang.h
+++ b/lib/isc/include/isc/lang.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lang.h,v 1.3 2000/06/22 21:57:38 tale Exp $ */
+/* $Id: lang.h,v 1.5 2000/08/01 01:30:18 tale Exp $ */
#ifndef ISC_LANG_H
#define ISC_LANG_H 1
diff --git a/lib/isc/include/isc/lex.h b/lib/isc/include/isc/lex.h
index beacd53e..00574e89 100644
--- a/lib/isc/include/isc/lex.h
+++ b/lib/isc/include/isc/lex.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lex.h,v 1.19.2.1 2000/07/10 19:13:10 gson Exp $ */
+/* $Id: lex.h,v 1.23 2000/11/08 01:55:30 bwelling Exp $ */
#ifndef ISC_LEX_H
#define ISC_LEX_H 1
@@ -209,7 +209,7 @@ isc_lex_setspecials(isc_lex_t *lex, isc_lexspecials_t specials);
* whitespace, they delimit strings and numbers.
*
* Note:
- * Comment processing takes precedence over special character
+ * Comment processing takes precedence over special character
* recognition.
*
* Requires:
@@ -301,6 +301,25 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp);
* ISC_R_NOMORE No more input sources
*/
+isc_result_t
+isc_lex_getmastertoken(isc_lex_t *lex, isc_token_t *token,
+ isc_tokentype_t expect, isc_boolean_t eol);
+/*
+ * Get the next token from a DNS master file type stream. This is a
+ * convenience function that sets appropriate options and handles quoted
+ * strings and end of line correctly for master files. It also ungets
+ * unexpected tokens.
+ *
+ * Requires:
+ * 'lex' is a valid lexer.
+ *
+ * 'token' is a valid pointer
+ *
+ * Returns:
+ *
+ * any return code from isc_lex_gettoken.
+ */
+
void
isc_lex_ungettoken(isc_lex_t *lex, isc_token_t *tokenp);
/*
diff --git a/lib/isc/include/isc/lfsr.h b/lib/isc/include/isc/lfsr.h
index 81432572..99359292 100644
--- a/lib/isc/include/isc/lfsr.h
+++ b/lib/isc/include/isc/lfsr.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lfsr.h,v 1.6 2000/06/22 21:57:40 tale Exp $ */
+/* $Id: lfsr.h,v 1.8 2000/08/01 01:30:20 tale Exp $ */
#ifndef ISC_LFSR_H
#define ISC_LFSR_H 1
diff --git a/lib/isc/include/isc/lib.h b/lib/isc/include/isc/lib.h
index b86d7cfb..acf28c0b 100644
--- a/lib/isc/include/isc/lib.h
+++ b/lib/isc/include/isc/lib.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lib.h,v 1.3 2000/06/22 21:57:42 tale Exp $ */
+/* $Id: lib.h,v 1.5 2000/08/01 01:30:21 tale Exp $ */
#ifndef ISC_LIB_H
#define ISC_LIB_H 1
diff --git a/lib/isc/include/isc/list.h b/lib/isc/include/isc/list.h
index 50d2360d..f70884f5 100644
--- a/lib/isc/include/isc/list.h
+++ b/lib/isc/include/isc/list.h
@@ -1,25 +1,32 @@
/*
* Copyright (C) 1997-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: list.h,v 1.11 2000/06/22 21:57:43 tale Exp $ */
+/* $Id: list.h,v 1.15 2000/10/20 13:35:56 marka Exp $ */
#ifndef ISC_LIST_H
#define ISC_LIST_H 1
#include <isc/boolean.h>
+#include <isc/assertions.h>
+
+#if 1
+#define ISC_LINK_INSIST(x) ISC_INSIST(x)
+#else
+#define ISC_LINK_INSIST(x)
+#endif
#define ISC_LIST(type) struct { type *head, *tail; }
#define ISC_LIST_INIT(list) \
@@ -37,7 +44,7 @@
#define ISC_LIST_TAIL(list) ((list).tail)
#define ISC_LIST_EMPTY(list) ISC_TF((list).head == NULL)
-#define ISC_LIST_PREPEND(list, elt, link) \
+#define ISC_LIST_PREPENDUNSAFE(list, elt, link) \
do { \
if ((list).head != NULL) \
(list).head->link.prev = (elt); \
@@ -48,7 +55,13 @@
(list).head = (elt); \
} while (0)
-#define ISC_LIST_APPEND(list, elt, link) \
+#define ISC_LIST_PREPEND(list, elt, link) \
+ do { \
+ ISC_LINK_INSIST(!ISC_LINK_LINKED(elt, link)); \
+ ISC_LIST_PREPENDUNSAFE(list, elt, link); \
+ } while (0)
+
+#define ISC_LIST_APPENDUNSAFE(list, elt, link) \
do { \
if ((list).tail != NULL) \
(list).tail->link.next = (elt); \
@@ -59,7 +72,13 @@
(list).tail = (elt); \
} while (0)
-#define ISC_LIST_UNLINK(list, elt, link) \
+#define ISC_LIST_APPEND(list, elt, link) \
+ do { \
+ ISC_LINK_INSIST(!ISC_LINK_LINKED(elt, link)); \
+ ISC_LIST_APPENDUNSAFE(list, elt, link); \
+ } while (0)
+
+#define ISC_LIST_UNLINKUNSAFE(list, elt, link) \
do { \
if ((elt)->link.next != NULL) \
(elt)->link.next->link.prev = (elt)->link.prev; \
@@ -73,10 +92,16 @@
(elt)->link.next = (void *)(-1); \
} while (0)
+#define ISC_LIST_UNLINK(list, elt, link) \
+ do { \
+ ISC_LINK_INSIST(ISC_LINK_LINKED(elt, link)); \
+ ISC_LIST_UNLINKUNSAFE(list, elt, link); \
+ } while (0)
+
#define ISC_LIST_PREV(elt, link) ((elt)->link.prev)
#define ISC_LIST_NEXT(elt, link) ((elt)->link.next)
-#define ISC_LIST_INSERTBEFORE(list, before, elt, link) \
+#define ISC_LIST_INSERTBEFOREUNSAFE(list, before, elt, link) \
do { \
if ((before)->link.prev == NULL) \
ISC_LIST_PREPEND(list, elt, link); \
@@ -88,7 +113,14 @@
} \
} while (0)
-#define ISC_LIST_INSERTAFTER(list, after, elt, link) \
+#define ISC_LIST_INSERTBEFORE(list, before, elt, link) \
+ do { \
+ ISC_LINK_INSIST(ISC_LINK_LINKED(before, link)); \
+ ISC_LINK_INSIST(!ISC_LINK_LINKED(elt, link)); \
+ ISC_LIST_INSERTBEFOREUNSAFE(list, before, elt, link); \
+ } while (0)
+
+#define ISC_LIST_INSERTAFTERUNSAFE(list, after, elt, link) \
do { \
if ((after)->link.next == NULL) \
ISC_LIST_APPEND(list, elt, link); \
@@ -100,6 +132,13 @@
} \
} while (0)
+#define ISC_LIST_INSERTAFTER(list, after, elt, link) \
+ do { \
+ ISC_LINK_INSIST(ISC_LINK_LINKED(after, link)); \
+ ISC_LINK_INSIST(!ISC_LINK_LINKED(elt, link)); \
+ ISC_LIST_INSERTAFTERUNSAFE(list, after, elt, link); \
+ } while (0)
+
#define ISC_LIST_APPENDLIST(list1, list2, link) \
do { \
if (ISC_LIST_EMPTY(list1)) \
@@ -114,6 +153,10 @@
} while (0)
#define ISC_LIST_ENQUEUE(list, elt, link) ISC_LIST_APPEND(list, elt, link)
+#define ISC_LIST_ENQUEUEUNSAFE(list, elt, link) \
+ ISC_LIST_APPENDUNSAFE(list, elt, link)
#define ISC_LIST_DEQUEUE(list, elt, link) ISC_LIST_UNLINK(list, elt, link)
+#define ISC_LIST_DEQUEUEUNSAFE(list, elt, link) \
+ ISC_LIST_UNLINKUNSAFE(list, elt, link)
#endif /* ISC_LIST_H */
diff --git a/lib/isc/include/isc/log.h b/lib/isc/include/isc/log.h
index f65e8cc0..355d2965 100644
--- a/lib/isc/include/isc/log.h
+++ b/lib/isc/include/isc/log.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: log.h,v 1.25.2.1 2000/08/22 01:45:26 bwelling Exp $ */
+/* $Id: log.h,v 1.31 2000/11/27 17:49:41 gson Exp $ */
#ifndef ISC_LOG_H
#define ISC_LOG_H 1
@@ -152,12 +152,12 @@ isc_log_create(isc_mem_t *mctx, isc_log_t **lctxp, isc_logconfig_t **lcfgp);
* Requires:
* mctx is a valid memory context.
* lctxp is not null and *lctxp is null.
- * lctfg is not null and *lcfgp is null.
+ * lcfgp is null or lcfgp is not null and *lcfgp is null.
*
* Ensures:
* *lctxp will point to a valid logging context if all of the necessary
* memory was allocated, or NULL otherwise.
- * *lcfgp will point to a valid logging configuration if all of the
+ * *lcfgp will point to a valid logging configuration if all of the
* necessary memory was allocated, or NULL otherwise.
* On failure, no additional memory is allocated.
*
@@ -470,7 +470,7 @@ isc_log_usechannel(isc_logconfig_t *lcfg, const char *name,
*
* Requires:
* lcfg is a valid logging configuration.
- *
+ *
* category is NULL or has an id that is in the range of known ids.
*
* module is NULL or has an id that is in the range of known ids.
@@ -622,7 +622,7 @@ isc_log_getdebuglevel(isc_log_t *lctx);
*
* Requires:
* lctx is a valid logging context.
- *
+ *
* Ensures:
* The current logging debugging level is returned.
*/
@@ -784,7 +784,7 @@ isc_logcategory_t *
isc_log_categorybyname(isc_log_t *lctx, const char *name);
/*
* Find a category by its name.
- *
+ *
* Notes:
* The string name of a category is not required to be unique.
*
@@ -802,7 +802,7 @@ isc_logmodule_t *
isc_log_modulebyname(isc_log_t *lctx, const char *name);
/*
* Find a module by its name.
- *
+ *
* Notes:
* The string name of a module is not required to be unique.
*
@@ -823,7 +823,6 @@ isc_log_setcontext(isc_log_t *lctx);
*
* Requires:
* lctx be a valid context.
- * This function must not have been previously called.
*/
ISC_LANG_ENDDECLS
diff --git a/lib/isc/include/isc/magic.h b/lib/isc/include/isc/magic.h
index 1c571534..3405373d 100644
--- a/lib/isc/include/isc/magic.h
+++ b/lib/isc/include/isc/magic.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: magic.h,v 1.8 2000/06/22 21:57:44 tale Exp $ */
+/* $Id: magic.h,v 1.10 2000/08/01 01:30:25 tale Exp $ */
#ifndef ISC_MAGIC_H
#define ISC_MAGIC_H 1
diff --git a/lib/isc/include/isc/md5.h b/lib/isc/include/isc/md5.h
index 617dcdab..e2f5f527 100644
--- a/lib/isc/include/isc/md5.h
+++ b/lib/isc/include/isc/md5.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: md5.h,v 1.5 2000/06/23 03:02:04 tale Exp $ */
+/* $Id: md5.h,v 1.7 2000/08/01 01:30:26 tale Exp $ */
/*
* This is the header file for the MD5 message-digest algorithm.
diff --git a/lib/isc/include/isc/mem.h b/lib/isc/include/isc/mem.h
index abaa1a83..a3bb16ec 100644
--- a/lib/isc/include/isc/mem.h
+++ b/lib/isc/include/isc/mem.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1997-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: mem.h,v 1.36 2000/06/22 21:57:46 tale Exp $ */
+/* $Id: mem.h,v 1.45 2000/12/01 00:32:02 gson Exp $ */
#ifndef ISC_MEM_H
#define ISC_MEM_H 1
@@ -28,32 +28,131 @@
ISC_LANG_BEGINDECLS
+#define ISC_MEM_LOWATER 0
+#define ISC_MEM_HIWATER 1
+typedef void (*isc_mem_water_t)(void *, int);
+
typedef void * (*isc_memalloc_t)(void *, size_t);
typedef void (*isc_memfree_t)(void *, void *);
-#define ISC_MEM_DEBUG
-extern isc_boolean_t isc_mem_debugging;
-
-#ifdef ISC_MEM_DEBUG
-#define isc_mem_get(c, s) isc__mem_getdebug(c, s, __FILE__, __LINE__)
-#define isc_mem_put(c, p, s) isc__mem_putdebug(c, p, s, __FILE__, __LINE__)
-#define isc_mem_allocate(c, s) isc__mem_allocatedebug(c, s, \
- __FILE__, __LINE__)
-#define isc_mem_free(c, p) isc__mem_freedebug(c, p, __FILE__, __LINE__)
-#define isc_mem_strdup(c, p) isc__mem_strdupdebug(c, p, \
- __FILE__, __LINE__)
-#define isc_mempool_get(c) isc__mempool_getdebug(c, __FILE__, __LINE__)
-#define isc_mempool_put(c, p) isc__mempool_putdebug(c, p, \
- __FILE__, __LINE__)
+/*
+ * ISC_MEM_DEBUG is enabled by default; set ISC_MEM_DEBUG=0 to disable it.
+ */
+#ifndef ISC_MEM_DEBUG
+#define ISC_MEM_DEBUG 1
+#endif
+
+/*
+ * Define ISC_MEM_TRACKLINES=1 to turn on detailed tracing of memory allocation
+ * and freeing by file and line number.
+ */
+#ifndef ISC_MEM_TRACKLINES
+#define ISC_MEM_TRACKLINES 0
+#endif
+
+/*
+ * Define ISC_MEM_CHECKOVERRUN=1 to turn on checks for using memory outside
+ * the requested space. This will increase the size of each allocation.
+ */
+#ifndef ISC_MEM_CHECKOVERRUN
+#define ISC_MEM_CHECKOVERRUN 0
+#endif
+
+/*
+ * Define ISC_MEM_FILL to fill each block of memory returned to the system
+ * with the byte string '0xbe'. This helps track down uninitialized pointers
+ * and the like. On freeing memory, the space is filled with '0xde' for
+ * the same reasons.
+ */
+#ifndef ISC_MEM_FILL
+#define ISC_MEM_FILL 1
+#endif
+
+/*
+ * Define this to turn on memory pool names.
+ */
+#ifndef ISC_MEMPOOL_NAMES
+#define ISC_MEMPOOL_NAMES 1
+#endif
+
+/*
+ * _DEBUGTRACE
+ * log (to isc_lctx) each allocation and free.
+ *
+ * _DEBUGRECORD
+ * remember each allocation, and match them up on free. Crash if
+ * a free doesn't match an allocation
+ */
+extern unsigned int isc_mem_debugging;
+#define ISC_MEM_DEBUGTRACE 0x00000001U
+#define ISC_MEM_DEBUGRECORD 0x00000002U
+
+#if ISC_MEM_TRACKLINES
+#define _ISC_MEM_FILELINE , __FILE__, __LINE__
+#define _ISC_MEM_FLARG , const char *, int
+#else
+#define _ISC_MEM_FILELINE
+#define _ISC_MEM_FLARG
+#endif
+
+#define isc_mem_get(c, s) isc__mem_get((c), (s) _ISC_MEM_FILELINE)
+#define isc_mem_allocate(c, s) isc__mem_allocate((c), (s) _ISC_MEM_FILELINE)
+#define isc_mem_strdup(c, p) isc__mem_strdup((c), (p) _ISC_MEM_FILELINE)
+#define isc_mempool_get(c) isc__mempool_get((c) _ISC_MEM_FILELINE)
+
+/*
+ * isc_mem_putanddetach() is a convienence function for use where you
+ * have a structure with an attached memory context.
+ *
+ * Given:
+ *
+ * struct {
+ * ...
+ * isc_mem_t *mctx;
+ * ...
+ * } *ptr;
+ *
+ * isc_mem_t *mctx;
+ *
+ * isc_mem_putanddetach(&ptr->mctx, ptr, sizeof(*ptr));
+ *
+ * is the equivalent of:
+ *
+ * mctx = NULL;
+ * isc_mem_attach(ptr->mctx, &mctx);
+ * isc_mem_detach(&ptr->mctx);
+ * isc_mem_put(mctx, ptr, sizeof(*ptr));
+ * isc_mem_detach(&mctx);
+ */
+
+#if ISC_MEM_DEBUG
+#define isc_mem_put(c, p, s) \
+ do { \
+ isc__mem_put((c), (p), (s) _ISC_MEM_FILELINE); \
+ (p) = NULL; \
+ } while (0)
+#define isc_mem_putanddetach(c, p, s) \
+ do { \
+ isc__mem_putanddetach((c), (p), (s) _ISC_MEM_FILELINE); \
+ (p) = NULL; \
+ } while (0)
+#define isc_mem_free(c, p) \
+ do { \
+ isc__mem_free((c), (p) _ISC_MEM_FILELINE); \
+ (p) = NULL; \
+ } while (0)
+#define isc_mempool_put(c, p) \
+ do { \
+ isc__mempool_put((c), (p) _ISC_MEM_FILELINE); \
+ (p) = NULL; \
+ } while (0)
#else
-#define isc_mem_get isc__mem_get
-#define isc_mem_put isc__mem_put
-#define isc_mem_allocate isc__mem_allocate
-#define isc_mem_free isc__mem_free
-#define isc_mem_strdup isc__mem_strdup
-#define isc_mempool_get isc__mempool_get
-#define isc_mempool_put isc__mempool_put
-#endif /* ISC_MEM_DEBUG */
+#define isc_mem_put(c, p, s) isc__mem_put((c), (p), (s) _ISC_MEM_FILELINE)
+#define isc_mem_putanddetach(c, p, s) \
+ isc__mem_putanddetach((c), (p), (s) _ISC_MEM_FILELINE)
+#define isc_mem_free(c, p) isc__mem_free((c), (p) _ISC_MEM_FILELINE)
+#define isc_mempool_put(c, p) isc__mempool_put((c), (p) _ISC_MEM_FILELINE)
+#endif
isc_result_t isc_mem_create(size_t, size_t, isc_mem_t **);
void isc_mem_attach(isc_mem_t *, isc_mem_t **);
@@ -62,25 +161,21 @@ void isc_mem_destroy(isc_mem_t **);
isc_result_t isc_mem_ondestroy(isc_mem_t *ctx,
isc_task_t *task,
isc_event_t **event);
-void * isc__mem_get(isc_mem_t *, size_t);
-void isc__mem_put(isc_mem_t *, void *, size_t);
-void * isc__mem_getdebug(isc_mem_t *, size_t,
- const char *, int);
-void isc__mem_putdebug(isc_mem_t *, void *,
- size_t, const char *, int);
+void * isc__mem_get(isc_mem_t *, size_t
+ _ISC_MEM_FLARG);
+void isc__mem_putanddetach(isc_mem_t **, void *,
+ size_t _ISC_MEM_FLARG);
+void isc__mem_put(isc_mem_t *, void *,
+ size_t _ISC_MEM_FLARG);
isc_result_t isc_mem_preallocate(isc_mem_t *);
void isc_mem_stats(isc_mem_t *, FILE *);
isc_boolean_t isc_mem_valid(isc_mem_t *, void *);
-void * isc__mem_allocate(isc_mem_t *, size_t);
-void * isc__mem_allocatedebug(isc_mem_t *, size_t,
- const char *, int);
-void isc__mem_free(isc_mem_t *, void *);
-void isc__mem_freedebug(isc_mem_t *, void *,
- const char *, int);
-char * isc__mem_strdup(isc_mem_t *, const char *);
-char * isc__mem_strdupdebug(isc_mem_t *,
- const char *,
- const char *, int);
+void * isc__mem_allocate(isc_mem_t *, size_t
+ _ISC_MEM_FLARG);
+void isc__mem_free(isc_mem_t *, void *
+ _ISC_MEM_FLARG);
+char * isc__mem_strdup(isc_mem_t *, const char *
+ _ISC_MEM_FLARG);
void isc_mem_setdestroycheck(isc_mem_t *,
isc_boolean_t);
void isc_mem_setsplit(isc_mem_t *, isc_boolean_t);
@@ -94,38 +189,25 @@ isc_result_t isc_mem_createx(size_t, size_t,
void *arg, isc_mem_t **);
isc_result_t isc_mem_restore(isc_mem_t *);
-#ifdef ISC_MEMCLUSTER_LEGACY
-
+void
+isc_mem_setwater(isc_mem_t *mctx, isc_mem_water_t water, void *water_arg,
+ size_t hiwater, size_t lowater);
/*
- * Legacy.
+ * Set high and low water marks for this memory context. When the memory
+ * usage of 'mctx' exceeds 'hiwater', '(water)(water_arg, ISC_MEM_HIWATER)'
+ * will be called. When the usage drops below 'lowater', 'water' will
+ * again be called, this time with ISC_MEM_LOWATER.
+ *
+ * Requires:
+ * If 'water' is NULL then 'water_arg', 'hi_water' and 'lo_water' are
+ * ignored and the state is reset. Otherwise, requires
+ *
+ * 'water' to point to a valid function.
+ * 'hi_water > lo_water'
+ * 'lo_water != 0'
+ * 'hi_water != 0'
*/
-#define meminit isc__legacy_meminit
-#define mem_default_context isc__legacy_mem_default_context
-#ifdef MEMCLUSTER_DEBUG
-#define memget(s) isc__legacy_memget_debug(s, __FILE__, __LINE__)
-#define memput(p, s) isc__legacy_memput_debug(p, s, \
- __FILE__, __LINE__)
-#else
-#define memget isc__legacy_memget
-#define memput isc__legacy_memput
-#endif
-#define memvalid isc__legacy_memvalid
-#define memstats isc__legacy_memstats
-
-int meminit(size_t, size_t);
-isc_mem_t * mem_default_context(void);
-void * isc__legacy_memget(size_t);
-void isc__legacy_memput(void *, size_t);
-void * isc__legacy_memget_debug(size_t, const char *,
- int);
-void isc__legacy_memput_debug(void *, size_t,
- const char *, int);
-int memvalid(void *);
-void memstats(FILE *);
-
-#endif /* ISC_MEMCLUSTER_LEGACY */
-
/*
* Memory pools
*/
@@ -134,11 +216,8 @@ void memstats(FILE *);
* Internal (but public) functions. Don't call these from application
* code. Use isc_mempool_get() and isc_mempool_put() instead.
*/
-void * isc__mempool_get(isc_mempool_t *);
-void isc__mempool_put(isc_mempool_t *, void *);
-void * isc__mempool_getdebug(isc_mempool_t *, const char *, int);
-void isc__mempool_putdebug(isc_mempool_t *, void *,
- const char *, int);
+void * isc__mempool_get(isc_mempool_t * _ISC_MEM_FLARG);
+void isc__mempool_put(isc_mempool_t *, void * _ISC_MEM_FLARG);
isc_result_t
isc_mempool_create(isc_mem_t *mctx, size_t size, isc_mempool_t **mpctxp);
diff --git a/lib/isc/include/isc/msgcat.h b/lib/isc/include/isc/msgcat.h
index 3cc2c5cb..cd7cbed6 100644
--- a/lib/isc/include/isc/msgcat.h
+++ b/lib/isc/include/isc/msgcat.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: msgcat.h,v 1.5 2000/06/22 21:57:47 tale Exp $ */
+/* $Id: msgcat.h,v 1.7 2000/08/01 01:30:28 tale Exp $ */
#ifndef ISC_MSGCAT_H
#define ISC_MSGCAT_H 1
diff --git a/lib/isc/include/isc/mutexblock.h b/lib/isc/include/isc/mutexblock.h
index dbb76910..3931d3cf 100644
--- a/lib/isc/include/isc/mutexblock.h
+++ b/lib/isc/include/isc/mutexblock.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: mutexblock.h,v 1.7 2000/06/22 21:57:48 tale Exp $ */
+/* $Id: mutexblock.h,v 1.9 2000/08/01 01:30:29 tale Exp $ */
#ifndef ISC_MUTEXBLOCK_H
#define ISC_MUTEXBLOCK_H 1
diff --git a/lib/isc/include/isc/netaddr.h b/lib/isc/include/isc/netaddr.h
index 38db7e2a..9cc2d0e3 100644
--- a/lib/isc/include/isc/netaddr.h
+++ b/lib/isc/include/isc/netaddr.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: netaddr.h,v 1.13 2000/06/22 21:57:49 tale Exp $ */
+/* $Id: netaddr.h,v 1.15 2000/08/01 01:30:30 tale Exp $ */
#ifndef ISC_NETADDR_H
#define ISC_NETADDR_H 1
@@ -63,7 +63,7 @@ isc_result_t
isc_netaddr_totext(const isc_netaddr_t *netaddr, isc_buffer_t *target);
/*
* Append a text representation of 'sockaddr' to the buffer 'target'.
- * The text is NOT null terminated. Handles IPv4 and IPv6 addresses.
+ * The text is NOT null terminated. Handles IPv4 and IPv6 addresses.
*
* Returns:
* ISC_R_SUCCESS
diff --git a/lib/isc/include/isc/ondestroy.h b/lib/isc/include/isc/ondestroy.h
index 69a0c0ed..30d867a4 100644
--- a/lib/isc/include/isc/ondestroy.h
+++ b/lib/isc/include/isc/ondestroy.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: ondestroy.h,v 1.4 2000/06/22 21:57:50 tale Exp $ */
+/* $Id: ondestroy.h,v 1.6 2000/08/01 01:30:31 tale Exp $ */
#ifndef ISC_ONDESTROY_H
#define ISC_ONDESTROY_H 1
@@ -30,7 +30,7 @@ ISC_LANG_BEGINDECLS
*
* Any class ``X'' of objects that wants to send out notifications
* on its destruction should declare a field of type isc_ondestroy_t
- * (call it 'ondest').
+ * (call it 'ondest').
*
* typedef struct {
* ...
@@ -41,14 +41,14 @@ ISC_LANG_BEGINDECLS
* When an object ``A'' of type X is created
* it must initialize the field ondest with a call to
*
- * isc_ondestroy_init(&A->ondest).
+ * isc_ondestroy_init(&A->ondest).
*
* X should also provide a registration function for third-party
* objects to call to register their interest in being told about
* the destruction of a particular instance of X.
*
* isc_result_t
- * X_ondestroy(X *instance, isc_task_t *task,
+ * X_ondestroy(X *instance, isc_task_t *task,
* isc_event_t **eventp) {
* return(isc_ondestroy_register(&instance->ondest, task,eventp));
* }
diff --git a/lib/isc/include/isc/os.h b/lib/isc/include/isc/os.h
index ab9c397f..45a86bbb 100644
--- a/lib/isc/include/isc/os.h
+++ b/lib/isc/include/isc/os.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: os.h,v 1.2 2000/06/22 21:57:51 tale Exp $ */
+/* $Id: os.h,v 1.4 2000/08/01 01:30:32 tale Exp $ */
#ifndef ISC_OS_H
#define ISC_OS_H 1
diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in
index d8c67d09..2ba1258d 100644
--- a/lib/isc/include/isc/platform.h.in
+++ b/lib/isc/include/isc/platform.h.in
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: platform.h.in,v 1.12 2000/06/22 21:57:53 tale Exp $ */
+/* $Id: platform.h.in,v 1.15 2000/08/28 23:51:09 gson Exp $ */
#ifndef ISC_PLATFORM_H
#define ISC_PLATFORM_H 1
@@ -116,6 +116,11 @@
@ISC_PLATFORM_LONGLONGEQUALLONG@
/*
+ * Defined if we are using threads.
+ */
+@ISC_PLATFORM_USETHREADS@
+
+/*
* Tell emacs to use C mode for this file.
*
* Local Variables:
diff --git a/lib/isc/include/isc/print.h b/lib/isc/include/isc/print.h
index c342ca25..d02715fe 100644
--- a/lib/isc/include/isc/print.h
+++ b/lib/isc/include/isc/print.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: print.h,v 1.8 2000/06/23 03:02:41 tale Exp $ */
+/* $Id: print.h,v 1.11 2000/11/14 23:40:31 tale Exp $ */
#ifndef ISC_PRINT_H
#define ISC_PRINT_H 1
@@ -29,6 +29,15 @@
#include <isc/platform.h>
/***
+ *** Macros
+ ***/
+#ifdef ISC_PLATFORM_LONGLONGEQUALLONG
+#define ISC_PRINT_QUADFORMAT "l"
+#else
+#define ISC_PRINT_QUADFORMAT "ll"
+#endif
+
+/***
*** Functions
***/
diff --git a/lib/isc/include/isc/quota.h b/lib/isc/include/isc/quota.h
index 28e1d91a..8e4e3c5b 100644
--- a/lib/isc/include/isc/quota.h
+++ b/lib/isc/include/isc/quota.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: quota.h,v 1.5 2000/06/22 21:57:55 tale Exp $ */
+/* $Id: quota.h,v 1.7 2000/08/01 01:30:36 tale Exp $ */
#ifndef ISC_QUOTA_H
#define ISC_QUOTA_H 1
@@ -58,7 +58,7 @@ struct isc_quota {
isc_result_t
isc_quota_init(isc_quota_t *quota, int max);
/*
- * Initialize a quota object.
+ * Initialize a quota object.
*
* Returns:
* ISC_R_SUCCESS
diff --git a/lib/isc/include/isc/random.h b/lib/isc/include/isc/random.h
index cc909778..1801ec9e 100644
--- a/lib/isc/include/isc/random.h
+++ b/lib/isc/include/isc/random.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: random.h,v 1.5 2000/06/22 21:57:56 tale Exp $ */
+/* $Id: random.h,v 1.10 2000/09/26 17:23:16 gson Exp $ */
#ifndef ISC_RANDOM_H
#define ISC_RANDOM_H 1
@@ -27,63 +27,32 @@
* Implements a random state pool which will let the caller return a
* series of possibly non-reproducable random values. Note that the
* strength of these numbers is not all that high, and should not be
- * used in cryptography functions.
+ * used in cryptography functions. It is useful for jittering values
+ * a bit here and there, such as timeouts, etc.
*/
ISC_LANG_BEGINDECLS
-struct isc_random {
- unsigned int magic;
-#if 0
- isc_mutex_t lock;
-#endif
-};
-
-#define ISC_RANDOM_MAGIC 0x52416e64 /* RAnd. */
-#define ISC_RANDOM_VALID(x) ((x) != NULL && (x->magic) == ISC_RANDOM_MAGIC)
-
-isc_result_t
-isc_random_init(isc_random_t *r);
-/*
- * Initialize a random state.
- *
- * This function must be called before using any of the following functions.
- *
- * Requires:
- * r != NULL.
- */
-
-isc_result_t
-isc_random_invalidate(isc_random_t *r);
+void
+isc_random_seed(isc_uint32_t seed);
/*
- * Invalidate a random state. This will wipe any information contained in
- * the state and make it unusable.
- *
- * Requires:
- * r be a valid pool.
+ * Set the initial seed of the random state.
*/
void
-isc_random_seed(isc_random_t *r, isc_uint32_t seed);
+isc_random_get(isc_uint32_t *val);
/*
- * Set the initial seed of the random state. Note that on some systems
- * the private state isn't all that private, and setting the seed may
- * alter numbers returned to other state pools.
+ * Get a random value.
*
* Requires:
- * r be a valid pool.
+ * val != NULL.
*/
-void
-isc_random_get(isc_random_t *r, isc_uint32_t *val);
+isc_uint32_t
+isc_random_jitter(isc_uint32_t max, isc_uint32_t jitter);
/*
- * Get a random value. Note that on some systems the private state isn't
- * all that private, and getting a value may alter what other state pools
- * would have returned.
- *
- * Requires:
- * r be a valid pool.
- * val != NULL.
+ * Get a random value between (max - jitter) and (max).
+ * This is useful for jittering timer values.
*/
ISC_LANG_ENDDECLS
diff --git a/lib/isc/include/isc/ratelimiter.h b/lib/isc/include/isc/ratelimiter.h
index 74102c09..e366ced9 100644
--- a/lib/isc/include/isc/ratelimiter.h
+++ b/lib/isc/include/isc/ratelimiter.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: ratelimiter.h,v 1.10 2000/06/22 21:57:57 tale Exp $ */
+/* $Id: ratelimiter.h,v 1.12 2000/08/01 01:30:38 tale Exp $ */
#ifndef ISC_RATELIMITER_H
#define ISC_RATELIMITER_H 1
@@ -26,7 +26,7 @@
/*
* A rate limiter is a mechanism for dispatching events at a limited
- * rate. This is intended to be used when sending zone maintenance
+ * rate. This is intended to be used when sending zone maintenance
* SOA queries, NOTIFY messages, etc.
*/
@@ -82,7 +82,7 @@ isc_ratelimiter_enqueue(isc_ratelimiter_t *rl, isc_task_t *task,
* Requires:
* An interval has been set by calling
* isc_ratelimiter_setinterval().
- *
+ *
* 'task' to be non NULL.
* '(*eventp)->ev_sender' to be NULL.
*/
diff --git a/lib/isc/include/isc/region.h b/lib/isc/include/isc/region.h
index cb3d90d6..89caef37 100644
--- a/lib/isc/include/isc/region.h
+++ b/lib/isc/include/isc/region.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: region.h,v 1.12 2000/06/22 21:57:58 tale Exp $ */
+/* $Id: region.h,v 1.15 2000/08/17 23:33:04 bwelling Exp $ */
#ifndef ISC_REGION_H
#define ISC_REGION_H 1
@@ -40,6 +40,11 @@ struct isc_constregion {
unsigned int length;
};
+struct isc_consttextregion {
+ const char * base;
+ unsigned int length;
+};
+
/*
* The region structure is not opaque, and is usually directly manipulated.
* Some macros are defined below for convenience.
diff --git a/lib/isc/include/isc/resource.h b/lib/isc/include/isc/resource.h
new file mode 100644
index 00000000..d0b8ee4d
--- /dev/null
+++ b/lib/isc/include/isc/resource.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: resource.h,v 1.3 2000/11/15 02:11:48 tale Exp $ */
+
+#ifndef ISC_RESOURCE_H
+#define ISC_RESOURCE_H 1
+
+#include <isc/lang.h>
+#include <isc/types.h>
+
+#define ISC_RESOURCE_UNLIMITED ((isc_resourcevalue_t)ISC_UINT64_MAX)
+
+ISC_LANG_BEGINDECLS
+
+isc_result_t
+isc_resource_setlimit(isc_resource_t resource, isc_resourcevalue_t value);
+/*
+ * Set the maximum limit for a system resource.
+ *
+ * Notes:
+ * If 'value' exceeds the maximum possible on the operating system,
+ * it is silently limited to that maximum -- or to "infinity", if
+ * the operating system has that concept. ISC_RESOURCE_UNLIMITED
+ * can be used to explicitly ask for the maximum.
+ *
+ * Requires:
+ * 'resource' is a valid member of the isc_resource_t enumeration.
+ *
+ * Returns:
+ * ISC_R_SUCCESS Success.
+ * ISC_R_NOTIMPLEMENTED 'resource' is not a type known by the OS.
+ * ISC_R_NOPERM The calling process did not have adequate permission
+ * to change the resource limit.
+ */
+
+isc_result_t
+isc_resource_getlimit(isc_resource_t resource, isc_resourcevalue_t *value);
+/*
+ * Get the maximum limit for a system resource.
+ *
+ * Notes:
+ * 'value' is set to the maximum limit.
+ *
+ * ISC_RESOURCE_UNLIMITED is the maximum value of isc_resourcevalue_t.
+ *
+ * On many (all?) Unix systems, RLIM_INFINITY is a valid value that is
+ * significantly less than ISC_RESOURCE_UNLIMITED, but which in practice
+ * behaves the same.
+ *
+ * The current ISC libdns configuration file parser assigns a value
+ * of ISC_UINT32_MAX for a size_spec of "unlimited" and ISC_UNIT32_MAX - 1
+ * for "default", the latter of which is supposed to represent "the
+ * limit that was in force when the server started". Since these are
+ * valid values in the middle of the range of isc_resourcevalue_t,
+ * there is the possibility for confusion over what exactly those
+ * particular values are supposed to represent in a particular context --
+ * discrete integral values or generalized concepts.
+ *
+ * Requires:
+ * 'resource' is a valid member of the isc_resource_t enumeration.
+ *
+ * Returns:
+ * ISC_R_SUCCESS Success.
+ * ISC_R_NOTIMPLEMENTED 'resource' is not a type known by the OS.
+ */
+
+ISC_LANG_ENDDECLS
+
+#endif /* ISC_RESOURCE_H */
+
diff --git a/lib/isc/include/isc/result.h b/lib/isc/include/isc/result.h
index 0ec1a344..fa979d8c 100644
--- a/lib/isc/include/isc/result.h
+++ b/lib/isc/include/isc/result.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: result.h,v 1.44 2000/06/22 21:57:59 tale Exp $ */
+/* $Id: result.h,v 1.52 2000/11/18 02:56:47 gson Exp $ */
#ifndef ISC_RESULT_H
#define ISC_RESULT_H 1
@@ -70,7 +70,14 @@
#define ISC_R_NOTFILE 44 /* not a file */
#define ISC_R_NOTDIRECTORY 45 /* not a directory */
#define ISC_R_QUEUEFULL 46 /* queue is full */
-#define ISC_R_NRESULTS 47 /* Number of results */
+#define ISC_R_FAMILYMISMATCH 47 /* address family mismatch */
+#define ISC_R_FAMILYNOSUPPORT 48 /* AF not supported */
+#define ISC_R_BADHEX 49 /* bad hex encoding */
+#define ISC_R_TOOMANYOPENFILES 50 /* too many open files */
+/*
+ * Not a result code: the number of results.
+ */
+#define ISC_R_NRESULTS 51
ISC_LANG_BEGINDECLS
diff --git a/lib/isc/include/isc/resultclass.h b/lib/isc/include/isc/resultclass.h
index 10ac21c5..abe1ec46 100644
--- a/lib/isc/include/isc/resultclass.h
+++ b/lib/isc/include/isc/resultclass.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: resultclass.h,v 1.7 2000/06/22 21:58:00 tale Exp $ */
+/* $Id: resultclass.h,v 1.9 2000/08/01 01:30:41 tale Exp $ */
#ifndef ISC_RESULTCLASS_H
#define ISC_RESULTCLASS_H 1
diff --git a/lib/isc/include/isc/rwlock.h b/lib/isc/include/isc/rwlock.h
index 94b28717..3f8723d8 100644
--- a/lib/isc/include/isc/rwlock.h
+++ b/lib/isc/include/isc/rwlock.h
@@ -1,28 +1,29 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rwlock.h,v 1.11 2000/06/22 21:58:01 tale Exp $ */
+/* $Id: rwlock.h,v 1.16 2000/09/08 21:25:21 gson Exp $ */
#ifndef ISC_RWLOCK_H
#define ISC_RWLOCK_H 1
+#include <isc/condition.h>
#include <isc/lang.h>
+#include <isc/platform.h>
#include <isc/types.h>
-#include <isc/condition.h>
ISC_LANG_BEGINDECLS
@@ -31,6 +32,7 @@ typedef enum {
isc_rwlocktype_write
} isc_rwlocktype_t;
+#ifdef ISC_PLATFORM_USETHREADS
struct isc_rwlock {
/* Unlocked. */
unsigned int magic;
@@ -39,13 +41,30 @@ struct isc_rwlock {
isc_condition_t readable;
isc_condition_t writeable;
isc_rwlocktype_t type;
+
+ /* The number of threads that have the lock. */
unsigned int active;
+
+ /*
+ * The number of lock grants made since the lock was last switched
+ * from reading to writing or vice versa; used in determining
+ * when the quota is reached and it is time to switch.
+ */
unsigned int granted;
+
unsigned int readers_waiting;
unsigned int writers_waiting;
unsigned int read_quota;
unsigned int write_quota;
};
+#else /* ISC_PLATFORM_USETHREADS */
+struct isc_rwlock {
+ unsigned int magic;
+ isc_rwlocktype_t type;
+ unsigned int active;
+};
+#endif /* ISC_PLATFORM_USETHREADS */
+
isc_result_t
isc_rwlock_init(isc_rwlock_t *rwl, unsigned int read_quota,
diff --git a/lib/isc/include/isc/serial.h b/lib/isc/include/isc/serial.h
index 2e4a85c4..0bcbfe42 100644
--- a/lib/isc/include/isc/serial.h
+++ b/lib/isc/include/isc/serial.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: serial.h,v 1.6 2000/04/28 22:13:15 tale Exp $ */
+/* $Id: serial.h,v 1.8 2000/08/01 01:30:43 tale Exp $ */
#ifndef ISC_SERIAL_H
#define ISC_SERIAL_H 1
diff --git a/lib/isc/include/isc/sha1.h b/lib/isc/include/isc/sha1.h
index 1784ef83..52068ba5 100644
--- a/lib/isc/include/isc/sha1.h
+++ b/lib/isc/include/isc/sha1.h
@@ -1,24 +1,24 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef ISC_SHA1_H
#define ISC_SHA1_H 1
-/* $Id: sha1.h,v 1.5 2000/06/23 03:02:58 tale Exp $ */
+/* $Id: sha1.h,v 1.7 2000/08/01 01:30:44 tale Exp $ */
/* $NetBSD: sha1.h,v 1.2 1998/05/29 22:55:44 thorpej Exp $ */
@@ -35,10 +35,10 @@
typedef struct {
isc_uint32_t state[5];
- isc_uint32_t count[2];
+ isc_uint32_t count[2];
unsigned char buffer[64];
} isc_sha1_t;
-
+
ISC_LANG_BEGINDECLS
void
diff --git a/lib/isc/include/isc/sockaddr.h b/lib/isc/include/isc/sockaddr.h
index 67b038ab..5d839eb8 100644
--- a/lib/isc/include/isc/sockaddr.h
+++ b/lib/isc/include/isc/sockaddr.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: sockaddr.h,v 1.30.2.1 2000/09/21 22:15:00 gson Exp $ */
+/* $Id: sockaddr.h,v 1.34 2000/08/09 19:09:09 gson Exp $ */
#ifndef ISC_SOCKADDR_H
#define ISC_SOCKADDR_H 1
@@ -40,41 +40,81 @@ ISC_LANG_BEGINDECLS
isc_boolean_t
isc_sockaddr_equal(const isc_sockaddr_t *a, const isc_sockaddr_t *b);
+/*
+ * Return ISC_TRUE iff the socket addresses 'a' and 'b' are equal.
+ */
isc_boolean_t
isc_sockaddr_eqaddr(const isc_sockaddr_t *a, const isc_sockaddr_t *b);
+/*
+ * Return ISC_TRUE iff the address parts of the socket addresses
+ * 'a' and 'b' are equal, ignoring the ports.
+ */
isc_boolean_t
isc_sockaddr_eqaddrprefix(const isc_sockaddr_t *a, const isc_sockaddr_t *b,
unsigned int prefixlen);
+/*
+ * Return ISC_TRUE iff the most significant 'prefixlen' bits of the
+ * socket addresses 'a' and 'b' are equal, ignoring the ports.
+ */
unsigned int
isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only);
+/*
+ * Return a hash value for the socket address 'sockaddr'. If 'address_only'
+ * is ISC_TRUE, the hash value will not depend on the port.
+ */
void
isc_sockaddr_any(isc_sockaddr_t *sockaddr);
+/*
+ * Return the IPv4 wildcard address.
+ */
void
isc_sockaddr_any6(isc_sockaddr_t *sockaddr);
+/*
+ * Return the IPv6 wildcard address.
+ */
void
isc_sockaddr_anyofpf(isc_sockaddr_t *sockaddr, int family);
+/*
+ * Set '*sockaddr' to the wildcard address of protocol family
+ * 'family'.
+ *
+ * Requires:
+ * 'family' is AF_INET or AF_INET6.
+ */
void
isc_sockaddr_fromin(isc_sockaddr_t *sockaddr, const struct in_addr *ina,
in_port_t port);
+/*
+ * Construct an isc_sockaddr_t from an IPv4 address and port.
+ */
void
isc_sockaddr_fromin6(isc_sockaddr_t *sockaddr, const struct in6_addr *ina6,
in_port_t port);
+/*
+ * Construct an isc_sockaddr_t from an IPv6 address and port.
+ */
void
isc_sockaddr_v6fromin(isc_sockaddr_t *sockaddr, const struct in_addr *ina,
in_port_t port);
+/*
+ * Construct an IPv6 isc_sockaddr_t representing a mapped IPv4 address.
+ */
void
isc_sockaddr_fromnetaddr(isc_sockaddr_t *sockaddr, const isc_netaddr_t *na,
in_port_t port);
+/*
+ * Construct an isc_sockaddr_t from an isc_netaddr_t and port.
+ */
int
isc_sockaddr_pf(const isc_sockaddr_t *sockaddr);
diff --git a/lib/isc/include/isc/socket.h b/lib/isc/include/isc/socket.h
index 14115cab..9d3ae5b0 100644
--- a/lib/isc/include/isc/socket.h
+++ b/lib/isc/include/isc/socket.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: socket.h,v 1.47 2000/06/22 21:58:03 tale Exp $ */
+/* $Id: socket.h,v 1.50 2000/09/07 01:59:56 explorer Exp $ */
#ifndef ISC_SOCKET_H
#define ISC_SOCKET_H 1
@@ -115,9 +115,6 @@ struct isc_socket_connev {
/*
* _ATTACHED: Internal use only.
- * _FATALERROR: The socket result code is "sticky" -- that is, any
- * further i/o activity of the same type (read or write)
- * will return the same code; retrying is pointless.
* _TRUNC: Packet was truncated on receive.
* _CTRUNC: Packet control information was truncated. This can
* indicate that the packet is not complete, even though
@@ -127,7 +124,6 @@ struct isc_socket_connev {
* _MULTICAST: The UDP packet was received via a multicast transmission.
*/
#define ISC_SOCKEVENTATTR_ATTACHED 0x80000000U /* internal */
-#define ISC_SOCKEVENTATTR_FATALERROR 0x40000000U /* sock is dead */
#define ISC_SOCKEVENTATTR_TRUNC 0x00800000U /* public */
#define ISC_SOCKEVENTATTR_CTRUNC 0x00400000U /* public */
#define ISC_SOCKEVENTATTR_TIMESTAMP 0x00200000U /* public */
@@ -238,7 +234,7 @@ isc_socket_cancel(isc_socket_t *sock, isc_task_t *task,
* Cancel pending isc_socket_connect() call.
*/
-void
+void
isc_socket_shutdown(isc_socket_t *sock, unsigned int how);
/*
* Shutdown 'socket' according to 'how'.
@@ -278,7 +274,7 @@ isc_socket_attach(isc_socket_t *sock, isc_socket_t **socketp);
* *socketp is attached to socket.
*/
-void
+void
isc_socket_detach(isc_socket_t **socketp);
/*
* Detach *socketp from its socket.
@@ -630,7 +626,7 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp);
* Destroy a socket manager.
*
* Notes:
- *
+ *
* This routine blocks until there are no sockets left in the manager,
* so if the caller holds any socket references using the manager, it
* must detach them before calling isc_socketmgr_destroy() or it will
diff --git a/lib/isc/include/isc/stdio.h b/lib/isc/include/isc/stdio.h
index 634c90f3..d6929088 100644
--- a/lib/isc/include/isc/stdio.h
+++ b/lib/isc/include/isc/stdio.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: stdio.h,v 1.3 2000/06/23 03:03:14 tale Exp $ */
+/* $Id: stdio.h,v 1.5 2000/08/01 01:30:48 tale Exp $ */
#ifndef ISC_STDIO_H
#define ISC_STDIO_H 1
diff --git a/lib/isc/include/isc/string.h b/lib/isc/include/isc/string.h
index 66347560..2bf687c5 100644
--- a/lib/isc/include/isc/string.h
+++ b/lib/isc/include/isc/string.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: string.h,v 1.6 2000/06/22 21:58:06 tale Exp $ */
+/* $Id: string.h,v 1.8 2000/08/01 01:30:49 tale Exp $ */
#ifndef ISC_STRING_H
#define ISC_STRING_H 1
@@ -32,10 +32,10 @@ isc_uint64_t
isc_string_touint64(char *source, char **endp, int base);
/*
* Convert the string pointed to by 'source' to isc_uint64_t.
- *
+ *
* On successful conversion 'endp' points to the first character
* after conversion is complete.
- *
+ *
* 'base': 0 or 2..36
*
* If base is 0 the base is computed from the string type.
@@ -45,7 +45,7 @@ isc_string_touint64(char *source, char **endp, int base);
char *
-isc_string_separate(char **stringp, const char *delim);
+isc_string_separate(char **stringp, const char *delim);
#ifdef ISC_PLATFORM_NEEDSTRSEP
#define strsep isc_string_separate
diff --git a/lib/isc/include/isc/symtab.h b/lib/isc/include/isc/symtab.h
index 1c2d7b71..eab9b289 100644
--- a/lib/isc/include/isc/symtab.h
+++ b/lib/isc/include/isc/symtab.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1996-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: symtab.h,v 1.12 2000/06/22 21:58:07 tale Exp $ */
+/* $Id: symtab.h,v 1.14 2000/08/01 01:30:50 tale Exp $ */
#ifndef ISC_SYMTAB_H
#define ISC_SYMTAB_H 1
diff --git a/lib/isc/include/isc/task.h b/lib/isc/include/isc/task.h
index 983bf061..bfa0055f 100644
--- a/lib/isc/include/isc/task.h
+++ b/lib/isc/include/isc/task.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: task.h,v 1.44 2000/06/22 21:58:08 tale Exp $ */
+/* $Id: task.h,v 1.47 2000/08/01 01:30:51 tale Exp $ */
#ifndef ISC_TASK_H
#define ISC_TASK_H 1
@@ -230,7 +230,7 @@ isc_task_purgerange(isc_task_t *task, void *sender, isc_eventtype_t first,
* Events in the event queue of 'task' whose sender is 'sender', whose
* type is >= first and <= last, and whose tag is 'tag' will be purged,
* unless they are marked as unpurgable.
- *
+ *
* A sender of NULL will match any sender. A NULL tag matches any
* tag.
*
@@ -320,7 +320,7 @@ isc_task_unsendrange(isc_task_t *task, void *sender, isc_eventtype_t first,
* Events in the event queue of 'task' whose sender is 'sender', whose
* type is >= first and <= last, and whose tag is 'tag' will be dequeued
* and appended to *events.
- *
+ *
* A sender of NULL will match any sender. A NULL tag matches any
* tag.
*
@@ -457,6 +457,36 @@ isc_task_setname(isc_task_t *task, const char *name, void *tag);
* 'task' is a valid task.
*/
+const char *
+isc_task_getname(isc_task_t *task);
+/*
+ * Get the name of 'task', as previously set using isc_task_setname().
+ *
+ * Notes:
+ * This function is for debugging purposes only.
+ *
+ * Requires:
+ * 'task' is a valid task.
+ *
+ * Returns:
+ * A non-NULL pointer to a null-terminated string.
+ * If the task has not been named, the string is
+ * empty.
+ *
+ */
+
+void *
+isc_task_gettag(isc_task_t *task);
+/*
+ * Get the tag value for 'task', as previously set using isc_task_settag().
+ *
+ * Notes:
+ * This function is for debugging purposes only.
+ *
+ * Requires:
+ * 'task' is a valid task.
+ */
+
/*****
***** Task Manager.
*****/
diff --git a/lib/isc/include/isc/taskpool.h b/lib/isc/include/isc/taskpool.h
index 48be0917..8556cda1 100644
--- a/lib/isc/include/isc/taskpool.h
+++ b/lib/isc/include/isc/taskpool.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: taskpool.h,v 1.4 2000/06/22 21:58:09 tale Exp $ */
+/* $Id: taskpool.h,v 1.6 2000/08/01 01:30:52 tale Exp $ */
#ifndef ISC_TASKPOOL_H
#define ISC_TASKPOOL_H 1
@@ -27,14 +27,14 @@
/*
* Task Pool
*
- * A task pool is a mechanism for sharing a small number of tasks
+ * A task pool is a mechanism for sharing a small number of tasks
* among a large number of objects such that each object is
* assigned a unique task, but each task may be shared by several
* objects.
*
- * Task pools are used to let objects that can exist in large
+ * Task pools are used to let objects that can exist in large
* numbers (e.g., zones) use tasks for synchronization without
- * the memory overhead and unfair scheduling competition that
+ * the memory overhead and unfair scheduling competition that
* could result from creating a separate task for each object.
*/
@@ -65,7 +65,7 @@ isc_taskpool_create(isc_taskmgr_t *tmgr, isc_mem_t *mctx,
/*
* Create a task pool of "ntasks" tasks, each with quantum
* "quantum".
- *
+ *
* Requires:
*
* 'tmgr' is a valid task manager.
diff --git a/lib/isc/include/isc/timer.h b/lib/isc/include/isc/timer.h
index 59be61c8..4990fc4c 100644
--- a/lib/isc/include/isc/timer.h
+++ b/lib/isc/include/isc/timer.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: timer.h,v 1.25 2000/06/22 21:58:10 tale Exp $ */
+/* $Id: timer.h,v 1.27 2000/08/01 01:30:53 tale Exp $ */
#ifndef ISC_TIMER_H
#define ISC_TIMER_H 1
@@ -41,7 +41,7 @@
* 'inactive' timers generate no events.
*
* Timers can change type. It is typical to create a timer as
- * an 'inactive' timer and then change it into a 'ticker' or
+ * an 'inactive' timer and then change it into a 'ticker' or
* 'once' timer.
*
* MP:
@@ -245,7 +245,7 @@ isc_timer_attach(isc_timer_t *timer, isc_timer_t **timerp);
* *timerp is attached to timer.
*/
-void
+void
isc_timer_detach(isc_timer_t **timerp);
/*
* Detach *timerp from its timer.
@@ -305,7 +305,7 @@ isc_timermgr_destroy(isc_timermgr_t **managerp);
* Destroy a timer manager.
*
* Notes:
- *
+ *
* This routine blocks until there are no timers left in the manager,
* so if the caller holds any timer references using the manager, it
* must detach them before calling isc_timermgr_destroy() or it will
diff --git a/lib/isc/include/isc/types.h b/lib/isc/include/isc/types.h
index 7c89f1fb..d14fc112 100644
--- a/lib/isc/include/isc/types.h
+++ b/lib/isc/include/isc/types.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: types.h,v 1.27 2000/06/22 21:58:11 tale Exp $ */
+/* $Id: types.h,v 1.31 2000/11/14 23:39:34 tale Exp $ */
#ifndef ISC_TYPES_H
#define ISC_TYPES_H 1
@@ -45,6 +45,7 @@ typedef struct isc_bitstring isc_bitstring_t;
typedef struct isc_buffer isc_buffer_t;
typedef ISC_LIST(isc_buffer_t) isc_bufferlist_t;
typedef struct isc_constregion isc_constregion_t;
+typedef struct isc_consttextregion isc_consttextregion_t;
typedef struct isc_entropy isc_entropy_t;
typedef struct isc_entropysource isc_entropysource_t;
typedef struct isc_event isc_event_t;
@@ -68,6 +69,7 @@ typedef struct isc_quota isc_quota_t;
typedef struct isc_random isc_random_t;
typedef struct isc_ratelimiter isc_ratelimiter_t;
typedef struct isc_region isc_region_t;
+typedef isc_uint64_t isc_resourcevalue_t;
typedef unsigned int isc_result_t;
typedef struct isc_rwlock isc_rwlock_t;
typedef struct isc_sockaddr isc_sockaddr_t;
@@ -84,4 +86,16 @@ typedef struct isc_timermgr isc_timermgr_t;
typedef void (*isc_taskaction_t)(isc_task_t *, isc_event_t *);
+typedef enum {
+ isc_resource_coresize = 1,
+ isc_resource_cputime,
+ isc_resource_datasize,
+ isc_resource_filesize,
+ isc_resource_lockedmemory,
+ isc_resource_openfiles,
+ isc_resource_processes,
+ isc_resource_residentsize,
+ isc_resource_stacksize
+} isc_resource_t;
+
#endif /* ISC_TYPES_H */
diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h
index 05154e7f..60cb20f2 100644
--- a/lib/isc/include/isc/util.h
+++ b/lib/isc/include/isc/util.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: util.h,v 1.13.2.1 2000/09/21 23:14:21 gson Exp $ */
+/* $Id: util.h,v 1.19 2000/08/28 19:49:38 bwelling Exp $ */
#ifndef ISC_UTIL_H
#define ISC_UTIL_H 1
@@ -97,6 +97,7 @@
#define DESTROYLOCK(lp) \
RUNTIME_CHECK(isc_mutex_destroy((lp)) == ISC_R_SUCCESS)
+
#define BROADCAST(cvp) do { \
ISC_UTIL_TRACE(fprintf(stderr, "BROADCAST %p %s %d\n", \
(cvp), __FILE__, __LINE__)); \
diff --git a/lib/isc/inet_aton.c b/lib/isc/inet_aton.c
index 7420c6f8..bcb67148 100644
--- a/lib/isc/inet_aton.c
+++ b/lib/isc/inet_aton.c
@@ -1,24 +1,24 @@
/*
* Portions Copyright (C) 1996-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Copyright (c) 1983, 1990, 1993
* The Regents of the University of California. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -34,7 +34,7 @@
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -50,14 +50,14 @@
/*
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
@@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93";
-static char rcsid[] = "$Id: inet_aton.c,v 1.12 2000/06/21 21:56:37 tale Exp $";
+static char rcsid[] = "$Id: inet_aton.c,v 1.14 2000/08/01 01:29:25 tale Exp $";
#endif /* LIBC_SCCS and not lint */
#include <config.h>
@@ -81,7 +81,7 @@ static char rcsid[] = "$Id: inet_aton.c,v 1.12 2000/06/21 21:56:37 tale Exp $";
#include <isc/types.h>
#include <isc/net.h>
-/*
+/*
* Check whether "cp" is a valid ascii representation
* of an Internet address and convert to a binary address.
* Returns 1 if the address is valid, 0 if not.
diff --git a/lib/isc/inet_ntop.c b/lib/isc/inet_ntop.c
index 6299652c..84f613a0 100644
--- a/lib/isc/inet_ntop.c
+++ b/lib/isc/inet_ntop.c
@@ -1,23 +1,23 @@
/*
* Copyright (C) 1996-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] =
- "$Id: inet_ntop.c,v 1.7 2000/06/21 21:56:38 tale Exp $";
+ "$Id: inet_ntop.c,v 1.9 2000/08/01 01:29:26 tale Exp $";
#endif /* LIBC_SCCS and not lint */
#include <config.h>
@@ -38,7 +38,7 @@ static char rcsid[] =
static const char *inet_ntop4(const unsigned char *src, char *dst,
size_t size);
-
+
#ifdef AF_INET6
static const char *inet_ntop6(const unsigned char *src, char *dst,
size_t size);
@@ -175,7 +175,7 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
tp += sprintf(tp, "%x", words[i]);
}
/* Was it a trailing run of 0x00's? */
- if (best.base != -1 && (best.base + best.len) ==
+ if (best.base != -1 && (best.base + best.len) ==
(NS_IN6ADDRSZ / NS_INT16SZ))
*tp++ = ':';
*tp++ = '\0';
diff --git a/lib/isc/inet_pton.c b/lib/isc/inet_pton.c
index c3c0cd77..4cccf1e3 100644
--- a/lib/isc/inet_pton.c
+++ b/lib/isc/inet_pton.c
@@ -1,23 +1,23 @@
/*
* Copyright (C) 1996-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] =
- "$Id: inet_pton.c,v 1.6 2000/06/21 21:56:39 tale Exp $";
+ "$Id: inet_pton.c,v 1.8 2000/08/01 01:29:28 tale Exp $";
#endif /* LIBC_SCCS and not lint */
#include <config.h>
diff --git a/lib/isc/lex.c b/lib/isc/lex.c
index b52a15e7..506633c0 100644
--- a/lib/isc/lex.c
+++ b/lib/isc/lex.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lex.c,v 1.31.2.2 2000/07/11 04:55:09 gson Exp $ */
+/* $Id: lex.c,v 1.52 2000/11/20 00:41:50 bwelling Exp $ */
#include <config.h>
@@ -36,10 +36,7 @@ typedef struct inputsource {
isc_boolean_t is_file;
isc_boolean_t need_close;
isc_boolean_t at_eof;
- isc_boolean_t have_token;
- isc_token_t token;
- unsigned int char_count;
- int chars[2];
+ isc_buffer_t * pushback;
void * input;
char * name;
unsigned long line;
@@ -61,6 +58,7 @@ struct isc_lex {
isc_boolean_t comment_ok;
isc_boolean_t last_was_eol;
unsigned int paren_count;
+ unsigned int saved_paren_count;
isc_lexspecials_t specials;
LIST(struct inputsource) sources;
};
@@ -90,7 +88,7 @@ isc_lex_create(isc_mem_t *mctx, size_t max_token, isc_lex_t **lexp) {
/*
* Create a lexer.
*/
-
+
REQUIRE(lexp != NULL && *lexp == NULL);
REQUIRE(max_token > 0);
@@ -108,10 +106,11 @@ isc_lex_create(isc_mem_t *mctx, size_t max_token, isc_lex_t **lexp) {
lex->comment_ok = ISC_TRUE;
lex->last_was_eol = ISC_TRUE;
lex->paren_count = 0;
+ lex->saved_paren_count = 0;
memset(lex->specials, 0, 256);
INIT_LIST(lex->sources);
lex->magic = LEX_MAGIC;
-
+
*lexp = lex;
return (ISC_R_SUCCESS);
@@ -189,6 +188,7 @@ new_source(isc_lex_t *lex, isc_boolean_t is_file, isc_boolean_t need_close,
void *input, const char *name)
{
inputsource *source;
+ isc_result_t result;
source = isc_mem_get(lex->mctx, sizeof *source);
if (source == NULL)
@@ -197,18 +197,22 @@ new_source(isc_lex_t *lex, isc_boolean_t is_file, isc_boolean_t need_close,
source->is_file = is_file;
source->need_close = need_close;
source->at_eof = ISC_FALSE;
- source->have_token = ISC_FALSE;
- source->token.type = isc_tokentype_unknown;
- source->token.value.as_pointer = NULL;
- source->char_count = 0;
source->input = input;
source->name = isc_mem_strdup(lex->mctx, name);
if (source->name == NULL) {
isc_mem_put(lex->mctx, source, sizeof *source);
return (ISC_R_NOMEMORY);
}
+ source->pushback = NULL;
+ result = isc_buffer_allocate(lex->mctx, &source->pushback,
+ lex->max_token);
+ if (result != ISC_R_SUCCESS) {
+ isc_mem_free(lex->mctx, source->name);
+ isc_mem_put(lex->mctx, source, sizeof *source);
+ return (result);
+ }
source->line = 1;
- PREPEND(lex->sources, source, link);
+ ISC_LIST_PREPENDUNSAFE(lex->sources, source, link);
return (ISC_R_SUCCESS);
}
@@ -228,8 +232,10 @@ isc_lex_openfile(isc_lex_t *lex, const char *filename) {
if (result != ISC_R_SUCCESS)
return (result);
+#ifdef HAVE_FLOCKFILE
flockfile(stream);
-
+#endif
+
return (new_source(lex, ISC_TRUE, ISC_TRUE, stream, filename));
}
@@ -243,7 +249,9 @@ isc_lex_openstream(isc_lex_t *lex, FILE *stream) {
REQUIRE(VALID_LEX(lex));
+#ifdef HAVE_FLOCKFILE
flockfile(stream);
+#endif
/* This is safe. */
sprintf(name, "stream-%p", stream);
@@ -279,14 +287,17 @@ isc_lex_close(isc_lex_t *lex) {
source = HEAD(lex->sources);
if (source == NULL)
return (ISC_R_NOMORE);
-
+
UNLINK(lex->sources, source, link);
if (source->is_file) {
+#ifdef HAVE_FLOCKFILE
funlockfile((FILE *)(source->input));
+#endif
if (source->need_close)
fclose((FILE *)(source->input));
}
isc_mem_free(lex->mctx, source->name);
+ isc_buffer_free(&source->pushback);
isc_mem_put(lex->mctx, source, sizeof *source);
return (ISC_R_SUCCESS);
@@ -306,14 +317,40 @@ typedef enum {
#define IWSEOL (ISC_LEXOPT_INITIALWS | ISC_LEXOPT_EOL)
-static void
+static void
pushback(inputsource *source, int c) {
- INSIST(source->char_count < 2);
- source->chars[source->char_count++] = c;
+ REQUIRE(source->pushback->current > 0);
+ if (c == EOF) {
+ source->at_eof = ISC_FALSE;
+ return;
+ }
+ source->pushback->current--;
if (c == '\n')
source->line--;
}
+static isc_result_t
+pushandgrow(isc_lex_t *lex, inputsource *source, int c) {
+ if (isc_buffer_availablelength(source->pushback) == 0) {
+ isc_buffer_t *tbuf = NULL;
+ unsigned int oldlen;
+ isc_region_t used;
+ isc_result_t result;
+
+ oldlen = isc_buffer_length(source->pushback);
+ result = isc_buffer_allocate(lex->mctx, &tbuf, oldlen * 2);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+ isc_buffer_usedregion(source->pushback, &used);
+ result = isc_buffer_copyregion(tbuf, &used);
+ INSIST(result == ISC_R_SUCCESS);
+ isc_buffer_free(&source->pushback);
+ source->pushback = tbuf;
+ }
+ isc_buffer_putuint8(source->pushback, (isc_uint8_t)c);
+ return (ISC_R_SUCCESS);
+}
+
isc_result_t
isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
inputsource *source;
@@ -340,6 +377,8 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
source = HEAD(lex->sources);
REQUIRE(tokenp != NULL);
+ lex->saved_paren_count = lex->paren_count;
+
if (source == NULL) {
if ((options & ISC_LEXOPT_NOMORE) != 0) {
tokenp->type = isc_tokentype_nomore;
@@ -351,13 +390,9 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
if (source->result != ISC_R_SUCCESS)
return (source->result);
- if (source->have_token) {
- *tokenp = source->token;
- source->have_token = ISC_FALSE;
- return (ISC_R_SUCCESS);
- }
-
- if (source->char_count == 0 && source->at_eof) {
+ if (isc_buffer_remaininglength(source->pushback) == 0 &&
+ source->at_eof)
+ {
if ((options & ISC_LEXOPT_DNSMULTILINE) != 0 &&
lex->paren_count != 0)
return (ISC_R_UNBALANCED);
@@ -368,6 +403,8 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
return (ISC_R_EOF);
}
+ isc_buffer_compact(source->pushback);
+
saved_options = options;
if ((options & ISC_LEXOPT_DNSMULTILINE) != 0 && lex->paren_count > 0)
options &= ~IWSEOL;
@@ -376,35 +413,48 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
prev = NULL;
remaining = lex->max_token;
do {
- if (source->char_count > 0) {
- source->char_count--;
- c = source->chars[source->char_count];
- } else if (source->is_file) {
- stream = source->input;
+ if (isc_buffer_remaininglength(source->pushback) == 0) {
+ if (source->is_file) {
+ stream = source->input;
+
+#ifdef HAVE_FLOCKFILE
+ c = getc_unlocked(stream);
+#else
+ c = getc(stream);
+#endif
+ if (c == EOF) {
+ if (ferror(stream)) {
+ source->result = ISC_R_IOERROR;
+ return (source->result);
+ }
+ source->at_eof = ISC_TRUE;
+ }
+ } else {
+ buffer = source->input;
- c = getc_unlocked(stream);
- if (c == EOF) {
- if (ferror(stream)) {
- source->result = ISC_R_IOERROR;
- return (source->result);
+ if (buffer->current == buffer->used) {
+ c = EOF;
+ source->at_eof = ISC_TRUE;
+ } else {
+ c = *((char *)buffer->base +
+ buffer->current);
+ buffer->current++;
}
- source->at_eof = ISC_TRUE;
}
- } else {
- buffer = source->input;
-
- if (buffer->current == buffer->used) {
- c = EOF;
- source->at_eof = ISC_TRUE;
- } else {
- c = *((char *)buffer->base + buffer->current);
- buffer->current++;
+ if (c != EOF) {
+ source->result = pushandgrow(lex, source, c);
+ if (source->result != ISC_R_SUCCESS)
+ return (source->result);
}
}
+ if (!source->at_eof)
+ c = isc_buffer_getuint8(source->pushback);
+ else
+ c = EOF;
if (c == '\n')
source->line++;
-
+
if (lex->comment_ok && !no_comments) {
if (!escaped && c == ';' &&
((lex->comments & ISC_LEXCOMMENT_DNSMASTERFILE)
@@ -534,7 +584,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
v = &(tokenp->value);
v->as_textregion.base =
lex->data;
- v->as_textregion.length =
+ v->as_textregion.length =
lex->max_token -
remaining;
}
@@ -564,9 +614,11 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
(c == ' ' || c == '\t' || lex->specials[c])) ||
c == '\r' || c == '\n' || c == EOF) {
pushback(source, c);
+ if (source->result != ISC_R_SUCCESS)
+ return (source->result);
tokenp->type = isc_tokentype_string;
tokenp->value.as_textregion.base = lex->data;
- tokenp->value.as_textregion.length =
+ tokenp->value.as_textregion.length =
lex->max_token - remaining;
done = ISC_TRUE;
continue;
@@ -582,7 +634,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
}
INSIST(remaining > 0);
*curr++ = c;
- *curr = 0;
+ *curr = '\0';
remaining--;
break;
case lexstate_maybecomment:
@@ -620,7 +672,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
no_comments = ISC_FALSE;
state = saved_state;
goto no_read;
- } else
+ } else if (c != '*')
state = lexstate_ccomment;
break;
case lexstate_eatline:
@@ -647,7 +699,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
tokenp->type = isc_tokentype_qstring;
tokenp->value.as_textregion.base =
lex->data;
- tokenp->value.as_textregion.length =
+ tokenp->value.as_textregion.length =
lex->max_token - remaining;
no_comments = ISC_FALSE;
done = ISC_TRUE;
@@ -666,7 +718,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
INSIST(remaining > 0);
prev = curr;
*curr++ = c;
- *curr = 0;
+ *curr = '\0';
remaining--;
}
break;
@@ -681,6 +733,38 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
return (ISC_R_SUCCESS);
}
+isc_result_t
+isc_lex_getmastertoken(isc_lex_t *lex, isc_token_t *token,
+ isc_tokentype_t expect, isc_boolean_t eol)
+{
+ unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF |
+ ISC_LEXOPT_DNSMULTILINE | ISC_LEXOPT_ESCAPE;
+ isc_result_t result;
+
+ if (expect == isc_tokentype_qstring)
+ options |= ISC_LEXOPT_QSTRING;
+ else if (expect == isc_tokentype_number)
+ options |= ISC_LEXOPT_NUMBER;
+ result = isc_lex_gettoken(lex, options, token);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+
+ if (eol && ((token->type == isc_tokentype_eol) ||
+ (token->type == isc_tokentype_eof)))
+ return (ISC_R_SUCCESS);
+ if (token->type == isc_tokentype_string &&
+ expect == isc_tokentype_qstring)
+ return (ISC_R_SUCCESS);
+ if (token->type != expect) {
+ isc_lex_ungettoken(lex, token);
+ if (token->type == isc_tokentype_eol ||
+ token->type == isc_tokentype_eof)
+ return (ISC_R_UNEXPECTEDEND);
+ return (ISC_R_UNEXPECTEDTOKEN);
+ }
+ return (ISC_R_SUCCESS);
+}
+
void
isc_lex_ungettoken(isc_lex_t *lex, isc_token_t *tokenp) {
inputsource *source;
@@ -691,11 +775,15 @@ isc_lex_ungettoken(isc_lex_t *lex, isc_token_t *tokenp) {
REQUIRE(VALID_LEX(lex));
source = HEAD(lex->sources);
REQUIRE(source != NULL);
- REQUIRE(!source->have_token);
REQUIRE(tokenp != NULL);
-
- source->token = *tokenp;
- source->have_token = ISC_TRUE;
+ REQUIRE(isc_buffer_consumedlength(source->pushback) != 0 ||
+ tokenp->type == isc_tokentype_eof);
+
+ UNUSED(tokenp);
+
+ isc_buffer_first(source->pushback);
+ lex->paren_count = lex->saved_paren_count;
+ source->at_eof = ISC_FALSE;
}
char *
diff --git a/lib/isc/lfsr.c b/lib/isc/lfsr.c
index 4abe0605..f98147d3 100644
--- a/lib/isc/lfsr.c
+++ b/lib/isc/lfsr.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lfsr.c,v 1.8 2000/06/22 21:56:58 tale Exp $ */
+/* $Id: lfsr.c,v 1.10 2000/08/01 01:29:30 tale Exp $ */
#include <config.h>
diff --git a/lib/isc/lib.c b/lib/isc/lib.c
index b6ad616f..0fbbf746 100644
--- a/lib/isc/lib.c
+++ b/lib/isc/lib.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lib.c,v 1.4 2000/06/22 21:56:59 tale Exp $ */
+/* $Id: lib.c,v 1.6 2000/08/01 01:29:31 tale Exp $ */
#include <config.h>
diff --git a/lib/isc/log.c b/lib/isc/log.c
index 1e7040e0..bd026fc3 100644
--- a/lib/isc/log.c
+++ b/lib/isc/log.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: log.c,v 1.38.2.3 2000/08/31 23:45:21 gson Exp $ */
+/* $Id: log.c,v 1.49 2000/11/24 01:37:24 marka Exp $ */
/* Principal Authors: DCL */
@@ -24,6 +24,7 @@
#include <errno.h>
#include <stdlib.h>
#include <limits.h>
+#include <time.h>
#include <sys/stat.h>
@@ -251,6 +252,7 @@ isc_log_create(isc_mem_t *mctx, isc_log_t **lctxp, isc_logconfig_t **lcfgp) {
REQUIRE(mctx != NULL);
REQUIRE(lctxp != NULL && *lctxp == NULL);
+ REQUIRE(lcfgp == NULL || *lcfgp == NULL);
lctx = isc_mem_get(mctx, sizeof(*lctx));
if (lctx != NULL) {
@@ -262,7 +264,7 @@ isc_log_create(isc_mem_t *mctx, isc_log_t **lctxp, isc_logconfig_t **lcfgp) {
lctx->debug_level = 0;
ISC_LIST_INIT(lctx->messages);
-
+
RUNTIME_CHECK(isc_mutex_init(&lctx->lock) == ISC_R_SUCCESS);
/*
@@ -290,7 +292,7 @@ isc_log_create(isc_mem_t *mctx, isc_log_t **lctxp, isc_logconfig_t **lcfgp) {
*lctxp = lctx;
if (lcfgp != NULL)
*lcfgp = lcfg;
-
+
} else
if (lctx != NULL)
isc_log_destroy(&lctx);
@@ -303,6 +305,7 @@ isc_logconfig_create(isc_log_t *lctx, isc_logconfig_t **lcfgp) {
isc_logconfig_t *lcfg;
isc_logdestination_t destination;
isc_result_t result = ISC_R_SUCCESS;
+ int level = ISC_LOG_INFO;
REQUIRE(lcfgp != NULL && *lcfgp == NULL);
REQUIRE(VALID_CONTEXT(lctx));
@@ -314,7 +317,7 @@ isc_logconfig_create(isc_log_t *lctx, isc_logconfig_t **lcfgp) {
lcfg->channellists = NULL;
lcfg->channellist_count = 0;
lcfg->duplicate_interval = 0;
- lcfg->highest_level = ISC_LOG_CRITICAL;
+ lcfg->highest_level = level;
lcfg->tag = NULL;
lcfg->dynamic = ISC_FALSE;
@@ -338,7 +341,7 @@ isc_logconfig_create(isc_log_t *lctx, isc_logconfig_t **lcfgp) {
if (result == ISC_R_SUCCESS) {
destination.facility = LOG_DAEMON;
result = isc_log_createchannel(lcfg, "default_syslog",
- ISC_LOG_TOSYSLOG, ISC_LOG_INFO,
+ ISC_LOG_TOSYSLOG, level,
&destination, 0);
}
@@ -349,7 +352,7 @@ isc_logconfig_create(isc_log_t *lctx, isc_logconfig_t **lcfgp) {
destination.file.maximum_size = 0;
result = isc_log_createchannel(lcfg, "default_stderr",
ISC_LOG_TOFILEDESC,
- ISC_LOG_INFO,
+ level,
&destination,
ISC_LOG_PRINTTIME);
}
@@ -445,7 +448,7 @@ isc_log_destroy(isc_log_t **lctxp) {
isc_logconfig_destroy(&lcfg);
}
- RUNTIME_CHECK(isc_mutex_destroy(&lctx->lock) == ISC_R_SUCCESS);
+ DESTROYLOCK(&lctx->lock);
while ((message = ISC_LIST_HEAD(lctx->messages)) != NULL) {
ISC_LIST_UNLINK(lctx->messages, message, link);
@@ -523,7 +526,7 @@ isc_logconfig_destroy(isc_logconfig_t **lcfgp) {
lcfg->dynamic = ISC_FALSE;
if (lcfg->tag != NULL)
- isc_mem_free(lcfg->lctx->mctx, lcfg->tag);
+ isc_mem_free(lcfg->lctx->mctx, lcfg->tag);
lcfg->tag = NULL;
lcfg->highest_level = 0;
lcfg->duplicate_interval = 0;
@@ -703,6 +706,7 @@ isc_log_createchannel(isc_logconfig_t *lcfg, const char *name,
channel->type = type;
channel->level = level;
channel->flags = flags;
+ ISC_LINK_INIT(channel, link);
switch (type) {
case ISC_LOG_TOSYSLOG:
@@ -738,7 +742,7 @@ isc_log_createchannel(isc_logconfig_t *lcfg, const char *name,
isc_mem_put(mctx, channel, sizeof(*channel));
return (ISC_R_UNEXPECTED);
}
-
+
ISC_LIST_PREPEND(lcfg->channels, channel, link);
/*
@@ -852,8 +856,6 @@ isc_log_vwrite1(isc_log_t *lctx, isc_logcategory_t *category,
void
isc_log_setcontext(isc_log_t *lctx) {
- REQUIRE(isc_lctx == NULL);
-
isc_lctx = lctx;
}
@@ -888,7 +890,7 @@ isc_log_getduplicateinterval(isc_logconfig_t *lcfg) {
isc_result_t
isc_log_settag(isc_logconfig_t *lcfg, const char *tag) {
REQUIRE(VALID_CONFIG(lcfg));
-
+
if (tag != NULL && *tag != '\0') {
lcfg->tag = isc_mem_strdup(lcfg->lctx->mctx, tag);
if (lcfg->tag == NULL)
@@ -966,7 +968,7 @@ assignchannel(isc_logconfig_t *lcfg, unsigned int category_id,
new_item->channel = channel;
new_item->module = module;
- ISC_LIST_PREPEND(lcfg->channellists[category_id], new_item, link);
+ ISC_LIST_PREPENDUNSAFE(lcfg->channellists[category_id], new_item, link);
/*
* Remember the highest logging level set by any channel in the
@@ -992,7 +994,7 @@ sync_channellist(isc_logconfig_t *lcfg) {
unsigned int bytes;
isc_log_t *lctx;
void *lists;
-
+
REQUIRE(VALID_CONFIG(lcfg));
lctx = lcfg->lctx;
@@ -1105,7 +1107,7 @@ roll_log(isc_logchannel_t *channel) {
* Since the highest number is one less than FILE_VERSIONS(channel)
* when not doing infinite log rolling, greatest will need to be
* decremented when it is equal to -- or greater than --
- * FILE_VERSIONS(channel). When greatest is less than
+ * FILE_VERSIONS(channel). When greatest is less than
* FILE_VERSIONS(channel), it is already suitable for use as
* the maximum version number.
*/
@@ -1206,7 +1208,7 @@ isc_log_wouldlog(isc_log_t *lctx, int level) {
* messages that the debug level is not high enough to print.
*
* If the level is (mathematically) less than or equal to the
- * highest_level, or if there is a dynamic channel and the level is
+ * highest_level, or if there is a dynamic channel and the level is
* less than or equal to the debug level, the main loop must be
* entered to see if the message should really be output.
*
@@ -1217,9 +1219,9 @@ isc_log_wouldlog(isc_log_t *lctx, int level) {
* dynamically changed.
*/
- if (lctx == NULL)
+ if (lctx == NULL || lctx->logconfig == NULL)
return (ISC_FALSE);
-
+
return (ISC_TF(level <= lctx->logconfig->highest_level ||
(lctx->logconfig->dynamic &&
level <= lctx->debug_level)));
@@ -1302,7 +1304,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
* default channel.
*/
category_channels = &default_channel;
-
+
if (category_channels->module != NULL &&
category_channels->module != module) {
category_channels = ISC_LIST_NEXT(category_channels,
@@ -1424,7 +1426,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
*
* Setting the interval to be
* to be longer will obviously
- * not cause the expired
+ * not cause the expired
* message to spring back into
* existence.
*/
diff --git a/lib/isc/md5.c b/lib/isc/md5.c
index 90242c5a..17e46579 100644
--- a/lib/isc/md5.c
+++ b/lib/isc/md5.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: md5.c,v 1.6 2000/06/22 21:57:00 tale Exp $ */
+/* $Id: md5.c,v 1.8 2000/08/01 01:29:33 tale Exp $ */
/*
* This code implements the MD5 message-digest algorithm.
@@ -214,7 +214,7 @@ isc_md5_update(isc_md5_t *ctx, const unsigned char *buf, unsigned int len) {
}
/*
- * Final wrapup - pad to 64-byte boundary with the bit pattern
+ * Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
*/
void
diff --git a/lib/isc/mem.c b/lib/isc/mem.c
index b9da015e..0e361c61 100644
--- a/lib/isc/mem.c
+++ b/lib/isc/mem.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1997-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: mem.c,v 1.52 2000/06/22 21:57:01 tale Exp $ */
+/* $Id: mem.c,v 1.68 2000/12/01 00:52:38 gson Exp $ */
#include <config.h>
@@ -29,34 +29,10 @@
#include <isc/ondestroy.h>
#include <isc/string.h>
-#ifndef ISC_SINGLETHREADED
#include <isc/mutex.h>
#include <isc/util.h>
-#else
-#define LOCK(l)
-#define UNLOCK(l)
-#endif
-
-isc_boolean_t isc_mem_debugging = ISC_FALSE;
-
-#ifndef ISC_MEM_FILL
- /*
- * XXXMPA
- * We want this on during development to catch:
- * 1. some reference after free bugs.
- * 2. some failure to initalise bugs.
- */
-#define ISC_MEM_FILL 1
-#endif
-
-#ifndef ISC_MEMPOOL_NAMES
-/*
- * During development it is nice to be able to see names associated with
- * memory pools.
- */
-#define ISC_MEMPOOL_NAMES 1
-#endif
+unsigned int isc_mem_debugging = 0;
/*
* Constants.
@@ -67,13 +43,29 @@ isc_boolean_t isc_mem_debugging = ISC_FALSE;
#define ALIGNMENT_SIZE 8
#define NUM_BASIC_BLOCKS 64 /* must be > 1 */
#define TABLE_INCREMENT 1024
+#define DEBUGLIST_COUNT 1024
/*
* Types.
*/
+#if ISC_MEM_TRACKLINES
+typedef struct debuglink debuglink_t;
+struct debuglink {
+ ISC_LINK(debuglink_t) link;
+ const void *ptr[DEBUGLIST_COUNT];
+ const char *file[DEBUGLIST_COUNT];
+ unsigned int line[DEBUGLIST_COUNT];
+ unsigned int count;
+};
-typedef struct element element;
+#define FLARG_PASS , file, line
+#define FLARG , const char *file, int line
+#else
+#define FLARG_PASS
+#define FLARG
+#endif
+typedef struct element element;
struct element {
element * next;
};
@@ -121,7 +113,15 @@ struct isc_mem {
size_t quota;
size_t total;
size_t inuse;
+ size_t hi_water;
+ size_t lo_water;
+ isc_boolean_t hi_called;
+ isc_mem_water_t water;
+ void * water_arg;
ISC_LIST(isc_mempool_t) pools;
+#if ISC_MEM_TRACKLINES
+ ISC_LIST(debuglink_t) debuglist;
+#endif
};
#define MEMPOOL_MAGIC 0x4D454d70U /* MEMp. */
@@ -154,6 +154,120 @@ struct isc_mempool {
* Private Inline-able.
*/
+#if ! ISC_MEM_TRACKLINES
+#define ADD_TRACE(a, b, c, d, e)
+#define DELETE_TRACE(a, b, c, d, e)
+#else
+#define ADD_TRACE(a, b, c, d, e) add_trace_entry(a, b, c, d, e)
+#define DELETE_TRACE(a, b, c, d, e) delete_trace_entry(a, b, c, d, e)
+
+#define MEM_TRACE ((isc_mem_debugging & ISC_MEM_DEBUGTRACE) != 0)
+#define MEM_RECORD ((isc_mem_debugging & ISC_MEM_DEBUGRECORD) != 0)
+
+/*
+ * mctx must be locked.
+ */
+static inline void
+add_trace_entry(isc_mem_t *mctx, const void *ptr, unsigned int size
+ FLARG)
+{
+ debuglink_t *dl;
+ unsigned int i;
+
+ if (MEM_TRACE)
+ fprintf(stderr, "add %p size %u file %s line %u mctx %p\n",
+ ptr, size, file, line, mctx);
+
+ if (!MEM_RECORD)
+ return;
+
+ dl = ISC_LIST_HEAD(mctx->debuglist);
+ while (dl != NULL) {
+ if (dl->count == DEBUGLIST_COUNT)
+ goto next;
+ for (i = 0 ; i < DEBUGLIST_COUNT ; i++) {
+ if (dl->ptr[i] == NULL) {
+ dl->ptr[i] = ptr;
+ dl->file[i] = file;
+ dl->line[i] = line;
+ dl->count++;
+ return;
+ }
+ }
+ next:
+ dl = ISC_LIST_NEXT(dl, link);
+ }
+
+ dl = malloc(sizeof(debuglink_t));
+ INSIST(dl != NULL);
+
+ ISC_LINK_INIT(dl, link);
+ for (i = 1 ; i < DEBUGLIST_COUNT ; i++) {
+ dl->ptr[i] = NULL;
+ dl->file[i] = NULL;
+ dl->line[i] = 0;
+ }
+
+ dl->ptr[0] = ptr;
+ dl->file[0] = file;
+ dl->line[0] = line;
+ dl->count = 1;
+
+ ISC_LIST_PREPEND(mctx->debuglist, dl, link);
+}
+
+static inline void
+delete_trace_entry(isc_mem_t *mctx, const void *ptr, unsigned int size,
+ const char *file, unsigned int line)
+{
+ debuglink_t *dl;
+ unsigned int i;
+
+ if (MEM_TRACE)
+ fprintf(stderr, "del %p size %u file %s line %u mctx %p\n",
+ ptr, size, file, line, mctx);
+
+ if (!MEM_RECORD)
+ return;
+
+ dl = ISC_LIST_HEAD(mctx->debuglist);
+ while (dl != NULL) {
+ for (i = 0 ; i < DEBUGLIST_COUNT ; i++) {
+ if (dl->ptr[i] == ptr) {
+ dl->ptr[i] = NULL;
+ dl->file[i] = NULL;
+ dl->line[i] = 0;
+
+ INSIST(dl->count > 0);
+ dl->count--;
+ if (dl->count == 0) {
+ ISC_LIST_UNLINK(mctx->debuglist,
+ dl, link);
+ free(dl);
+ }
+ return;
+ }
+ }
+ dl = ISC_LIST_NEXT(dl, link);
+ }
+
+ /*
+ * If we get here, we didn't find the item on the list. We're
+ * screwed.
+ */
+ INSIST(dl != NULL);
+}
+#endif /* ISC_MEM_TRACKLINES */
+
+static inline size_t
+rmsize(size_t size) {
+ /*
+ * round down to ALIGNMENT_SIZE
+ */
+ size -= (size % ALIGNMENT_SIZE);
+ return (size);
+}
+
static inline size_t
quantize(size_t size) {
int temp;
@@ -167,7 +281,7 @@ quantize(size_t size) {
if (size == 0)
return (ALIGNMENT_SIZE);
temp = size + (ALIGNMENT_SIZE - 1);
- return (temp - temp % ALIGNMENT_SIZE);
+ return (temp - temp % ALIGNMENT_SIZE);
}
static inline void
@@ -319,7 +433,7 @@ more_frags(isc_mem_t *ctx, size_t new_size) {
* hit the quota for this context.
*/
/*
- * XXXRTH "At quota" notification here.
+ * XXXRTH "At quota" notification here.
*/
/*
* Maybe we can split one of our existing
@@ -341,10 +455,21 @@ more_frags(isc_mem_t *ctx, size_t new_size) {
*/
curr = new;
next = curr + new_size;
+ total_size -= new_size;
for (i = 0; i < (frags - 1); i++) {
((element *)curr)->next = (element *)next;
curr = next;
next += new_size;
+ total_size -= new_size;
+ }
+ /*
+ * Add the remaining fragment of the basic block to a free list.
+ */
+ total_size = rmsize(total_size);
+ if (total_size > 0) {
+ ((element *)next)->next = ctx->freelists[total_size];
+ ctx->freelists[total_size] = (element *)next;
+ ctx->stats[total_size].freefrags++;
}
/*
* curr is now pointing at the last block in the
@@ -385,7 +510,7 @@ mem_getunlocked(isc_mem_t *ctx, size_t size) {
goto done;
}
- /*
+ /*
* If there are no blocks in the free list for this size, get a chunk
* of memory and then break it up into "new_size"-sized blocks, adding
* them to the free list.
@@ -399,7 +524,7 @@ mem_getunlocked(isc_mem_t *ctx, size_t size) {
ret = ctx->freelists[new_size];
ctx->freelists[new_size] = ctx->freelists[new_size]->next;
- /*
+ /*
* The stats[] uses the _actual_ "size" requested by the
* caller, with the caveat (in the code above) that "size" >= the
* max. size (max_size) ends up getting recorded as a call to
@@ -453,7 +578,7 @@ mem_putunlocked(isc_mem_t *ctx, void *mem, size_t size) {
((element *)mem)->next = ctx->freelists[new_size];
ctx->freelists[new_size] = (element *)mem;
- /*
+ /*
* The stats[] uses the _actual_ "size" requested by the
* caller, with the caveat (in the code above) that "size" >= the
* max. size (max_size) ends up getting recorded as a call to
@@ -546,9 +671,17 @@ isc_mem_createx(size_t init_max_size, size_t target_size,
ctx->quota = 0;
ctx->total = 0;
ctx->inuse = 0;
+ ctx->hi_water = 0;
+ ctx->lo_water = 0;
+ ctx->hi_called = ISC_FALSE;
+ ctx->water = NULL;
+ ctx->water_arg = NULL;
ctx->magic = MEM_MAGIC;
isc_ondestroy_init(&ctx->ondestroy);
ISC_LIST_INIT(ctx->pools);
+#if ISC_MEM_TRACKLINES
+ ISC_LIST_INIT(ctx->debuglist);
+#endif
*ctxp = ctx;
return (ISC_R_SUCCESS);
@@ -571,6 +704,20 @@ destroy(isc_mem_t *ctx) {
ctx->magic = 0;
INSIST(ISC_LIST_EMPTY(ctx->pools));
+#if ISC_MEM_TRACKLINES
+ if (ctx->checkfree)
+ INSIST(ISC_LIST_EMPTY(ctx->debuglist));
+ else {
+ debuglink_t *dl;
+
+ for (dl = ISC_LIST_HEAD(ctx->debuglist);
+ dl != NULL;
+ dl = ISC_LIST_HEAD(ctx->debuglist)) {
+ ISC_LIST_UNLINK(ctx->debuglist, dl, link);
+ free(dl);
+ }
+ }
+#endif
INSIST(ctx->references == 0);
if (ctx->checkfree) {
@@ -583,7 +730,7 @@ destroy(isc_mem_t *ctx) {
memset(ctx->basic_table[i], 0x0,
NUM_BASIC_BLOCKS * ctx->mem_target);
#endif
-
+
for (i = 0; i < ctx->basic_table_count; i++)
(ctx->memfree)(ctx->arg, ctx->basic_table[i]);
@@ -593,7 +740,7 @@ destroy(isc_mem_t *ctx) {
ondest = ctx->ondestroy;
- (void)isc_mutex_destroy(&ctx->lock);
+ DESTROYLOCK(&ctx->lock);
(ctx->memfree)(ctx->arg, ctx);
isc_ondestroy_notify(&ondest, ctx);
@@ -633,6 +780,45 @@ isc_mem_detach(isc_mem_t **ctxp) {
*ctxp = NULL;
}
+/*
+ * isc_mem_putanddetach() is the equivalent of:
+ *
+ * mctx = NULL;
+ * isc_mem_attach(ptr->mctx, &mctx);
+ * isc_mem_detach(&ptr->mctx);
+ * isc_mem_put(mctx, ptr, sizeof(*ptr);
+ * isc_mem_detach(&mctx);
+ */
+
+void
+isc__mem_putanddetach(isc_mem_t **ctxp, void *ptr, size_t size FLARG) {
+ isc_mem_t *ctx;
+ isc_boolean_t want_destroy = ISC_FALSE;
+
+ REQUIRE(ctxp != NULL);
+ ctx = *ctxp;
+ REQUIRE(VALID_CONTEXT(ctx));
+ REQUIRE(ptr != NULL);
+
+ /*
+ * Must be before mem_putunlocked() as ctxp is usually within
+ * [ptr..ptr+size).
+ */
+ *ctxp = NULL;
+
+ LOCK(&ctx->lock);
+ DELETE_TRACE(ctx, ptr, size, file, line);
+ mem_putunlocked(ctx, ptr, size);
+ INSIST(ctx->references > 0);
+ ctx->references--;
+ if (ctx->references == 0)
+ want_destroy = ISC_TRUE;
+ UNLOCK(&ctx->lock);
+
+ if (want_destroy)
+ destroy(ctx);
+}
+
void
isc_mem_destroy(isc_mem_t **ctxp) {
isc_mem_t *ctx;
@@ -663,7 +849,7 @@ isc_mem_destroy(isc_mem_t **ctxp) {
isc_result_t
isc_mem_ondestroy(isc_mem_t *ctx, isc_task_t *task, isc_event_t **event) {
isc_result_t res;
-
+
LOCK(&ctx->lock);
res = isc_ondestroy_register(&ctx->ondestroy, task, event);
UNLOCK(&ctx->lock);
@@ -676,27 +862,14 @@ isc_result_t
isc_mem_restore(isc_mem_t *ctx) {
isc_result_t result;
- result = isc_mutex_init(&ctx->lock);
+ result = isc_mutex_init(&ctx->lock);
if (result != ISC_R_SUCCESS)
ctx->magic = 0;
return (result);
}
-void *
-isc__mem_get(isc_mem_t *ctx, size_t size) {
- void *ret;
-
- REQUIRE(VALID_CONTEXT(ctx));
-
- LOCK(&ctx->lock);
- ret = mem_getunlocked(ctx, size);
- UNLOCK(&ctx->lock);
-
- return (ret);
-}
-
-#if ISC_MEM_FILL != 0 && ISC_MEM_CHECKOVERRUN != 0
+#if ISC_MEM_FILL && ISC_MEM_CHECKOVERRUN
static inline void
check_overrun(void *mem, size_t size, size_t new_size) {
unsigned char *cp;
@@ -711,34 +884,64 @@ check_overrun(void *mem, size_t size, size_t new_size) {
}
#endif
-void
-isc__mem_put(isc_mem_t *ctx, void *mem, size_t size) {
+void *
+isc__mem_get(isc_mem_t *ctx, size_t size FLARG) {
+ void *ptr;
+ isc_boolean_t call_water = ISC_FALSE;
+
REQUIRE(VALID_CONTEXT(ctx));
LOCK(&ctx->lock);
- mem_putunlocked(ctx, mem, size);
+ ptr = mem_getunlocked(ctx, size);
+ ADD_TRACE(ctx, ptr, size, file, line);
+ if (ctx->hi_water != 0 && !ctx->hi_called &&
+ ctx->inuse > ctx->hi_water) {
+ ctx->hi_called = ISC_TRUE;
+ call_water = ISC_TRUE;
+ }
UNLOCK(&ctx->lock);
-}
-void *
-isc__mem_getdebug(isc_mem_t *ctx, size_t size, const char *file, int line) {
- void *ptr;
+ /* XXX remove */
+ if (ctx->hi_water)
+ fprintf(stderr,"inuse %u, total %u\n", ctx->inuse, ctx->total);
+
+ if (call_water) {
+ /* XXX remove */
+ fprintf(stderr, "calling water(%p,ISC_MEM_HIWATER)\n",
+ ctx->water_arg);
+ (ctx->water)(ctx->water_arg, ISC_MEM_HIWATER);
+ }
- ptr = isc__mem_get(ctx, size);
- if (isc_mem_debugging)
- fprintf(stderr, "%s:%d: mem_get(%p, %lu) -> %p\n", file, line,
- ctx, (unsigned long)size, ptr);
return (ptr);
}
void
-isc__mem_putdebug(isc_mem_t *ctx, void *ptr, size_t size, const char *file,
- int line)
+isc__mem_put(isc_mem_t *ctx, void *ptr, size_t size FLARG)
{
- if (isc_mem_debugging)
- fprintf(stderr, "%s:%d: mem_put(%p, %p, %lu)\n", file, line,
- ctx, ptr, (unsigned long)size);
- isc__mem_put(ctx, ptr, size);
+ isc_boolean_t call_water = ISC_FALSE;
+
+ REQUIRE(VALID_CONTEXT(ctx));
+ REQUIRE(ptr != NULL);
+
+ LOCK(&ctx->lock);
+ DELETE_TRACE(ctx, ptr, size, file, line);
+ mem_putunlocked(ctx, ptr, size);
+ if (ctx->hi_called && ctx->inuse < ctx->lo_water) {
+ ctx->hi_called = ISC_FALSE;
+ call_water = ISC_TRUE;
+ }
+ UNLOCK(&ctx->lock);
+
+ /* XXX remove */
+ if (ctx->hi_water)
+ fprintf(stderr,"inuse %u, total %u\n", ctx->inuse, ctx->total);
+
+ if (call_water) {
+ /* XXX remove */
+ fprintf(stderr, "calling water(%p,ISC_MEM_LOWATER)\n",
+ ctx->water_arg);
+ (ctx->water)(ctx->water_arg, ISC_MEM_LOWATER);
+ }
}
isc_result_t
@@ -759,7 +962,7 @@ isc_mem_preallocate(isc_mem_t *ctx) {
}
mem_putunlocked(ctx, ptr, i);
}
-
+
UNLOCK(&ctx->lock);
return (result);
@@ -783,10 +986,10 @@ isc_mem_stats(isc_mem_t *ctx, FILE *out) {
if (s->totalgets == 0 && s->gets == 0)
continue;
- fprintf(out, "%s%5d: %11lu gets, %11lu rem",
+ fprintf(out, "%s%5lu: %11lu gets, %11lu rem",
(i == ctx->max_size) ? ">=" : " ",
- i, s->totalgets, s->gets);
- if (s->blocks != 0)
+ (unsigned long) i, s->totalgets, s->gets);
+ if (s->blocks != 0 || s->freefrags != 0)
fprintf(out, " (%lu bl, %lu ff)",
s->blocks, s->freefrags);
fputc('\n', out);
@@ -808,14 +1011,35 @@ isc_mem_stats(isc_mem_t *ctx, FILE *out) {
"freemax", "fillcount", "gets", "L");
}
while (pool != NULL) {
- fprintf(out, "%15s %10u %10u %10u %10u %10u %10u %10u %s\n",
- pool->name, pool->size, pool->maxalloc,
+ fprintf(out, "%15s %10lu %10u %10u %10u %10u %10u %10u %s\n",
+ pool->name, (unsigned long) pool->size, pool->maxalloc,
pool->allocated, pool->freecount, pool->freemax,
pool->fillcount, pool->gets,
(pool->lock == NULL ? "N" : "Y"));
pool = ISC_LIST_NEXT(pool, link);
}
+#if ISC_MEM_TRACKLINES
+ if (isc_mem_debugging > 1) {
+ debuglink_t *dl;
+ unsigned int i;
+
+ fprintf(out, "DUMP OF ALL OUTSTANDING MEMORY ALLOCATIONS\n");
+ dl = ISC_LIST_HEAD(ctx->debuglist);
+ if (dl == NULL)
+ fprintf(out, "\tNone.\n");
+ while (dl != NULL) {
+ for (i = 0 ; i < DEBUGLIST_COUNT ; i++)
+ if (dl->ptr[i] != NULL)
+ fprintf(out,
+ "\tptr %p file %s line %u\n",
+ dl->ptr[i], dl->file[i],
+ dl->line[i]);
+ dl = ISC_LIST_NEXT(dl, link);
+ }
+ }
+#endif
+
UNLOCK(&ctx->lock);
}
@@ -840,12 +1064,12 @@ isc_mem_valid(isc_mem_t *ctx, void *ptr) {
* size of the object allocated (with some additional overhead).
*/
-void *
-isc__mem_allocate(isc_mem_t *ctx, size_t size) {
+static void *
+isc__mem_allocateunlocked(isc_mem_t *ctx, size_t size) {
size_info *si;
size += ALIGNMENT_SIZE;
- si = isc__mem_get(ctx, size);
+ si = mem_getunlocked(ctx, size);
if (si == NULL)
return (NULL);
si->u.size = size;
@@ -853,36 +1077,34 @@ isc__mem_allocate(isc_mem_t *ctx, size_t size) {
}
void *
-isc__mem_allocatedebug(isc_mem_t *ctx, size_t size, const char *file,
- int line) {
+isc__mem_allocate(isc_mem_t *ctx, size_t size FLARG) {
size_info *si;
- si = isc__mem_allocate(ctx, size);
- if (si == NULL)
- return (NULL);
- if (isc_mem_debugging)
- fprintf(stderr, "%s:%d: mem_get(%p, %lu) -> %p\n", file, line,
- ctx, (unsigned long)si[-1].u.size, si);
- return (si);
-}
+ REQUIRE(VALID_CONTEXT(ctx));
-void
-isc__mem_free(isc_mem_t *ctx, void *ptr) {
- size_info *si;
+ LOCK(&ctx->lock);
+ si = isc__mem_allocateunlocked(ctx, size);
+#if ISC_MEM_TRACKLINES
+ if (si != NULL)
+ ADD_TRACE(ctx, si, si[-1].u.size, file, line);
+#endif
+ UNLOCK(&ctx->lock);
- si = &(((size_info *)ptr)[-1]);
- isc__mem_put(ctx, si, si->u.size);
+ return (si);
}
void
-isc__mem_freedebug(isc_mem_t *ctx, void *ptr, const char *file, int line) {
+isc__mem_free(isc_mem_t *ctx, void *ptr FLARG) {
size_info *si;
+ REQUIRE(VALID_CONTEXT(ctx));
+ REQUIRE(ptr != NULL);
+
si = &(((size_info *)ptr)[-1]);
- if (isc_mem_debugging)
- fprintf(stderr, "%s:%d: mem_put(%p, %p, %lu)\n", file, line,
- ctx, ptr, (unsigned long)si->u.size);
- isc__mem_put(ctx, si, si->u.size);
+ LOCK(&ctx->lock);
+ DELETE_TRACE(ctx, ptr, si->u.size, file, line);
+ mem_putunlocked(ctx, si, si->u.size);
+ UNLOCK(&ctx->lock);
}
/*
@@ -890,31 +1112,21 @@ isc__mem_freedebug(isc_mem_t *ctx, void *ptr, const char *file, int line) {
*/
char *
-isc__mem_strdup(isc_mem_t *mctx, const char *s) {
+isc__mem_strdup(isc_mem_t *mctx, const char *s FLARG) {
size_t len;
char *ns;
+ REQUIRE(VALID_CONTEXT(mctx));
+ REQUIRE(s != NULL);
+
len = strlen(s);
- ns = isc__mem_allocate(mctx, len + 1);
- if (ns == NULL)
- return (NULL);
- strncpy(ns, s, len + 1);
-
- return (ns);
-}
-char *
-isc__mem_strdupdebug(isc_mem_t *mctx, const char *s, const char *file,
- int line) {
- char *ptr;
- size_info *si;
+ ns = isc__mem_allocate(mctx, len + 1 FLARG_PASS);
- ptr = isc__mem_strdup(mctx, s);
- si = &(((size_info *)ptr)[-1]);
- if (isc_mem_debugging)
- fprintf(stderr, "%s:%d: mem_get(%p, %lu) -> %p\n", file, line,
- mctx, (unsigned long)si->u.size, ptr);
- return (ptr);
+ if (ns != NULL)
+ strncpy(ns, s, len + 1);
+
+ return (ns);
}
void
@@ -980,92 +1192,35 @@ isc_mem_inuse(isc_mem_t *ctx) {
return (inuse);
}
-#ifdef ISC_MEMCLUSTER_LEGACY
-
-/*
- * Public Legacy.
- */
-
-static isc_mem_t *default_context = NULL;
-
-int
-meminit(size_t init_max_size, size_t target_size) {
- /*
- * Need default_context lock here.
- */
- if (default_context != NULL)
- return (-1);
- return (isc_mem_create(init_max_size, target_size, &default_context));
-}
-
-isc_mem_t *
-mem_default_context(void) {
- /*
- * Need default_context lock here.
- */
- if (default_context == NULL && meminit(0, 0) == -1)
- return (NULL);
- return (default_context);
-}
-
-void *
-isc__legacy_memget(size_t size) {
- /*
- * Need default_context lock here.
- */
- if (default_context == NULL && meminit(0, 0) == -1)
- return (NULL);
- return (isc__mem_get(default_context, size));
-}
-
-void
-isc__legacy_memput(void *mem, size_t size) {
- /*
- * Need default_context lock here.
- */
- REQUIRE(default_context != NULL);
- isc__mem_put(default_context, mem, size);
-}
-
-void *
-isc__legacy_memget_debug(size_t size, const char *file, int line) {
- void *ptr;
- ptr = isc__legacy_memget(size);
- if (isc_mem_debugging)
- fprintf(stderr, "%s:%d: memget(%lu) -> %p\n", file, line,
- (unsigned long)size, ptr);
- return (ptr);
-}
-
void
-isc__legacy_memput_debug(void *ptr, size_t size, const char *file, int line) {
- if (isc_mem_debugging)
- fprintf(stderr, "%s:%d: memput(%p, %lu)\n", file, line,
- ptr, (unsigned long)size);
- isc__legacy_memput(ptr, size);
-}
+isc_mem_setwater(isc_mem_t *ctx, isc_mem_water_t water, void *water_arg,
+ size_t hiwater, size_t lowater)
+{
+ REQUIRE(VALID_CONTEXT(ctx));
-int
-memvalid(void *ptr) {
- /*
- * Need default_context lock here.
- */
- REQUIRE(default_context != NULL);
- return (isc_mem_valid(default_context, ptr));
-}
+ if (water != NULL) {
+ REQUIRE(hiwater > lowater);
+ REQUIRE(hiwater > 0);
+ REQUIRE(lowater > 0);
+ }
-void
-memstats(FILE *out) {
- /*
- * Need default_context lock here.
- */
- REQUIRE(default_context != NULL);
- isc_mem_stats(default_context, out);
+ LOCK(&ctx->lock);
+ if (water == NULL) {
+ ctx->water = NULL;
+ ctx->water_arg = NULL;
+ ctx->hi_water = 0;
+ ctx->lo_water = 0;
+ ctx->hi_called = ISC_FALSE;
+ } else {
+ ctx->water = water;
+ ctx->water_arg = water_arg;
+ ctx->hi_water = hiwater;
+ ctx->lo_water = lowater;
+ ctx->hi_called = ISC_FALSE;
+ }
+ UNLOCK(&ctx->lock);
}
-#endif /* ISC_MEMCLUSTER_LEGACY */
-
-
/*
* Memory pool stuff
*/
@@ -1175,7 +1330,7 @@ isc_mempool_create(isc_mem_t *mctx, size_t size, isc_mempool_t **mpctxp) {
*mpctxp = mpctx;
- ISC_LIST_APPEND(mctx->pools, mpctx, link);
+ ISC_LIST_APPENDUNSAFE(mctx->pools, mpctx, link);
UNLOCK(&mctx->lock);
@@ -1230,7 +1385,7 @@ isc_mempool_destroy(isc_mempool_t **mpctxp) {
* Remove our linked list entry from the memory context.
*/
ISC_LIST_UNLINK(mctx->pools, mpctx, link);
-
+
mpctx->magic = 0;
mem_putunlocked(mpctx->mctx, mpctx, sizeof(isc_mempool_t));
@@ -1253,7 +1408,7 @@ isc_mempool_associatelock(isc_mempool_t *mpctx, isc_mutex_t *lock) {
}
void *
-isc__mempool_get(isc_mempool_t *mpctx) {
+isc__mempool_get(isc_mempool_t *mpctx FLARG) {
element *item;
isc_mem_t *mctx;
unsigned int i;
@@ -1317,11 +1472,17 @@ isc__mempool_get(isc_mempool_t *mpctx) {
if (mpctx->lock != NULL)
UNLOCK(mpctx->lock);
+ if (item != NULL) {
+ LOCK(&mctx->lock);
+ ADD_TRACE(mctx, item, mpctx->size, file, line);
+ UNLOCK(&mctx->lock);
+ }
+
return (item);
}
void
-isc__mempool_put(isc_mempool_t *mpctx, void *mem) {
+isc__mempool_put(isc_mempool_t *mpctx, void *mem FLARG) {
isc_mem_t *mctx;
element *item;
@@ -1336,11 +1497,15 @@ isc__mempool_put(isc_mempool_t *mpctx, void *mem) {
INSIST(mpctx->allocated > 0);
mpctx->allocated--;
+ DELETE_TRACE(mctx, mem, mpctx->size, file, line);
+
/*
* If our free list is full, return this to the mctx directly.
*/
if (mpctx->freecount >= mpctx->freemax) {
- isc__mem_put(mctx, mem, mpctx->size);
+ LOCK(&mctx->lock);
+ mem_putunlocked(mctx, mem, mpctx->size);
+ UNLOCK(&mctx->lock);
if (mpctx->lock != NULL)
UNLOCK(mpctx->lock);
return;
@@ -1358,28 +1523,6 @@ isc__mempool_put(isc_mempool_t *mpctx, void *mem) {
UNLOCK(mpctx->lock);
}
-void *
-isc__mempool_getdebug(isc_mempool_t *mpctx, const char *file, int line) {
- void *ptr;
-
- ptr = isc__mempool_get(mpctx);
- if (isc_mem_debugging)
- fprintf(stderr, "%s:%d: mempool_get(%p) -> %p\n", file, line,
- mpctx, ptr);
-
- return (ptr);
-}
-
-void
-isc__mempool_putdebug(isc_mempool_t *mpctx, void *ptr, const char *file,
- int line)
-{
- if (isc_mem_debugging)
- fprintf(stderr, "%s:%d: mempool_put(%p, %p)\n", file, line,
- mpctx, ptr);
- isc__mempool_put(mpctx, ptr);
-}
-
/*
* Quotas
*/
diff --git a/lib/isc/mutexblock.c b/lib/isc/mutexblock.c
index 02932e3b..e4ab6a74 100644
--- a/lib/isc/mutexblock.c
+++ b/lib/isc/mutexblock.c
@@ -1,25 +1,26 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: mutexblock.c,v 1.8 2000/06/22 21:57:02 tale Exp $ */
+/* $Id: mutexblock.c,v 1.13 2000/08/29 00:25:23 bwelling Exp $ */
#include <config.h>
#include <isc/mutexblock.h>
+#include <isc/util.h>
isc_result_t
isc_mutexblock_init(isc_mutex_t *block, unsigned int count) {
@@ -31,7 +32,7 @@ isc_mutexblock_init(isc_mutex_t *block, unsigned int count) {
if (result != ISC_R_SUCCESS) {
i--;
while (i > 0) {
- isc_mutex_destroy(&block[i]);
+ DESTROYLOCK(&block[i]);
i--;
}
return (result);
diff --git a/lib/isc/netaddr.c b/lib/isc/netaddr.c
index 884aa060..0bf067c6 100644
--- a/lib/isc/netaddr.c
+++ b/lib/isc/netaddr.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: netaddr.c,v 1.10 2000/06/22 21:57:03 tale Exp $ */
+/* $Id: netaddr.c,v 1.12 2000/08/01 01:29:37 tale Exp $ */
#include <config.h>
@@ -59,12 +59,12 @@ isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b,
unsigned int ipabytes; /* Length of whole IP address in bytes */
unsigned int nbytes; /* Number of significant whole bytes */
unsigned int nbits; /* Number of significant leftover bits */
-
+
REQUIRE(a != NULL && b != NULL);
if (a->family != b->family)
return (ISC_FALSE);
-
+
switch (a->family) {
case AF_INET:
pa = (const unsigned char *) &a->type.in;
@@ -125,7 +125,7 @@ isc_netaddr_totext(const isc_netaddr_t *netaddr, isc_buffer_t *target) {
if (alen > isc_buffer_availablelength(target))
return (ISC_R_NOSPACE);
-
+
isc_buffer_putmem(target, (unsigned char *)abuf, alen);
return (ISC_R_SUCCESS);
@@ -148,7 +148,7 @@ isc_netaddr_format(isc_netaddr_t *na, char *array, unsigned int size) {
else
result = ISC_R_NOSPACE;
}
-
+
if (result != ISC_R_SUCCESS) {
snprintf(array, size,
"<unknown address, family %u>",
@@ -161,7 +161,7 @@ isc_result_t
isc_netaddr_masktoprefixlen(const isc_netaddr_t *s, unsigned int *lenp) {
unsigned int nbits, nbytes, ipbytes, i;
const unsigned char *p;
-
+
switch (s->family) {
case AF_INET:
p = (const unsigned char *) &s->type.in;
diff --git a/lib/isc/nls/Makefile.in b/lib/isc/nls/Makefile.in
index 25de2141..d48bb85f 100644
--- a/lib/isc/nls/Makefile.in
+++ b/lib/isc/nls/Makefile.in
@@ -1,19 +1,19 @@
# Copyright (C) 1999, 2000 Internet Software Consortium.
-#
+#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
-# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
-# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-# SOFTWARE.
-
-# $Id: Makefile.in,v 1.8 2000/06/22 21:58:14 tale Exp $
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+# $Id: Makefile.in,v 1.10 2000/08/01 01:30:57 tale Exp $
srcdir = @srcdir@
VPATH = @srcdir@
diff --git a/lib/isc/nls/msgcat.c b/lib/isc/nls/msgcat.c
index ee4a3e9c..f9600c60 100644
--- a/lib/isc/nls/msgcat.c
+++ b/lib/isc/nls/msgcat.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: msgcat.c,v 1.6 2000/06/22 21:58:15 tale Exp $ */
+/* $Id: msgcat.c,v 1.8 2000/08/01 01:30:58 tale Exp $ */
/*
* Principal Author: Bob Halley
diff --git a/lib/isc/nothreads/Makefile.in b/lib/isc/nothreads/Makefile.in
new file mode 100644
index 00000000..de9f8054
--- /dev/null
+++ b/lib/isc/nothreads/Makefile.in
@@ -0,0 +1,38 @@
+# Copyright (C) 2000 Internet Software Consortium.
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+# $Id: Makefile.in,v 1.2 2000/08/29 19:22:34 bwelling Exp $
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+top_srcdir = @top_srcdir@
+
+CINCLUDES = -I${srcdir}/include \
+ -I${srcdir}/../unix/include \
+ -I../include \
+ -I${srcdir}/../include \
+ -I${srcdir}/..
+
+CDEFINES =
+CWARNINGS =
+
+OBJS = condition.@O@ thread.@O@
+
+SRCS = condition.c thread.c
+
+SUBDIRS = include
+TARGETS = ${OBJS}
+
+@BIND9_MAKE_RULES@
diff --git a/lib/isc/nothreads/condition.c b/lib/isc/nothreads/condition.c
new file mode 100644
index 00000000..6b1978fd
--- /dev/null
+++ b/lib/isc/nothreads/condition.c
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: condition.c,v 1.1 2000/08/29 18:19:29 bwelling Exp $ */
+
+/* This file intentionally left blank. */
diff --git a/lib/isc/nothreads/include/Makefile.in b/lib/isc/nothreads/include/Makefile.in
new file mode 100644
index 00000000..08547313
--- /dev/null
+++ b/lib/isc/nothreads/include/Makefile.in
@@ -0,0 +1,25 @@
+# Copyright (C) 2000 Internet Software Consortium.
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+# $Id: Makefile.in,v 1.1 2000/08/28 23:16:49 bwelling Exp $
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+top_srcdir = @top_srcdir@
+
+SUBDIRS = isc
+TARGETS =
+
+@BIND9_MAKE_RULES@
diff --git a/lib/isc/nothreads/include/isc/Makefile.in b/lib/isc/nothreads/include/isc/Makefile.in
new file mode 100644
index 00000000..5142f473
--- /dev/null
+++ b/lib/isc/nothreads/include/isc/Makefile.in
@@ -0,0 +1,37 @@
+# Copyright (C) 2000 Internet Software Consortium.
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+# $Id: Makefile.in,v 1.2 2000/09/20 19:06:04 gson Exp $
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+top_srcdir = @top_srcdir@
+
+@BIND9_VERSION@
+
+HEADERS = mutex.h once.h thread.h
+
+SUBDIRS =
+TARGETS =
+
+@BIND9_MAKE_RULES@
+
+installdirs:
+ $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}/isc
+
+install:: installdirs
+ for i in ${HEADERS}; do \
+ ${INSTALL_DATA} $(srcdir)/$$i ${DESTDIR}${includedir}/isc ; \
+ done
diff --git a/lib/isc/nothreads/include/isc/condition.h b/lib/isc/nothreads/include/isc/condition.h
new file mode 100644
index 00000000..59d62607
--- /dev/null
+++ b/lib/isc/nothreads/include/isc/condition.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: condition.h,v 1.2 2000/11/29 01:27:09 gson Exp $ */
+
+/*
+ * This provides a limited subset of the isc_condition_t
+ * functionality for use by single-threaded programs that
+ * need to block waiting for events. Only a single
+ * call to isc_condition_wait() may be blocked at any given
+ * time, and the _waituntil and _broadcast functions are not
+ * supported. This is intended primarily for use by the omapi
+ * library, and may go away once omapi goes away. Use for
+ * other purposes is strongly discouraged.
+ */
+
+#ifndef ISC_CONDITION_H
+#define ISC_CONDITION_H 1
+
+#include <isc/mutex.h>
+
+typedef int isc_condition_t;
+
+isc_result_t isc__nothread_wait_hack(isc_condition_t *cp, isc_mutex_t *mp);
+isc_result_t isc__nothread_signal_hack(isc_condition_t *cp);
+
+#define isc_condition_init(cp) \
+ (*(cp) = 0, ISC_R_SUCCESS)
+
+#define isc_condition_wait(cp, mp) \
+ isc__nothread_wait_hack(cp, mp)
+
+#define isc_condition_waituntil(cp, mp, tp) \
+ ((void)(cp), (void)(mp), (void)(tp), ISC_R_NOTIMPLEMENTED)
+
+#define isc_condition_signal(cp) \
+ isc__nothread_signal_hack(cp)
+
+#define isc_condition_broadcast(cp) \
+ ((void)(cp), ISC_R_NOTIMPLEMENTED)
+
+#define isc_condition_destroy(cp) \
+ (*(cp) == 0 ? (*(cp) = -1, ISC_R_SUCCESS) : ISC_R_UNEXPECTED)
+
+#endif /* ISC_CONDITION_H */
diff --git a/lib/isc/nothreads/include/isc/mutex.h b/lib/isc/nothreads/include/isc/mutex.h
new file mode 100644
index 00000000..04b909ea
--- /dev/null
+++ b/lib/isc/nothreads/include/isc/mutex.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: mutex.h,v 1.1 2000/08/28 23:16:50 bwelling Exp $ */
+
+#ifndef ISC_MUTEX_H
+#define ISC_MUTEX_H 1
+
+#include <isc/result.h> /* for ISC_R_ codes */
+
+typedef int isc_mutex_t;
+
+#define isc_mutex_init(mp) \
+ (*(mp) = 0, ISC_R_SUCCESS)
+#define isc_mutex_lock(mp) \
+ ((*(mp))++ == 0 ? ISC_R_SUCCESS : ISC_R_UNEXPECTED)
+#define isc_mutex_unlock(mp) \
+ (--(*(mp)) == 0 ? ISC_R_SUCCESS : ISC_R_UNEXPECTED)
+#define isc_mutex_trylock(mp) \
+ (*(mp) == 0 ? ((*(mp))++, ISC_R_SUCCESS) : ISC_R_LOCKBUSY)
+#define isc_mutex_destroy(mp) \
+ (*(mp) == 0 ? (*(mp) = -1, ISC_R_SUCCESS) : ISC_R_UNEXPECTED)
+
+#endif /* ISC_MUTEX_H */
diff --git a/lib/isc/nothreads/include/isc/once.h b/lib/isc/nothreads/include/isc/once.h
new file mode 100644
index 00000000..f5c4a9e7
--- /dev/null
+++ b/lib/isc/nothreads/include/isc/once.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: once.h,v 1.2 2000/08/30 01:11:37 bwelling Exp $ */
+
+#ifndef ISC_ONCE_H
+#define ISC_ONCE_H 1
+
+#include <isc/result.h>
+
+typedef isc_boolean_t isc_once_t;
+
+#define ISC_ONCE_INIT ISC_FALSE
+
+#define isc_once_do(op, f) \
+ (!*(op) ? (f(), *(op) = ISC_TRUE, ISC_R_SUCCESS) : ISC_R_SUCCESS)
+
+#endif /* ISC_ONCE_H */
diff --git a/lib/isc/nothreads/include/isc/thread.h b/lib/isc/nothreads/include/isc/thread.h
new file mode 100644
index 00000000..3bcc721e
--- /dev/null
+++ b/lib/isc/nothreads/include/isc/thread.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: thread.h,v 1.1 2000/08/28 23:16:50 bwelling Exp $ */
+
+#ifndef ISC_THREAD_H
+#define ISC_THREAD_H 1
+
+#include <isc/lang.h>
+#include <isc/result.h>
+
+ISC_LANG_BEGINDECLS
+
+void
+isc_thread_setconcurrency(unsigned int level);
+
+#define isc_thread_self (unsigned long)0
+
+ISC_LANG_ENDDECLS
+
+#endif /* ISC_THREAD_H */
diff --git a/lib/isc/nothreads/thread.c b/lib/isc/nothreads/thread.c
new file mode 100644
index 00000000..9849aaae
--- /dev/null
+++ b/lib/isc/nothreads/thread.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: thread.c,v 1.1 2000/08/28 23:16:48 bwelling Exp $ */
+
+#include <config.h>
+
+#include <isc/thread.h>
+#include <isc/util.h>
+
+void
+isc_thread_setconcurrency(unsigned int level) {
+ UNUSED(level);
+}
diff --git a/lib/isc/ondestroy.c b/lib/isc/ondestroy.c
index 081db848..ea6064a8 100644
--- a/lib/isc/ondestroy.c
+++ b/lib/isc/ondestroy.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: ondestroy.c,v 1.7 2000/06/22 21:57:05 tale Exp $ */
+/* $Id: ondestroy.c,v 1.9 2000/08/01 01:29:38 tale Exp $ */
#include <config.h>
@@ -54,7 +54,7 @@ isc_ondestroy_register(isc_ondestroy_t *ondest, isc_task_t *task,
isc_task_attach(task, &thetask);
theevent->ev_sender = thetask;
-
+
ISC_LIST_APPEND(ondest->events, theevent, ev_link);
return (ISC_R_SUCCESS);
@@ -64,7 +64,7 @@ void
isc_ondestroy_notify(isc_ondestroy_t *ondest, void *sender) {
isc_event_t *eventp;
isc_task_t *task;
-
+
REQUIRE(VALID_ONDESTROY(ondest));
eventp = ISC_LIST_HEAD(ondest->events);
@@ -73,11 +73,11 @@ isc_ondestroy_notify(isc_ondestroy_t *ondest, void *sender) {
task = eventp->ev_sender;
eventp->ev_sender = sender;
-
+
isc_task_sendanddetach(&task, &eventp);
eventp = ISC_LIST_HEAD(ondest->events);
}
}
-
+
diff --git a/lib/isc/print.c b/lib/isc/print.c
index d8353f58..2002fea5 100644
--- a/lib/isc/print.c
+++ b/lib/isc/print.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: print.c,v 1.11 2000/06/22 21:57:06 tale Exp $ */
+/* $Id: print.c,v 1.14 2000/11/14 23:42:29 tale Exp $ */
#include <config.h>
@@ -83,7 +83,7 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
long double ldbl;
#endif
char fmt[32];
-
+
INSIST(str != NULL);
INSIST(format != NULL);
@@ -141,7 +141,7 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
char *e;
width = strtoul(format, &e, 10);
format = e;
- }
+ }
/*
* Precision.
@@ -233,11 +233,8 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
head = "";
tmpui = tmpi;
}
-#ifdef ISC_PLATFORM_LONGLONGEQUALLONG
- sprintf(buf, "%lu", tmpui);
-#else
- sprintf(buf, "%llu", tmpui);
-#endif
+ sprintf(buf, "%" ISC_PRINT_QUADFORMAT "u",
+ tmpui);
goto printint;
case 'o':
if (q)
@@ -246,11 +243,10 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
tmpui = va_arg(ap, long int);
else
tmpui = va_arg(ap, int);
-#ifdef ISC_PLATFORM_LONGLONGEQUALLONG
- sprintf(buf, alt ? "%#lo" : "%lo", tmpui);
-#else
- sprintf(buf, alt ? "%#llo" : "%llo", tmpui);
-#endif
+ sprintf(buf,
+ alt ? "%#" ISC_PRINT_QUADFORMAT "o"
+ : "%" ISC_PRINT_QUADFORMAT "o",
+ tmpui);
goto printint;
case 'u':
if (q)
@@ -259,11 +255,8 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
tmpui = va_arg(ap, unsigned long int);
else
tmpui = va_arg(ap, unsigned int);
-#ifdef ISC_PLATFORM_LONGLONGEQUALLONG
- sprintf(buf, "%lu", tmpui);
-#else
- sprintf(buf, "%llu", tmpui);
-#endif
+ sprintf(buf, "%" ISC_PRINT_QUADFORMAT "u",
+ tmpui);
goto printint;
case 'x':
if (q)
@@ -277,11 +270,8 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
if (precision > 2)
precision -= 2;
}
-#ifdef ISC_PLATFORM_LONGLONGEQUALLONG
- sprintf(buf, "%lx", tmpui);
-#else
- sprintf(buf, "%llx", tmpui);
-#endif
+ sprintf(buf, "%" ISC_PRINT_QUADFORMAT "x",
+ tmpui);
goto printint;
case 'X':
if (q)
@@ -295,11 +285,8 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
if (precision > 2)
precision -= 2;
}
-#ifdef ISC_PLATFORM_LONGLONGEQUALLONG
- sprintf(buf, "%lX", tmpui);
-#else
- sprintf(buf, "%llX", tmpui);
-#endif
+ sprintf(buf, "%" ISC_PRINT_QUADFORMAT "X",
+ tmpui);
goto printint;
printint:
if (precision != 0 || width != 0) {
@@ -380,7 +367,7 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
size--;
pad--;
}
- if (precision != 0)
+ if (precision != 0)
while (precision > 0 && *cp != '\0' &&
size > 1) {
*str++ = *cp++;
@@ -406,7 +393,7 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
if (left) {
*str++ = c;
size--;
- }
+ }
while (width-- > 0 && size > 1) {
*str++ = ' ';
size--;
@@ -497,7 +484,7 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
*
* precisions > 324 don't make much sence.
* if we cap the precision at 512 we will not
- * overflow buf.
+ * overflow buf.
*/
if (precision > 512)
precision = 512;
diff --git a/lib/isc/pthreads/Makefile.in b/lib/isc/pthreads/Makefile.in
index 49da1502..80099880 100644
--- a/lib/isc/pthreads/Makefile.in
+++ b/lib/isc/pthreads/Makefile.in
@@ -1,19 +1,19 @@
# Copyright (C) 1998-2000 Internet Software Consortium.
-#
+#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
-# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
-# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-# SOFTWARE.
-
-# $Id: Makefile.in,v 1.12 2000/06/22 21:58:16 tale Exp $
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+# $Id: Makefile.in,v 1.14 2000/08/01 01:30:59 tale Exp $
srcdir = @srcdir@
VPATH = @srcdir@
diff --git a/lib/isc/pthreads/condition.c b/lib/isc/pthreads/condition.c
index bf5889e0..a72d6977 100644
--- a/lib/isc/pthreads/condition.c
+++ b/lib/isc/pthreads/condition.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: condition.c,v 1.22 2000/06/22 21:58:17 tale Exp $ */
+/* $Id: condition.c,v 1.24 2000/08/01 01:31:00 tale Exp $ */
#include <config.h>
diff --git a/lib/isc/pthreads/include/Makefile.in b/lib/isc/pthreads/include/Makefile.in
index 6b464f8a..57d11ac2 100644
--- a/lib/isc/pthreads/include/Makefile.in
+++ b/lib/isc/pthreads/include/Makefile.in
@@ -1,19 +1,19 @@
# Copyright (C) 1998-2000 Internet Software Consortium.
-#
+#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
-# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
-# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-# SOFTWARE.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.8 2000/06/22 21:58:20 tale Exp $
+# $Id: Makefile.in,v 1.10 2000/08/01 01:31:03 tale Exp $
srcdir = @srcdir@
VPATH = @srcdir@
diff --git a/lib/isc/pthreads/include/isc/Makefile.in b/lib/isc/pthreads/include/isc/Makefile.in
index 86c08612..79e44f1b 100644
--- a/lib/isc/pthreads/include/isc/Makefile.in
+++ b/lib/isc/pthreads/include/isc/Makefile.in
@@ -1,19 +1,19 @@
# Copyright (C) 1998-2000 Internet Software Consortium.
-#
+#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
-# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
-# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-# SOFTWARE.
-
-# $Id: Makefile.in,v 1.9 2000/06/22 21:58:21 tale Exp $
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+# $Id: Makefile.in,v 1.12 2000/09/20 19:06:06 gson Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@@ -29,12 +29,7 @@ TARGETS =
@BIND9_MAKE_RULES@
installdirs:
- if [ ! -d ${DESTDIR}${includedir} ]; then \
- mkdir ${DESTDIR}${includedir} ; \
- fi
- if [ ! -d ${DESTDIR}${includedir}/isc ]; then \
- mkdir ${DESTDIR}${includedir}/isc ; \
- fi
+ $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}/isc
install:: installdirs
for i in ${HEADERS}; do \
diff --git a/lib/isc/pthreads/include/isc/condition.h b/lib/isc/pthreads/include/isc/condition.h
index 20bb2331..4c5a6c49 100644
--- a/lib/isc/pthreads/include/isc/condition.h
+++ b/lib/isc/pthreads/include/isc/condition.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: condition.h,v 1.16 2000/06/22 21:58:23 tale Exp $ */
+/* $Id: condition.h,v 1.18 2000/08/01 01:31:05 tale Exp $ */
#ifndef ISC_CONDITION_H
#define ISC_CONDITION_H 1
diff --git a/lib/isc/pthreads/include/isc/mutex.h b/lib/isc/pthreads/include/isc/mutex.h
index 22cbd371..269122b6 100644
--- a/lib/isc/pthreads/include/isc/mutex.h
+++ b/lib/isc/pthreads/include/isc/mutex.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: mutex.h,v 1.14 2000/06/22 21:58:24 tale Exp $ */
+/* $Id: mutex.h,v 1.16 2000/08/01 01:31:06 tale Exp $ */
#ifndef ISC_MUTEX_H
#define ISC_MUTEX_H 1
diff --git a/lib/isc/pthreads/include/isc/once.h b/lib/isc/pthreads/include/isc/once.h
index afc0ad7e..e75e4424 100644
--- a/lib/isc/pthreads/include/isc/once.h
+++ b/lib/isc/pthreads/include/isc/once.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: once.h,v 1.5 2000/06/22 21:58:26 tale Exp $ */
+/* $Id: once.h,v 1.7 2000/08/01 01:31:07 tale Exp $ */
#ifndef ISC_ONCE_H
#define ISC_ONCE_H 1
diff --git a/lib/isc/pthreads/include/isc/thread.h b/lib/isc/pthreads/include/isc/thread.h
index d8afb8c1..e1b75280 100644
--- a/lib/isc/pthreads/include/isc/thread.h
+++ b/lib/isc/pthreads/include/isc/thread.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: thread.h,v 1.16 2000/06/22 21:58:27 tale Exp $ */
+/* $Id: thread.h,v 1.18 2000/08/01 01:31:08 tale Exp $ */
#ifndef ISC_THREAD_H
#define ISC_THREAD_H 1
diff --git a/lib/isc/pthreads/thread.c b/lib/isc/pthreads/thread.c
index f0f6c04f..578d3d61 100644
--- a/lib/isc/pthreads/thread.c
+++ b/lib/isc/pthreads/thread.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: thread.c,v 1.5 2000/06/22 21:58:18 tale Exp $ */
+/* $Id: thread.c,v 1.7 2000/08/01 01:31:01 tale Exp $ */
#include <config.h>
diff --git a/lib/isc/quota.c b/lib/isc/quota.c
index 7f42fddc..4285fc95 100644
--- a/lib/isc/quota.c
+++ b/lib/isc/quota.c
@@ -1,24 +1,26 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: quota.c,v 1.6 2000/06/22 21:57:07 tale Exp $ */
+/* $Id: quota.c,v 1.10 2000/08/26 01:23:13 bwelling Exp $ */
#include <config.h>
+#include <stddef.h>
+
#include <isc/quota.h>
#include <isc/util.h>
@@ -34,7 +36,7 @@ isc_quota_destroy(isc_quota_t *quota) {
INSIST(quota->used == 0);
quota->max = -1;
quota->used = -1;
- RUNTIME_CHECK(isc_mutex_destroy(&quota->lock) == ISC_R_SUCCESS);
+ DESTROYLOCK(&quota->lock);
}
isc_result_t
@@ -56,7 +58,7 @@ isc_quota_release(isc_quota_t *quota) {
LOCK(&quota->lock);
INSIST(quota->used > 0);
quota->used--;
- UNLOCK(&quota->lock);
+ UNLOCK(&quota->lock);
}
isc_result_t
diff --git a/lib/isc/random.c b/lib/isc/random.c
index d88a8155..4434345c 100644
--- a/lib/isc/random.c
+++ b/lib/isc/random.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: random.c,v 1.7 2000/06/22 21:57:08 tale Exp $ */
+/* $Id: random.c,v 1.13 2000/09/26 17:23:17 gson Exp $ */
#include <config.h>
@@ -28,12 +28,11 @@
#include <isc/util.h>
static isc_once_t once = ISC_ONCE_INIT;
-static isc_mutex_t rand_lock;
static void
initialize_rand(void)
{
- RUNTIME_CHECK(isc_mutex_init(&rand_lock) == ISC_R_SUCCESS);
+ srand(time(NULL));
}
static void
@@ -42,74 +41,29 @@ initialize(void)
RUNTIME_CHECK(isc_once_do(&once, initialize_rand) == ISC_R_SUCCESS);
}
-isc_result_t
-isc_random_init(isc_random_t *r)
-{
- REQUIRE(r != NULL);
-
- r->magic = ISC_RANDOM_MAGIC;
-#if 0
- return (isc_mutex_init(&r->lock));
-#else
- return (ISC_R_SUCCESS);
-#endif
-}
-
-isc_result_t
-isc_random_invalidate(isc_random_t *r)
-{
- isc_result_t result;
-
- REQUIRE(ISC_RANDOM_VALID(r));
-
-#if 0
- result = isc_mutex_destroy(&r->lock);
-#else
- result = ISC_R_SUCCESS;
-#endif
-
- memset(r, 0, sizeof(isc_random_t));
-
- return (result);
-}
-
void
-isc_random_seed(isc_random_t *r, isc_uint32_t seed)
+isc_random_seed(isc_uint32_t seed)
{
- REQUIRE(ISC_RANDOM_VALID(r));
-
- UNUSED(r);
-
initialize();
-#if 0
- LOCK(&r->lock);
-#endif
- LOCK(&rand_lock);
srand(seed);
- UNLOCK(&rand_lock);
-#if 0
- UNLOCK(&r->lock);
-#endif
}
void
-isc_random_get(isc_random_t *r, isc_uint32_t *val)
+isc_random_get(isc_uint32_t *val)
{
- REQUIRE(ISC_RANDOM_VALID(r));
REQUIRE(val != NULL);
- UNUSED(r);
-
initialize();
-#if 0
- LOCK(&r->lock);
-#endif
- LOCK(&rand_lock);
*val = rand();
- UNLOCK(&rand_lock);
-#if 0
- UNLOCK(&r->lock);
-#endif
+}
+
+isc_uint32_t
+isc_random_jitter(isc_uint32_t max, isc_uint32_t jitter) {
+ REQUIRE(jitter < max);
+ if (jitter == 0)
+ return (max);
+ else
+ return (max - rand() % jitter);
}
diff --git a/lib/isc/ratelimiter.c b/lib/isc/ratelimiter.c
index 847a8208..801a23f4 100644
--- a/lib/isc/ratelimiter.c
+++ b/lib/isc/ratelimiter.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: ratelimiter.c,v 1.14 2000/06/22 21:57:09 tale Exp $ */
+/* $Id: ratelimiter.c,v 1.17 2000/08/26 01:31:49 bwelling Exp $ */
#include <config.h>
@@ -60,7 +60,7 @@ isc_ratelimiter_create(isc_mem_t *mctx, isc_timermgr_t *timermgr,
isc_result_t result;
isc_ratelimiter_t *rl;
INSIST(ratelimiterp != NULL && *ratelimiterp == NULL);
-
+
rl = isc_mem_get(mctx, sizeof(*rl));
if (rl == NULL)
return ISC_R_NOMEMORY;
@@ -87,7 +87,7 @@ isc_ratelimiter_create(isc_mem_t *mctx, isc_timermgr_t *timermgr,
* (soon) have events outstanding.
*/
rl->refs++;
-
+
ISC_EVENT_INIT(&rl->shutdownevent,
sizeof(isc_event_t),
0, NULL, ISC_RATELIMITEREVENT_SHUTDOWN,
@@ -97,7 +97,7 @@ isc_ratelimiter_create(isc_mem_t *mctx, isc_timermgr_t *timermgr,
return (ISC_R_SUCCESS);
free_mutex:
- isc_mutex_destroy(&rl->lock);
+ DESTROYLOCK(&rl->lock);
free_mem:
isc_mem_put(mctx, rl, sizeof(*rl));
return (result);
@@ -125,7 +125,7 @@ isc_ratelimiter_setpertic(isc_ratelimiter_t *rl, isc_uint32_t pertic) {
pertic = 1;
rl->pertic = pertic;
}
-
+
isc_result_t
isc_ratelimiter_enqueue(isc_ratelimiter_t *rl, isc_task_t *task,
isc_event_t **eventp)
@@ -224,14 +224,14 @@ isc_ratelimiter_shutdown(isc_ratelimiter_t *rl) {
*/
ev = &rl->shutdownevent;
isc_task_send(rl->task, &ev);
-
+
UNLOCK(&rl->lock);
}
static void
ratelimiter_shutdowncomplete(isc_task_t *task, isc_event_t *event) {
isc_ratelimiter_t *rl = (isc_ratelimiter_t *)event->ev_arg;
-
+
UNUSED(task);
isc_ratelimiter_detach(&rl);
@@ -239,7 +239,7 @@ ratelimiter_shutdowncomplete(isc_task_t *task, isc_event_t *event) {
static void
ratelimiter_free(isc_ratelimiter_t *rl) {
- isc_mutex_destroy(&rl->lock);
+ DESTROYLOCK(&rl->lock);
isc_mem_put(rl->mctx, rl, sizeof(*rl));
}
diff --git a/lib/isc/result.c b/lib/isc/result.c
index 53ea993b..4e3d3e40 100644
--- a/lib/isc/result.c
+++ b/lib/isc/result.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: result.c,v 1.44 2000/06/22 21:57:10 tale Exp $ */
+/* $Id: result.c,v 1.50 2000/11/18 02:56:45 gson Exp $ */
#include <config.h>
@@ -84,7 +84,11 @@ static const char *text[ISC_R_NRESULTS] = {
"invalid use of multicast address", /* 43 */
"not a file", /* 44 */
"not a directory", /* 45 */
- "queue is full" /* 46 */
+ "queue is full", /* 46 */
+ "address family mismatch", /* 47 */
+ "address family not supported", /* 48 */
+ "bad hex encoding", /* 49 */
+ "too many open files" /* 50 */
};
#define ISC_RESULT_RESULTSET 2
diff --git a/lib/isc/rwlock.c b/lib/isc/rwlock.c
index 592425f4..f4c3bb01 100644
--- a/lib/isc/rwlock.c
+++ b/lib/isc/rwlock.c
@@ -1,31 +1,36 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rwlock.c,v 1.16.2.1 2000/08/25 01:29:35 gson Exp $ */
+/* $Id: rwlock.c,v 1.25 2000/08/29 00:33:35 bwelling Exp $ */
#include <config.h>
+#include <stddef.h>
+
#include <isc/magic.h>
+#include <isc/platform.h>
#include <isc/rwlock.h>
#include <isc/util.h>
#define RWLOCK_MAGIC 0x52574C6BU /* RWLk. */
#define VALID_RWLOCK(rwl) ISC_MAGIC_VALID(rwl, RWLOCK_MAGIC)
+#ifdef ISC_PLATFORM_USETHREADS
+
#ifndef RWLOCK_DEFAULT_READ_QUOTA
#define RWLOCK_DEFAULT_READ_QUOTA 4
#endif
@@ -36,12 +41,13 @@
#ifdef ISC_RWLOCK_TRACE
#include <stdio.h> /* Required for fprintf/stderr. */
+#include <isc/thread.h> /* Requried for isc_thread_self(). */
static void
-print_lock(char *operation, isc_rwlock_t *rwl, isc_rwlocktype_t type) {
+print_lock(const char *operation, isc_rwlock_t *rwl, isc_rwlocktype_t type) {
fprintf(stderr,
- "%s(%s): %s, %u active, %u granted, "
- "%u rwaiting, %u wwaiting\n",
+ "rwlock %p thread %lu %s(%s): %s, %u active, %u granted, "
+ "%u rwaiting, %u wwaiting\n", rwl, isc_thread_self(),
operation, (type == isc_rwlocktype_read ? "read" : "write"),
(rwl->type == isc_rwlocktype_read ? "reading" : "writing"),
rwl->active, rwl->granted, rwl->readers_waiting,
@@ -228,5 +234,61 @@ isc_rwlock_destroy(isc_rwlock_t *rwl) {
rwl->magic = 0;
(void)isc_condition_destroy(&rwl->readable);
(void)isc_condition_destroy(&rwl->writeable);
- (void)isc_mutex_destroy(&rwl->lock);
+ DESTROYLOCK(&rwl->lock);
+}
+
+#else /* ISC_PLATFORM_USETHREADS */
+
+isc_result_t
+isc_rwlock_init(isc_rwlock_t *rwl, unsigned int read_quota,
+ unsigned int write_quota)
+{
+ REQUIRE(rwl != NULL);
+
+ UNUSED(read_quota);
+ UNUSED(write_quota);
+
+ rwl->type = isc_rwlocktype_read;
+ rwl->active = 0;
+ rwl->magic = RWLOCK_MAGIC;
+
+ return (ISC_R_SUCCESS);
+}
+
+isc_result_t
+isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
+ REQUIRE(VALID_RWLOCK(rwl));
+
+ if (type == isc_rwlocktype_read) {
+ if (rwl->type != isc_rwlocktype_read && rwl->active != 0)
+ return (ISC_R_LOCKBUSY);
+ rwl->type = isc_rwlocktype_read;
+ rwl->active++;
+ } else {
+ if (rwl->active != 0)
+ return (ISC_R_LOCKBUSY);
+ rwl->type = isc_rwlocktype_write;
+ rwl->active = 1;
+ }
+ return (ISC_R_SUCCESS);
+}
+
+isc_result_t
+isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
+ REQUIRE(VALID_RWLOCK(rwl));
+ REQUIRE(rwl->type == type);
+
+ INSIST(rwl->active > 0);
+ rwl->active--;
+
+ return (ISC_R_SUCCESS);
}
+
+void
+isc_rwlock_destroy(isc_rwlock_t *rwl) {
+ REQUIRE(rwl != NULL);
+ REQUIRE(rwl->active == 0);
+ rwl->magic = 0;
+}
+
+#endif /* ISC_PLATFORM_USETHREADS */
diff --git a/lib/isc/serial.c b/lib/isc/serial.c
index 141a316a..7f5ba638 100644
--- a/lib/isc/serial.c
+++ b/lib/isc/serial.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: serial.c,v 1.4 2000/05/08 14:37:37 tale Exp $ */
+/* $Id: serial.c,v 1.6 2000/08/01 01:29:45 tale Exp $ */
#include <config.h>
#include <isc/serial.h>
diff --git a/lib/isc/sha1.c b/lib/isc/sha1.c
index e224ade9..91f5a7cd 100644
--- a/lib/isc/sha1.c
+++ b/lib/isc/sha1.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: sha1.c,v 1.7 2000/06/08 05:26:00 explorer Exp $ */
+/* $Id: sha1.c,v 1.9 2000/08/01 01:29:47 tale Exp $ */
/* $NetBSD: sha1.c,v 1.5 2000/01/22 22:19:14 mycroft Exp $ */
/* $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $ */
diff --git a/lib/isc/sockaddr.c b/lib/isc/sockaddr.c
index 06233757..e9cdc5e4 100644
--- a/lib/isc/sockaddr.c
+++ b/lib/isc/sockaddr.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: sockaddr.c,v 1.42.2.1 2000/09/21 22:14:59 gson Exp $ */
+/* $Id: sockaddr.c,v 1.46 2000/08/09 19:09:08 gson Exp $ */
#include <config.h>
@@ -65,9 +65,6 @@ isc_sockaddr_equal(const isc_sockaddr_t *a, const isc_sockaddr_t *b) {
return (ISC_TRUE);
}
-/*
- * Compare just the addresses (ignore ports)
- */
isc_boolean_t
isc_sockaddr_eqaddr(const isc_sockaddr_t *a, const isc_sockaddr_t *b) {
REQUIRE(a != NULL && b != NULL);
@@ -95,11 +92,6 @@ isc_sockaddr_eqaddr(const isc_sockaddr_t *a, const isc_sockaddr_t *b) {
return (ISC_TRUE);
}
-/*
- * Compare just a prefix of the addresses (ignore ports and
- * low address bits)
- */
-
isc_boolean_t
isc_sockaddr_eqaddrprefix(const isc_sockaddr_t *a, const isc_sockaddr_t *b,
unsigned int prefixlen)
@@ -122,7 +114,7 @@ isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) {
/*
* Do the port first, giving us the opportunity to check for
- * unsupported address families before calling
+ * unsupported address families before calling
* isc_netaddr_fromsockaddr().
*/
switch (sockaddr->type.sa.sa_family) {
@@ -135,18 +127,18 @@ isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) {
default:
return (ISC_R_FAILURE);
}
-
+
plen = strlen(pbuf);
INSIST(plen < sizeof(pbuf));
-
+
isc_netaddr_fromsockaddr(&netaddr, sockaddr);
result = isc_netaddr_totext(&netaddr, target);
if (result != ISC_R_SUCCESS)
return (result);
-
+
if (1 + plen + 1 > isc_buffer_availablelength(target))
return (ISC_R_NOSPACE);
-
+
isc_buffer_putmem(target, (const unsigned char *)"#", 1);
isc_buffer_putmem(target, (const unsigned char *)pbuf, plen);
@@ -181,10 +173,6 @@ isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only) {
const unsigned char *s;
unsigned int h = 0;
unsigned int g;
-
- /*
- * Provide a hash value for 'sockaddr'.
- */
REQUIRE(sockaddr != NULL);
@@ -350,7 +338,7 @@ isc_sockaddr_fromnetaddr(isc_sockaddr_t *sockaddr, const isc_netaddr_t *na,
sockaddr->type.sin.sin_port = htons(port);
break;
case AF_INET6:
- sockaddr->length = sizeof sockaddr->type.sin6;
+ sockaddr->length = sizeof sockaddr->type.sin6;
#ifdef ISC_PLATFORM_HAVESALEN
sockaddr->type.sin6.sin6_len = sizeof sockaddr->type.sin6;
#endif
diff --git a/lib/isc/string.c b/lib/isc/string.c
index f2c18485..2e476e7e 100644
--- a/lib/isc/string.c
+++ b/lib/isc/string.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: string.c,v 1.3 2000/06/22 21:57:13 tale Exp $ */
+/* $Id: string.c,v 1.5 2000/08/01 01:29:49 tale Exp $ */
#include <config.h>
@@ -32,7 +32,7 @@ isc_string_touint64(char *source, char **end, int base) {
char *s = source;
char *o;
char c;
-
+
if ((base < 0) || (base == 1) || (base > 36)) {
*end = source;
return (0);
@@ -58,7 +58,7 @@ isc_string_touint64(char *source, char **end, int base) {
overflow = ~0;
overflow /= base;
tmp = 0;
-
+
while ((c = *s) != 0) {
c = tolower(c);
/* end ? */
diff --git a/lib/isc/symtab.c b/lib/isc/symtab.c
index b8815921..3eea65dd 100644
--- a/lib/isc/symtab.c
+++ b/lib/isc/symtab.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1996-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: symtab.c,v 1.18 2000/06/22 21:57:15 tale Exp $ */
+/* $Id: symtab.c,v 1.21 2000/10/20 02:21:57 marka Exp $ */
#include <config.h>
@@ -215,6 +215,7 @@ isc_symtab_define(isc_symtab_t *symtab, const char *key, unsigned int type,
elt = (elt_t *)isc_mem_get(symtab->mctx, sizeof *elt);
if (elt == NULL)
return (ISC_R_NOMEMORY);
+ ISC_LINK_INIT(elt, link);
}
/*
diff --git a/lib/isc/task.c b/lib/isc/task.c
index 60834b5c..40375c3e 100644
--- a/lib/isc/task.c
+++ b/lib/isc/task.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: task.c,v 1.65 2000/06/22 21:57:16 tale Exp $ */
+/* $Id: task.c,v 1.75 2000/09/28 21:31:04 bwelling Exp $ */
/*
* Principal Author: Bob Halley
@@ -31,19 +31,24 @@
#include <isc/condition.h>
#include <isc/event.h>
#include <isc/mem.h>
+#include <isc/platform.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/thread.h>
#include <isc/util.h>
+#ifndef ISC_PLATFORM_USETHREADS
+#include "task_p.h"
+#endif /* ISC_PLATFORM_USETHREADS */
+
#define ISC_TASK_NAMES 1
#ifdef ISC_TASK_TRACE
-#define XTRACE(m) printf("task %p thread %lu: %s\n", \
+#define XTRACE(m) fprintf(stderr, "task %p thread %lu: %s\n", \
task, isc_thread_self(), (m))
-#define XTTRACE(t, m) printf("task %p thread %lu: %s\n", \
+#define XTTRACE(t, m) fprintf(stderr, "task %p thread %lu: %s\n", \
(t), isc_thread_self(), (m))
-#define XTHREADTRACE(m) printf("thread %lu: %s\n", \
+#define XTHREADTRACE(m) fprintf(stderr, "thread %lu: %s\n", \
isc_thread_self(), (m))
#else
#define XTRACE(m)
@@ -100,18 +105,30 @@ struct isc_taskmgr {
isc_mem_t * mctx;
isc_mutex_t lock;
unsigned int workers;
+#ifdef ISC_PLATFORM_USETHREADS
isc_thread_t * threads;
+#endif /* ISC_PLATFORM_USETHREADS */
/* Locked by task manager lock. */
unsigned int default_quantum;
LIST(isc_task_t) tasks;
LIST(isc_task_t) ready_tasks;
+#ifdef ISC_PLATFORM_USETHREADS
isc_condition_t work_available;
+#endif /* ISC_PLATFORM_USETHREADS */
isc_boolean_t exiting;
+#ifndef ISC_PLATFORM_USETHREADS
+ unsigned int refs;
+#endif /* ISC_PLATFORM_USETHREADS */
};
+#define DEFAULT_TASKMGR_QUANTUM 10
#define DEFAULT_DEFAULT_QUANTUM 5
#define FINISHED(m) ((m)->exiting && EMPTY((m)->tasks))
+#ifndef ISC_PLATFORM_USETHREADS
+static isc_taskmgr_t *taskmgr = NULL;
+#endif /* ISC_PLATFORM_USETHREADS */
+
/***
*** Tasks.
***/
@@ -129,6 +146,7 @@ task_finished(isc_task_t *task) {
LOCK(&manager->lock);
UNLINK(manager->tasks, task, link);
+#ifdef ISC_PLATFORM_USETHREADS
if (FINISHED(manager)) {
/*
* All tasks have completed and the
@@ -138,9 +156,10 @@ task_finished(isc_task_t *task) {
*/
BROADCAST(&manager->work_available);
}
+#endif /* ISC_PLATFORM_USETHREADS */
UNLOCK(&manager->lock);
- (void)isc_mutex_destroy(&task->lock);
+ DESTROYLOCK(&task->lock);
task->magic = 0;
isc_mem_put(manager->mctx, task, sizeof *task);
}
@@ -190,7 +209,7 @@ isc_task_create(isc_taskmgr_t *manager, unsigned int quantum,
UNLOCK(&manager->lock);
if (exiting) {
- isc_mutex_destroy(&task->lock);
+ DESTROYLOCK(&task->lock);
isc_mem_put(manager->mctx, task, sizeof *task);
return (ISC_R_SHUTTINGDOWN);
}
@@ -224,7 +243,7 @@ static inline isc_boolean_t
task_shutdown(isc_task_t *task) {
isc_boolean_t was_idle = ISC_FALSE;
isc_event_t *event, *prev;
-
+
/*
* Caller must be holding the task's lock.
*/
@@ -268,7 +287,9 @@ task_ready(isc_task_t *task) {
LOCK(&manager->lock);
ENQUEUE(manager->ready_tasks, task, ready_link);
+#ifdef ISC_PLATFORM_USETHREADS
SIGNAL(&manager->work_available);
+#endif /* ISC_PLATFORM_USETHREADS */
UNLOCK(&manager->lock);
}
@@ -292,8 +313,8 @@ task_detach(isc_task_t *task) {
* pending events. We could try to optimize and
* either initiate shutdown or clean up the task,
* depending on its state, but it's easier to just
- * make the task ready and allow run() to deal with
- * shutting down and termination.
+ * make the task ready and allow run() or the event
+ * loop to deal with shutting down and termination.
*/
task->state = task_state_ready;
return (ISC_TRUE);
@@ -331,7 +352,7 @@ static inline isc_boolean_t
task_send(isc_task_t *task, isc_event_t **eventp) {
isc_boolean_t was_idle = ISC_FALSE;
isc_event_t *event;
-
+
/*
* Caller must be holding the task lock.
*/
@@ -339,7 +360,6 @@ task_send(isc_task_t *task, isc_event_t **eventp) {
REQUIRE(eventp != NULL);
event = *eventp;
REQUIRE(event != NULL);
- REQUIRE(event->ev_sender != NULL);
REQUIRE(event->ev_type > 0);
REQUIRE(task->state != task_state_done);
@@ -356,7 +376,7 @@ task_send(isc_task_t *task, isc_event_t **eventp) {
*eventp = NULL;
return (was_idle);
-}
+}
void
isc_task_send(isc_task_t *task, isc_event_t **eventp) {
@@ -681,26 +701,33 @@ isc_task_setname(isc_task_t *task, const char *name, void *tag) {
}
+const char *
+isc_task_getname(isc_task_t *task) {
+ return (task->name);
+}
+
+void *
+isc_task_gettag(isc_task_t *task) {
+ return (task->tag);
+}
+
+
/***
*** Task Manager.
***/
-
-static isc_threadresult_t
-#ifdef _WIN32
-WINAPI
-#endif
-run(void *uap) {
- isc_taskmgr_t *manager = uap;
+static void
+dispatch(isc_taskmgr_t *manager) {
isc_task_t *task;
-
- XTHREADTRACE("start");
+#ifndef ISC_PLATFORM_USETHREADS
+ unsigned int total_dispatch_count = 0;
+#endif /* ISC_PLATFORM_USETHREADS */
REQUIRE(VALID_MANAGER(manager));
/*
* Again we're trying to hold the lock for as short a time as possible
* and to do as little locking and unlocking as possible.
- *
+ *
* In both while loops, the appropriate lock must be held before the
* while body starts. Code which acquired the lock at the top of
* the loop would be more readable, but would result in a lot of
@@ -728,7 +755,7 @@ run(void *uap) {
* unlocks. Also note that the lock is not held when the while
* condition is tested, which may or may not be important, depending
* on the expression.
- *
+ *
* As written:
*
* LOCK();
@@ -749,6 +776,7 @@ run(void *uap) {
LOCK(&manager->lock);
while (!FINISHED(manager)) {
+#ifdef ISC_PLATFORM_USETHREADS
/*
* For reasons similar to those given in the comment in
* isc_task_send() above, it is safe for us to dequeue
@@ -761,8 +789,13 @@ run(void *uap) {
WAIT(&manager->work_available, &manager->lock);
XTHREADTRACE("awake");
}
+#else /* ISC_PLATFORM_USETHREADS */
+ if (total_dispatch_count >= DEFAULT_TASKMGR_QUANTUM ||
+ EMPTY(manager->ready_tasks))
+ break;
+#endif /* ISC_PLATFORM_USETHREADS */
XTHREADTRACE("working");
-
+
task = HEAD(manager->ready_tasks);
if (task != NULL) {
unsigned int dispatch_count = 0;
@@ -775,7 +808,7 @@ run(void *uap) {
/*
* Note we only unlock the manager lock if we actually
- * have a task to do. We must reacquire the manager
+ * have a task to do. We must reacquire the manager
* lock before exiting the 'if (task != NULL)' block.
*/
DEQUEUE(manager->ready_tasks, task, ready_link);
@@ -800,13 +833,16 @@ run(void *uap) {
LOCK(&task->lock);
}
dispatch_count++;
+#ifndef ISC_PLATFORM_USETHREADS
+ total_dispatch_count++;
+#endif /* ISC_PLATFORM_USETHREADS */
}
if (task->references == 0 &&
EMPTY(task->events) &&
!TASK_SHUTTINGDOWN(task)) {
isc_boolean_t was_idle;
-
+
/*
* There are no references and no
* pending events for this task,
@@ -899,20 +935,36 @@ run(void *uap) {
}
}
UNLOCK(&manager->lock);
+}
+
+#ifdef ISC_PLATFORM_USETHREADS
+static isc_threadresult_t
+#ifdef _WIN32
+WINAPI
+#endif
+run(void *uap) {
+ isc_taskmgr_t *manager = uap;
+
+ XTHREADTRACE("start");
+
+ dispatch(manager);
XTHREADTRACE("exit");
return ((isc_threadresult_t)0);
}
+#endif /* ISC_PLATFORM_USETHREADS */
static void
manager_free(isc_taskmgr_t *manager) {
isc_mem_t *mctx;
+#ifdef ISC_PLATFORM_USETHREADS
(void)isc_condition_destroy(&manager->work_available);
- (void)isc_mutex_destroy(&manager->lock);
isc_mem_put(manager->mctx, manager->threads,
manager->workers * sizeof (isc_thread_t));
+#endif /* ISC_PLATFORM_USETHREADS */
+ DESTROYLOCK(&manager->lock);
manager->magic = 0;
mctx = manager->mctx;
isc_mem_put(mctx, manager, sizeof *manager);
@@ -920,12 +972,11 @@ manager_free(isc_taskmgr_t *manager) {
}
isc_result_t
-isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers,
+isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers,
unsigned int default_quantum, isc_taskmgr_t **managerp)
{
unsigned int i, started = 0;
isc_taskmgr_t *manager;
- isc_thread_t *threads;
/*
* Create a new task manager.
@@ -934,50 +985,64 @@ isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers,
REQUIRE(workers > 0);
REQUIRE(managerp != NULL && *managerp == NULL);
+#ifndef ISC_PLATFORM_USETHREADS
+ UNUSED(i);
+ UNUSED(started);
+
+ if (taskmgr != NULL) {
+ taskmgr->refs++;
+ *managerp = taskmgr;
+ return (ISC_R_SUCCESS);
+ }
+#endif /* ISC_PLATFORM_USETHREADS */
+
manager = isc_mem_get(mctx, sizeof *manager);
if (manager == NULL)
return (ISC_R_NOMEMORY);
manager->magic = TASK_MANAGER_MAGIC;
manager->mctx = NULL;
- threads = isc_mem_get(mctx, workers * sizeof (isc_thread_t));
- if (threads == NULL) {
- isc_mem_put(mctx, manager, sizeof *manager);
- return (ISC_R_NOMEMORY);
- }
- manager->threads = threads;
manager->workers = 0;
if (isc_mutex_init(&manager->lock) != ISC_R_SUCCESS) {
- isc_mem_put(mctx, threads, workers * sizeof (isc_thread_t));
isc_mem_put(mctx, manager, sizeof *manager);
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_mutex_init() failed");
return (ISC_R_UNEXPECTED);
}
- if (default_quantum == 0)
- default_quantum = DEFAULT_DEFAULT_QUANTUM;
- manager->default_quantum = default_quantum;
- INIT_LIST(manager->tasks);
- INIT_LIST(manager->ready_tasks);
+#ifdef ISC_PLATFORM_USETHREADS
+ manager->threads = isc_mem_get(mctx, workers * sizeof (isc_thread_t));
+ if (manager->threads == NULL) {
+ DESTROYLOCK(&manager->lock);
+ isc_mem_put(mctx, manager, sizeof *manager);
+ return (ISC_R_NOMEMORY);
+ }
if (isc_condition_init(&manager->work_available) != ISC_R_SUCCESS) {
- (void)isc_mutex_destroy(&manager->lock);
- isc_mem_put(mctx, threads, workers * sizeof (isc_thread_t));
+ DESTROYLOCK(&manager->lock);
+ isc_mem_put(mctx, manager->threads,
+ workers * sizeof (isc_thread_t));
isc_mem_put(mctx, manager, sizeof *manager);
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_condition_init() failed");
return (ISC_R_UNEXPECTED);
}
+#endif /* ISC_PLATFORM_USETHREADS */
+ if (default_quantum == 0)
+ default_quantum = DEFAULT_DEFAULT_QUANTUM;
+ manager->default_quantum = default_quantum;
+ INIT_LIST(manager->tasks);
+ INIT_LIST(manager->ready_tasks);
manager->exiting = ISC_FALSE;
manager->workers = 0;
isc_mem_attach(mctx, &manager->mctx);
+#ifdef ISC_PLATFORM_USETHREADS
LOCK(&manager->lock);
/*
* Start workers.
*/
for (i = 0; i < workers; i++) {
if (isc_thread_create(run, manager,
- &manager->threads[manager->workers]) ==
+ &manager->threads[manager->workers]) ==
ISC_R_SUCCESS) {
manager->workers++;
started++;
@@ -988,7 +1053,11 @@ isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers,
if (started == 0) {
manager_free(manager);
return (ISC_R_NOTHREADS);
- }
+ }
+#else /* ISC_PLATFORM_USETHREADS */
+ manager->refs = 0;
+ taskmgr = manager;
+#endif /* ISC_PLATFORM_USETHREADS */
*managerp = manager;
@@ -1009,6 +1078,16 @@ isc_taskmgr_destroy(isc_taskmgr_t **managerp) {
manager = *managerp;
REQUIRE(VALID_MANAGER(manager));
+#ifndef ISC_PLATFORM_USETHREADS
+ UNUSED(i);
+
+ if (manager->refs > 1) {
+ manager->refs--;
+ *managerp = NULL;
+ return;
+ }
+#endif /* ISC_PLATFORM_USETHREADS */
+
XTHREADTRACE("isc_taskmgr_destroy");
/*
* Only one non-worker thread may ever call this routine.
@@ -1047,7 +1126,7 @@ isc_taskmgr_destroy(isc_taskmgr_t **managerp) {
ENQUEUE(manager->ready_tasks, task, ready_link);
UNLOCK(&task->lock);
}
-
+#ifdef ISC_PLATFORM_USETHREADS
/*
* Wake up any sleeping workers. This ensures we get work done if
* there's work left to do, and if there are already no tasks left
@@ -1061,8 +1140,37 @@ isc_taskmgr_destroy(isc_taskmgr_t **managerp) {
*/
for (i = 0; i < manager->workers; i++)
(void)isc_thread_join(manager->threads[i], NULL);
+#else /* ISC_PLATFORM_USETHREADS */
+ /*
+ * Dispatch the shutdown events.
+ */
+ UNLOCK(&manager->lock);
+ while (isc__taskmgr_ready())
+ (void)isc__taskmgr_dispatch();
+#endif /* ISC_PLATFORM_USETHREADS */
manager_free(manager);
*managerp = NULL;
}
+
+#ifndef ISC_PLATFORM_USETHREADS
+isc_boolean_t
+isc__taskmgr_ready(void) {
+ if (taskmgr == NULL)
+ return (ISC_FALSE);
+ return (ISC_TF(!ISC_LIST_EMPTY(taskmgr->ready_tasks)));
+}
+
+isc_result_t
+isc__taskmgr_dispatch(void) {
+ isc_taskmgr_t *manager = taskmgr;
+
+ if (taskmgr == NULL)
+ return (ISC_R_NOTFOUND);
+
+ dispatch(manager);
+
+ return (ISC_R_SUCCESS);
+}
+#endif /* ISC_PLATFORM_USETHREADS */
diff --git a/lib/isc/task_p.h b/lib/isc/task_p.h
new file mode 100644
index 00000000..b9c6c704
--- /dev/null
+++ b/lib/isc/task_p.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: task_p.h,v 1.4 2000/09/28 21:32:49 bwelling Exp $ */
+
+/* ISC_PLATFORM_USETHREADS_DELETE */
+
+#ifndef ISC_TASK_P_H
+#define ISC_TASK_P_H
+
+isc_boolean_t
+isc__taskmgr_ready(void);
+
+isc_result_t
+isc__taskmgr_dispatch(void);
+
+#endif /* ISC_TASK_P_H */
diff --git a/lib/isc/taskpool.c b/lib/isc/taskpool.c
index 9a9a4e94..3320a148 100644
--- a/lib/isc/taskpool.c
+++ b/lib/isc/taskpool.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: taskpool.c,v 1.7 2000/06/22 21:57:17 tale Exp $ */
+/* $Id: taskpool.c,v 1.9 2000/08/01 01:29:52 tale Exp $ */
#include <config.h>
@@ -28,7 +28,7 @@
***/
struct isc_taskpool {
- isc_mem_t * mctx;
+ isc_mem_t * mctx;
unsigned int ntasks;
isc_task_t ** tasks;
};
@@ -44,7 +44,7 @@ isc_taskpool_create(isc_taskmgr_t *tmgr, isc_mem_t *mctx,
unsigned int i;
isc_taskpool_t *pool;
isc_result_t result;
-
+
INSIST(ntasks > 0);
pool = isc_mem_get(mctx, sizeof *pool);
if (pool == NULL)
@@ -52,7 +52,7 @@ isc_taskpool_create(isc_taskmgr_t *tmgr, isc_mem_t *mctx,
pool->mctx = mctx;
pool->ntasks = ntasks;
pool->tasks = isc_mem_get(mctx, ntasks * sizeof(isc_task_t *));
- for (i = 0; i < ntasks; i++)
+ for (i = 0; i < ntasks; i++)
pool->tasks[i] = NULL;
for (i = 0; i < ntasks; i++) {
result = isc_task_create(tmgr, quantum, &pool->tasks[i]);
diff --git a/lib/isc/timer.c b/lib/isc/timer.c
index 4557999a..90c79811 100644
--- a/lib/isc/timer.c
+++ b/lib/isc/timer.c
@@ -1,33 +1,38 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: timer.c,v 1.52 2000/06/22 21:57:18 tale Exp $ */
+/* $Id: timer.c,v 1.58 2000/10/20 02:21:58 marka Exp $ */
#include <config.h>
#include <isc/condition.h>
#include <isc/heap.h>
#include <isc/mem.h>
+#include <isc/platform.h>
#include <isc/task.h>
#include <isc/thread.h>
#include <isc/time.h>
#include <isc/timer.h>
#include <isc/util.h>
+#ifndef ISC_PLATFORM_USETHREADS
+#include "timer_p.h"
+#endif /* ISC_PLATFORM_USETHREADS */
+
#ifdef ISC_TIMER_TRACE
#define XTRACE(s) printf("%s\n", (s))
#define XTRACEID(s, t) printf("%s %p\n", (s), (t))
@@ -80,11 +85,22 @@ struct isc_timermgr {
LIST(isc_timer_t) timers;
unsigned int nscheduled;
isc_time_t due;
+#ifdef ISC_PLATFORM_USETHREADS
isc_condition_t wakeup;
isc_thread_t thread;
+#else /* ISC_PLATFORM_USETHREADS */
+ unsigned int refs;
+#endif /* ISC_PLATFORM_USETHREADS */
isc_heap_t * heap;
};
+#ifndef ISC_PLATFORM_USETHREADS
+/*
+ * If threads are not in use, there can be only one.
+ */
+static isc_timermgr_t *timermgr = NULL;
+#endif /* ISC_PLATFORM_USETHREADS */
+
static inline isc_result_t
schedule(isc_timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) {
isc_result_t result;
@@ -92,12 +108,16 @@ schedule(isc_timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) {
isc_time_t due;
int cmp;
- /*
+ /*
* Note: the caller must ensure locking.
*/
REQUIRE(timer->type != isc_timertype_inactive);
+#ifndef ISC_PLATFORM_USETHREADS
+ UNUSED(signal_ok);
+#endif /* ISC_PLATFORM_USETHREADS */
+
/*
* Compute the new due time.
*/
@@ -115,7 +135,7 @@ schedule(isc_timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) {
else
due = timer->expires;
}
-
+
/*
* Schedule the timer.
*/
@@ -150,15 +170,21 @@ schedule(isc_timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) {
XTRACETIMER("schedule", timer, due);
/*
- * If this timer is at the head of the queue, we wake up the run
- * thread. We do this, because we likely have set a more recent
- * due time than the one the run thread is sleeping on, and we don't
- * want it to oversleep.
+ * If this timer is at the head of the queue, we need to ensure
+ * that we won't miss it if it has a more recent due time than
+ * the current "next" timer. We do this either by waking up the
+ * run thread, or explicitly setting the value in the manager.
*/
+#ifdef ISC_PLATFORM_USETHREADS
if (timer->index == 1 && signal_ok) {
XTRACE("signal (schedule)");
SIGNAL(&manager->wakeup);
}
+#else /* ISC_PLATFORM_USETHREADS */
+ if (timer->index == 1 &&
+ isc_time_compare(&timer->due, &manager->due) < 0)
+ manager->due = timer->due;
+#endif /* ISC_PLATFORM_USETHREADS */
return (ISC_R_SUCCESS);
}
@@ -168,7 +194,7 @@ deschedule(isc_timer_t *timer) {
isc_boolean_t need_wakeup = ISC_FALSE;
isc_timermgr_t *manager;
- /*
+ /*
* The caller must ensure locking.
*/
@@ -180,10 +206,12 @@ deschedule(isc_timer_t *timer) {
timer->index = 0;
INSIST(manager->nscheduled > 0);
manager->nscheduled--;
+#ifdef ISC_PLATFORM_USETHREADS
if (need_wakeup) {
XTRACE("signal (deschedule)");
SIGNAL(&manager->wakeup);
}
+#endif /* ISC_PLATFORM_USETHREADS */
}
}
@@ -208,7 +236,7 @@ destroy(isc_timer_t *timer) {
UNLOCK(&manager->lock);
isc_task_detach(&timer->task);
- (void)isc_mutex_destroy(&timer->lock);
+ DESTROYLOCK(&timer->lock);
timer->magic = 0;
isc_mem_put(manager->mctx, timer, sizeof *timer);
}
@@ -302,6 +330,7 @@ isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type,
"isc_mutex_init() failed");
return (ISC_R_UNEXPECTED);
}
+ ISC_LINK_INIT(timer, link);
timer->magic = TIMER_MAGIC;
LOCK(&manager->lock);
@@ -317,12 +346,12 @@ isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type,
result = ISC_R_SUCCESS;
if (result == ISC_R_SUCCESS)
APPEND(manager->timers, timer, link);
-
+
UNLOCK(&manager->lock);
if (result != ISC_R_SUCCESS) {
timer->magic = 0;
- (void)isc_mutex_destroy(&timer->lock);
+ DESTROYLOCK(&timer->lock);
isc_task_detach(&timer->task);
isc_mem_put(manager->mctx, timer, sizeof *timer);
return (result);
@@ -461,11 +490,11 @@ isc_timer_attach(isc_timer_t *timer, isc_timer_t **timerp) {
LOCK(&timer->lock);
timer->references++;
UNLOCK(&timer->lock);
-
+
*timerp = timer;
}
-void
+void
isc_timer_detach(isc_timer_t **timerp) {
isc_timer_t *timer;
isc_boolean_t free_timer = ISC_FALSE;
@@ -484,7 +513,7 @@ isc_timer_detach(isc_timer_t **timerp) {
if (timer->references == 0)
free_timer = ISC_TRUE;
UNLOCK(&timer->lock);
-
+
if (free_timer)
destroy(timer);
@@ -550,7 +579,7 @@ dispatch(isc_timermgr_t *manager, isc_time_t *now) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"couldn't allocate event");
}
-
+
timer->index = 0;
isc_heap_delete(manager->heap, 1);
manager->nscheduled--;
@@ -566,9 +595,10 @@ dispatch(isc_timermgr_t *manager, isc_time_t *now) {
manager->due = timer->due;
done = ISC_TRUE;
}
- }
+ }
}
+#ifdef ISC_PLATFORM_USETHREADS
static isc_threadresult_t
#ifdef _WIN32 /* XXXDCL */
WINAPI
@@ -602,6 +632,7 @@ run(void *uap) {
return ((isc_threadresult_t)0);
}
+#endif /* ISC_PLATFORM_USETHREADS */
static isc_boolean_t
sooner(void *v1, void *v2) {
@@ -638,10 +669,18 @@ isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) {
REQUIRE(managerp != NULL && *managerp == NULL);
+#ifndef ISC_PLATFORM_USETHREADS
+ if (timermgr != NULL) {
+ timermgr->refs++;
+ *managerp = timermgr;
+ return (ISC_R_SUCCESS);
+ }
+#endif /* ISC_PLATFORM_USETHREADS */
+
manager = isc_mem_get(mctx, sizeof *manager);
if (manager == NULL)
return (ISC_R_NOMEMORY);
-
+
manager->magic = TIMER_MANAGER_MAGIC;
manager->mctx = NULL;
manager->done = ISC_FALSE;
@@ -662,26 +701,32 @@ isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) {
"isc_mutex_init() failed");
return (ISC_R_UNEXPECTED);
}
+ isc_mem_attach(mctx, &manager->mctx);
+#ifdef ISC_PLATFORM_USETHREADS
if (isc_condition_init(&manager->wakeup) != ISC_R_SUCCESS) {
- (void)isc_mutex_destroy(&manager->lock);
+ isc_mem_detach(&manager->mctx);
+ DESTROYLOCK(&manager->lock);
isc_heap_destroy(&manager->heap);
isc_mem_put(mctx, manager, sizeof *manager);
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_condition_init() failed");
return (ISC_R_UNEXPECTED);
}
- isc_mem_attach(mctx, &manager->mctx);
if (isc_thread_create(run, manager, &manager->thread) !=
ISC_R_SUCCESS) {
isc_mem_detach(&manager->mctx);
(void)isc_condition_destroy(&manager->wakeup);
- (void)isc_mutex_destroy(&manager->lock);
+ DESTROYLOCK(&manager->lock);
isc_heap_destroy(&manager->heap);
isc_mem_put(mctx, manager, sizeof *manager);
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_thread_create() failed");
return (ISC_R_UNEXPECTED);
}
+#else /* ISC_PLATFORM_USETHREADS */
+ manager->refs = 1;
+ timermgr = manager;
+#endif /* ISC_PLATFORM_USETHREADS */
*managerp = manager;
@@ -703,26 +748,43 @@ isc_timermgr_destroy(isc_timermgr_t **managerp) {
LOCK(&manager->lock);
+#ifndef ISC_PLATFORM_USETHREADS
+ if (manager->refs > 1) {
+ manager->refs--;
+ UNLOCK(&manager->lock);
+ *managerp = NULL;
+ return;
+ }
+
+ isc__timermgr_dispatch();
+#endif /* ISC_PLATFORM_USETHREADS */
+
REQUIRE(EMPTY(manager->timers));
manager->done = ISC_TRUE;
+#ifdef ISC_PLATFORM_USETHREADS
XTRACE("signal (destroy)");
SIGNAL(&manager->wakeup);
+#endif /* ISC_PLATFORM_USETHREADS */
UNLOCK(&manager->lock);
+#ifdef ISC_PLATFORM_USETHREADS
/*
* Wait for thread to exit.
*/
if (isc_thread_join(manager->thread, NULL) != ISC_R_SUCCESS)
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_thread_join() failed");
+#endif /* ISC_PLATFORM_USETHREADS */
/*
* Clean up.
*/
+#ifdef ISC_PLATFORM_USETHREADS
(void)isc_condition_destroy(&manager->wakeup);
- (void)isc_mutex_destroy(&manager->lock);
+#endif /* ISC_PLATFORM_USETHREADS */
+ DESTROYLOCK(&manager->lock);
isc_heap_destroy(&manager->heap);
manager->magic = 0;
mctx = manager->mctx;
@@ -731,3 +793,23 @@ isc_timermgr_destroy(isc_timermgr_t **managerp) {
*managerp = NULL;
}
+
+#ifndef ISC_PLATFORM_USETHREADS
+isc_result_t
+isc__timermgr_nextevent(isc_time_t *when) {
+ if (timermgr == NULL || timermgr->nscheduled == 0)
+ return (ISC_R_NOTFOUND);
+ *when = timermgr->due;
+ return (ISC_R_SUCCESS);
+}
+
+isc_result_t
+isc__timermgr_dispatch(void) {
+ isc_time_t now;
+ if (timermgr == NULL)
+ return (ISC_R_NOTFOUND);
+ isc_time_now(&now);
+ dispatch(timermgr, &now);
+ return (ISC_R_SUCCESS);
+}
+#endif /* ISC_PLATFORM_USETHREADS */
diff --git a/lib/isc/timer_p.h b/lib/isc/timer_p.h
new file mode 100644
index 00000000..9e792800
--- /dev/null
+++ b/lib/isc/timer_p.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: timer_p.h,v 1.2 2000/09/28 21:32:50 bwelling Exp $ */
+
+/* ISC_PLATFORM_USETHREADS_DELETE */
+
+#ifndef ISC_TIMER_P_H
+#define ISC_TIMER_P_H
+
+isc_result_t
+isc__timermgr_nextevent(isc_time_t *when);
+
+isc_result_t
+isc__timermgr_dispatch(void);
+
+#endif /* ISC_TIMER_P_H */
diff --git a/lib/isc/unix/Makefile.in b/lib/isc/unix/Makefile.in
index 59aa0e58..a16b8e17 100644
--- a/lib/isc/unix/Makefile.in
+++ b/lib/isc/unix/Makefile.in
@@ -1,26 +1,26 @@
# Copyright (C) 1998-2000 Internet Software Consortium.
-#
+#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
-# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
-# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-# SOFTWARE.
-
-# $Id: Makefile.in,v 1.29 2000/06/22 21:58:28 tale Exp $
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+# $Id: Makefile.in,v 1.33 2000/11/14 23:38:09 tale Exp $
srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
CINCLUDES = -I${srcdir}/include \
- -I${srcdir}/../pthreads/include \
+ -I${srcdir}/../@ISC_THREAD_DIR@/include \
-I../include \
-I${srcdir}/../include \
-I${srcdir}/..
@@ -32,13 +32,13 @@ CWARNINGS =
OBJS = @ISC_IPV6_O@ \
app.@O@ dir.@O@ entropy.@O@ errno2result.@O@ file.@O@ \
fsaccess.@O@ interfaceiter.@O@ keyboard.@O@ net.@O@ \
- os.@O@ socket.@O@ stdio.@O@ stdtime.@O@ time.@O@
+ os.@O@ resource.@O@ socket.@O@ stdio.@O@ stdtime.@O@ time.@O@
# Alphabetically
SRCS = @ISC_IPV6_C@ \
app.c dir.c entropy.c errno2result.c file.c \
fsaccess.c interfaceiter.c keyboard.c net.c \
- os.c socket.c stdio.c stdtime.c time.c
+ os.c resource.c socket.c stdio.c stdtime.c time.c
SUBDIRS = include
TARGETS = ${OBJS}
diff --git a/lib/isc/unix/app.c b/lib/isc/unix/app.c
index 09476c27..27587b3c 100644
--- a/lib/isc/unix/app.c
+++ b/lib/isc/unix/app.c
@@ -1,41 +1,51 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: app.c,v 1.16.2.1 2000/06/28 03:12:30 gson Exp $ */
+/* $Id: app.c,v 1.33 2000/11/29 01:51:54 gson Exp $ */
#include <config.h>
-#include <pthread.h>
-
#include <sys/types.h>
#include <stddef.h>
#include <errno.h>
#include <unistd.h>
#include <signal.h>
+#include <sys/time.h>
#include <isc/app.h>
#include <isc/boolean.h>
+#include <isc/condition.h>
#include <isc/mutex.h>
#include <isc/event.h>
+#include <isc/platform.h>
#include <isc/string.h>
#include <isc/task.h>
+#include <isc/time.h>
#include <isc/util.h>
+#ifdef ISC_PLATFORM_USETHREADS
+#include <pthread.h>
+#else /* ISC_PLATFORM_USETHREADS */
+#include "../timer_p.h"
+#include "../task_p.h"
+#include "socket_p.h"
+#endif /* ISC_PLATFORM_USETHREADS */
+
static isc_eventlist_t on_run;
static isc_mutex_t lock;
static isc_boolean_t shutdown_requested = ISC_FALSE;
@@ -49,6 +59,11 @@ static isc_boolean_t want_shutdown = ISC_FALSE;
*/
static isc_boolean_t want_reload = ISC_FALSE;
+static isc_boolean_t blocked = ISC_FALSE;
+#ifdef ISC_PLATFORM_USETHREADS
+static pthread_t blockedthread;
+#endif /* ISC_PLATFORM_USETHREADS */
+
#ifdef HAVE_LINUXTHREADS
/*
* Linux has sigwait(), but it appears to prevent signal handlers from
@@ -91,15 +106,17 @@ handle_signal(int sig, void (*handler)(int)) {
strerror(errno));
return (ISC_R_UNEXPECTED);
}
-
+
return (ISC_R_SUCCESS);
}
isc_result_t
isc_app_start(void) {
isc_result_t result;
+#ifdef ISC_PLATFORM_USETHREADS
int presult;
sigset_t sset;
+#endif /* ISC_PLATFORM_USETHREADS */
/*
* Start an ISC library application.
@@ -112,7 +129,7 @@ isc_app_start(void) {
presult = pthread_init();
if (presult != 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_app_start() pthread_init: %s",
+ "isc_app_start() pthread_init: %s",
strerror(presult));
return (ISC_R_UNEXPECTED);
}
@@ -152,14 +169,26 @@ isc_app_start(void) {
/*
* On Solaris 2, delivery of a signal whose action is SIG_IGN
* will not cause sigwait() to return. We may have inherited
- * a SIG_IGN action for SIGHUP from our parent process,
- * (e.g, Solaris cron). Set an action of SIG_DFL to make
- * sure sigwait() works as expected.
+ * unexpected actions for SIGHUP, SIGINT, and SIGTERM from our parent
+ * process, * (e.g, Solaris cron). Set an action of SIG_DFL to make
+ * sure sigwait() works as expected. Only do this for SIGTERM and
+ * SIGINT if we don't have sigwait(), since a different handler is
+ * installed above.
*/
result = handle_signal(SIGHUP, SIG_DFL);
if (result != ISC_R_SUCCESS)
return (result);
+#ifdef HAVE_SIGWAIT
+ result = handle_signal(SIGTERM, SIG_DFL);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+ result = handle_signal(SIGINT, SIG_DFL);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+#endif
+
+#ifdef ISC_PLATFORM_USETHREADS
/*
* Block SIGHUP, SIGINT, SIGTERM.
*
@@ -174,17 +203,18 @@ isc_app_start(void) {
sigaddset(&sset, SIGINT) != 0 ||
sigaddset(&sset, SIGTERM) != 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_app_start() sigsetops: %s",
+ "isc_app_start() sigsetops: %s",
strerror(errno));
return (ISC_R_UNEXPECTED);
}
presult = pthread_sigmask(SIG_BLOCK, &sset, NULL);
if (presult != 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_app_start() pthread_sigmask: %s",
+ "isc_app_start() pthread_sigmask: %s",
strerror(presult));
return (ISC_R_UNEXPECTED);
}
+#endif /* ISC_PLATFORM_USETHREADS */
ISC_LIST_INIT(on_run);
@@ -221,7 +251,7 @@ isc_app_onrun(isc_mem_t *mctx, isc_task_t *task, isc_taskaction_t action,
result = ISC_R_NOMEMORY;
goto unlock;
}
-
+
ISC_LIST_APPEND(on_run, event, ev_link);
result = ISC_R_SUCCESS;
@@ -232,12 +262,128 @@ isc_app_onrun(isc_mem_t *mctx, isc_task_t *task, isc_taskaction_t action,
return (result);
}
+#ifndef ISC_PLATFORM_USETHREADS
+/*
+ * Event loop for nonthreaded programs.
+ */
+static isc_result_t
+evloop() {
+ isc_result_t result;
+ while (!want_shutdown) {
+ int n;
+ isc_time_t when, now;
+ struct timeval tv, *tvp;
+ fd_set readfds, writefds;
+ int maxfd;
+ isc_boolean_t readytasks;
+
+ readytasks = isc__taskmgr_ready();
+ if (readytasks) {
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+ tvp = &tv;
+ } else {
+ result = isc__timermgr_nextevent(&when);
+ if (result != ISC_R_SUCCESS)
+ tvp = NULL;
+ else {
+ isc_uint64_t us;
+
+ (void)isc_time_now(&now);
+ us = isc_time_microdiff(&when, &now);
+ tv.tv_sec = us / 1000000;
+ tv.tv_usec = us % 1000000;
+ tvp = &tv;
+ }
+ }
+
+ isc__socketmgr_getfdsets(&readfds, &writefds, &maxfd);
+ n = select(maxfd, &readfds, &writefds, NULL, tvp);
+
+ (void)isc__timermgr_dispatch();
+ if (n > 0)
+ (void)isc__socketmgr_dispatch(&readfds, &writefds,
+ maxfd);
+ (void)isc__taskmgr_dispatch();
+
+ if (want_reload) {
+ want_reload = ISC_FALSE;
+ return (ISC_R_RELOAD);
+ }
+ }
+ return (ISC_R_SUCCESS);
+}
+
+/*
+ * This is a gross hack to support waiting for condition
+ * variables in nonthreaded programs in a limited way;
+ * see lib/isc/nothreads/include/isc/condition.h.
+ * We implement isc_condition_wait() by entering the
+ * event loop recursively until the want_shutdown flag
+ * is set by isc_condition_signal().
+ */
+
+/*
+ * True iff we are currently executing in the recursive
+ * event loop.
+ */
+static isc_boolean_t in_recursive_evloop = ISC_FALSE;
+
+/*
+ * True iff we are exiting the event loop as the result of
+ * a call to isc_condition_signal() rather than a shutdown
+ * or reload.
+ */
+static isc_boolean_t signalled = ISC_FALSE;
+
+isc_result_t
+isc__nothread_wait_hack(isc_condition_t *cp, isc_mutex_t *mp) {
+ isc_result_t result;
+
+ UNUSED(cp);
+ UNUSED(mp);
+
+ INSIST(!in_recursive_evloop);
+ in_recursive_evloop = ISC_TRUE;
+
+ INSIST(*mp == 1); /* Mutex must be locked on entry. */
+ --*mp;
+
+ result = evloop();
+ if (result == ISC_R_RELOAD)
+ want_reload = ISC_TRUE;
+ if (signalled) {
+ want_shutdown = ISC_FALSE;
+ signalled = ISC_FALSE;
+ }
+
+ ++*mp;
+ in_recursive_evloop = ISC_FALSE;
+ return (ISC_R_SUCCESS);
+}
+
+isc_result_t
+isc__nothread_signal_hack(isc_condition_t *cp) {
+
+ UNUSED(cp);
+
+ INSIST(in_recursive_evloop);
+
+ want_shutdown = ISC_TRUE;
+ signalled = ISC_TRUE;
+ return (ISC_R_SUCCESS);
+}
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
isc_result_t
isc_app_run(void) {
int result;
- sigset_t sset;
isc_event_t *event, *next_event;
isc_task_t *task;
+#ifdef ISC_PLATFORM_USETHREADS
+ sigset_t sset;
+#endif /* ISC_PLATFORM_USETHREADS */
#ifdef HAVE_SIGWAIT
int sig;
#endif
@@ -264,12 +410,12 @@ isc_app_run(void) {
next_event = ISC_LIST_NEXT(event, ev_link);
ISC_LIST_UNLINK(on_run, event, ev_link);
task = event->ev_sender;
- event->ev_sender = (void *)&running;
+ event->ev_sender = NULL;
isc_task_sendanddetach(&task, &event);
}
}
-
+
UNLOCK(&lock);
#ifndef HAVE_SIGWAIT
@@ -284,6 +430,7 @@ isc_app_run(void) {
return (ISC_R_SUCCESS);
#endif
+#ifdef ISC_PLATFORM_USETHREADS
/*
* There is no danger if isc_app_shutdown() is called before we wait
* for signals. Signals are blocked, so any such signal will simply
@@ -300,7 +447,7 @@ isc_app_run(void) {
sigaddset(&sset, SIGINT) != 0 ||
sigaddset(&sset, SIGTERM) != 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_app_run() sigsetops: %s",
+ "isc_app_run() sigsetops: %s",
strerror(errno));
return (ISC_R_UNEXPECTED);
}
@@ -332,7 +479,7 @@ isc_app_run(void) {
*/
if (sigemptyset(&sset) != 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_app_run() sigsetops: %s",
+ "isc_app_run() sigsetops: %s",
strerror(errno));
return (ISC_R_UNEXPECTED);
}
@@ -345,6 +492,19 @@ isc_app_run(void) {
}
}
+#else /* ISC_PLATFORM_USETHREADS */
+
+ (void)isc__taskmgr_dispatch();
+
+ result = evloop();
+ if (result != ISC_R_SUCCESS)
+ return (result);
+
+ while (isc__taskmgr_ready())
+ (void)isc__taskmgr_dispatch();
+
+#endif /* ISC_PLATFORM_USETHREADS */
+
return (ISC_R_SUCCESS);
}
@@ -357,7 +517,7 @@ isc_app_shutdown(void) {
*/
LOCK(&lock);
-
+
REQUIRE(running);
if (shutdown_requested)
@@ -370,7 +530,7 @@ isc_app_shutdown(void) {
if (want_kill) {
#ifdef HAVE_LINUXTHREADS
int result;
-
+
result = pthread_kill(main_thread, SIGTERM);
if (result != 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
@@ -400,7 +560,7 @@ isc_app_reload(void) {
*/
LOCK(&lock);
-
+
REQUIRE(running);
/*
@@ -414,18 +574,18 @@ isc_app_reload(void) {
if (want_kill) {
#ifdef HAVE_LINUXTHREADS
int result;
-
+
result = pthread_kill(main_thread, SIGHUP);
if (result != 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_app_shutdown() pthread_kill: %s",
+ "isc_app_reload() pthread_kill: %s",
strerror(result));
return (ISC_R_UNEXPECTED);
}
#else
if (kill(getpid(), SIGHUP) < 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_app_shutdown() kill: %s",
+ "isc_app_reload() kill: %s",
strerror(errno));
return (ISC_R_UNEXPECTED);
}
@@ -441,5 +601,45 @@ isc_app_finish(void) {
* Finish an ISC library application.
*/
- (void)isc_mutex_destroy(&lock);
+ DESTROYLOCK(&lock);
+}
+
+void
+isc_app_block(void) {
+#ifdef ISC_PLATFORM_USETHREADS
+ sigset_t sset;
+#endif /* ISC_PLATFORM_USETHREADS */
+ REQUIRE(running);
+ REQUIRE(!blocked);
+
+ blocked = ISC_TRUE;
+#ifdef ISC_PLATFORM_USETHREADS
+ blockedthread = pthread_self();
+ RUNTIME_CHECK(sigemptyset(&sset) == 0 &&
+ sigaddset(&sset, SIGINT) == 0 &&
+ sigaddset(&sset, SIGTERM) == 0);
+ RUNTIME_CHECK(pthread_sigmask(SIG_UNBLOCK, &sset, NULL) == 0);
+#endif /* ISC_PLATFORM_USETHREADS */
+}
+
+void
+isc_app_unblock(void) {
+#ifdef ISC_PLATFORM_USETHREADS
+ sigset_t sset;
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ REQUIRE(running);
+ REQUIRE(blocked);
+
+ blocked = ISC_FALSE;
+
+#ifdef ISC_PLATFORM_USETHREADS
+ REQUIRE(blockedthread == pthread_self());
+
+ RUNTIME_CHECK(sigemptyset(&sset) == 0 &&
+ sigaddset(&sset, SIGINT) == 0 &&
+ sigaddset(&sset, SIGTERM) == 0);
+ RUNTIME_CHECK(pthread_sigmask(SIG_BLOCK, &sset, NULL) == 0);
+#endif /* ISC_PLATFORM_USETHREADS */
}
+
diff --git a/lib/isc/unix/dir.c b/lib/isc/unix/dir.c
index 33d5742e..069a56f0 100644
--- a/lib/isc/unix/dir.c
+++ b/lib/isc/unix/dir.c
@@ -1,26 +1,30 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dir.c,v 1.10 2000/05/11 15:09:27 tale Exp $ */
+/* $Id: dir.c,v 1.14 2000/08/03 13:44:02 tale Exp $ */
/* Principal Authors: DCL */
#include <config.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
#include <errno.h>
#include <unistd.h>
@@ -47,7 +51,7 @@ isc_dir_init(isc_dir_t *dir) {
}
/*
- * Allocate workspace and open directory stream. If either one fails,
+ * Allocate workspace and open directory stream. If either one fails,
* NULL will be returned.
*/
isc_result_t
@@ -88,7 +92,7 @@ isc_dir_read(isc_dir_t *dir) {
return (ISC_R_NOMORE);
/*
- * Make sure that the space for the name is long enough.
+ * Make sure that the space for the name is long enough.
*/
if (sizeof(dir->entry.name) <= strlen(entry->d_name))
return (ISC_R_UNEXPECTED);
@@ -126,10 +130,6 @@ isc_dir_reset(isc_dir_t *dir) {
return (ISC_R_SUCCESS);
}
-/*
- * XXX Is there a better place for this?
- */
-
isc_result_t
isc_dir_chdir(const char *dirname) {
/*
@@ -143,3 +143,72 @@ isc_dir_chdir(const char *dirname) {
return (ISC_R_SUCCESS);
}
+
+isc_result_t
+isc_dir_createunique(char *templet) {
+ isc_result_t result;
+ char *x;
+ char *p;
+ int i;
+ int pid;
+
+ REQUIRE(templet != NULL);
+
+ /*
+ * mkdtemp is not portable, so this emulates it.
+ */
+
+ pid = getpid();
+
+ /*
+ * Replace trailing Xs with the process-id, zero-filled.
+ */
+ for (x = templet + strlen(templet) - 1; *x == 'X' && x >= templet;
+ x--, pid /= 10)
+ *x = pid % 10 + '0';
+
+ x++; /* Set x to start of ex-Xs. */
+
+ do {
+ i = mkdir(templet, 0700);
+ if (i == 0 || errno != EEXIST)
+ break;
+
+ /*
+ * The BSD algorithm.
+ */
+ p = x;
+ while (*p != '\0') {
+ if (isdigit(*p & 0xff))
+ *p = 'a';
+ else if (*p != 'z')
+ ++*p;
+ else {
+ /*
+ * Reset character and move to next.
+ */
+ *p++ = 'a';
+ continue;
+ }
+
+ break;
+ }
+
+ if (*p == '\0') {
+ /*
+ * Tried all combinations. errno should already
+ * be EEXIST, but ensure it is anyway for
+ * isc__errno2result().
+ */
+ errno = EEXIST;
+ break;
+ }
+ } while (1);
+
+ if (i == -1)
+ result = isc__errno2result(errno);
+ else
+ result = ISC_R_SUCCESS;
+
+ return (result);
+}
diff --git a/lib/isc/unix/entropy.c b/lib/isc/unix/entropy.c
index 04b91f7a..a3599dfd 100644
--- a/lib/isc/unix/entropy.c
+++ b/lib/isc/unix/entropy.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: entropy.c,v 1.44.2.1 2000/06/26 21:43:44 gson Exp $ */
+/* $Id: entropy.c,v 1.51 2000/11/23 01:04:00 bwelling Exp $ */
#include <config.h>
@@ -134,10 +134,11 @@ struct isc_entropysource {
isc_uint32_t total; /* entropy from this source */
ISC_LINK(isc_entropysource_t) link;
char name[32];
+ isc_boolean_t bad;
union {
isc_entropysamplesource_t sample;
isc_entropyfilesource_t file;
- isc_cbsource_t callback;
+ isc_cbsource_t callback;
} sources;
};
@@ -374,7 +375,7 @@ get_from_filesource(isc_entropysource_t *source, isc_uint32_t desired) {
ssize_t n, ndesired;
unsigned int added;
- if (fd == -1)
+ if (source->bad)
return (0);
desired = desired / 8 + (((desired & 0x07) > 0) ? 1 : 0);
@@ -387,12 +388,12 @@ get_from_filesource(isc_entropysource_t *source, isc_uint32_t desired) {
if (errno == EAGAIN)
goto out;
close(fd);
- source->sources.file.fd = -1;
+ source->bad = ISC_TRUE;
goto out;
}
if (n == 0) {
close(fd);
- source->sources.file.fd = -1;
+ source->bad = ISC_TRUE;
goto out;
}
@@ -418,6 +419,9 @@ get_from_callback(isc_entropysource_t *source, unsigned int desired,
if (desired == 0)
return (0);
+ if (source->bad)
+ return (0);
+
if (!cbs->start_called && cbs->startfunc != NULL) {
result = cbs->startfunc(source, cbs->arg, blocking);
if (result != ISC_R_SUCCESS)
@@ -434,7 +438,9 @@ get_from_callback(isc_entropysource_t *source, unsigned int desired,
added += got;
desired -= ISC_MIN(got, desired);
result = ISC_R_SUCCESS;
- }
+ } else if (result != ISC_R_SUCCESS)
+ source->bad = ISC_TRUE;
+
}
return (added);
@@ -708,7 +714,7 @@ isc_entropy_getdata(isc_entropy_t *ent, void *data, unsigned int length,
isc_sha1_update(&hash, (void *)(ent->pool.pool),
RND_POOLWORDS * 4);
isc_sha1_final(&hash, digest);
-
+
/*
* Stir the extracted data (all of it) back into the pool.
*/
@@ -834,7 +840,7 @@ destroysource(isc_entropysource_t **sourcep) {
switch (source->type) {
case ENTROPY_SOURCETYPE_FILE:
fd = source->sources.file.fd;
- if (fd >= 0)
+ if (!source->bad)
close(fd);
break;
case ENTROPY_SOURCETYPE_SAMPLE:
@@ -914,7 +920,7 @@ destroy(isc_entropy_t **entp) {
UNLOCK(&ent->lock);
- isc_mutex_destroy(&ent->lock);
+ DESTROYLOCK(&ent->lock);
memset(ent, 0, sizeof(isc_entropy_t));
isc_mem_put(mctx, ent, sizeof(isc_entropy_t));
@@ -956,22 +962,20 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) {
LOCK(&ent->lock);
source = NULL;
- fd = -1;
fd = open(fname, O_RDONLY | O_NONBLOCK, 0);
if (fd < 0) {
ret = ISC_R_IOERROR;
goto errout;
}
-
ret = make_nonblock(fd);
if (ret != ISC_R_SUCCESS)
- goto errout;
+ goto closefd;
source = isc_mem_get(ent->mctx, sizeof(isc_entropysource_t));
if (source == NULL) {
ret = ISC_R_NOMEMORY;
- goto errout;
+ goto closefd;
}
/*
@@ -981,6 +985,7 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) {
source->type = ENTROPY_SOURCETYPE_FILE;
source->ent = ent;
source->total = 0;
+ source->bad = ISC_FALSE;
memset(source->name, 0, sizeof(source->name));
ISC_LINK_INIT(source, link);
source->sources.file.fd = fd;
@@ -994,11 +999,12 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) {
UNLOCK(&ent->lock);
return (ISC_R_SUCCESS);
+ closefd:
+ close(fd);
+
errout:
if (source != NULL)
isc_mem_put(ent->mctx, source, sizeof(isc_entropysource_t));
- if (fd >= 0)
- close(fd);
UNLOCK(&ent->lock);
@@ -1055,6 +1061,7 @@ isc_entropy_createcallbacksource(isc_entropy_t *ent,
ret = ISC_R_NOMEMORY;
goto errout;
}
+ source->bad = ISC_FALSE;
cbs = &source->sources.callback;
diff --git a/lib/isc/unix/errno2result.c b/lib/isc/unix/errno2result.c
index 7eba8955..b2c96804 100644
--- a/lib/isc/unix/errno2result.c
+++ b/lib/isc/unix/errno2result.c
@@ -1,26 +1,24 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: errno2result.c,v 1.2 2000/05/16 03:00:53 tale Exp $ */
+/* $Id: errno2result.c,v 1.6 2000/11/18 02:56:48 gson Exp $ */
#include <config.h>
-#include <errno.h>
-
#include <isc/result.h>
#include "errno2result.h"
@@ -36,13 +34,14 @@ isc__errno2result(int posixerrno) {
switch (posixerrno) {
case ENOTDIR:
case ELOOP:
- case EINVAL:
+ case EINVAL: /* XXX sometimes this is not for files */
case ENAMETOOLONG:
case EBADF:
return (ISC_R_INVALIDFILE);
case ENOENT:
return (ISC_R_FILENOTFOUND);
case EACCES:
+ case EPERM:
return (ISC_R_NOPERM);
case EEXIST:
return (ISC_R_FILEEXISTS);
@@ -50,6 +49,9 @@ isc__errno2result(int posixerrno) {
return (ISC_R_IOERROR);
case ENOMEM:
return (ISC_R_NOMEMORY);
+ case ENFILE:
+ case EMFILE:
+ return (ISC_R_TOOMANYOPENFILES);
default:
/*
* XXXDCL would be nice if perhaps this function could
diff --git a/lib/isc/unix/errno2result.h b/lib/isc/unix/errno2result.h
index f3204d14..15e68558 100644
--- a/lib/isc/unix/errno2result.h
+++ b/lib/isc/unix/errno2result.h
@@ -1,27 +1,29 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: errno2result.h,v 1.3 2000/06/23 03:03:57 tale Exp $ */
+/* $Id: errno2result.h,v 1.6 2000/11/14 23:37:10 tale Exp $ */
#ifndef UNIX_ERRNO2RESULT_H
#define UNIX_ERRNO2RESULT_H 1
/* XXXDCL this should be moved to lib/isc/include/isc/errno2result.h. */
+#include <errno.h> /* Provides errno. */
+
#include <isc/lang.h>
#include <isc/types.h>
diff --git a/lib/isc/unix/file.c b/lib/isc/unix/file.c
index 8facaa81..0eb2f860 100644
--- a/lib/isc/unix/file.c
+++ b/lib/isc/unix/file.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: file.c,v 1.17.2.1 2000/09/11 19:27:52 explorer Exp $ */
+/* $Id: file.c,v 1.26 2000/10/20 22:09:01 gson Exp $ */
#include <config.h>
@@ -45,10 +45,10 @@
static isc_result_t
file_stats(const char *file, struct stat *stats) {
isc_result_t result = ISC_R_SUCCESS;
-
+
if (stat(file, stats) != 0)
result = isc__errno2result(errno);
-
+
return (result);
}
@@ -90,12 +90,10 @@ isc_file_settime(const char *file, isc_time_t *time) {
times[0].tv_sec = times[1].tv_sec = (long)isc_time_seconds(time);
/*
- * Solaris 5.6 gives this warning about the left shift:
- * warning: integer overflow detected: op "<<"
- * if the U(nsigned) qualifier is not on the 1.
+ * Here is the real check for the high bit being set.
*/
if ((times[0].tv_sec &
- (1U << (sizeof(times[0].tv_sec) * CHAR_BIT - 1))) != 0)
+ (1ULL << (sizeof(times[0].tv_sec) * CHAR_BIT - 1))) != 0)
return (ISC_R_RANGE);
/*
@@ -119,29 +117,61 @@ isc_file_settime(const char *file, isc_time_t *time) {
isc_result_t
isc_file_mktemplate(const char *path, char *buf, size_t buflen) {
+ return (isc_file_template(path, TEMPLATE, buf, buflen));
+}
+
+isc_result_t
+isc_file_template(const char *path, const char *templet, char *buf,
+ size_t buflen) {
char *s;
REQUIRE(buf != NULL);
+ s = strrchr(templet, '/');
+ if (s != NULL)
+ templet = s + 1;
+
s = strrchr(path, '/');
if (s != NULL) {
- if ((s - path + 1 + sizeof(TEMPLATE)) > buflen)
+ if ((s - path + 1 + strlen(templet) + 1) > buflen)
return (ISC_R_NOSPACE);
-
+
strncpy(buf, path, s - path + 1);
buf[s - path + 1] = '\0';
- strcat(buf, TEMPLATE);
+ strcat(buf, templet);
} else {
- if (sizeof(TEMPLATE) > buflen)
+ if ((strlen(templet) + 1) > buflen)
return (ISC_R_NOSPACE);
-
- strcpy(buf, TEMPLATE);
+
+ strcpy(buf, templet);
}
-
+
return (ISC_R_SUCCESS);
}
-
+
+isc_result_t
+isc_file_renameunique(const char *file, char *templet) {
+ int fd = -1;
+ int res = 0;
+ isc_result_t result = ISC_R_SUCCESS;
+
+ fd = mkstemp(templet);
+ if (fd == -1) {
+ result = isc__errno2result(errno);
+ }
+ if (result == ISC_R_SUCCESS) {
+ res = rename(file, templet);
+ if (res != 0) {
+ (void)unlink(templet);
+ result = isc__errno2result(errno);
+ }
+ }
+ if (fd != -1)
+ close(fd);
+ return (result);
+}
+
isc_result_t
isc_file_openunique(char *templet, FILE **fp) {
int fd;
@@ -175,7 +205,7 @@ isc_file_openunique(char *templet, FILE **fp) {
isc_result_t
isc_file_remove(const char *filename) {
int r;
-
+
r = unlink(filename);
if (r == 0)
return (ISC_R_SUCCESS);
@@ -193,3 +223,8 @@ isc_file_rename(const char *oldname, const char *newname) {
else
return (isc__errno2result(errno));
}
+
+isc_boolean_t
+isc_file_isabsolute(const char *filename) {
+ return (ISC_TF(filename[0] == '/'));
+}
diff --git a/lib/isc/unix/fsaccess.c b/lib/isc/unix/fsaccess.c
index bcc41dce..b820795f 100644
--- a/lib/isc/unix/fsaccess.c
+++ b/lib/isc/unix/fsaccess.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: fsaccess.c,v 1.3 2000/06/22 21:58:36 tale Exp $ */
+/* $Id: fsaccess.c,v 1.5 2000/08/01 01:31:18 tale Exp $ */
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/lib/isc/unix/ifiter_ioctl.c b/lib/isc/unix/ifiter_ioctl.c
index 2f0cb51e..526e1700 100644
--- a/lib/isc/unix/ifiter_ioctl.c
+++ b/lib/isc/unix/ifiter_ioctl.c
@@ -1,26 +1,26 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: ifiter_ioctl.c,v 1.11 2000/06/22 21:58:37 tale Exp $ */
+/* $Id: ifiter_ioctl.c,v 1.13 2000/08/01 01:31:19 tale Exp $ */
/*
* Obtain the list of network interfaces using the SIOCGLIFCONF ioctl.
* See netintro(4).
- */
+ */
#ifndef SIOCGLIFCONF
#define SIOCGLIFCONF SIOCGIFCONF
#define lifc_len ifc_len
@@ -45,7 +45,7 @@
#endif
-#define IFITER_MAGIC 0x49464954U /* IFIT. */
+#define IFITER_MAGIC 0x49464954U /* IFIT. */
#define VALID_IFITER(t) ((t) != NULL && (t)->magic == IFITER_MAGIC)
struct isc_interfaceiter {
@@ -77,7 +77,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
REQUIRE(mctx != NULL);
REQUIRE(iterp != NULL);
REQUIRE(*iterp == NULL);
-
+
iter = isc_mem_get(mctx, sizeof(*iter));
if (iter == NULL)
return (ISC_R_NOMEMORY);
@@ -95,7 +95,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
result = ISC_R_UNEXPECTED;
goto socket_failure;
}
-
+
/*
* Get the interface configuration, allocating more memory if
* necessary.
@@ -108,7 +108,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
result = ISC_R_NOMEMORY;
goto alloc_failure;
}
-
+
memset(&iter->ifc.lifc_len, 0, sizeof(iter->ifc.lifc_len));
#ifdef ISC_HAVE_LIFC_FAMILY
iter->ifc.lifc_family = AF_UNSPEC;
@@ -146,18 +146,18 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
* retry.
*/
if (iter->ifc.lifc_len + 2 * sizeof(struct lifreq)
- < iter->bufsize)
+ < iter->bufsize)
break;
}
if (iter->bufsize >= IFCONF_BUFSIZE_MAX) {
- UNEXPECTED_ERROR(__FILE__, __LINE__,
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
"get interface configuration: "
"maximum buffer size exceeded");
result = ISC_R_UNEXPECTED;
goto ioctl_failure;
}
isc_mem_put(mctx, iter->buf, iter->bufsize);
-
+
iter->bufsize *= 2;
}
@@ -167,7 +167,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
*/
iter->pos = (unsigned int) -1;
iter->result = ISC_R_FAILURE;
-
+
iter->magic = IFITER_MAGIC;
*iterp = iter;
return (ISC_R_SUCCESS);
@@ -177,7 +177,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
alloc_failure:
(void) close(iter->socket);
-
+
socket_failure:
isc_mem_put(mctx, iter, sizeof *iter);
return (result);
@@ -196,25 +196,25 @@ internal_current(isc_interfaceiter_t *iter) {
struct lifreq *ifrp;
struct lifreq lifreq;
int family;
-
+
REQUIRE(VALID_IFITER(iter));
REQUIRE (iter->pos < (unsigned int) iter->ifc.lifc_len);
-
+
ifrp = (struct lifreq *)((char *) iter->ifc.lifc_req + iter->pos);
-
+
memset(&lifreq, 0, sizeof lifreq);
memcpy(&lifreq, ifrp, sizeof lifreq);
family = lifreq.lifr_addr.ss_family;
if (family != AF_INET)
- return (ISC_R_IGNORE);
-
+ return (ISC_R_IGNORE);
+
memset(&iter->current, 0, sizeof(iter->current));
iter->current.af = family;
-
+
INSIST(sizeof(lifreq.lifr_name) <= sizeof(iter->current.name));
memcpy(iter->current.name, lifreq.lifr_name, sizeof(lifreq.lifr_name));
-
+
get_addr(family, &iter->current.address,
(struct sockaddr *)&lifreq.lifr_addr);
@@ -223,20 +223,20 @@ internal_current(isc_interfaceiter_t *iter) {
*/
iter->current.flags = 0;
-
+
/*
* Ignore the HP/UX warning about "interger overflow during
* conversion. It comes from its own macro definition,
* and is really hard to shut up.
*/
if (ioctl(iter->socket, SIOCGLIFFLAGS, (char *) &lifreq) < 0) {
- UNEXPECTED_ERROR(__FILE__, __LINE__,
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
"%s: getting interface flags: %s",
lifreq.lifr_name,
strerror(errno));
return (ISC_R_IGNORE);
}
-
+
if ((lifreq.lifr_flags & IFF_UP) != 0)
iter->current.flags |= INTERFACE_F_UP;
@@ -257,7 +257,7 @@ internal_current(isc_interfaceiter_t *iter) {
*/
if (ioctl(iter->socket, SIOCGLIFDSTADDR, (char *)&lifreq)
< 0) {
- UNEXPECTED_ERROR(__FILE__, __LINE__,
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
"%s: getting destination address: %s",
lifreq.lifr_name,
strerror(errno));
@@ -269,7 +269,7 @@ internal_current(isc_interfaceiter_t *iter) {
/*
* Get the network mask.
- */
+ */
memset(&lifreq, 0, sizeof lifreq);
memcpy(&lifreq, ifrp, sizeof lifreq);
switch (family) {
@@ -288,7 +288,7 @@ internal_current(isc_interfaceiter_t *iter) {
return (ISC_R_IGNORE);
}
get_addr(family, &iter->current.netmask,
- (struct sockaddr *)&lifreq.lifr_addr);
+ (struct sockaddr *)&lifreq.lifr_addr);
break;
case AF_INET6: {
#ifdef lifr_addrlen
@@ -308,12 +308,12 @@ internal_current(isc_interfaceiter_t *iter) {
break;
}
}
-
+
return (ISC_R_SUCCESS);
}
/*
- * Step the iterator to the next interface. Unlike
+ * Step the iterator to the next interface. Unlike
* isc_interfaceiter_next(), this may leave the iterator
* positioned on an interface that will ultimately
* be ignored. Return ISC_R_NOMORE if there are no more
@@ -324,9 +324,9 @@ internal_next(isc_interfaceiter_t *iter) {
struct lifreq *ifrp;
REQUIRE (iter->pos < (unsigned int) iter->ifc.lifc_len);
-
+
ifrp = (struct lifreq *)((char *) iter->ifc.lifc_req + iter->pos);
-
+
#ifdef ISC_PLATFORM_HAVESALEN
if (ifrp->lifr_addr.sa_len > sizeof(struct sockaddr))
iter->pos += sizeof(ifrp->lifr_name) + ifrp->lifr_addr.sa_len;
@@ -336,7 +336,7 @@ internal_next(isc_interfaceiter_t *iter) {
if (iter->pos >= (unsigned int) iter->ifc.lifc_len)
return (ISC_R_NOMORE);
-
+
return (ISC_R_SUCCESS);
}
diff --git a/lib/isc/unix/ifiter_sysctl.c b/lib/isc/unix/ifiter_sysctl.c
index 22f26839..7740188c 100644
--- a/lib/isc/unix/ifiter_sysctl.c
+++ b/lib/isc/unix/ifiter_sysctl.c
@@ -1,27 +1,27 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: ifiter_sysctl.c,v 1.8 2000/06/22 21:58:38 tale Exp $ */
+/* $Id: ifiter_sysctl.c,v 1.10 2000/08/01 01:31:20 tale Exp $ */
/*
* Obtain the list of network interfaces using sysctl.
* See TCP/IP Illustrated Volume 2, sections 19.8, 19.14,
* and 19.16.
- */
+ */
#include <sys/param.h>
#include <sys/sysctl.h>
@@ -39,7 +39,7 @@
: sizeof(long))
#endif
-#define IFITER_MAGIC 0x49464953U /* IFIS. */
+#define IFITER_MAGIC 0x49464953U /* IFIS. */
#define VALID_IFITER(t) ((t) != NULL && (t)->magic == IFITER_MAGIC)
struct isc_interfaceiter {
@@ -56,23 +56,23 @@ struct isc_interfaceiter {
static int mib[6] = {
CTL_NET,
- PF_ROUTE,
- 0,
+ PF_ROUTE,
+ 0,
0, /* Any address family. */
- NET_RT_IFLIST,
+ NET_RT_IFLIST,
0 /* Flags. */
};
-
+
isc_result_t
isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
isc_interfaceiter_t *iter;
isc_result_t result;
size_t bufsize;
- size_t bufused;
+ size_t bufused;
REQUIRE(mctx != NULL);
REQUIRE(iterp != NULL);
REQUIRE(*iterp == NULL);
-
+
iter = isc_mem_get(mctx, sizeof(*iter));
if (iter == NULL)
return (ISC_R_NOMEMORY);
@@ -85,7 +85,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
*/
bufsize = 0;
if (sysctl(mib, 6, NULL, &bufsize, NULL, (size_t) 0) < 0) {
- UNEXPECTED_ERROR(__FILE__, __LINE__,
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
"getting interface list size: sysctl: %s",
strerror(errno));
result = ISC_R_UNEXPECTED;
@@ -101,7 +101,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
bufused = bufsize;
if (sysctl(mib, 6, iter->buf, &bufused, NULL, (size_t) 0) < 0) {
- UNEXPECTED_ERROR(__FILE__, __LINE__,
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
"getting interface list: sysctl: %s",
strerror(errno));
result = ISC_R_UNEXPECTED;
@@ -116,7 +116,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
*/
iter->pos = (unsigned int) -1;
iter->result = ISC_R_FAILURE;
-
+
iter->magic = IFITER_MAGIC;
*iterp = iter;
return (ISC_R_SUCCESS);
@@ -139,34 +139,34 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
static isc_result_t
internal_current(isc_interfaceiter_t *iter) {
struct ifa_msghdr *ifam, *ifam_end;
-
+
REQUIRE(VALID_IFITER(iter));
REQUIRE (iter->pos < (unsigned int) iter->bufused);
ifam = (struct ifa_msghdr *) ((char *) iter->buf + iter->pos);
ifam_end = (struct ifa_msghdr *) ((char *) iter->buf + iter->bufused);
-
+
if (ifam->ifam_type == RTM_IFINFO) {
struct if_msghdr *ifm = (struct if_msghdr *) ifam;
struct sockaddr_dl *sdl = (struct sockaddr_dl *) (ifm + 1);
unsigned int namelen;
memset(&iter->current, 0, sizeof(iter->current));
-
+
namelen = sdl->sdl_nlen;
if (namelen > sizeof(iter->current.name) - 1)
namelen = sizeof(iter->current.name) - 1;
-
+
memcpy(iter->current.name, sdl->sdl_data, namelen);
iter->current.flags = 0;
if ((ifam->ifam_flags & IFF_UP) != 0)
iter->current.flags |= INTERFACE_F_UP;
-
+
if ((ifam->ifam_flags & IFF_POINTOPOINT) != 0)
iter->current.flags |= INTERFACE_F_POINTTOPOINT;
-
+
if ((ifam->ifam_flags & IFF_LOOPBACK) != 0)
iter->current.flags |= INTERFACE_F_LOOPBACK;
@@ -191,7 +191,7 @@ internal_current(isc_interfaceiter_t *iter) {
continue;
INSIST(sa < (struct sockaddr *) ifam_end);
-
+
switch (i) {
case RTAX_NETMASK: /* Netmask */
mask_sa = sa;
@@ -223,18 +223,18 @@ internal_current(isc_interfaceiter_t *iter) {
if (addr_sa == NULL)
return (ISC_R_IGNORE);
-
+
family = addr_sa->sa_family;
if (family != AF_INET) /* XXX IP6 */
return (ISC_R_IGNORE);
iter->current.af = family;
-
+
get_addr(family, &iter->current.address, addr_sa);
if (mask_sa != NULL)
get_addr(family, &iter->current.netmask, mask_sa);
-
+
if (dst_sa != NULL &&
(iter->current.flags & IFF_POINTOPOINT) != 0)
get_addr(family, &iter->current.dstaddress, dst_sa);
@@ -247,7 +247,7 @@ internal_current(isc_interfaceiter_t *iter) {
}
/*
- * Step the iterator to the next interface. Unlike
+ * Step the iterator to the next interface. Unlike
* isc_interfaceiter_next(), this may leave the iterator
* positioned on an interface that will ultimately
* be ignored. Return ISC_R_NOMORE if there are no more
@@ -257,14 +257,14 @@ static isc_result_t
internal_next(isc_interfaceiter_t *iter) {
struct ifa_msghdr *ifam;
REQUIRE (iter->pos < (unsigned int) iter->bufused);
-
+
ifam = (struct ifa_msghdr *) ((char *) iter->buf + iter->pos);
iter->pos += ifam->ifam_msglen;
if (iter->pos >= iter->bufused)
return (ISC_R_NOMORE);
-
+
return (ISC_R_SUCCESS);
}
diff --git a/lib/isc/unix/include/Makefile.in b/lib/isc/unix/include/Makefile.in
index 722da518..dd3b10fa 100644
--- a/lib/isc/unix/include/Makefile.in
+++ b/lib/isc/unix/include/Makefile.in
@@ -1,19 +1,19 @@
# Copyright (C) 1998-2000 Internet Software Consortium.
-#
+#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
-# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
-# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-# SOFTWARE.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.8 2000/06/22 21:58:51 tale Exp $
+# $Id: Makefile.in,v 1.10 2000/08/01 01:31:31 tale Exp $
srcdir = @srcdir@
VPATH = @srcdir@
diff --git a/lib/isc/unix/include/isc/Makefile.in b/lib/isc/unix/include/isc/Makefile.in
index 7542599a..c6cd4f6f 100644
--- a/lib/isc/unix/include/isc/Makefile.in
+++ b/lib/isc/unix/include/isc/Makefile.in
@@ -1,19 +1,19 @@
# Copyright (C) 1998-2000 Internet Software Consortium.
-#
+#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
-# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
-# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-# SOFTWARE.
-
-# $Id: Makefile.in,v 1.21 2000/06/22 21:58:53 tale Exp $
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+# $Id: Makefile.in,v 1.24 2000/09/20 19:06:08 gson Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@@ -29,12 +29,7 @@ TARGETS =
@BIND9_MAKE_RULES@
installdirs:
- if [ ! -d ${DESTDIR}${includedir} ]; then \
- mkdir ${DESTDIR}${includedir} ; \
- fi
- if [ ! -d ${DESTDIR}${includedir}/isc ]; then \
- mkdir ${DESTDIR}${includedir}/isc ; \
- fi
+ $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}/isc
install:: installdirs
for i in ${HEADERS}; do \
diff --git a/lib/isc/unix/include/isc/app.h b/lib/isc/unix/include/isc/app.h
index 17f77bb6..4eb504c7 100644
--- a/lib/isc/unix/include/isc/app.h
+++ b/lib/isc/unix/include/isc/app.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: app.h,v 1.6 2000/06/22 21:58:54 tale Exp $ */
+/* $Id: app.h,v 1.9 2000/09/01 21:31:53 bwelling Exp $ */
#ifndef ISC_APP_H
#define ISC_APP_H 1
@@ -176,6 +176,37 @@ isc_app_finish(void);
* Any resources allocated by isc_app_start() have been released.
*/
+void
+isc_app_block(void);
+/*
+ * Indicate that a blocking operation will be performed.
+ *
+ * Notes:
+ * If a blocking operation is in process, a call to isc_app_shutdown()
+ * or an external signal will abort the program, rather than allowing
+ * clean shutdown. This is primarily useful for reading user input.
+ *
+ * Requires:
+ * isc_app_start() has been called.
+ * No other blocking operations are in progress.
+ */
+
+void
+isc_app_unblock(void);
+/*
+ * Indicate that a blocking operation is complete.
+ *
+ * Notes:
+ * When a blocking operation has completed, return the program to a
+ * state where a call to isc_app_shutdown() or an external signal will
+ * shutdown normally.
+ *
+ * Requires:
+ * isc_app_start() has been called.
+ * isc_app_block() has been called by the same thread.
+ */
+
+
ISC_LANG_ENDDECLS
#endif /* ISC_APP_H */
diff --git a/lib/isc/unix/include/isc/dir.h b/lib/isc/unix/include/isc/dir.h
index 3e928b81..44d73a10 100644
--- a/lib/isc/unix/include/isc/dir.h
+++ b/lib/isc/unix/include/isc/dir.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dir.h,v 1.8 2000/06/23 03:08:18 tale Exp $ */
+/* $Id: dir.h,v 1.11 2000/08/01 01:31:35 tale Exp $ */
/* Principal Authors: DCL */
@@ -73,6 +73,15 @@ isc_dir_close(isc_dir_t *dir);
isc_result_t
isc_dir_chdir(const char *dirname);
+isc_result_t
+isc_dir_createunique(char *templet);
+/*
+ * Use a templet (such as from isc_file_mktemplate()) to create a uniquely
+ * named, empty directory. The templet string is modified in place.
+ * If result == ISC_R_SUCCESS, it is the name of the directory that was
+ * created.
+ */
+
ISC_LANG_ENDDECLS
#endif /* ISC_DIR_H */
diff --git a/lib/isc/unix/include/isc/int.h b/lib/isc/unix/include/isc/int.h
index 4478ecab..b787af39 100644
--- a/lib/isc/unix/include/isc/int.h
+++ b/lib/isc/unix/include/isc/int.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: int.h,v 1.6 2000/06/22 21:58:55 tale Exp $ */
+/* $Id: int.h,v 1.10 2000/11/14 23:41:46 tale Exp $ */
#ifndef ISC_INT_H
#define ISC_INT_H 1
@@ -29,4 +29,25 @@ typedef unsigned int isc_uint32_t;
typedef long long isc_int64_t;
typedef unsigned long long isc_uint64_t;
+#define ISC_INT8_MIN -128
+#define ISC_INT8_MAX 127
+#define ISC_UINT8_MAX 255
+
+#define ISC_INT16_MIN -32768
+#define ISC_INT16_MAX 32767
+#define ISC_UINT16_MAX 65535
+
+/*
+ * Note that "int" is 32 bits on all currently supported Unix-like operating
+ * systems, but "long" can be either 32 bits or 64 bits, thus the 32 bit
+ * constants are not qualified with "L".
+ */
+#define ISC_INT32_MIN -2147483648
+#define ISC_INT32_MAX 2147483647
+#define ISC_UINT32_MAX 4294967295U
+
+#define ISC_INT64_MIN -9223372036854775808LL
+#define ISC_INT64_MAX 9223372036854775807LL
+#define ISC_UINT64_MAX 18446744073709551615ULL
+
#endif /* ISC_INT_H */
diff --git a/lib/isc/unix/include/isc/keyboard.h b/lib/isc/unix/include/isc/keyboard.h
index 2c7eaac6..26b2c867 100644
--- a/lib/isc/unix/include/isc/keyboard.h
+++ b/lib/isc/unix/include/isc/keyboard.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: keyboard.h,v 1.2.2.1 2000/08/07 16:39:59 gson Exp $ */
+/* $Id: keyboard.h,v 1.5 2000/08/01 01:31:37 tale Exp $ */
#ifndef ISC_KEYBOARD_H
#define ISC_KEYBOARD_H 1
diff --git a/lib/isc/unix/include/isc/net.h b/lib/isc/unix/include/isc/net.h
index a7a7819e..4cd94e63 100644
--- a/lib/isc/unix/include/isc/net.h
+++ b/lib/isc/unix/include/isc/net.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: net.h,v 1.21 2000/06/23 21:43:46 tale Exp $ */
+/* $Id: net.h,v 1.23 2000/08/01 01:31:38 tale Exp $ */
#ifndef ISC_NET_H
#define ISC_NET_H 1
diff --git a/lib/isc/unix/include/isc/netdb.h b/lib/isc/unix/include/isc/netdb.h
index 14e90018..dcca0400 100644
--- a/lib/isc/unix/include/isc/netdb.h
+++ b/lib/isc/unix/include/isc/netdb.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: netdb.h,v 1.3 2000/06/22 21:58:58 tale Exp $ */
+/* $Id: netdb.h,v 1.5 2000/08/01 01:31:39 tale Exp $ */
#ifndef ISC_NETDB_H
#define ISC_NETDB_H 1
diff --git a/lib/isc/unix/include/isc/offset.h b/lib/isc/unix/include/isc/offset.h
index 2882940b..a63ab443 100644
--- a/lib/isc/unix/include/isc/offset.h
+++ b/lib/isc/unix/include/isc/offset.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: offset.h,v 1.7 2000/06/23 03:07:45 tale Exp $ */
+/* $Id: offset.h,v 1.9 2000/08/01 01:31:40 tale Exp $ */
#ifndef ISC_OFFSET_H
#define ISC_OFFSET_H 1
diff --git a/lib/isc/unix/include/isc/stdtime.h b/lib/isc/unix/include/isc/stdtime.h
index 12b96bd7..5dfa31ea 100644
--- a/lib/isc/unix/include/isc/stdtime.h
+++ b/lib/isc/unix/include/isc/stdtime.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: stdtime.h,v 1.5 2000/06/22 21:58:59 tale Exp $ */
+/* $Id: stdtime.h,v 1.7 2000/08/01 01:31:41 tale Exp $ */
#ifndef ISC_STDTIME_H
#define ISC_STDTIME_H 1
diff --git a/lib/isc/unix/include/isc/time.h b/lib/isc/unix/include/isc/time.h
index 3d4774be..366d3670 100644
--- a/lib/isc/unix/include/isc/time.h
+++ b/lib/isc/unix/include/isc/time.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: time.h,v 1.20 2000/06/22 21:59:01 tale Exp $ */
+/* $Id: time.h,v 1.24 2000/08/01 01:31:42 tale Exp $ */
#ifndef ISC_TIME_H
#define ISC_TIME_H 1
@@ -218,12 +218,15 @@ isc_time_subtract(isc_time_t *t, isc_interval_t *i, isc_time_t *result);
isc_uint64_t
isc_time_microdiff(isc_time_t *t1, isc_time_t *t2);
/*
- * Find the difference in milliseconds between time t1 and time t2.
+ * Find the difference in microseconds between time t1 and time t2.
* t2 is the subtrahend of t1; ie, difference = t1 - t2.
*
* Requires:
*
* 't1' and 't2' are valid pointers.
+ *
+ * Returns:
+ * The difference of t1 - t2, or 0 if t1 <= t2.
*/
isc_uint32_t
diff --git a/lib/isc/unix/interfaceiter.c b/lib/isc/unix/interfaceiter.c
index ec000834..f8ddb803 100644
--- a/lib/isc/unix/interfaceiter.c
+++ b/lib/isc/unix/interfaceiter.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: interfaceiter.c,v 1.17 2000/06/22 21:58:39 tale Exp $ */
+/* $Id: interfaceiter.c,v 1.19 2000/08/01 01:31:21 tale Exp $ */
#include <config.h>
@@ -44,14 +44,14 @@
/*
* Extract the network address part from a "struct sockaddr".
- *
+ *
* The address family is given explicity
* instead of using src->sa_family, because the latter does not work
* for copying a network mask obtained by SIOCGIFNETMASK (it does
* not have a valid address family).
*/
-static void
+static void
get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src) {
dst->family = family;
switch (family) {
@@ -98,12 +98,12 @@ isc_result_t
isc_interfaceiter_first(isc_interfaceiter_t *iter) {
isc_result_t result;
- REQUIRE(VALID_IFITER(iter));
+ REQUIRE(VALID_IFITER(iter));
iter->pos = 0;
for (;;) {
result = internal_current(iter);
- if (result != ISC_R_IGNORE)
+ if (result != ISC_R_IGNORE)
break;
result = internal_next(iter);
if (result != ISC_R_SUCCESS)
@@ -116,7 +116,7 @@ isc_interfaceiter_first(isc_interfaceiter_t *iter) {
isc_result_t
isc_interfaceiter_next(isc_interfaceiter_t *iter) {
isc_result_t result;
-
+
REQUIRE(VALID_IFITER(iter));
REQUIRE(iter->result == ISC_R_SUCCESS);
diff --git a/lib/isc/unix/ipv6.c b/lib/isc/unix/ipv6.c
index f18f71f2..3a96dd8e 100644
--- a/lib/isc/unix/ipv6.c
+++ b/lib/isc/unix/ipv6.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: ipv6.c,v 1.4 2000/06/22 21:58:41 tale Exp $ */
+/* $Id: ipv6.c,v 1.6 2000/08/01 01:31:22 tale Exp $ */
#include <isc/ipv6.h>
diff --git a/lib/isc/unix/keyboard.c b/lib/isc/unix/keyboard.c
index 97a07631..2feb3f14 100644
--- a/lib/isc/unix/keyboard.c
+++ b/lib/isc/unix/keyboard.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: keyboard.c,v 1.4.2.1 2000/08/03 19:54:42 gson Exp $ */
+/* $Id: keyboard.c,v 1.8 2000/08/02 15:28:13 tale Exp $ */
#include <config.h>
diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c
index 66a1decf..bc05fc56 100644
--- a/lib/isc/unix/net.c
+++ b/lib/isc/unix/net.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: net.c,v 1.10 2000/06/22 21:58:43 tale Exp $ */
+/* $Id: net.c,v 1.13 2000/09/15 20:52:27 bwelling Exp $ */
#include <config.h>
@@ -68,12 +68,14 @@ static void
initialize_action(void) {
ipv4_result = try_proto(PF_INET);
#ifdef ISC_PLATFORM_HAVEIPV6
+#ifdef WANT_IPV6
#ifdef ISC_PLATFORM_HAVEIN6PKTINFO
ipv6_result = try_proto(PF_INET6);
#else
ipv6_result = 0;
#endif
#endif
+#endif
}
static void
diff --git a/lib/isc/unix/os.c b/lib/isc/unix/os.c
index 278b31d8..a8c11e97 100644
--- a/lib/isc/unix/os.c
+++ b/lib/isc/unix/os.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: os.c,v 1.3 2000/06/22 21:58:44 tale Exp $ */
+/* $Id: os.c,v 1.5 2000/08/01 01:31:25 tale Exp $ */
#include <config.h>
diff --git a/lib/isc/unix/resource.c b/lib/isc/unix/resource.c
new file mode 100644
index 00000000..0a6b06e9
--- /dev/null
+++ b/lib/isc/unix/resource.c
@@ -0,0 +1,196 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: resource.c,v 1.5 2000/11/28 21:40:52 gson Exp $ */
+
+#include <sys/types.h>
+#include <sys/time.h> /* Required on some systems for <sys/resource.h>. */
+#include <sys/resource.h>
+
+#include <isc/resource.h>
+#include <isc/result.h>
+#include <isc/util.h>
+
+#include "errno2result.h"
+
+static isc_result_t
+resource2rlim(isc_resource_t resource, int *rlim_resource) {
+ isc_result_t result = ISC_R_SUCCESS;
+
+ switch (resource) {
+ case isc_resource_coresize:
+ *rlim_resource = RLIMIT_CORE;
+ break;
+ case isc_resource_cputime:
+ *rlim_resource = RLIMIT_CPU;
+ break;
+ case isc_resource_datasize:
+ *rlim_resource = RLIMIT_DATA;
+ break;
+ case isc_resource_filesize:
+ *rlim_resource = RLIMIT_FSIZE;
+ break;
+ case isc_resource_lockedmemory:
+#ifdef RLIMIT_MEMLOCK
+ *rlim_resource = RLIMIT_MEMLOCK;
+#else
+ result = ISC_R_NOTIMPLEMENTED;
+#endif
+ break;
+ case isc_resource_openfiles:
+ *rlim_resource = RLIMIT_NOFILE;
+ break;
+ case isc_resource_processes:
+#ifdef RLIMIT_NPROC
+ *rlim_resource = RLIMIT_NPROC;
+#else
+ result = ISC_R_NOTIMPLEMENTED;
+#endif
+ break;
+ case isc_resource_residentsize:
+#ifdef RLIMIT_RSS
+ *rlim_resource = RLIMIT_RSS;
+#else
+ result = ISC_R_NOTIMPLEMENTED;
+#endif
+ break;
+ case isc_resource_stacksize:
+ *rlim_resource = RLIMIT_STACK;
+ break;
+ default:
+ /*
+ * This test is not very robust if isc_resource_t
+ * changes, but generates a clear assertion message.
+ */
+ REQUIRE(resource >= isc_resource_coresize &&
+ resource <= isc_resource_stacksize);
+
+ result = ISC_R_RANGE;
+ break;
+ }
+
+ return (result);
+}
+
+isc_result_t
+isc_resource_setlimit(isc_resource_t resource, isc_resourcevalue_t value) {
+ struct rlimit rl;
+ rlim_t rlim_value;
+ int unixresult;
+ int unixresource;
+ isc_result_t result;
+
+ result = resource2rlim(resource, &unixresource);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+
+ if (value == ISC_RESOURCE_UNLIMITED)
+ rlim_value = RLIM_INFINITY;
+
+ else {
+ /*
+ * isc_resourcevalue_t was chosen as an unsigned 64 bit
+ * integer so that it could contain the maximum range of
+ * reasonable values. Unfortunately, this exceeds the typical
+ * range on Unix systems. Ensure the value of rlim_t is not
+ * overflowed.
+ */
+ isc_resourcevalue_t rlim_max;
+ isc_boolean_t rlim_t_is_signed =
+ ISC_TF(((double)(rlim_t)-1) < 0);
+
+ if (rlim_t_is_signed)
+ rlim_max = ~((rlim_t)1 << (sizeof(rlim_t) * 8 - 1));
+ else
+ rlim_max = (rlim_t)-1;
+
+ if (value > rlim_max)
+ value = rlim_max;
+
+ rlim_value = value;
+ }
+
+ /*
+ * The BIND 8 documentation reports:
+ *
+ * Note: on some operating systems the server cannot set an
+ * unlimited value and cannot determine the maximum number of
+ * open files the kernel can support. On such systems, choosing
+ * unlimited will cause the server to use the larger of the
+ * rlim_max for RLIMIT_NOFILE and the value returned by
+ * sysconf(_SC_OPEN_MAX). If the actual kernel limit is larger
+ * than this value, use limit files to specify the limit
+ * explicitly.
+ *
+ * The CHANGES for 8.1.2-T3A also mention:
+ *
+ * 352. [bug] Because of problems with setting an infinite
+ * rlim_max for RLIMIT_NOFILE on some systems, previous versions
+ * of the server implemented "limit files unlimited" by setting
+ * the limit to the value returned by sysconf(_SC_OPEN_MAX). The
+ * server will now use RLIM_INFINITY on systems which allow it.
+ *
+ * At some point the BIND 8 server stopped using SC_OPEN_MAX for this
+ * purpose at all, but it isn't clear to me when or why, as my access
+ * to the CVS archive is limited at the time of this writing. What
+ * BIND 8 *does* do is to set RLIMIT_NOFILE to either RLIMIT_INFINITY
+ * on a half dozen operating systems or to FD_SETSIZE on the rest,
+ * the latter of which is probably fewer than the real limit. (Note
+ * that libisc's socket module will have problems with any fd over
+ * FD_SETSIZE. This should be fixed in the socket module, not a
+ * limitation here. BIND 8's eventlib also has a problem, making
+ * its RLIMIT_INFINITY setting useless, because it closes and ignores
+ * any fd over FD_SETSIZE.)
+ *
+ * More troubling is the reference to some operating systems not being
+ * able to set an unlimited value for the number of open files. I'd
+ * hate to put in code that is really only there to support archaic
+ * systems that the rest of libisc won't work on anyway. So what this
+ * extremely verbose comment is here to say is the following:
+ *
+ * I'm aware there might be an issue with not limiting the value
+ * for RLIMIT_NOFILE on some systems, but since I don't know yet
+ * what those systems are and what the best workaround is (use
+ * sysconf()? rlim_max from getrlimit()? FD_SETSIZE?) so nothing
+ * is currently being done to clamp the value for open files.
+ */
+
+ rl.rlim_cur = rl.rlim_max = rlim_value;
+ unixresult = setrlimit(unixresource, &rl);
+
+ if (unixresult == 0)
+ return (ISC_R_SUCCESS);
+ else
+ return (isc__errno2result(errno));
+}
+
+isc_result_t
+isc_resource_getlimit(isc_resource_t resource, isc_resourcevalue_t *value) {
+ int unixresult;
+ int unixresource;
+ struct rlimit rl;
+ isc_result_t result;
+
+ result = resource2rlim(resource, &unixresource);
+ if (result == ISC_R_SUCCESS) {
+ unixresult = getrlimit(unixresource, &rl);
+ INSIST(unixresult == 0);
+ *value = rl.rlim_max;
+ }
+
+ return (result);
+}
diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c
index a0e9add6..98a8815c 100644
--- a/lib/isc/unix/socket.c
+++ b/lib/isc/unix/socket.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: socket.c,v 1.142.2.6 2000/09/08 22:17:27 gson Exp $ */
+/* $Id: socket.c,v 1.172 2000/11/22 23:48:14 gson Exp $ */
#include <config.h>
@@ -38,7 +38,9 @@
#include <isc/list.h>
#include <isc/log.h>
#include <isc/mem.h>
+#include <isc/mutex.h>
#include <isc/net.h>
+#include <isc/platform.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/socket.h>
@@ -46,6 +48,10 @@
#include <isc/thread.h>
#include <isc/util.h>
+#ifndef ISC_PLATFORM_USETHREADS
+#include "socket_p.h"
+#endif /* ISC_PLATFORM_USETHREADS */
+
/*
* Some systems define the socket length argument as an int, some as size_t,
* some as socklen_t. This is here so it can be easily changed if needed.
@@ -134,6 +140,7 @@ struct isc_socket {
ISC_LINK(isc_socket_t) link;
unsigned int references;
int fd;
+ int pf;
ISC_LIST(isc_socketevent_t) send_list;
ISC_LIST(isc_socketevent_t) recv_list;
@@ -177,16 +184,24 @@ struct isc_socketmgr {
isc_mutex_t lock;
/* Locked by manager lock. */
ISC_LIST(isc_socket_t) socklist;
- isc_thread_t watcher;
- isc_condition_t shutdown_ok;
fd_set read_fds;
fd_set write_fds;
isc_socket_t *fds[FD_SETSIZE];
int fdstate[FD_SETSIZE];
int maxfd;
+#ifdef ISC_PLATFORM_USETHREADS
+ isc_thread_t watcher;
+ isc_condition_t shutdown_ok;
int pipe_fds[2];
+#else /* ISC_PLATFORM_USETHREADS */
+ unsigned int refs;
+#endif /* ISC_PLATFORM_USETHREADS */
};
+#ifndef ISC_PLATFORM_USETHREADS
+static isc_socketmgr_t *socketmgr = NULL;
+#endif /* ISC_PLATFORM_USETHREADS */
+
#define CLOSED 0 /* this one must be zero */
#define MANAGED 1
#define CLOSE_PENDING 2
@@ -269,6 +284,51 @@ socket_log(isc_socket_t *sock, isc_sockaddr_t *address,
}
}
+static void
+wakeup_socket(isc_socketmgr_t *manager, int fd) {
+ isc_event_t *ev2;
+ isc_socketevent_t *rev;
+ isc_socket_t *sock;
+
+ /*
+ * This is a wakeup on a socket. Look at the event queue for both
+ * read and write, and decide if we need to watch on it now or not.
+ */
+ INSIST(fd < FD_SETSIZE);
+
+ if (manager->fdstate[fd] == CLOSE_PENDING) {
+ manager->fdstate[fd] = CLOSED;
+ FD_CLR(fd, &manager->read_fds);
+ FD_CLR(fd, &manager->write_fds);
+ close(fd);
+ return;
+ }
+ if (manager->fdstate[fd] != MANAGED)
+ return;
+
+ sock = manager->fds[fd];
+
+ /*
+ * If there are no events, or there is an event but we
+ * have already queued up the internal event on a task's
+ * queue, clear the bit. Otherwise, set it.
+ */
+ rev = ISC_LIST_HEAD(sock->recv_list);
+ ev2 = (isc_event_t *) ISC_LIST_HEAD(sock->accept_list);
+ if ((rev == NULL && ev2 == NULL)
+ || sock->pending_recv || sock->pending_accept)
+ FD_CLR(sock->fd, &manager->read_fds);
+ else
+ FD_SET(sock->fd, &manager->read_fds);
+
+ rev = ISC_LIST_HEAD(sock->send_list);
+ if ((rev == NULL || sock->pending_send) && !sock->connecting)
+ FD_CLR(sock->fd, &manager->write_fds);
+ else
+ FD_SET(sock->fd, &manager->write_fds);
+}
+
+#ifdef ISC_PLATFORM_USETHREADS
/*
* Poke the select loop when there is something for us to do.
* We assume that if a write completes here, it will be inserted into the
@@ -281,7 +341,7 @@ select_poke(isc_socketmgr_t *mgr, int msg) {
do {
cc = write(mgr->pipe_fds[1], &msg, sizeof(int));
} while (cc < 0 && SOFT_ERROR(errno));
-
+
if (cc < 0)
FATAL_ERROR(__FILE__, __LINE__,
"write() failed during watcher poke: %s",
@@ -291,7 +351,7 @@ select_poke(isc_socketmgr_t *mgr, int msg) {
}
/*
- * read a message on the internal fd.
+ * Read a message on the internal fd.
*/
static int
select_readmsg(isc_socketmgr_t *mgr) {
@@ -306,15 +366,28 @@ select_readmsg(isc_socketmgr_t *mgr) {
FATAL_ERROR(__FILE__, __LINE__,
"read() failed during watcher poke: %s",
strerror(errno));
-
+
return (SELECT_POKE_NOTHING);
}
return (msg);
}
+#else /* ISC_PLATFORM_USETHREADS */
+/*
+ * Update the state of the socketmgr when something changes.
+ */
+static void
+select_poke(isc_socketmgr_t *manager, int msg) {
+ if (msg == SELECT_POKE_SHUTDOWN)
+ return;
+ else if (msg >= 0)
+ wakeup_socket(manager, msg);
+ return;
+}
+#endif /* ISC_PLATFORM_USETHREADS */
/*
- * Make a fd non-blocking
+ * Make a fd non-blocking.
*/
static isc_result_t
make_nonblock(int fd) {
@@ -771,8 +844,8 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
}
SOFT_OR_HARD(ECONNREFUSED, ISC_R_CONNREFUSED);
- ALWAYS_HARD(ENETUNREACH, ISC_R_NETUNREACH);
- ALWAYS_HARD(EHOSTUNREACH, ISC_R_HOSTUNREACH);
+ SOFT_OR_HARD(ENETUNREACH, ISC_R_NETUNREACH);
+ SOFT_OR_HARD(EHOSTUNREACH, ISC_R_HOSTUNREACH);
ALWAYS_HARD(ENOBUFS, ISC_R_NORESOURCES);
#undef SOFT_OR_HARD
@@ -845,7 +918,7 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
return (DOIO_SOFT);
/*
- * full reads are posted, or partials if partials are ok.
+ * Full reads are posted, or partials if partials are ok.
*/
send_recvdone_event(sock, &dev, ISC_R_SUCCESS);
return (DOIO_SUCCESS);
@@ -870,13 +943,14 @@ doio_send(isc_socket_t *sock, isc_socketevent_t *dev) {
struct iovec iov[MAXSCATTERGATHER_SEND];
size_t write_count;
struct msghdr msghdr;
+ char addrbuf[ISC_SOCKADDR_FORMATSIZE];
build_msghdr_send(sock, dev, &msghdr, iov, &write_count);
cc = sendmsg(sock->fd, &msghdr, 0);
/*
- * check for error or block condition
+ * Check for error or block condition.
*/
if (cc < 0) {
if (SOFT_ERROR(errno))
@@ -896,13 +970,16 @@ doio_send(isc_socket_t *sock, isc_socketevent_t *dev) {
return (DOIO_HARD); \
}
- SOFT_OR_HARD(ECONNREFUSED, ISC_R_CONNREFUSED);
SOFT_OR_HARD(EACCES, ISC_R_NOPERM);
SOFT_OR_HARD(EAFNOSUPPORT, ISC_R_ADDRNOTAVAIL);
- ALWAYS_HARD(ENETUNREACH, ISC_R_NETUNREACH);
+ SOFT_OR_HARD(ECONNREFUSED, ISC_R_CONNREFUSED);
+ ALWAYS_HARD(EADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL);
ALWAYS_HARD(EHOSTUNREACH, ISC_R_HOSTUNREACH);
+#ifdef EHOSTDOWN
+ ALWAYS_HARD(EHOSTDOWN, ISC_R_HOSTUNREACH);
+#endif
+ ALWAYS_HARD(ENETUNREACH, ISC_R_NETUNREACH);
ALWAYS_HARD(ENOBUFS, ISC_R_NORESOURCES);
- ALWAYS_HARD(EADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL);
ALWAYS_HARD(EPERM, ISC_R_HOSTUNREACH);
ALWAYS_HARD(EPIPE, ISC_R_NOTCONNECTED);
@@ -918,9 +995,10 @@ doio_send(isc_socket_t *sock, isc_socketevent_t *dev) {
* However, these soft errors are still returned as
* a status.
*/
+ isc_sockaddr_format(&dev->address, addrbuf, sizeof(addrbuf));
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "internal_send: %s",
- strerror(errno));
+ "internal_send: %s: %s",
+ addrbuf, strerror(errno));
send_senddone_event(sock, &dev, ISC_R_UNEXPECTED);
return (DOIO_HARD);
}
@@ -930,8 +1008,7 @@ doio_send(isc_socket_t *sock, isc_socketevent_t *dev) {
"internal_send: send() returned 0");
/*
- * if we write less than we expected, update counters,
- * poke.
+ * If we write less than we expected, update counters, poke.
*/
dev->n += cc;
if ((size_t)cc != write_count)
@@ -974,8 +1051,10 @@ destroy(isc_socket_t **sockp) {
select_poke(manager, sock->fd);
ISC_LIST_UNLINK(manager->socklist, sock, link);
+#ifdef ISC_PLATFORM_USETHREADS
if (ISC_LIST_EMPTY(manager->socklist))
SIGNAL(&manager->shutdown_ok);
+#endif /* ISC_PLATFORM_USETHREADS */
/*
* XXX should reset manager->maxfd here
@@ -1101,7 +1180,7 @@ free_socket(isc_socket_t **socketp) {
sock->magic = 0;
- (void)isc_mutex_destroy(&sock->lock);
+ DESTROYLOCK(&sock->lock);
#ifdef USE_CMSG
isc_mem_put(sock->manager->mctx, sock->cmsg, sock->cmsglen);
@@ -1135,6 +1214,7 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
if (ret != ISC_R_SUCCESS)
return (ret);
+ sock->pf = pf;
switch (type) {
case isc_sockettype_udp:
sock->fd = socket(pf, SOCK_DGRAM, IPPROTO_UDP);
@@ -1151,6 +1231,12 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
case ENFILE:
case ENOBUFS:
return (ISC_R_NORESOURCES);
+
+ case EPROTONOSUPPORT:
+ case EPFNOSUPPORT:
+ case EAFNOSUPPORT:
+ return (ISC_R_FAMILYNOSUPPORT);
+
default:
UNEXPECTED_ERROR(__FILE__, __LINE__,
"socket() failed: %s",
@@ -1168,8 +1254,8 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
if (setsockopt(sock->fd, SOL_SOCKET, SO_BSDCOMPAT,
(void *)&on, sizeof on) < 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "setsockopt(%d, SO_BSDCOMPAT) failed",
- sock->fd);
+ "setsockopt(%d, SO_BSDCOMPAT) failed: %s",
+ sock->fd, strerror(errno));
/* Press on... */
}
#endif
@@ -1179,10 +1265,12 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
#if defined(SO_TIMESTAMP)
if (setsockopt(sock->fd, SOL_SOCKET, SO_TIMESTAMP,
- (void *)&on, sizeof on) < 0) {
+ (void *)&on, sizeof on) < 0
+ && errno != ENOPROTOOPT) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "setsockopt(%d, SO_TIMESTAMP) failed",
- sock->fd);
+ "setsockopt(%d, SO_TIMESTAMP) "
+ "failed: %s",
+ sock->fd, strerror(errno));
/* Press on... */
}
#endif /* SO_TIMESTAMP */
@@ -1256,7 +1344,7 @@ isc_socket_attach(isc_socket_t *sock, isc_socket_t **socketp) {
LOCK(&sock->lock);
sock->references++;
UNLOCK(&sock->lock);
-
+
*socketp = sock;
}
@@ -1264,7 +1352,7 @@ isc_socket_attach(isc_socket_t *sock, isc_socket_t **socketp) {
* Dereference a socket. If this is the last reference to it, clean things
* up by destroying the socket.
*/
-void
+void
isc_socket_detach(isc_socket_t **socketp) {
isc_socket_t *sock;
isc_boolean_t kill_socket = ISC_FALSE;
@@ -1279,7 +1367,7 @@ isc_socket_detach(isc_socket_t **socketp) {
if (sock->references == 0)
kill_socket = ISC_TRUE;
UNLOCK(&sock->lock);
-
+
if (kill_socket)
destroy(&sock);
@@ -1742,6 +1830,75 @@ internal_send(isc_task_t *me, isc_event_t *ev) {
UNLOCK(&sock->lock);
}
+static void
+process_fds(isc_socketmgr_t *manager, int maxfd,
+ fd_set *readfds, fd_set *writefds)
+{
+ int i;
+ isc_socket_t *sock;
+ isc_boolean_t unlock_sock;
+
+ /*
+ * Process read/writes on other fds here. Avoid locking
+ * and unlocking twice if both reads and writes are possible.
+ */
+ for (i = 0 ; i < maxfd ; i++) {
+#ifdef ISC_PLATFORM_USETHREADS
+ if (i == manager->pipe_fds[0] || i == manager->pipe_fds[1])
+ continue;
+#endif /* ISC_PLATFORM_USETHREADS */
+
+ if (manager->fdstate[i] == CLOSE_PENDING) {
+ manager->fdstate[i] = CLOSED;
+ FD_CLR(i, &manager->read_fds);
+ FD_CLR(i, &manager->write_fds);
+
+ close(i);
+
+ continue;
+ }
+
+ sock = manager->fds[i];
+ unlock_sock = ISC_FALSE;
+ if (FD_ISSET(i, readfds)) {
+ if (sock == NULL) {
+ FD_CLR(i, &manager->read_fds);
+ goto check_write;
+ }
+ unlock_sock = ISC_TRUE;
+ LOCK(&sock->lock);
+ if (!SOCK_DEAD(sock)) {
+ if (sock->listener)
+ dispatch_accept(sock);
+ else
+ dispatch_recv(sock);
+ }
+ FD_CLR(i, &manager->read_fds);
+ }
+ check_write:
+ if (FD_ISSET(i, writefds)) {
+ if (sock == NULL) {
+ FD_CLR(i, &manager->write_fds);
+ continue;
+ }
+ if (!unlock_sock) {
+ unlock_sock = ISC_TRUE;
+ LOCK(&sock->lock);
+ }
+ if (!SOCK_DEAD(sock)) {
+ if (sock->connecting)
+ dispatch_connect(sock);
+ else
+ dispatch_send(sock);
+ }
+ FD_CLR(i, &manager->write_fds);
+ }
+ if (unlock_sock)
+ UNLOCK(&sock->lock);
+ }
+}
+
+#ifdef ISC_PLATFORM_USETHREADS
/*
* This is the thread that will loop forever, always in a select or poll
* call.
@@ -1752,17 +1909,12 @@ internal_send(isc_task_t *me, isc_event_t *ev) {
static isc_threadresult_t
watcher(void *uap) {
isc_socketmgr_t *manager = uap;
- isc_socket_t *sock;
isc_boolean_t done;
int ctlfd;
int cc;
fd_set readfds;
fd_set writefds;
int msg;
- isc_boolean_t unlock_sock;
- int i;
- isc_socketevent_t *rev;
- isc_event_t *ev2;
int maxfd;
/*
@@ -1778,21 +1930,6 @@ watcher(void *uap) {
writefds = manager->write_fds;
maxfd = manager->maxfd + 1;
-#ifdef ISC_SOCKET_DEBUG
- for (i = 0 ; i < FD_SETSIZE ; i++) {
- int printit;
-
- printit = 0;
-
- if (FD_ISSET(i, &readfds)) {
- printit = 1;
- }
- if (FD_ISSET(i, &writefds)) {
- printit = 1;
- }
- }
-#endif
-
UNLOCK(&manager->lock);
cc = select(maxfd, &readfds, &writefds, NULL, NULL);
@@ -1841,122 +1978,12 @@ watcher(void *uap) {
* and decide if we need to watch on it now
* or not.
*/
- if (msg >= 0) {
- INSIST(msg < FD_SETSIZE);
-
- if (manager->fdstate[msg] ==
- CLOSE_PENDING) {
- manager->fdstate[msg] = CLOSED;
- FD_CLR(msg,
- &manager->read_fds);
- FD_CLR(msg,
- &manager->write_fds);
-
- close(msg);
-
- continue;
- }
-
- if (manager->fdstate[msg] != MANAGED)
- continue;
-
- sock = manager->fds[msg];
-
- LOCK(&sock->lock);
-
- /*
- * If there are no events, or there
- * is an event but we have already
- * queued up the internal event on a
- * task's queue, clear the bit.
- * Otherwise, set it.
- */
- rev = ISC_LIST_HEAD(sock->recv_list);
- ev2 = (isc_event_t *)
- ISC_LIST_HEAD(sock->accept_list);
- if ((rev == NULL && ev2 == NULL)
- || sock->pending_recv
- || sock->pending_accept) {
- FD_CLR(sock->fd,
- &manager->read_fds);
- } else {
- FD_SET(sock->fd,
- &manager->read_fds);
- }
-
- rev = ISC_LIST_HEAD(sock->send_list);
- if ((rev == NULL
- || sock->pending_send)
- && !sock->connecting) {
- FD_CLR(sock->fd,
- &manager->write_fds);
- } else {
- FD_SET(sock->fd,
- &manager->write_fds);
- }
-
- UNLOCK(&sock->lock);
- }
+ if (msg >= 0)
+ wakeup_socket(manager, msg);
}
}
- /*
- * Process read/writes on other fds here. Avoid locking
- * and unlocking twice if both reads and writes are possible.
- */
- for (i = 0 ; i < maxfd ; i++) {
- if (i == manager->pipe_fds[0]
- || i == manager->pipe_fds[1])
- continue;
-
- if (manager->fdstate[i] == CLOSE_PENDING) {
- manager->fdstate[i] = CLOSED;
- FD_CLR(i, &manager->read_fds);
- FD_CLR(i, &manager->write_fds);
-
- close(i);
-
- continue;
- }
-
- sock = manager->fds[i];
- unlock_sock = ISC_FALSE;
- if (FD_ISSET(i, &readfds)) {
- if (sock == NULL) {
- FD_CLR(i, &manager->read_fds);
- goto check_write;
- }
- unlock_sock = ISC_TRUE;
- LOCK(&sock->lock);
- if (!SOCK_DEAD(sock)) {
- if (sock->listener)
- dispatch_accept(sock);
- else
- dispatch_recv(sock);
- }
- FD_CLR(i, &manager->read_fds);
- }
- check_write:
- if (FD_ISSET(i, &writefds)) {
- if (sock == NULL) {
- FD_CLR(i, &manager->write_fds);
- continue;
- }
- if (!unlock_sock) {
- unlock_sock = ISC_TRUE;
- LOCK(&sock->lock);
- }
- if (!SOCK_DEAD(sock)) {
- if (sock->connecting)
- dispatch_connect(sock);
- else
- dispatch_send(sock);
- }
- FD_CLR(i, &manager->write_fds);
- }
- if (unlock_sock)
- UNLOCK(&sock->lock);
- }
+ process_fds(manager, maxfd, &readfds, &writefds);
}
manager_log(manager, TRACE, "watcher exiting");
@@ -1964,6 +1991,7 @@ watcher(void *uap) {
UNLOCK(&manager->lock);
return ((isc_threadresult_t)0);
}
+#endif /* ISC_PLATFORM_USETHREADS */
/*
* Create a new socket manager.
@@ -1974,10 +2002,18 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
REQUIRE(managerp != NULL && *managerp == NULL);
+#ifndef ISC_PLATFORM_USETHREADS
+ if (socketmgr != NULL) {
+ socketmgr->refs++;
+ *managerp = socketmgr;
+ return (ISC_R_SUCCESS);
+ }
+#endif /* ISC_PLATFORM_USETHREADS */
+
manager = isc_mem_get(mctx, sizeof *manager);
if (manager == NULL)
return (ISC_R_NOMEMORY);
-
+
manager->magic = SOCKET_MANAGER_MAGIC;
manager->mctx = NULL;
memset(manager->fds, 0, sizeof(manager->fds));
@@ -1988,9 +2024,9 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
"isc_mutex_init() failed");
return (ISC_R_UNEXPECTED);
}
-
+#ifdef ISC_PLATFORM_USETHREADS
if (isc_condition_init(&manager->shutdown_ok) != ISC_R_SUCCESS) {
- (void)isc_mutex_destroy(&manager->lock);
+ DESTROYLOCK(&manager->lock);
isc_mem_put(mctx, manager, sizeof *manager);
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_condition_init() failed");
@@ -2002,7 +2038,7 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
* select/poll loop when something internal needs to be done.
*/
if (pipe(manager->pipe_fds) != 0) {
- (void)isc_mutex_destroy(&manager->lock);
+ DESTROYLOCK(&manager->lock);
isc_mem_put(mctx, manager, sizeof *manager);
UNEXPECTED_ERROR(__FILE__, __LINE__,
"pipe() failed: %s",
@@ -2015,22 +2051,30 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
#if 0
RUNTIME_CHECK(make_nonblock(manager->pipe_fds[1]) == ISC_R_SUCCESS);
#endif
+#else /* ISC_PLATFORM_USETHREADS */
+ manager->refs = 1;
+#endif /* ISC_PLATFORM_USETHREADS */
/*
* Set up initial state for the select loop
*/
FD_ZERO(&manager->read_fds);
FD_ZERO(&manager->write_fds);
+#ifdef ISC_PLATFORM_USETHREADS
FD_SET(manager->pipe_fds[0], &manager->read_fds);
manager->maxfd = manager->pipe_fds[0];
+#else /* ISC_PLATFORM_USETHREADS */
+ manager->maxfd = 0;
+#endif /* ISC_PLATFORM_USETHREADS */
memset(manager->fdstate, 0, sizeof(manager->fdstate));
+#ifdef ISC_PLATFORM_USETHREADS
/*
* Start up the select/poll thread.
*/
if (isc_thread_create(watcher, manager, &manager->watcher) !=
ISC_R_SUCCESS) {
- (void)isc_mutex_destroy(&manager->lock);
+ DESTROYLOCK(&manager->lock);
isc_mem_put(mctx, manager, sizeof *manager);
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_thread_create() failed");
@@ -2038,9 +2082,12 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
close(manager->pipe_fds[1]);
return (ISC_R_UNEXPECTED);
}
-
+#endif /* ISC_PLATFORM_USETHREADS */
isc_mem_attach(mctx, &manager->mctx);
+#ifndef ISC_PLATFORM_USETHREADS
+ socketmgr = manager;
+#endif /* ISC_PLATFORM_USETHREADS */
*managerp = manager;
return (ISC_R_SUCCESS);
@@ -2060,8 +2107,17 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
manager = *managerp;
REQUIRE(VALID_MANAGER(manager));
+#ifndef ISC_PLATFORM_USETHREADS
+ if (manager->refs > 1) {
+ manager->refs--;
+ *managerp = NULL;
+ return;
+ }
+#endif /* ISC_PLATFORM_USETHREADS */
+
LOCK(&manager->lock);
+#ifdef ISC_PLATFORM_USETHREADS
/*
* Wait for all sockets to be destroyed.
*/
@@ -2069,34 +2125,48 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
manager_log(manager, CREATION, "sockets exist");
WAIT(&manager->shutdown_ok, &manager->lock);
}
+#else /* ISC_PLATFORM_USETHREADS */
+ /*
+ * Hope all sockets have been destroyed.
+ */
+ if (!ISC_LIST_EMPTY(manager->socklist)) {
+ manager_log(manager, CREATION, "sockets exist");
+ INSIST(0);
+ }
+#endif /* ISC_PLATFORM_USETHREADS */
UNLOCK(&manager->lock);
/*
* Here, poke our select/poll thread. Do this by closing the write
* half of the pipe, which will send EOF to the read half.
+ * This is currently a no-op in the non-threaded case.
*/
select_poke(manager, SELECT_POKE_SHUTDOWN);
+#ifdef ISC_PLATFORM_USETHREADS
/*
* Wait for thread to exit.
*/
if (isc_thread_join(manager->watcher, NULL) != ISC_R_SUCCESS)
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_thread_join() failed");
+#endif /* ISC_PLATFORM_USETHREADS */
/*
* Clean up.
*/
+#ifdef ISC_PLATFORM_USETHREADS
close(manager->pipe_fds[0]);
close(manager->pipe_fds[1]);
+ (void)isc_condition_destroy(&manager->shutdown_ok);
+#endif /* ISC_PLATFORM_USETHREADS */
for (i = 0 ; i < FD_SETSIZE ; i++)
if (manager->fdstate[i] == CLOSE_PENDING)
close(i);
- (void)isc_condition_destroy(&manager->shutdown_ok);
- (void)isc_mutex_destroy(&manager->lock);
+ DESTROYLOCK(&manager->lock);
manager->magic = 0;
mctx= manager->mctx;
isc_mem_put(mctx, manager, sizeof *manager);
@@ -2246,7 +2316,7 @@ isc_socket_recv(isc_socket_t *sock, isc_region_t *region, unsigned int minimum,
}
/*
- * UDP sockets are always partial read
+ * UDP sockets are always partial read.
*/
if (sock->type == isc_sockettype_udp)
dev->minimum = 1;
@@ -2290,7 +2360,7 @@ isc_socket_recv(isc_socket_t *sock, isc_region_t *region, unsigned int minimum,
* We couldn't read all or part of the request right now, so queue
* it.
*
- * Attach to socket and to task
+ * Attach to socket and to task.
*/
isc_task_attach(task, &ntask);
dev->attributes |= ISC_SOCKEVENTATTR_ATTACHED;
@@ -2315,7 +2385,7 @@ isc_socket_send(isc_socket_t *sock, isc_region_t *region,
isc_task_t *task, isc_taskaction_t action, const void *arg)
{
/*
- * REQUIRE() checking performed in isc_socket_sendto()
+ * REQUIRE() checking is performed in isc_socket_sendto().
*/
return (isc_socket_sendto(sock, region, task, action, arg, NULL,
NULL));
@@ -2447,11 +2517,11 @@ isc_socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist,
return (ISC_R_NOMEMORY);
}
- /***
- *** From here down, only ISC_R_SUCCESS can be returned. Any further
- *** error information will result in the done event being posted
- *** to the task rather than this function failing.
- ***/
+ /*
+ * From here down, only ISC_R_SUCCESS can be returned. Any further
+ * error information will result in the done event being posted
+ * to the task rather than this function failing.
+ */
dev->ev_sender = task;
@@ -2519,6 +2589,10 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) {
INSIST(!sock->bound);
+ if (sock->pf != sockaddr->type.sa.sa_family) {
+ UNLOCK(&sock->lock);
+ return (ISC_R_FAMILYMISMATCH);
+ }
if (setsockopt(sock->fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on,
sizeof on) < 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d) failed",
@@ -2599,6 +2673,7 @@ isc_socket_accept(isc_socket_t *sock,
isc_task_t *ntask = NULL;
isc_socket_t *nsock;
isc_result_t ret;
+ isc_boolean_t do_poke = ISC_FALSE;
REQUIRE(VALID_SOCKET(sock));
manager = sock->manager;
@@ -2630,7 +2705,7 @@ isc_socket_accept(isc_socket_t *sock,
}
/*
- * Attach to socket and to task
+ * Attach to socket and to task.
*/
isc_task_attach(task, &ntask);
nsock->references++;
@@ -2639,15 +2714,18 @@ isc_socket_accept(isc_socket_t *sock,
dev->newsocket = nsock;
/*
- * poke watcher here. We still have the socket locked, so there
+ * Poke watcher here. We still have the socket locked, so there
* is no race condition. We will keep the lock for such a short
* bit of time waking it up now or later won't matter all that much.
*/
if (ISC_LIST_EMPTY(sock->accept_list))
- select_poke(manager, sock->fd);
+ do_poke = ISC_TRUE;
ISC_LIST_ENQUEUE(sock->accept_list, dev, ev_link);
+ if (do_poke)
+ select_poke(manager, sock->fd);
+
UNLOCK(&sock->lock);
return (ISC_R_SUCCESS);
}
@@ -2698,12 +2776,20 @@ isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
goto queue;
switch (errno) {
- case ECONNREFUSED:
- dev->result = ISC_R_CONNREFUSED;
- goto err_exit;
- case ENETUNREACH:
- dev->result = ISC_R_NETUNREACH;
- goto err_exit;
+#define ERROR_MATCH(a, b) case a: dev->result = b; goto err_exit;
+ ERROR_MATCH(EACCES, ISC_R_NOPERM);
+ ERROR_MATCH(EADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL);
+ ERROR_MATCH(EAFNOSUPPORT, ISC_R_ADDRNOTAVAIL);
+ ERROR_MATCH(ECONNREFUSED, ISC_R_CONNREFUSED);
+ ERROR_MATCH(EHOSTUNREACH, ISC_R_HOSTUNREACH);
+#ifdef EHOSTDOWN
+ ERROR_MATCH(EHOSTDOWN, ISC_R_HOSTUNREACH);
+#endif
+ ERROR_MATCH(ENETUNREACH, ISC_R_NETUNREACH);
+ ERROR_MATCH(ENOBUFS, ISC_R_NORESOURCES);
+ ERROR_MATCH(EPERM, ISC_R_HOSTUNREACH);
+ ERROR_MATCH(EPIPE, ISC_R_NOTCONNECTED);
+#undef ERROR_MATCH
}
sock->connected = 0;
@@ -2724,7 +2810,7 @@ isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
}
/*
- * If connect completed, fire off the done event
+ * If connect completed, fire off the done event.
*/
if (cc == 0) {
sock->connected = 1;
@@ -2739,7 +2825,7 @@ isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
queue:
/*
- * Attach to to task
+ * Attach to task.
*/
isc_task_attach(task, &ntask);
@@ -2748,7 +2834,7 @@ isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
dev->ev_sender = ntask;
/*
- * poke watcher here. We still have the socket locked, so there
+ * Poke watcher here. We still have the socket locked, so there
* is no race condition. We will keep the lock for such a short
* bit of time waking it up now or later won't matter all that much.
*/
@@ -2832,15 +2918,21 @@ internal_connect(isc_task_t *me, isc_event_t *ev) {
* Translate other errors into ISC_R_* flavors.
*/
switch (errno) {
- case ETIMEDOUT:
- dev->result = ISC_R_TIMEDOUT;
- break;
- case ECONNREFUSED:
- dev->result = ISC_R_CONNREFUSED;
- break;
- case ENETUNREACH:
- dev->result = ISC_R_NETUNREACH;
- break;
+#define ERROR_MATCH(a, b) case a: dev->result = b; break;
+ ERROR_MATCH(EACCES, ISC_R_NOPERM);
+ ERROR_MATCH(EADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL);
+ ERROR_MATCH(EAFNOSUPPORT, ISC_R_ADDRNOTAVAIL);
+ ERROR_MATCH(ECONNREFUSED, ISC_R_CONNREFUSED);
+ ERROR_MATCH(EHOSTUNREACH, ISC_R_HOSTUNREACH);
+#ifdef EHOSTDOWN
+ ERROR_MATCH(EHOSTDOWN, ISC_R_HOSTUNREACH);
+#endif
+ ERROR_MATCH(ENETUNREACH, ISC_R_NETUNREACH);
+ ERROR_MATCH(ENOBUFS, ISC_R_NORESOURCES);
+ ERROR_MATCH(EPERM, ISC_R_HOSTUNREACH);
+ ERROR_MATCH(EPIPE, ISC_R_NOTCONNECTED);
+ ERROR_MATCH(ETIMEDOUT, ISC_R_TIMEDOUT);
+#undef ERROR_MATCH
default:
dev->result = ISC_R_UNEXPECTED;
UNEXPECTED_ERROR(__FILE__, __LINE__,
@@ -2921,7 +3013,6 @@ isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) {
*/
void
isc_socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how) {
- isc_boolean_t poke_needed;
REQUIRE(VALID_SOCKET(sock));
@@ -2932,8 +3023,6 @@ isc_socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how) {
if (how == 0)
return;
- poke_needed = ISC_FALSE;
-
LOCK(&sock->lock);
/*
@@ -3152,3 +3241,27 @@ isc_socket_isbound(isc_socket_t *sock) {
return (val);
}
+
+#ifndef ISC_PLATFORM_USETHREADS
+void
+isc__socketmgr_getfdsets(fd_set *readset, fd_set *writeset, int *maxfd) {
+ if (socketmgr == NULL)
+ *maxfd = 0;
+ else {
+ *readset = socketmgr->read_fds;
+ *writeset = socketmgr->write_fds;
+ *maxfd = socketmgr->maxfd + 1;
+ }
+}
+
+isc_result_t
+isc__socketmgr_dispatch(fd_set *readset, fd_set *writeset, int maxfd) {
+ isc_socketmgr_t *manager = socketmgr;
+
+ if (manager == NULL)
+ return (ISC_R_NOTFOUND);
+
+ process_fds(manager, maxfd, readset, writeset);
+ return (ISC_R_SUCCESS);
+}
+#endif /* ISC_PLATFORM_USETHREADS */
diff --git a/lib/isc/unix/socket_p.h b/lib/isc/unix/socket_p.h
new file mode 100644
index 00000000..2bd68369
--- /dev/null
+++ b/lib/isc/unix/socket_p.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2000 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: socket_p.h,v 1.2 2000/09/28 21:32:51 bwelling Exp $ */
+
+/* ISC_PLATFORM_USETHREADS_DELETE */
+
+#ifndef ISC_SOCKET_P_H
+#define ISC_SOCKET_P_H
+
+void
+isc__socketmgr_getfdsets(fd_set *readset, fd_set *writeset, int *maxfd);
+
+isc_result_t
+isc__socketmgr_dispatch(fd_set *readset, fd_set *writeset, int maxfd);
+
+#endif /* ISC_SOCKET_P_H */
diff --git a/lib/isc/unix/stdio.c b/lib/isc/unix/stdio.c
index e49c7cfd..67e42b65 100644
--- a/lib/isc/unix/stdio.c
+++ b/lib/isc/unix/stdio.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: stdio.c,v 1.2 2000/06/22 21:58:47 tale Exp $ */
+/* $Id: stdio.c,v 1.4 2000/08/01 01:31:28 tale Exp $ */
#include <config.h>
@@ -29,7 +29,7 @@
isc_result_t
isc_stdio_open(const char *filename, const char *mode, FILE **fp) {
FILE *f;
-
+
f = fopen(filename, mode);
if (f == NULL)
return (isc__errno2result(errno));
@@ -63,7 +63,7 @@ isc_result_t
isc_stdio_read(void *ptr, size_t size, size_t nmemb, FILE *f, size_t *nret) {
isc_result_t result = ISC_R_SUCCESS;
size_t r;
-
+
clearerr(f);
r = fread(ptr, size, nmemb, f);
if (r != nmemb) {
@@ -83,7 +83,7 @@ isc_stdio_write(const void *ptr, size_t size, size_t nmemb, FILE *f,
{
isc_result_t result = ISC_R_SUCCESS;
size_t r;
-
+
clearerr(f);
r = fwrite(ptr, size, nmemb, f);
if (r != nmemb)
@@ -96,7 +96,7 @@ isc_stdio_write(const void *ptr, size_t size, size_t nmemb, FILE *f,
isc_result_t
isc_stdio_flush(FILE *f) {
int r;
-
+
r = fflush(f);
if (r == 0)
return (ISC_R_SUCCESS);
@@ -107,7 +107,7 @@ isc_stdio_flush(FILE *f) {
isc_result_t
isc_stdio_sync(FILE *f) {
int r;
-
+
r = fsync(fileno(f));
if (r == 0)
return (ISC_R_SUCCESS);
diff --git a/lib/isc/unix/stdtime.c b/lib/isc/unix/stdtime.c
index 0089df10..9db52e17 100644
--- a/lib/isc/unix/stdtime.c
+++ b/lib/isc/unix/stdtime.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: stdtime.c,v 1.7 2000/06/22 21:58:49 tale Exp $ */
+/* $Id: stdtime.c,v 1.9 2000/08/01 01:31:29 tale Exp $ */
#include <config.h>
@@ -32,9 +32,9 @@ isc_stdtime_get(isc_stdtime_t *t) {
* Set 't' to the number of seconds since 00:00:00 UTC, January 1,
* 1970.
*/
-
+
REQUIRE(t != NULL);
-
+
RUNTIME_CHECK(gettimeofday(&tv, NULL) != -1);
INSIST(tv.tv_usec >= 0 && tv.tv_usec < 1000000);
diff --git a/lib/isc/unix/time.c b/lib/isc/unix/time.c
index 87659156..add0e94c 100644
--- a/lib/isc/unix/time.c
+++ b/lib/isc/unix/time.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: time.c,v 1.26.2.1 2000/09/18 18:50:24 bwelling Exp $ */
+/* $Id: time.c,v 1.29 2000/09/18 18:43:03 gson Exp $ */
#include <config.h>
@@ -34,7 +34,7 @@
#define US_PER_S 1000000 /* Microseconds per second. */
/*
- * All of the INSIST()s checks of nanoseconds < NS_PER_S are for
+ * All of the INSIST()s checks of nanoseconds < NS_PER_S are for
* consistency checking of the type. In lieu of magic numbers, it
* is the best we've got. The check is only performed on functions which
* need an initialized type.
@@ -137,9 +137,9 @@ isc_time_now(isc_time_t *t) {
/*
* Set *t to the current absolute time.
*/
-
+
REQUIRE(t != NULL);
-
+
if (gettimeofday(&tv, NULL) == -1) {
UNEXPECTED_ERROR(__FILE__, __LINE__, strerror(errno));
return (ISC_R_UNEXPECTED);
@@ -156,7 +156,7 @@ isc_time_now(isc_time_t *t) {
return (ISC_R_UNEXPECTED);
/*
- * Ensure the tv_sec value fits in t->seconds.
+ * Ensure the tv_sec value fits in t->seconds.
*/
if (sizeof(tv.tv_sec) > sizeof(t->seconds) &&
((tv.tv_sec | (unsigned int)-1) ^ (unsigned int)-1) != 0)
@@ -175,7 +175,7 @@ isc_time_nowplusinterval(isc_time_t *t, isc_interval_t *i) {
/*
* Set *t to the current absolute time + i.
*/
-
+
REQUIRE(t != NULL);
REQUIRE(i != NULL);
INSIST(i->nanoseconds < NS_PER_S);
@@ -342,7 +342,7 @@ isc_time_secondsastimet(isc_time_t *t, time_t *secondsp) {
* about "signed versus unsigned" while trying to determine if the
* the unsigned int t->seconds is out range for tv_sec, which is
* pretty much only true if time_t is a signed integer of the same
- * size as the return value of isc_time_seconds.
+ * size as the return value of isc_time_seconds.
*
* The use of the 64 bit integer ``i'' takes advantage of C's
* conversion rules to either zero fill or sign extend the widened
diff --git a/lib/isc/version.c b/lib/isc/version.c
index b5814cb7..a1aa355b 100644
--- a/lib/isc/version.c
+++ b/lib/isc/version.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: version.c,v 1.6 2000/06/22 21:57:19 tale Exp $ */
+/* $Id: version.c,v 1.8 2000/08/01 01:29:54 tale Exp $ */
char isc_version[] = VERSION;
diff --git a/lib/isc/win32/Makefile.in b/lib/isc/win32/Makefile.in
index 477776e2..75d9efad 100644
--- a/lib/isc/win32/Makefile.in
+++ b/lib/isc/win32/Makefile.in
@@ -1,19 +1,19 @@
# Copyright (C) 1999, 2000 Internet Software Consortium.
-#
+#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
-# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
-# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-# SOFTWARE.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.5 2000/06/22 21:59:02 tale Exp $
+# $Id: Makefile.in,v 1.7 2000/08/01 01:31:44 tale Exp $
srcdir = @srcdir@
VPATH = @srcdir@
diff --git a/lib/isc/win32/condition.c b/lib/isc/win32/condition.c
index 16d9e526..f9b04f49 100644
--- a/lib/isc/win32/condition.c
+++ b/lib/isc/win32/condition.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: condition.c,v 1.12 2000/06/22 21:59:03 tale Exp $ */
+/* $Id: condition.c,v 1.14 2000/08/01 01:31:45 tale Exp $ */
#include <config.h>
@@ -28,7 +28,7 @@
isc_result_t
isc_condition_init(isc_condition_t *cond) {
HANDLE h;
-
+
REQUIRE(cond != NULL);
cond->waiters = 0;
@@ -51,7 +51,7 @@ isc_condition_init(isc_condition_t *cond) {
isc_result_t
isc_condition_signal(isc_condition_t *cond) {
-
+
/*
* Unlike pthreads, the caller MUST hold the lock associated with
* the condition variable when calling us.
@@ -69,7 +69,7 @@ isc_condition_signal(isc_condition_t *cond) {
isc_result_t
isc_condition_broadcast(isc_condition_t *cond) {
-
+
/*
* Unlike pthreads, the caller MUST hold the lock associated with
* the condition variable when calling us.
@@ -87,7 +87,7 @@ isc_condition_broadcast(isc_condition_t *cond) {
isc_result_t
isc_condition_destroy(isc_condition_t *cond) {
-
+
REQUIRE(cond != NULL);
(void)CloseHandle(cond->events[SIGNAL]);
diff --git a/lib/isc/win32/dir.c b/lib/isc/win32/dir.c
index b1099db7..00a579df 100644
--- a/lib/isc/win32/dir.c
+++ b/lib/isc/win32/dir.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dir.c,v 1.4 2000/02/03 23:08:11 halley Exp $ */
+/* $Id: dir.c,v 1.6 2000/08/01 01:31:46 tale Exp $ */
/* Principal Authors: DCL */
@@ -48,7 +48,7 @@ isc_dir_init(isc_dir_t *dir) {
}
/*
- * Allocate workspace and open directory stream. If either one fails,
+ * Allocate workspace and open directory stream. If either one fails,
* NULL will be returned.
*/
isc_result_t
@@ -118,7 +118,7 @@ isc_dir_read(isc_dir_t *dir) {
}
/*
- * Make sure that the space for the name is long enough.
+ * Make sure that the space for the name is long enough.
*/
strcpy(dir->entry.name, dir->entry.find_data.cFileName);
dir->entry.length = strlen(dir->entry.name);
@@ -169,7 +169,7 @@ isc_dir_reset(isc_dir_t *dir) {
*/
static isc_result_t
start_directory(isc_dir_t *dir)
-{
+{
REQUIRE(VALID_DIR(dir));
REQUIRE(dir->search_handle == INVALID_HANDLE_VALUE);
@@ -195,7 +195,7 @@ start_directory(isc_dir_t *dir)
}
/*
- * Make sure that the space for the name is long enough.
+ * Make sure that the space for the name is long enough.
*/
INSIST(sizeof(dir->entry.name) >
strlen(dir->entry.find_data.cFileName));
diff --git a/lib/isc/win32/file.c b/lib/isc/win32/file.c
index b6b0e00a..44f32e3f 100644
--- a/lib/isc/win32/file.c
+++ b/lib/isc/win32/file.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: file.c,v 1.3 2000/06/22 21:59:04 tale Exp $ */
+/* $Id: file.c,v 1.5 2000/08/01 01:31:47 tale Exp $ */
#include <string.h>
diff --git a/lib/isc/win32/fsaccess.c b/lib/isc/win32/fsaccess.c
index 2fd01882..5fbe72ce 100644
--- a/lib/isc/win32/fsaccess.c
+++ b/lib/isc/win32/fsaccess.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: fsaccess.c,v 1.3 2000/06/22 21:59:06 tale Exp $ */
+/* $Id: fsaccess.c,v 1.5 2000/08/01 01:31:48 tale Exp $ */
#include <windows.h>
#include <winerror.h>
@@ -56,7 +56,7 @@ isc_fsaccess_set(const char *path, isc_fsaccess_t access) {
result = check_bad_bits(access, is_dir);
if (result != ISC_R_SUCCESS)
return (result);
-
+
winerror = GetNamedSecurityInfo(path, SE_FILE_OBJECT,
OWNER_SECURITY_INFORMATION |
GROUP_SECURITY_INFORMATION,
@@ -123,7 +123,7 @@ isc_fsaccess_set(const char *path, isc_fsaccess_t access) {
/*
* Setting world.
*/
- SID_IDENTIFIER_AUTHORITY authworld =
+ SID_IDENTIFIER_AUTHORITY authworld =
SECURITY_WORLD_SID_AUTHORITY;
if (AllocateAndInitializeSid(&authworld, 1,
diff --git a/lib/isc/win32/include/Makefile.in b/lib/isc/win32/include/Makefile.in
index 5f9ca2f3..c8d66a37 100644
--- a/lib/isc/win32/include/Makefile.in
+++ b/lib/isc/win32/include/Makefile.in
@@ -1,19 +1,19 @@
# Copyright (C) 1999, 2000 Internet Software Consortium.
-#
+#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
-# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
-# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-# SOFTWARE.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.3 2000/06/22 21:59:10 tale Exp $
+# $Id: Makefile.in,v 1.5 2000/08/01 01:31:54 tale Exp $
srcdir = @srcdir@
VPATH = @srcdir@
diff --git a/lib/isc/win32/include/isc/Makefile.in b/lib/isc/win32/include/isc/Makefile.in
index 88b49344..3953b974 100644
--- a/lib/isc/win32/include/isc/Makefile.in
+++ b/lib/isc/win32/include/isc/Makefile.in
@@ -1,19 +1,19 @@
# Copyright (C) 1999, 2000 Internet Software Consortium.
-#
+#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
-# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
-# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-# SOFTWARE.
-
-# $Id: Makefile.in,v 1.4 2000/06/22 21:59:11 tale Exp $
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+# $Id: Makefile.in,v 1.7 2000/09/20 19:06:09 gson Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@@ -30,12 +30,7 @@ TARGETS =
@BIND9_MAKE_RULES@
installdirs:
- if [ ! -d $(includedir) ]; then \
- mkdir $(includedir) ; \
- fi
- if [ ! -d $(includedir)\isc ]; then \
- mkdir $(includedir)\isc ; \
- fi
+ $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}\isc
install:: installdirs
for i in $(HEADERS); do \
diff --git a/lib/isc/win32/include/isc/condition.h b/lib/isc/win32/include/isc/condition.h
index d7fa43b9..3f27d274 100644
--- a/lib/isc/win32/include/isc/condition.h
+++ b/lib/isc/win32/include/isc/condition.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: condition.h,v 1.10 2000/06/22 21:59:13 tale Exp $ */
+/* $Id: condition.h,v 1.12 2000/08/01 01:31:56 tale Exp $ */
#ifndef ISC_CONDITION_H
#define ISC_CONDITION_H 1
@@ -27,7 +27,7 @@
#include <isc/types.h>
typedef struct isc_condition {
- HANDLE events[2];
+ HANDLE events[2];
unsigned int waiters;
} isc_condition_t;
diff --git a/lib/isc/win32/include/isc/dir.h b/lib/isc/win32/include/isc/dir.h
index e70eb3bb..e3a55c5a 100644
--- a/lib/isc/win32/include/isc/dir.h
+++ b/lib/isc/win32/include/isc/dir.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dir.h,v 1.5 2000/04/28 17:46:30 tale Exp $ */
+/* $Id: dir.h,v 1.7 2000/08/01 01:31:57 tale Exp $ */
/* Principal Authors: DCL */
diff --git a/lib/isc/win32/include/isc/int.h b/lib/isc/win32/include/isc/int.h
index 2046bc8c..585e12e1 100644
--- a/lib/isc/win32/include/isc/int.h
+++ b/lib/isc/win32/include/isc/int.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: int.h,v 1.4 2000/06/22 21:59:14 tale Exp $ */
+/* $Id: int.h,v 1.6 2000/08/01 01:31:58 tale Exp $ */
#ifndef ISC_INT_H
#define ISC_INT_H 1
diff --git a/lib/isc/win32/include/isc/mutex.h b/lib/isc/win32/include/isc/mutex.h
index f62bb77c..ed797d58 100644
--- a/lib/isc/win32/include/isc/mutex.h
+++ b/lib/isc/win32/include/isc/mutex.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: mutex.h,v 1.10 2000/06/22 21:59:15 tale Exp $ */
+/* $Id: mutex.h,v 1.12 2000/08/01 01:31:59 tale Exp $ */
#ifndef ISC_MUTEX_H
#define ISC_MUTEX_H 1
diff --git a/lib/isc/win32/include/isc/net.h b/lib/isc/win32/include/isc/net.h
index 3417b7b7..aa82a98c 100644
--- a/lib/isc/win32/include/isc/net.h
+++ b/lib/isc/win32/include/isc/net.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: net.h,v 1.9 2000/06/22 21:59:16 tale Exp $ */
+/* $Id: net.h,v 1.11 2000/08/01 01:32:01 tale Exp $ */
#ifndef ISC_NET_H
#define ISC_NET_H 1
diff --git a/lib/isc/win32/include/isc/netdb.h b/lib/isc/win32/include/isc/netdb.h
index 1b9c60a2..fe5eb5d8 100644
--- a/lib/isc/win32/include/isc/netdb.h
+++ b/lib/isc/win32/include/isc/netdb.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: netdb.h,v 1.3 2000/06/22 21:59:17 tale Exp $ */
+/* $Id: netdb.h,v 1.5 2000/08/01 01:32:02 tale Exp $ */
#ifndef ISC_NETDB_H
#define ISC_NETDB_H 1
diff --git a/lib/isc/win32/include/isc/once.h b/lib/isc/win32/include/isc/once.h
index f769b143..dc1ebeba 100644
--- a/lib/isc/win32/include/isc/once.h
+++ b/lib/isc/win32/include/isc/once.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: once.h,v 1.3 2000/02/03 23:08:13 halley Exp $ */
+/* $Id: once.h,v 1.5 2000/08/01 01:32:03 tale Exp $ */
#ifndef ISC_ONCE_H
#define ISC_ONCE_H 1
diff --git a/lib/isc/win32/include/isc/stdtime.h b/lib/isc/win32/include/isc/stdtime.h
index 01405dca..54159fbe 100644
--- a/lib/isc/win32/include/isc/stdtime.h
+++ b/lib/isc/win32/include/isc/stdtime.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: stdtime.h,v 1.4 2000/04/28 23:53:55 tale Exp $ */
+/* $Id: stdtime.h,v 1.6 2000/08/01 01:32:04 tale Exp $ */
#ifndef ISC_STDTIME_H
#define ISC_STDTIME_H 1
diff --git a/lib/isc/win32/include/isc/thread.h b/lib/isc/win32/include/isc/thread.h
index 9904cbe9..df4a6f4c 100644
--- a/lib/isc/win32/include/isc/thread.h
+++ b/lib/isc/win32/include/isc/thread.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: thread.h,v 1.10 2000/06/22 21:59:18 tale Exp $ */
+/* $Id: thread.h,v 1.12 2000/08/01 01:32:05 tale Exp $ */
#ifndef ISC_THREAD_H
#define ISC_THREAD_H 1
diff --git a/lib/isc/win32/include/isc/time.h b/lib/isc/win32/include/isc/time.h
index e2cb8902..fee01475 100644
--- a/lib/isc/win32/include/isc/time.h
+++ b/lib/isc/win32/include/isc/time.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: time.h,v 1.15 2000/06/22 21:59:20 tale Exp $ */
+/* $Id: time.h,v 1.18 2000/08/01 01:32:06 tale Exp $ */
#ifndef ISC_TIME_H
#define ISC_TIME_H 1
@@ -224,6 +224,9 @@ isc_time_microdiff(isc_time_t *t1, isc_time_t *t2);
* Requires:
*
* 't1' and 't2' are valid pointers.
+ *
+ * Returns:
+ * The difference of t1 - t2, or 0 if t1 <= t2.
*/
isc_uint32_t
diff --git a/lib/isc/win32/once.c b/lib/isc/win32/once.c
index 0b49b917..4dc7b97f 100644
--- a/lib/isc/win32/once.c
+++ b/lib/isc/win32/once.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: once.c,v 1.3 2000/02/03 23:08:11 halley Exp $ */
+/* $Id: once.c,v 1.5 2000/08/01 01:31:49 tale Exp $ */
/* Principal Authors: DCL */
@@ -30,8 +30,8 @@ isc_once_do(isc_once_t *controller, void(*function)(void))
{
REQUIRE(controller != NULL && function != NULL);
- if (controller->status == ISC_ONCE_INIT_NEEDED) {
-
+ if (controller->status == ISC_ONCE_INIT_NEEDED) {
+
if (InterlockedDecrement(&controller->counter) == 0) {
if (controller->status == ISC_ONCE_INIT_NEEDED) {
function();
diff --git a/lib/isc/win32/stdtime.c b/lib/isc/win32/stdtime.c
index c41a7c52..57a84154 100644
--- a/lib/isc/win32/stdtime.c
+++ b/lib/isc/win32/stdtime.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: stdtime.c,v 1.4 2000/02/03 23:08:11 halley Exp $ */
+/* $Id: stdtime.c,v 1.6 2000/08/01 01:31:50 tale Exp $ */
#include <time.h>
diff --git a/lib/isc/win32/thread.c b/lib/isc/win32/thread.c
index 0487f1bb..b7fa686f 100644
--- a/lib/isc/win32/thread.c
+++ b/lib/isc/win32/thread.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: thread.c,v 1.11 2000/06/22 21:59:07 tale Exp $ */
+/* $Id: thread.c,v 1.13 2000/08/01 01:31:51 tale Exp $ */
#include <config.h>
@@ -24,7 +24,7 @@
#include <isc/thread.h>
isc_result_t
-isc_thread_create(isc_threadfunc_t start, isc_threadarg_t arg,
+isc_thread_create(isc_threadfunc_t start, isc_threadarg_t arg,
isc_thread_t *threadp)
{
isc_thread_t thread;
diff --git a/lib/isc/win32/time.c b/lib/isc/win32/time.c
index ac580359..17b05ea5 100644
--- a/lib/isc/win32/time.c
+++ b/lib/isc/win32/time.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1998-2000 Internet Software Consortium.
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: time.c,v 1.17 2000/06/22 21:59:09 tale Exp $ */
+/* $Id: time.c,v 1.19 2000/08/01 01:31:52 tale Exp $ */
#include <config.h>
@@ -139,7 +139,7 @@ isc_time_now(isc_time_t *t) {
/*
* Set *t to the current absolute time.
*/
-
+
REQUIRE(t != NULL);
GetSystemTimeAsFileTime(&t->absolute);
@@ -154,10 +154,10 @@ isc_time_nowplusinterval(isc_time_t *t, isc_interval_t *i) {
/*
* Set *t to the current absolute time + i.
*/
-
+
REQUIRE(t != NULL);
REQUIRE(i != NULL);
-
+
GetSystemTimeAsFileTime(&t->absolute);
i1.LowPart = t->absolute.dwLowDateTime;