summaryrefslogtreecommitdiffstats
path: root/contrib/bind/lib/isc
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>2002-02-04 19:12:46 +0000
committernectar <nectar@FreeBSD.org>2002-02-04 19:12:46 +0000
commitebeabb1ba32f14e308ae9aff9a2a7151265259cf (patch)
tree71ba64d0a82be4894e23f6d65f36b61203ec3875 /contrib/bind/lib/isc
parent1385a0dca8f9199ece158336f4c6a9f1e2e03c3e (diff)
downloadFreeBSD-src-ebeabb1ba32f14e308ae9aff9a2a7151265259cf.zip
FreeBSD-src-ebeabb1ba32f14e308ae9aff9a2a7151265259cf.tar.gz
Import of ISC BIND 8.3.1-REL.
Diffstat (limited to 'contrib/bind/lib/isc')
-rw-r--r--contrib/bind/lib/isc/Makefile8
-rw-r--r--contrib/bind/lib/isc/assertions.c13
-rw-r--r--contrib/bind/lib/isc/assertions.mdoc22
-rw-r--r--contrib/bind/lib/isc/bitncmp.c6
-rw-r--r--contrib/bind/lib/isc/bitncmp.mdoc8
-rw-r--r--contrib/bind/lib/isc/ctl_clnt.c39
-rw-r--r--contrib/bind/lib/isc/ctl_p.c40
-rw-r--r--contrib/bind/lib/isc/ctl_p.h4
-rw-r--r--contrib/bind/lib/isc/ctl_srvr.c68
-rw-r--r--contrib/bind/lib/isc/ev_connects.c27
-rw-r--r--contrib/bind/lib/isc/ev_files.c21
-rw-r--r--contrib/bind/lib/isc/ev_streams.c12
-rw-r--r--contrib/bind/lib/isc/ev_timers.c15
-rw-r--r--contrib/bind/lib/isc/eventlib.c10
-rw-r--r--contrib/bind/lib/isc/eventlib.mdoc33
-rw-r--r--contrib/bind/lib/isc/eventlib_p.h10
-rw-r--r--contrib/bind/lib/isc/heap.mdoc46
-rw-r--r--contrib/bind/lib/isc/hex.c116
-rw-r--r--contrib/bind/lib/isc/logging.c26
-rw-r--r--contrib/bind/lib/isc/logging.mdoc38
-rw-r--r--contrib/bind/lib/isc/memcluster.c35
-rw-r--r--contrib/bind/lib/isc/memcluster.mdoc9
-rw-r--r--contrib/bind/lib/isc/tree.c20
-rw-r--r--contrib/bind/lib/isc/tree.mdoc24
24 files changed, 472 insertions, 178 deletions
diff --git a/contrib/bind/lib/isc/Makefile b/contrib/bind/lib/isc/Makefile
index 7845365..0127c6d 100644
--- a/contrib/bind/lib/isc/Makefile
+++ b/contrib/bind/lib/isc/Makefile
@@ -13,7 +13,7 @@
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
-# $Id: Makefile,v 8.28 2000/12/23 08:03:00 vixie Exp $
+# $Id: Makefile,v 8.30 2001/08/14 05:58:08 marka Exp $
# these are only appropriate for BSD 4.4 or derivatives, and are used in
# development. normal builds will be done in the top level directory and
@@ -48,14 +48,14 @@ SRCS= tree.c base64.c bitncmp.c assertions.c \
ctl_p.c ctl_srvr.c ctl_clnt.c \
eventlib.c ev_connects.c ev_files.c \
ev_timers.c ev_streams.c ev_waits.c \
- movefile.c
+ hex.c movefile.c
OBJS= tree.${O} base64.${O} bitncmp.${O} assertions.${O} \
memcluster.${O} logging.${O} heap.${O} \
ctl_p.${O} ctl_srvr.${O} ctl_clnt.${O} \
eventlib.${O} ev_connects.${O} ev_files.${O} \
ev_timers.${O} ev_streams.${O} ev_waits.${O} \
- movefile.${O}
+ hex.${O} movefile.${O}
all: ${LIBBIND}
@@ -67,7 +67,7 @@ ${LIBBIND}: ${OBJS}
${RANLIB} ${LIBBIND}
.c.${O}:
- if test ! -d ${THREADED} ; then mkdir ${THREADED} ; else true ; fi
+ mkdir ${THREADED} 2> /dev/null || test -d ${THREADED} -a -w ${THREADED}
${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} ${REENTRANT} -c $*.c \
-o ${THREADED}/$*.${O}
-${LDS} ${LD} ${LD_LIBFLAGS} ${THREADED}/$*.${O} \
diff --git a/contrib/bind/lib/isc/assertions.c b/contrib/bind/lib/isc/assertions.c
index b53cc0a..704801c 100644
--- a/contrib/bind/lib/isc/assertions.c
+++ b/contrib/bind/lib/isc/assertions.c
@@ -16,7 +16,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: assertions.c,v 8.3 1999/01/08 19:25:14 vixie Exp $";
+static const char rcsid[] = "$Id: assertions.c,v 8.4 2001/05/29 05:49:22 marka Exp $";
#endif
#include "port_before.h"
@@ -34,7 +34,8 @@ static const char rcsid[] = "$Id: assertions.c,v 8.3 1999/01/08 19:25:14 vixie E
* Forward.
*/
-static void default_assertion_failed(char *, int, assertion_type, char *, int);
+static void default_assertion_failed(const char *, int, assertion_type,
+ const char *, int);
/*
* Public.
@@ -50,9 +51,9 @@ set_assertion_failure_callback(assertion_failure_callback f) {
__assertion_failed = f;
}
-char *
+const char *
assertion_type_to_text(assertion_type type) {
- char *result;
+ const char *result;
switch (type) {
case assert_require:
@@ -78,8 +79,8 @@ assertion_type_to_text(assertion_type type) {
*/
static void
-default_assertion_failed(char *file, int line, assertion_type type, char *cond,
- int print_errno)
+default_assertion_failed(const char *file, int line, assertion_type type,
+ const char *cond, int print_errno)
{
fprintf(stderr, "%s:%d: %s(%s)%s%s failed.\n",
file, line, assertion_type_to_text(type), cond,
diff --git a/contrib/bind/lib/isc/assertions.mdoc b/contrib/bind/lib/isc/assertions.mdoc
index 3d8d103..863829a 100644
--- a/contrib/bind/lib/isc/assertions.mdoc
+++ b/contrib/bind/lib/isc/assertions.mdoc
@@ -1,4 +1,4 @@
-.\" $Id: assertions.mdoc,v 8.2 1999/01/08 19:25:15 vixie Exp $
+.\" $Id: assertions.mdoc,v 8.3 2001/08/08 07:50:20 marka Exp $
.\"
.\"Copyright (c) 1997,1999 by Internet Software Consortium.
.\"
@@ -75,9 +75,9 @@ macro. If this macro's value is
when
.Dq "<isc/assertions.h>"
is included, then assertions of that type will not be checked. E.g.
-
+.Pp
.Dl #define CHECK_ENSURE 0
-
+.Pp
will disable checking of
.Fn ENSURE
and
@@ -93,8 +93,7 @@ assertion types should be checked.
specifies the function to call when an assertion fails.
.Pp
When an
-.li
-assertion_failure_callback
+.Fn assertion_failure_callback
is called, the
.Fa filename
and
@@ -109,7 +108,7 @@ assert_ensure
assert_insist
assert_invariant
.Ed
-
+.Pp
and may be used by the callback to determine the type of the failing
assertion.
.Fa condition
@@ -127,8 +126,13 @@ For example,
returns the string
.Dq REQUIRE .
.Sh SEE ALSO
-Bertrand Meyer,
-.Sy Object-Oriented Software Construction,
-2nd edition, Prentice\-Hall, 1997, ISBN 0\-13\-629155\-4, chapter 11.
+.Rs
+.%A Bertrand Meyer
+.%B Object-Oriented Software Construction, 2nd edition
+.%Q Prentice\-Hall
+.%D 1997
+.%O ISBN 0\-13\-629155\-4
+.%P chapter 11
+.Re
.Sh AUTHOR
Bob Halley (ISC).
diff --git a/contrib/bind/lib/isc/bitncmp.c b/contrib/bind/lib/isc/bitncmp.c
index 8dadca0..c86db62 100644
--- a/contrib/bind/lib/isc/bitncmp.c
+++ b/contrib/bind/lib/isc/bitncmp.c
@@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: bitncmp.c,v 1.6 1999/01/08 19:25:20 vixie Exp $";
+static const char rcsid[] = "$Id: bitncmp.c,v 1.7 2001/05/29 05:49:23 marka Exp $";
#endif
#include "port_before.h"
@@ -51,8 +51,8 @@ bitncmp(const void *l, const void *r, int n) {
if (x)
return (x);
- lb = ((u_char *)l)[b];
- rb = ((u_char *)r)[b];
+ lb = ((const u_char *)l)[b];
+ rb = ((const u_char *)r)[b];
for (b = n % 8; b > 0; b--) {
if ((lb & 0x80) != (rb & 0x80)) {
if (lb & 0x80)
diff --git a/contrib/bind/lib/isc/bitncmp.mdoc b/contrib/bind/lib/isc/bitncmp.mdoc
index 4fa12e8..d3cff2e 100644
--- a/contrib/bind/lib/isc/bitncmp.mdoc
+++ b/contrib/bind/lib/isc/bitncmp.mdoc
@@ -1,4 +1,4 @@
-.\" $Id: bitncmp.mdoc,v 8.2 1999/01/08 19:25:21 vixie Exp $
+.\" $Id: bitncmp.mdoc,v 8.3 2001/08/08 07:50:21 marka Exp $
.\"
.\"Copyright (c) 1996,1999 by Internet Software Consortium.
.\"
@@ -41,7 +41,7 @@ is lexicographically less than, equal to, or greater than
when taken to be unsigned characters (this behaviour is just like that of
.Xr memcmp 3 ) .
.Pp
-.Sy NOTE:
+.Sy NOTE :
.Fn Bitncmp
assumes
.Sy network byte order ;
@@ -52,7 +52,7 @@ this means that the fourth octet of
.Fn Bitncmp
returns values in the manner of
.Xr memcmp 3 :
-.Bd -filled -offset indent
+.Bd -ragged -offset indent
+1 if
.Dq Fa 1
is greater than
@@ -75,7 +75,7 @@ where
and
.Dq Fa r
are both interpreted as strings of unsigned characters (through bit
-.Dq Fa n .)
+.Dq Fa n . )
.Sh SEE ALSO
.Xr memcmp 3 .
.Sh AUTHOR
diff --git a/contrib/bind/lib/isc/ctl_clnt.c b/contrib/bind/lib/isc/ctl_clnt.c
index 4e19d2c..56e5098 100644
--- a/contrib/bind/lib/isc/ctl_clnt.c
+++ b/contrib/bind/lib/isc/ctl_clnt.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: ctl_clnt.c,v 8.15 2000/11/14 01:10:36 vixie Exp $";
+static const char rcsid[] = "$Id: ctl_clnt.c,v 8.17 2001/06/06 00:33:35 marka Exp $";
#endif /* not lint */
/*
@@ -55,8 +55,9 @@ static const char rcsid[] = "$Id: ctl_clnt.c,v 8.15 2000/11/14 01:10:36 vixie Ex
/* Macros. */
#define donefunc_p(ctx) ((ctx).donefunc != NULL)
-#define arpacode_p(line) (isdigit(line[0]) && isdigit(line[1]) && \
- isdigit(line[2]))
+#define arpacode_p(line) (isdigit((unsigned char)(line[0])) && \
+ isdigit((unsigned char)(line[1])) && \
+ isdigit((unsigned char)(line[2])))
#define arpacont_p(line) (line[3] == '-')
#define arpadone_p(line) (line[3] == ' ' || line[3] == '\t' || \
line[3] == '\r' || line[3] == '\0')
@@ -135,6 +136,7 @@ ctl_client(evContext lev, const struct sockaddr *cap, size_t cap_len,
static const char me[] = "ctl_client";
static const int on = 1;
struct ctl_cctx *ctx;
+ struct sockaddr *captmp;
if (logger == NULL)
logger = ctl_logger;
@@ -168,18 +170,19 @@ ctl_client(evContext lev, const struct sockaddr *cap, size_t cap_len,
}
if (cap != NULL) {
if (setsockopt(ctx->sock, SOL_SOCKET, SO_REUSEADDR,
- (char *)&on, sizeof on) != 0) {
+ (const char *)&on, sizeof on) != 0) {
(*ctx->logger)(ctl_warning,
"%s: setsockopt(REUSEADDR): %s",
me, strerror(errno));
}
- if (bind(ctx->sock, cap, cap_len) < 0) {
+ DE_CONST(cap, captmp);
+ if (bind(ctx->sock, captmp, cap_len) < 0) {
(*ctx->logger)(ctl_error, "%s: bind: %s", me,
strerror(errno));
goto fatal;
}
}
- if (evConnect(lev, ctx->sock, (struct sockaddr *)sap, sap_len,
+ if (evConnect(lev, ctx->sock, (const struct sockaddr *)sap, sap_len,
conn_done, ctx, &ctx->coID) < 0) {
(*ctx->logger)(ctl_error, "%s: evConnect(fd %d): %s",
me, (void *)ctx->sock, strerror(errno));
@@ -219,7 +222,7 @@ ctl_command(struct ctl_cctx *ctx, const char *cmd, size_t len,
{
struct ctl_tran *tran;
char *pc;
- int n;
+ unsigned int n;
switch (ctx->state) {
case destroyed:
@@ -243,7 +246,8 @@ ctl_command(struct ctl_cctx *ctx, const char *cmd, size_t len,
memcpy(tran->outbuf.text, cmd, len);
tran->outbuf.used = len;
for (pc = tran->outbuf.text, n = 0; n < tran->outbuf.used; pc++, n++)
- if (!isascii(*pc) || !isprint(*pc))
+ if (!isascii((unsigned char)*pc) ||
+ !isprint((unsigned char)*pc))
*pc = '\040';
start_write(ctx);
return (0);
@@ -274,6 +278,7 @@ start_write(struct ctl_cctx *ctx) {
static const char me[] = "isc/ctl_clnt::start_write";
struct ctl_tran *tran;
struct iovec iov[2], *iovp = iov;
+ char * tmp;
REQUIRE(ctx->state == connecting || ctx->state == connected);
/* If there is a write in progress, don't try to write more yet. */
@@ -297,7 +302,8 @@ start_write(struct ctl_cctx *ctx) {
return;
/* Marshall a newline-terminated message and clock it out. */
*iovp++ = evConsIovec(tran->outbuf.text, tran->outbuf.used);
- *iovp++ = evConsIovec("\r\n", 2);
+ DE_CONST("\r\n", tmp);
+ *iovp++ = evConsIovec(tmp, 2);
if (evWrite(ctx->ev, ctx->sock, iov, iovp - iov,
write_done, tran, &ctx->wrID) < 0) {
(*ctx->logger)(ctl_error, "%s: evWrite: %s", me,
@@ -387,6 +393,12 @@ conn_done(evContext ev, void *uap, int fd,
struct ctl_cctx *ctx = uap;
struct ctl_tran *tran;
+ UNUSED(ev);
+ UNUSED(la);
+ UNUSED(lalen);
+ UNUSED(ra);
+ UNUSED(ralen);
+
ctx->coID.opaque = NULL;
if (fd < 0) {
(*ctx->logger)(ctl_error, "%s: evConnect: %s", me,
@@ -416,6 +428,9 @@ write_done(evContext lev, void *uap, int fd, int bytes) {
struct ctl_tran *tran = (struct ctl_tran *)uap;
struct ctl_cctx *ctx = tran->ctx;
+ UNUSED(lev);
+ UNUSED(fd);
+
ctx->wrID.opaque = NULL;
if (ctx->tiID.opaque != NULL)
touch_timer(ctx);
@@ -459,6 +474,8 @@ readable(evContext ev, void *uap, int fd, int evmask) {
ssize_t n;
char *eos;
+ UNUSED(ev);
+
REQUIRE(ctx != NULL);
REQUIRE(fd >= 0);
REQUIRE(evmask == EV_READ);
@@ -574,6 +591,10 @@ timer(evContext ev, void *uap, struct timespec due, struct timespec itv) {
static const char me[] = "isc/ctl_clnt::timer";
struct ctl_cctx *ctx = uap;
+ UNUSED(ev);
+ UNUSED(due);
+ UNUSED(itv);
+
ctx->tiID.opaque = NULL;
(*ctx->logger)(ctl_error, "%s: timeout after %u seconds while %s", me,
ctx->timeout.tv_sec, state_names[ctx->state]);
diff --git a/contrib/bind/lib/isc/ctl_p.c b/contrib/bind/lib/isc/ctl_p.c
index 7d9058c..4f22f9f 100644
--- a/contrib/bind/lib/isc/ctl_p.c
+++ b/contrib/bind/lib/isc/ctl_p.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: ctl_p.c,v 8.7 2000/02/04 08:28:33 vixie Exp $";
+static const char rcsid[] = "$Id: ctl_p.c,v 8.8 2001/05/29 05:49:26 marka Exp $";
#endif /* not lint */
/*
@@ -104,11 +104,30 @@ ctl_sa_ntop(const struct sockaddr *sa,
{
static const char me[] = "ctl_sa_ntop";
static const char punt[] = "[0].-1";
- char tmp[sizeof "255.255.255.255"];
+ char tmp[INET6_ADDRSTRLEN];
switch (sa->sa_family) {
+ case AF_INET6: {
+ const struct sockaddr_in6 *in6 =
+ (const struct sockaddr_in6 *) sa;
+
+ if (inet_ntop(in6->sin6_family, &in6->sin6_addr, tmp, sizeof tmp)
+ == NULL) {
+ (*logger)(ctl_error, "%s: inet_ntop(%u %04x): %s",
+ me, in6->sin6_family,
+ in6->sin6_port, strerror(errno));
+ return (punt);
+ }
+ if (strlen(tmp) + sizeof "[].65535" > size) {
+ (*logger)(ctl_error, "%s: buffer overflow", me);
+ return (punt);
+ }
+ (void) sprintf(buf, "[%s].%u", tmp, ntohs(in6->sin6_port));
+ return (buf);
+ }
case AF_INET: {
- const struct sockaddr_in *in = (struct sockaddr_in *) sa;
+ const struct sockaddr_in *in =
+ (const struct sockaddr_in *) sa;
if (inet_ntop(in->sin_family, &in->sin_addr, tmp, sizeof tmp)
== NULL) {
@@ -127,8 +146,9 @@ ctl_sa_ntop(const struct sockaddr *sa,
}
#ifndef NO_SOCKADDR_UN
case AF_UNIX: {
- const struct sockaddr_un *un = (struct sockaddr_un *) sa;
- int x = sizeof un->sun_path;
+ const struct sockaddr_un *un =
+ (const struct sockaddr_un *) sa;
+ unsigned int x = sizeof un->sun_path;
if (x > size)
x = size;
@@ -145,12 +165,18 @@ ctl_sa_ntop(const struct sockaddr *sa,
void
ctl_sa_copy(const struct sockaddr *src, struct sockaddr *dst) {
switch (src->sa_family) {
+ case AF_INET6:
+ *((struct sockaddr_in6 *)dst) =
+ *((const struct sockaddr_in6 *)src);
+ break;
case AF_INET:
- *((struct sockaddr_in *)dst) = *((struct sockaddr_in *)src);
+ *((struct sockaddr_in *)dst) =
+ *((const struct sockaddr_in *)src);
break;
#ifndef NO_SOCKADDR_UN
case AF_UNIX:
- *((struct sockaddr_un *)dst) = *((struct sockaddr_un *)src);
+ *((struct sockaddr_un *)dst) =
+ *((const struct sockaddr_un *)src);
break;
#endif
default:
diff --git a/contrib/bind/lib/isc/ctl_p.h b/contrib/bind/lib/isc/ctl_p.h
index 1ebb254..42aade7 100644
--- a/contrib/bind/lib/isc/ctl_p.h
+++ b/contrib/bind/lib/isc/ctl_p.h
@@ -4,7 +4,11 @@ struct ctl_buf {
};
#define MAX_LINELEN 990 /* Like SMTP. */
+#ifndef NO_SOCKADDR_UN
+#define MAX_NTOP PATH_MAX
+#else
#define MAX_NTOP (sizeof "[255.255.255.255].65535")
+#endif
#define allocated_p(Buf) ((Buf).text != NULL)
#define buffer_init(Buf) ((Buf).text = 0, (Buf.used) = 0)
diff --git a/contrib/bind/lib/isc/ctl_srvr.c b/contrib/bind/lib/isc/ctl_srvr.c
index 9beea0d..91a2c1b 100644
--- a/contrib/bind/lib/isc/ctl_srvr.c
+++ b/contrib/bind/lib/isc/ctl_srvr.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: ctl_srvr.c,v 8.24 2000/11/14 01:10:37 vixie Exp $";
+static const char rcsid[] = "$Id: ctl_srvr.c,v 8.25 2001/05/29 05:49:27 marka Exp $";
#endif /* not lint */
/*
@@ -92,7 +92,7 @@ struct ctl_sess {
struct ctl_buf outbuf;
const struct ctl_verb * verb;
u_int helpcode;
- void * respctx;
+ const void * respctx;
u_int respflags;
ctl_srvrdone donefunc;
void * uap;
@@ -139,7 +139,7 @@ static void ctl_morehelp(struct ctl_sctx *,
struct ctl_sess *,
const struct ctl_verb *,
const char *,
- u_int, void *, void *);
+ u_int, const void *, void *);
static void ctl_signal_done(struct ctl_sctx *,
struct ctl_sess *);
@@ -152,7 +152,9 @@ static const char * state_names[] = {
static const char space[] = " ";
-static const struct ctl_verb fakehelpverb = { "fakehelp", ctl_morehelp };
+static const struct ctl_verb fakehelpverb = {
+ "fakehelp", ctl_morehelp , NULL
+};
/* Public. */
@@ -225,7 +227,7 @@ ctl_server(evContext lev, const struct sockaddr *sap, size_t sap_len,
if (sap->sa_family != AF_UNIX)
#endif
if (setsockopt(ctx->sock, SOL_SOCKET, SO_REUSEADDR,
- (char *)&on, sizeof on) != 0) {
+ (const char *)&on, sizeof on) != 0) {
(*ctx->logger)(ctl_warning,
"%s: setsockopt(REUSEADDR): %s",
me, strerror(errno));
@@ -234,7 +236,7 @@ ctl_server(evContext lev, const struct sockaddr *sap, size_t sap_len,
char tmp[MAX_NTOP];
save_errno = errno;
(*ctx->logger)(ctl_error, "%s: bind: %s: %s",
- me, ctl_sa_ntop((struct sockaddr *)sap,
+ me, ctl_sa_ntop((const struct sockaddr *)sap,
tmp, sizeof tmp, ctx->logger),
strerror(save_errno));
close(ctx->sock);
@@ -295,8 +297,8 @@ ctl_endserver(struct ctl_sctx *ctx) {
*/
void
ctl_response(struct ctl_sess *sess, u_int code, const char *text,
- u_int flags, void *respctx, ctl_srvrdone donefunc, void *uap,
- const char *body, size_t bodylen)
+ u_int flags, const void *respctx, ctl_srvrdone donefunc,
+ void *uap, const char *body, size_t bodylen)
{
static const char me[] = "ctl_response";
struct iovec iov[3], *iovp = iov;
@@ -327,13 +329,18 @@ ctl_response(struct ctl_sess *sess, u_int code, const char *text,
sess->outbuf.used = SPRINTF((sess->outbuf.text, "%03d%c%s\r\n",
code, (flags & CTL_MORE) != 0 ? '-' : ' ',
text));
- for (pc = sess->outbuf.text, n = 0; n < sess->outbuf.used-2; pc++, n++)
- if (!isascii(*pc) || !isprint(*pc))
+ for (pc = sess->outbuf.text, n = 0;
+ n < (int)sess->outbuf.used-2; pc++, n++)
+ if (!isascii((unsigned char)*pc) ||
+ !isprint((unsigned char)*pc))
*pc = '\040';
*iovp++ = evConsIovec(sess->outbuf.text, sess->outbuf.used);
if (body != NULL) {
- *iovp++ = evConsIovec((char *)body, bodylen);
- *iovp++ = evConsIovec(".\r\n", 3);
+ char *tmp;
+ DE_CONST(body, tmp);
+ *iovp++ = evConsIovec(tmp, bodylen);
+ DE_CONST(".\r\n", tmp);
+ *iovp++ = evConsIovec(tmp, 3);
}
(*ctx->logger)(ctl_debug, "%s: [%d] %s", me,
sess->outbuf.used, sess->outbuf.text);
@@ -369,7 +376,8 @@ ctl_sendhelp(struct ctl_sess *sess, u_int code) {
sess->helpcode = code;
sess->verb = &fakehelpverb;
- ctl_morehelp(ctx, sess, NULL, me, CTL_MORE, (void *)ctx->verbs, NULL);
+ ctl_morehelp(ctx, sess, NULL, me, CTL_MORE,
+ (const void *)ctx->verbs, NULL);
}
void *
@@ -397,6 +405,10 @@ ctl_accept(evContext lev, void *uap, int fd,
struct ctl_sess *sess = NULL;
char tmp[MAX_NTOP];
+ UNUSED(lev);
+ UNUSED(lalen);
+ UNUSED(ralen);
+
if (fd < 0) {
(*ctx->logger)(ctl_error, "%s: accept: %s",
me, strerror(errno));
@@ -404,7 +416,7 @@ ctl_accept(evContext lev, void *uap, int fd,
}
if (ctx->cur_sess == ctx->max_sess) {
(*ctx->logger)(ctl_error, "%s: %s: too many control sessions",
- me, ctl_sa_ntop((struct sockaddr *)rav,
+ me, ctl_sa_ntop((const struct sockaddr *)rav,
tmp, sizeof tmp,
ctx->logger));
(void) close(fd);
@@ -432,11 +444,11 @@ ctl_accept(evContext lev, void *uap, int fd,
sess->rdtiID.opaque = NULL;
sess->respctx = NULL;
sess->csctx = NULL;
- if (((struct sockaddr *)rav)->sa_family == AF_UNIX)
- ctl_sa_copy((struct sockaddr *)lav,
+ if (((const struct sockaddr *)rav)->sa_family == AF_UNIX)
+ ctl_sa_copy((const struct sockaddr *)lav,
(struct sockaddr *)&sess->sa);
else
- ctl_sa_copy((struct sockaddr *)rav,
+ ctl_sa_copy((const struct sockaddr *)rav,
(struct sockaddr *)&sess->sa);
sess->donefunc = NULL;
buffer_init(sess->inbuf);
@@ -447,7 +459,7 @@ ctl_accept(evContext lev, void *uap, int fd,
(*ctx->logger)(ctl_debug, "%s: %s: accepting (fd %d)",
me, address_expr, sess->sock);
(*ctx->connverb->func)(ctx, sess, ctx->connverb, "", 0,
- (struct sockaddr *)rav, ctx->uctx);
+ (const struct sockaddr *)rav, ctx->uctx);
}
static void
@@ -614,6 +626,10 @@ ctl_wrtimeout(evContext lev, void *uap,
struct ctl_sess *sess = uap;
struct ctl_sctx *ctx = sess->ctx;
char tmp[MAX_NTOP];
+
+ UNUSED(lev);
+ UNUSED(due);
+ UNUSED(itv);
REQUIRE(sess->state == writing);
sess->wrtiID.opaque = NULL;
@@ -638,6 +654,10 @@ ctl_rdtimeout(evContext lev, void *uap,
struct ctl_sctx *ctx = sess->ctx;
char tmp[MAX_NTOP];
+ UNUSED(lev);
+ UNUSED(due);
+ UNUSED(itv);
+
REQUIRE(sess->state == reading);
sess->rdtiID.opaque = NULL;
(*ctx->logger)(ctl_warning, "%s: %s: timeout, closing",
@@ -699,6 +719,9 @@ ctl_writedone(evContext lev, void *uap, int fd, int bytes) {
char tmp[MAX_NTOP];
int save_errno = errno;
+ UNUSED(lev);
+ UNUSED(uap);
+
REQUIRE(sess->state == writing);
REQUIRE(fd == sess->sock);
REQUIRE(sess->wrtiID.opaque != NULL);
@@ -731,9 +754,14 @@ ctl_writedone(evContext lev, void *uap, int fd, int bytes) {
static void
ctl_morehelp(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *text,
- u_int respflags, void *respctx, void *uctx)
+ u_int respflags, const void *respctx, void *uctx)
{
- struct ctl_verb *this = respctx, *next = this + 1;
+ const struct ctl_verb *this = respctx, *next = this + 1;
+
+ UNUSED(ctx);
+ UNUSED(verb);
+ UNUSED(text);
+ UNUSED(uctx);
REQUIRE(!lastverb_p(this));
REQUIRE((respflags & CTL_MORE) != 0);
diff --git a/contrib/bind/lib/isc/ev_connects.c b/contrib/bind/lib/isc/ev_connects.c
index 5378665..5be432a 100644
--- a/contrib/bind/lib/isc/ev_connects.c
+++ b/contrib/bind/lib/isc/ev_connects.c
@@ -20,7 +20,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: ev_connects.c,v 8.27 2000/11/14 01:10:37 vixie Exp $";
+static const char rcsid[] = "$Id: ev_connects.c,v 8.32 2001/07/03 13:26:35 marka Exp $";
#endif
/* Import. */
@@ -30,6 +30,7 @@ static const char rcsid[] = "$Id: ev_connects.c,v 8.27 2000/11/14 01:10:37 vixie
#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/ioctl.h>
#include <unistd.h>
@@ -77,7 +78,12 @@ evListen(evContext opaqueCtx, int fd, int maxconn,
* incorrectly.
*/
if ((mode & PORT_NONBLOCK) == 0) {
+#ifdef USE_FIONBIO_IOCTL
+ int on = 1;
+ OK(ioctl(fd, FIONBIO, (char *)&on));
+#else
OK(fcntl(fd, F_SETFL, mode | PORT_NONBLOCK));
+#endif
new->flags |= EV_CONN_BLOCK;
}
OK(listen(fd, maxconn));
@@ -103,7 +109,7 @@ evListen(evContext opaqueCtx, int fd, int maxconn,
}
int
-evConnect(evContext opaqueCtx, int fd, void *ra, int ralen,
+evConnect(evContext opaqueCtx, int fd, const void *ra, int ralen,
evConnFunc func, void *uap, evConnID *id)
{
evContext_p *ctx = opaqueCtx.opaque;
@@ -160,8 +166,14 @@ evCancelConn(evContext opaqueCtx, evConnID id) {
if (mode == -1) {
if (errno != EBADF)
return (-1);
- } else
+ } else {
+#ifdef USE_FIONBIO_IOCTL
+ int on = 1;
+ OK(ioctl(this->fd, FIONBIO, (char *)&on));
+#else
OK(fcntl(this->fd, F_SETFL, mode | PORT_NONBLOCK));
+#endif
+ }
}
/* Unlink from ctx->conns. */
@@ -275,7 +287,8 @@ listener(evContext opaqueCtx, void *uap, int fd, int evmask) {
struct sockaddr_un un;
#endif
} la, ra;
- int new, lalen = 0, ralen;
+ int new;
+ ISC_SOCKLEN_T lalen = 0, ralen;
REQUIRE((evmask & EV_READ) != 0);
ralen = sizeof ra;
@@ -309,13 +322,15 @@ connector(evContext opaqueCtx, void *uap, int fd, int evmask) {
struct sockaddr_un un;
#endif
} la, ra;
- int lalen, ralen;
+ ISC_SOCKLEN_T lalen, ralen;
char buf[1];
void *conn_uap;
evConnFunc conn_func;
evConnID id;
int socket_errno = 0;
- int optlen;
+ ISC_SOCKLEN_T optlen;
+
+ UNUSED(evmask);
lalen = sizeof la;
ralen = sizeof ra;
diff --git a/contrib/bind/lib/isc/ev_files.c b/contrib/bind/lib/isc/ev_files.c
index 434385c..c6bcab6 100644
--- a/contrib/bind/lib/isc/ev_files.c
+++ b/contrib/bind/lib/isc/ev_files.c
@@ -20,7 +20,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: ev_files.c,v 1.19 1999/10/07 20:44:04 vixie Exp $";
+static const char rcsid[] = "$Id: ev_files.c,v 1.21 2001/11/01 05:35:46 marka Exp $";
#endif
#include "port_before.h"
@@ -28,6 +28,7 @@ static const char rcsid[] = "$Id: ev_files.c,v 1.19 1999/10/07 20:44:04 vixie Ex
#include <sys/types.h>
#include <sys/time.h>
+#include <sys/ioctl.h>
#include <errno.h>
#include <fcntl.h>
@@ -56,9 +57,9 @@ evSelectFD(evContext opaqueCtx,
"evSelectFD(ctx %#x, fd %d, mask 0x%x, func %#x, uap %#x)\n",
ctx, fd, eventmask, func, uap);
if (eventmask == 0 || (eventmask & ~EV_MASK_ALL) != 0)
- ERR(EINVAL);
+ EV_ERR(EINVAL);
if (fd > ctx->highestFD)
- ERR(EINVAL);
+ EV_ERR(EINVAL);
OK(mode = fcntl(fd, F_GETFL, NULL)); /* side effect: validate fd. */
/*
@@ -72,7 +73,12 @@ evSelectFD(evContext opaqueCtx,
if (mode & PORT_NONBLOCK)
FD_SET(fd, &ctx->nonblockBefore);
else {
+#ifdef USE_FIONBIO_IOCTL
+ int on = 1;
+ OK(ioctl(fd, FIONBIO, (char *)&on));
+#else
OK(fcntl(fd, F_SETFL, mode | PORT_NONBLOCK));
+#endif
FD_CLR(fd, &ctx->nonblockBefore);
}
}
@@ -84,7 +90,7 @@ evSelectFD(evContext opaqueCtx,
* same context.
*/
if (id != NULL && FindFD(ctx, fd, eventmask) != NULL)
- ERR(ETOOMANYREFS);
+ EV_ERR(ETOOMANYREFS);
/* Allocate and fill. */
OKNEW(id);
@@ -166,7 +172,7 @@ evDeselectFD(evContext opaqueCtx, evFileID opaqueID) {
/* Get the mode. Unless the file has been closed, errors are bad. */
mode = fcntl(del->fd, F_GETFL, NULL);
if (mode == -1 && errno != EBADF)
- ERR(errno);
+ EV_ERR(errno);
/* Remove from the list of files. */
if (del->prev != NULL)
@@ -197,7 +203,12 @@ evDeselectFD(evContext opaqueCtx, evFileID opaqueID) {
* this fcntl() fails since (a) we've already done the work
* and (b) the caller didn't ask us anything about O_NONBLOCK.
*/
+#ifdef USE_FIONBIO_IOCTL
+ int off = 1;
+ (void) ioctl(del->fd, FIONBIO, (char *)&off);
+#else
(void) fcntl(del->fd, F_SETFL, mode & ~PORT_NONBLOCK);
+#endif
}
/*
diff --git a/contrib/bind/lib/isc/ev_streams.c b/contrib/bind/lib/isc/ev_streams.c
index b25a666..a301720 100644
--- a/contrib/bind/lib/isc/ev_streams.c
+++ b/contrib/bind/lib/isc/ev_streams.c
@@ -20,7 +20,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: ev_streams.c,v 8.21 1999/10/07 20:44:04 vixie Exp $";
+static const char rcsid[] = "$Id: ev_streams.c,v 8.22 2001/05/29 05:49:29 marka Exp $";
#endif
#include "port_before.h"
@@ -125,6 +125,8 @@ int
evTimeRW(evContext opaqueCtx, evStreamID id, evTimerID timer) /*ARGSUSED*/ {
evStream *str = id.opaque;
+ UNUSED(opaqueCtx);
+
str->timer = timer;
str->flags |= EV_STR_TIMEROK;
return (0);
@@ -134,6 +136,8 @@ int
evUntimeRW(evContext opaqueCtx, evStreamID id) /*ARGSUSED*/ {
evStream *str = id.opaque;
+ UNUSED(opaqueCtx);
+
str->flags &= ~EV_STR_TIMEROK;
return (0);
}
@@ -218,7 +222,7 @@ copyvec(evStream *str, const struct iovec *iov, int iocnt) {
static void
consume(evStream *str, size_t bytes) {
while (bytes > 0) {
- if (bytes < str->iovCur->iov_len) {
+ if (bytes < (size_t)str->iovCur->iov_len) {
str->iovCur->iov_len -= bytes;
str->iovCur->iov_base = (void *)
((u_char *)str->iovCur->iov_base + bytes);
@@ -257,6 +261,8 @@ writable(evContext opaqueCtx, void *uap, int fd, int evmask) {
evStream *str = uap;
int bytes;
+ UNUSED(evmask);
+
bytes = writev(fd, str->iovCur, str->iovCurCount);
if (bytes > 0) {
if ((str->flags & EV_STR_TIMEROK) != 0)
@@ -278,6 +284,8 @@ readable(evContext opaqueCtx, void *uap, int fd, int evmask) {
evStream *str = uap;
int bytes;
+ UNUSED(evmask);
+
bytes = readv(fd, str->iovCur, str->iovCurCount);
if (bytes > 0) {
if ((str->flags & EV_STR_TIMEROK) != 0)
diff --git a/contrib/bind/lib/isc/ev_timers.c b/contrib/bind/lib/isc/ev_timers.c
index e5e5684..03436c6 100644
--- a/contrib/bind/lib/isc/ev_timers.c
+++ b/contrib/bind/lib/isc/ev_timers.c
@@ -20,7 +20,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: ev_timers.c,v 1.30 2001/02/12 23:13:48 marka Exp $";
+static const char rcsid[] = "$Id: ev_timers.c,v 1.32 2001/11/01 05:35:47 marka Exp $";
#endif
/* Import. */
@@ -201,7 +201,7 @@ evClearTimer(evContext opaqueCtx, evTimerID id) {
}
if (heap_element(ctx->timers, del->index) != del)
- ERR(ENOENT);
+ EV_ERR(ENOENT);
if (heap_delete(ctx->timers, del->index) < 0)
return (-1);
@@ -229,7 +229,7 @@ evResetTimer(evContext opaqueCtx,
int result=0;
if (heap_element(ctx->timers, timer->index) != timer)
- ERR(ENOENT);
+ EV_ERR(ENOENT);
old_due = timer->due;
@@ -332,6 +332,9 @@ evTouchIdleTimer(evContext opaqueCtx, evTimerID id) {
heap_context
evCreateTimers(const evContext_p *ctx) {
+
+ UNUSED(ctx);
+
return (heap_new(due_sooner, set_index, 2048));
}
@@ -363,6 +366,9 @@ set_index(void *what, int index) {
static void
free_timer(void *what, void *uap) {
evTimer *t = what;
+
+ UNUSED(uap);
+
FREE(t);
}
@@ -388,6 +394,9 @@ idle_timeout(evContext opaqueCtx,
evContext_p *ctx = opaqueCtx.opaque;
idle_timer *this = uap;
struct timespec idle;
+
+ UNUSED(due);
+ UNUSED(inter);
idle = evSubTime(ctx->lastEventTime, this->lastTouched);
if (evCmpTime(idle, this->max_idle) >= 0) {
diff --git a/contrib/bind/lib/isc/eventlib.c b/contrib/bind/lib/isc/eventlib.c
index cea98ac..0e52733 100644
--- a/contrib/bind/lib/isc/eventlib.c
+++ b/contrib/bind/lib/isc/eventlib.c
@@ -20,7 +20,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: eventlib.c,v 1.45 2000/02/04 07:25:39 vixie Exp $";
+static const char rcsid[] = "$Id: eventlib.c,v 1.46 2001/11/01 05:35:48 marka Exp $";
#endif
#include "port_before.h"
@@ -193,7 +193,7 @@ evGetNext(evContext opaqueCtx, evEvent *opaqueEv, int options) {
/* Ensure that exactly one of EV_POLL or EV_WAIT was specified. */
x = ((options & EV_POLL) != 0) + ((options & EV_WAIT) != 0);
if (x != 1)
- ERR(EINVAL);
+ EV_ERR(EINVAL);
/* Get the time of day. We'll do this again after select() blocks. */
ctx->lastEventTime = evNowTime();
@@ -248,7 +248,7 @@ evGetNext(evContext opaqueCtx, evEvent *opaqueEv, int options) {
/* Are there any events at all? */
if ((options & EV_WAIT) != 0 && !nextTimer && ctx->fdMax == -1)
- ERR(ENOENT);
+ EV_ERR(ENOENT);
/* Figure out what select()'s timeout parameter should be. */
if ((options & EV_POLL) != 0) {
@@ -343,11 +343,11 @@ evGetNext(evContext opaqueCtx, evEvent *opaqueEv, int options) {
}
abort();
}
- ERR(pselect_errno);
+ EV_ERR(pselect_errno);
}
if (x == 0 && (nextTimer == NULL || !timerPast) &&
(options & EV_POLL))
- ERR(EWOULDBLOCK);
+ EV_ERR(EWOULDBLOCK);
ctx->fdCount = x;
#ifdef EVENTLIB_TIME_CHECKS
ctx->lastFdCount = x;
diff --git a/contrib/bind/lib/isc/eventlib.mdoc b/contrib/bind/lib/isc/eventlib.mdoc
index 202b1cb..e95871c 100644
--- a/contrib/bind/lib/isc/eventlib.mdoc
+++ b/contrib/bind/lib/isc/eventlib.mdoc
@@ -1,4 +1,4 @@
-.\" $Id: eventlib.mdoc,v 1.20 1999/08/18 22:09:04 vixie Exp $
+.\" $Id: eventlib.mdoc,v 1.22 2001/12/28 04:24:22 marka Exp $
.\"
.\"Copyright (c) 1995-1999 by Internet Software Consortium
.\"
@@ -70,17 +70,17 @@
.Sh SYNOPSIS
.Fd #include <isc/eventlib.h>
.Ft typedef void
-.Fn (*evConnFunc) "evContext ctx" "void *uap" "int fd" \
+.Fn \*(lp*evConnFunc\*(rp "evContext ctx" "void *uap" "int fd" \
"const void *la" "int lalen" "const void *ra" "int ralen"
.Ft typedef void
-.Fn (*evTimerFunc) "evContext ctx" "void *uap" \
+.Fn \*(lp*evTimerFunc\*(rp "evContext ctx" "void *uap" \
"struct timespec due" "struct timespec inter"
.Ft typedef void
-.Fn (*evFileFunc) "evContext ctx" "void *uap" "int fd" "int eventmask"
+.Fn \*(lp*evFileFunc\*(rp "evContext ctx" "void *uap" "int fd" "int eventmask"
.Ft typedef void
-.Fn (*evStreamFunc) "evContext ctx" "void *uap" "int fd" "int bytes"
+.Fn \*(lp*evStreamFunc\*(rp "evContext ctx" "void *uap" "int fd" "int bytes"
.Ft typedef void
-.Fn (*evWaitFunc) "evContext ctx" "void *uap" "const void *tag"
+.Fn \*(lp*evWaitFunc\*(rp "evContext ctx" "void *uap" "const void *tag"
.Ft int
.Fn evCreate "evContext *ctx"
.Ft int
@@ -197,7 +197,7 @@ The function
creates an event context which is needed by all the other functions in this
library. All information used internally by this library is bound to this
context, rather than to static storage. This makes the library
-.Dq thread safe,
+.Dq thread safe ,
and permits other library functions to use events without
disrupting the application's use of events.
.Pp
@@ -325,7 +325,7 @@ The function
adds two
.Dq Fa struct timespec
values and returns the result as a
-.Dq Fa struct timespec.
+.Dq Fa struct timespec .
.Pp
The function
.Fn evSubTime
@@ -334,7 +334,7 @@ subtracts its second
argument from its first
.Dq Fa struct timespec
argument and returns the result as a
-.Dq Fa struct timespec.
+.Dq Fa struct timespec .
.Pp
The function
.Fn evCmpTime
@@ -384,15 +384,15 @@ argument. The event will be delivered at absolute time
and then if time
.Fa inter
is not equal to
-.Dq Fa evConsTime(0,0) ,
+.Dq Fn evConsTime 0 0 ,
subsequently at intervals equal to time
.Fa inter .
As a special case, specifying a
.Fa due
argument equal to
-.Dq Fa evConsTime(0,0)
+.Dq Fn evConsTime 0 0
means
-.Dq due immediately.
+.Dq due immediately .
The
.Fa opaqueID
argument, if specified as a value other than
@@ -406,9 +406,8 @@ Note that in a
timer (which has an
.Fa inter
argument equal to
-.Dq Fa evConsTime(0,0)
-.\" putting the ) after the Dq Fa arg did not work well. --vix
-) the user function
+.Dq Fa evConsTime(0,0) )
+the user function
.Fa func
should deallocate any dynamic memory that is uniquely bound to the
.Fa uap ,
@@ -711,7 +710,7 @@ initiates an outgoing connection on
to destination address
.Fa ra
(whose length is
-.Fa ralen ).
+.Fa ralen ) .
When the connection is complete,
.Fa func
will be called with
@@ -719,7 +718,7 @@ will be called with
as one of its arguments. The argument
.Fa fd
to
-.Fn (*func)()
+.Fn \*(lp*func\*(rp
will be
.Fa -1
if an error occurred that prevented this connection from completing
diff --git a/contrib/bind/lib/isc/eventlib_p.h b/contrib/bind/lib/isc/eventlib_p.h
index b4d7ecc..78f0100 100644
--- a/contrib/bind/lib/isc/eventlib_p.h
+++ b/contrib/bind/lib/isc/eventlib_p.h
@@ -18,7 +18,7 @@
/* eventlib_p.h - private interfaces for eventlib
* vix 09sep95 [initial]
*
- * $Id: eventlib_p.h,v 1.28 2000/02/04 08:28:34 vixie Exp $
+ * $Id: eventlib_p.h,v 1.30 2001/11/01 05:35:50 marka Exp $
*/
#ifndef _EVENTLIB_P_H
@@ -43,8 +43,8 @@
#include <isc/memcluster.h>
#define EV_MASK_ALL (EV_READ | EV_WRITE | EV_EXCEPT)
-#define ERR(e) return (errno = (e), -1)
-#define OK(x) if ((x) < 0) ERR(errno); else (void)NULL
+#define EV_ERR(e) return (errno = (e), -1)
+#define OK(x) if ((x) < 0) EV_ERR(errno); else (void)NULL
#define NEW(p) if (((p) = memget(sizeof *(p))) != NULL) \
FILL(p); \
@@ -85,7 +85,7 @@ typedef struct evAccept {
struct sockaddr_un un;
#endif
} la;
- int lalen;
+ ISC_SOCKLEN_T lalen;
union {
struct sockaddr sa;
struct sockaddr_in in;
@@ -93,7 +93,7 @@ typedef struct evAccept {
struct sockaddr_un un;
#endif
} ra;
- int ralen;
+ ISC_SOCKLEN_T ralen;
int ioErrno;
evConn * conn;
LINK(struct evAccept) link;
diff --git a/contrib/bind/lib/isc/heap.mdoc b/contrib/bind/lib/isc/heap.mdoc
index 6e0384d..4b60e91 100644
--- a/contrib/bind/lib/isc/heap.mdoc
+++ b/contrib/bind/lib/isc/heap.mdoc
@@ -1,4 +1,4 @@
-.\" $Id: heap.mdoc,v 8.6 2000/11/15 02:03:52 marka Exp $
+.\" $Id: heap.mdoc,v 8.7 2001/08/08 07:50:24 marka Exp $
.\"
.\"Copyright (c) 1997,1999 by Internet Software Consortium.
.\"
@@ -15,7 +15,7 @@
.\"ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\"SOFTWARE.
.\"
-.Dd Jan 1, 1997
+.Dd January 1, 1997
.\"Os OPERATING_SYSTEM [version/release]
.Os BSD 4
.Dt HEAP @SYSCALL_EXT@
@@ -52,10 +52,9 @@
These functions implement heap\-based priority queues. The user defines a
priority scheme, and provides a function for comparison of the priority
of heap elements
-.Po see the description of the
+(see the description of the
.Ft heap_higher_priority_func
-function pointer, below
-.Pc .
+function pointer, below).
.Pp
Each of the functions depends upon the
.Ft heap_context
@@ -163,9 +162,8 @@ into the appropriate place (priority\-wise) in the
.Ft heap
indicated by
.Fa ctx
-.Po a pointer to a
-.Ft heap_context
-.Pc .
+(a pointer to a
+.Ft heap_context ) .
If
.No non\- Ns Dv NULL ,
the user-defined
@@ -189,7 +187,9 @@ element onward via the priority as determined by the user function
pointed to by
.Ft higher_priority
function pointer
-.Pq see description of Fn heap_new, No above .
+(see description of
+.Fn heap_new ,
+above).
.Pp
.Fn heap_increased
.Pp
@@ -233,7 +233,7 @@ a
or if the
.Fa higher_priority
function pointer is
-.Dv NULL;
+.Dv NULL ;
otherwise, a valid
.Ft heap_context
.Ns .
@@ -347,14 +347,24 @@ please refer to
.Sh SEE ALSO
.Xr malloc 3 ,
.Xr realloc 3 .
-.Pp
-Cormen, Leiserson, and Rivest,
-.Sy Introduction to Algorithms,
-MIT Press / McGraw Hill, 1990, ISBN 0\-262\-03141\-8, chapter 7.
-.Pp
-Sedgewick,
-.Sy Algorithms,
-2nd ed'n, Addison\-Wesley, 1988, ISBN 0\-201\-06673\-4, chapter 11.
+.Rs
+.%A Cormen
+.%A Leiserson
+.%A Rivest
+.%B Introduction to Algorithms
+.%Q "MIT Press / McGraw Hill"
+.%D 1990
+.%O ISBN 0\-262\-03141\-8
+.%P chapter 7
+.Re
+.Rs
+.%A Sedgewick
+.%B Algorithms, 2nd ed'n
+.%Q Addison\-Wesley
+.%D 1988
+.%O ISBN 0\-201\-06673\-4
+.%P chapter 11
+.Re
.\" .Sh STANDARDS
.\" .Sh HISTORY
.Sh AUTHORS
diff --git a/contrib/bind/lib/isc/hex.c b/contrib/bind/lib/isc/hex.c
new file mode 100644
index 0000000..2239796
--- /dev/null
+++ b/contrib/bind/lib/isc/hex.c
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2001 by 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.
+ */
+
+#include <port_before.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+#include <isc/misc.h>
+#include <port_after.h>
+
+static const char hex[17] = "0123456789abcdef";
+
+int
+isc_gethexstring(unsigned char *buf, size_t len, int count, FILE *fp,
+ int *multiline)
+{
+ int c, n;
+ unsigned char x;
+ char *s;
+ int result = count;
+
+ x = 0; /* silence compiler */
+ n = 0;
+ while (count > 0) {
+ c = fgetc(fp);
+
+ if ((c == EOF) ||
+ (c == '\n' && !*multiline) ||
+ (c == '(' && *multiline) ||
+ (c == ')' && !*multiline))
+ goto formerr;
+ /* comment */
+ if (c == ';') {
+ while ((c = fgetc(fp)) != EOF && c != '\n')
+ /* empty */
+ if (c == '\n' && *multiline)
+ continue;
+ goto formerr;
+ }
+ /* white space */
+ if (c == ' ' || c == '\t' || c == '\n' || c == '\r')
+ continue;
+ /* multiline */
+ if ('(' == c || c == ')') {
+ *multiline = (c == '(' /*)*/);
+ continue;
+ }
+ if ((s = strchr(hex, tolower(c))) == NULL)
+ goto formerr;
+ x = (x<<4) | (s - hex);
+ if (++n == 2) {
+ if (len > 0) {
+ *buf++ = x;
+ len--;
+ } else
+ result = -1;
+ count--;
+ n = 0;
+ }
+ }
+ return (result);
+
+ formerr:
+ if (c == '\n')
+ ungetc(c, fp);
+ return (-1);
+}
+
+void
+isc_puthexstring(FILE *fp, const unsigned char *buf, size_t buflen,
+ size_t len1, size_t len2, const char *sep)
+{
+ size_t i = 0;
+
+ if (len1 < 4)
+ len1 = 4;
+ if (len2 < 4)
+ len2 = 4;
+ while (buflen > 0) {
+ fputc(hex[(buf[0]>>4)&0xf], fp);
+ fputc(hex[buf[0]&0xf], fp);
+ i += 2;
+ buflen--;
+ buf++;
+ if (i >= len1 && sep != NULL) {
+ fputs(sep, fp);
+ i = 0;
+ len1 = len2;
+ }
+ }
+}
+
+void
+isc_tohex(const unsigned char *buf, size_t buflen, char *t) {
+ while (buflen > 0) {
+ *t++ = hex[(buf[0]>>4)&0xf];
+ *t++ = hex[buf[0]&0xf];
+ buf++;
+ buflen--;
+ }
+ *t = '\0';
+}
diff --git a/contrib/bind/lib/isc/logging.c b/contrib/bind/lib/isc/logging.c
index 0d9037f..ca7ea04 100644
--- a/contrib/bind/lib/isc/logging.c
+++ b/contrib/bind/lib/isc/logging.c
@@ -16,7 +16,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: logging.c,v 8.28 2000/12/23 08:14:54 vixie Exp $";
+static const char rcsid[] = "$Id: logging.c,v 8.31 2001/06/18 14:44:03 marka Exp $";
#endif /* not lint */
#include "port_before.h"
@@ -57,8 +57,9 @@ static const int syslog_priority[] = { LOG_DEBUG, LOG_INFO, LOG_NOTICE,
static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
-static char *level_text[] = { "info: ", "notice: ", "warning: ", "error: ",
- "critical: " };
+static const char *level_text[] = {
+ "info: ", "notice: ", "warning: ", "error: ", "critical: "
+};
static void
version_rename(log_channel chan) {
@@ -177,6 +178,19 @@ log_close_stream(log_channel chan) {
return (0);
}
+void
+log_close_debug_channels(log_context lc) {
+ log_channel_list lcl;
+ int i;
+
+ for (i = 0; i < lc->num_categories; i++)
+ for (lcl = lc->categories[i]; lcl != NULL; lcl = lcl->next)
+ if (lcl->channel->type == log_file &&
+ lcl->channel->out.file.stream != NULL &&
+ lcl->channel->flags & LOG_REQUIRE_DEBUG)
+ (void)log_close_stream(lcl->channel);
+}
+
FILE *
log_get_stream(log_channel chan) {
if (chan == NULL || chan->type != log_file) {
@@ -268,8 +282,8 @@ log_vwrite(log_context lc, int category, int level, const char *format,
log_channel chan;
struct timeval tv;
struct tm *local_tm;
- char *category_name;
- char *level_str;
+ const char *category_name;
+ const char *level_str;
char time_buf[256];
char level_buf[256];
@@ -582,7 +596,7 @@ log_new_syslog_channel(unsigned int flags, int level, int facility) {
log_channel
log_new_file_channel(unsigned int flags, int level,
- char *name, FILE *stream, unsigned int versions,
+ const char *name, FILE *stream, unsigned int versions,
unsigned long max_size) {
log_channel chan;
diff --git a/contrib/bind/lib/isc/logging.mdoc b/contrib/bind/lib/isc/logging.mdoc
index 47d4312..8d8d27e 100644
--- a/contrib/bind/lib/isc/logging.mdoc
+++ b/contrib/bind/lib/isc/logging.mdoc
@@ -1,4 +1,4 @@
-.\" $Id: logging.mdoc,v 8.4 2000/04/23 02:19:02 vixie Exp $
+.\" $Id: logging.mdoc,v 8.6 2001/12/28 04:24:23 marka Exp $
.\"
.\"Copyright (c) 1995-1999 by Internet Software Consortium
.\"
@@ -212,7 +212,7 @@ Each category can have its own list of
associated with it; we say that such a channel is
.Dq in
the particular category.
-.Sy NOTE:
+.Sy NOTE :
Individual logging channels can appear in more than one category.
.Pp
A
@@ -220,12 +220,12 @@ A
is the set of all
.Nm logging channels
associated with the context's
-.Nm categories;
+.Nm categories ;
thus, a particular
.Nm category
scheme is associated with a particular
-.Nm logging context.
-.Sy NOTE:
+.Nm logging context .
+.Sy NOTE :
A logging channel may appear in more than one logging context, and in
multiple categories within each logging context.
.Pp
@@ -325,8 +325,8 @@ type
or
.Dv log_file .
.It Dv LOG_TRUNCATE
-Truncate logging file when re-opened (
-.Fn log_open_stream
+Truncate logging file when re-opened
+.Fn ( log_open_stream
will
.Xr unlink 2
the file and then
@@ -370,8 +370,8 @@ bit of the
field of the logging channel structure is set), then any file with the
.Dq current
filename for the stream is
-.X4 unlink 2 Ns -d .
-.Sy NOTE:
+.Xr unlink 2 Ns -d .
+.Sy NOTE :
If the logging file is
.Em not
a regular file, and either of the above operations (version numbering
@@ -477,7 +477,7 @@ set and the message is not a debugging message (i.e., has a level greater
than 0), then it will not be logged.
Finally, if the message's priority is less important than the
channel's logging level (the priority threshold), will not be logged.
-.Sy NOTE:
+.Sy NOTE :
If a logging channel's flag has
.Dv LOG_USE_CONTEXT_LEVEL
set, it will use the logging context's priority, rather than its own.
@@ -572,7 +572,7 @@ and
.Dq Fa category_names
which are supplied; the latter can be
.Dv NULL .
-.Sy NOTE:
+.Sy NOTE :
Since
.Dq Fa category_names
is used directly, it
@@ -586,7 +586,7 @@ The
function is used to free the opaque structure
.Dq Va lc.opaque
and its components.
-.Sy NOTE:
+.Sy NOTE :
The
.Dq Va opaque
field of
@@ -614,7 +614,7 @@ and
is set to
.Dv NULL .
.Pp
-.Sy NOTE:
+.Sy NOTE :
The function
.Fn log_free_context
does
@@ -704,7 +704,9 @@ create a new channel of the type specified (thus, the difference in arguments);
the
.Dq Va type
field of the new
-.Dq Ft struct log_channel
+.Do
+.Ft struct log_channel
+.Dc
is always set to the appropriate value.
.Pp
The
@@ -807,7 +809,8 @@ c) if any of
or
.Xr fdopen 3
fails
-.Po Va errno
+.Po
+.Va errno
is set by the call which failed
.Pc .
If some value other than
@@ -862,7 +865,8 @@ is
or
.Fa category
is invalid (negative or greater than or equal to
-.Va lcp->num_categories ), with
+.Va lcp->num_categories ) ,
+with
.Va errno
set to
.Dv EINVAL ;
@@ -897,7 +901,7 @@ is
.Dv NULL ,
b)
.Fa option
-specifies an unknown logging option ;
+specifies an unknown logging option;
in either case,
.Va errno
is set to
diff --git a/contrib/bind/lib/isc/memcluster.c b/contrib/bind/lib/isc/memcluster.c
index d565c05..fcba1a3 100644
--- a/contrib/bind/lib/isc/memcluster.c
+++ b/contrib/bind/lib/isc/memcluster.c
@@ -24,7 +24,7 @@
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: memcluster.c,v 8.20 2001/02/13 23:14:54 marka Exp $";
+static const char rcsid[] = "$Id: memcluster.c,v 8.23 2001/06/18 14:44:05 marka Exp $";
#endif /* not lint */
#include "port_before.h"
@@ -67,7 +67,7 @@ typedef struct {
const char * file;
int line;
#endif
- int size;
+ size_t size;
fence_t fencepost;
#endif
} memcluster_element;
@@ -173,6 +173,10 @@ __memget_record(size_t size, const char *file, int line) {
#endif
void *ret;
+#if !defined(MEMCLUSTER_RECORD)
+ UNUSED(file);
+ UNUSED(line);
+#endif
if (freelists == NULL)
if (meminit(0, 0) == -1)
return (NULL);
@@ -335,12 +339,19 @@ __memput_record(void *mem, size_t size, const char *file, int line) {
size_t new_size = quantize(size);
#if defined (DEBUGGING_MEMCLUSTER)
memcluster_element *e;
+ memcluster_element *el;
#ifdef MEMCLUSTER_RECORD
- memcluster_element *prev, *el;
+ memcluster_element *prev;
#endif
- int fp;
+ fence_t fp;
char *p;
#endif
+
+#if !defined (MEMCLUSTER_RECORD)
+ UNUSED(file);
+ UNUSED(line);
+#endif
+
REQUIRE(freelists != NULL);
if (size == 0) {
@@ -473,7 +484,7 @@ memstats(FILE *out) {
for (i = 1; i <= max_size; i++) {
if ((e = activelists[i]) != NULL)
while (e != NULL) {
- fprintf(out, "%s:%d %#p:%d\n",
+ fprintf(out, "%s:%d %p:%d\n",
e->file != NULL ? e->file :
"<UNKNOWN>", e->line,
(char *)e + sizeof *e, e->size);
@@ -483,6 +494,18 @@ memstats(FILE *out) {
#endif
}
+int
+memactive(void) {
+ size_t i;
+
+ if (stats == NULL)
+ return (0);
+ for (i = 1; i <= max_size; i++)
+ if (stats[i].gets != 0)
+ return (1);
+ return (0);
+}
+
/* Private. */
/*
@@ -515,7 +538,7 @@ quantize(size_t size) {
#if defined(DEBUGGING_MEMCLUSTER)
static void
check(unsigned char *a, int value, size_t len) {
- int i;
+ size_t i;
for (i = 0; i < len; i++)
INSIST(a[i] == value);
}
diff --git a/contrib/bind/lib/isc/memcluster.mdoc b/contrib/bind/lib/isc/memcluster.mdoc
index 82bfd71..c4c4588 100644
--- a/contrib/bind/lib/isc/memcluster.mdoc
+++ b/contrib/bind/lib/isc/memcluster.mdoc
@@ -1,4 +1,4 @@
-.\" $Id: memcluster.mdoc,v 8.2 1999/01/08 19:25:46 vixie Exp $
+.\" $Id: memcluster.mdoc,v 8.3 2001/08/08 07:50:27 marka Exp $
.\"
.\"Copyright (c) 1995-1999 by Internet Software Consortium
.\"
@@ -20,7 +20,7 @@
.\"Os OPERATING_SYSTEM [version/release]
.Os BSD 4
.\"Dt DOCUMENT_TITLE [section number] [volume]
-.Dt memcluster 3
+.Dt MEMCLUSTER 3
.Sh NAME
.Nm meminit ,
.Nm memget ,
@@ -192,7 +192,8 @@ the the value
as mentioned in the
.Sx INTERNALS
subsection, above, the block is placed at the head of the free list of
-.Va new_size Ns No -sized blocks.
+.Va new_size Ns -sized
+blocks.
If the given
.Fa size
is zero or negative, then
@@ -276,7 +277,7 @@ is generally
equal to
.Fa size ,
which has these implications:
-.Bl -enum -offset -indent means that, for
+.Bl -enum -offset indent
.It
For
.Fa size
diff --git a/contrib/bind/lib/isc/tree.c b/contrib/bind/lib/isc/tree.c
index 90ba146..65025e4 100644
--- a/contrib/bind/lib/isc/tree.c
+++ b/contrib/bind/lib/isc/tree.c
@@ -1,5 +1,5 @@
#ifndef LINT
-static const char rcsid[] = "$Id: tree.c,v 8.9 1999/01/08 19:25:47 vixie Exp $";
+static const char rcsid[] = "$Id: tree.c,v 8.10 2001/11/01 05:33:46 marka Exp $";
#endif
/*
@@ -101,7 +101,7 @@ tree_init(tree **ppr_tree) {
}
tree_t
-tree_srch(tree **ppr_tree, int (*pfi_compare)(), tree_t p_user) {
+tree_srch(tree **ppr_tree, int (*pfi_compare)(tree_t, tree_t), tree_t p_user) {
ENTER("tree_srch")
if (*ppr_tree) {
@@ -128,7 +128,7 @@ tree_srch(tree **ppr_tree, int (*pfi_compare)(), tree_t p_user) {
}
tree_t
-tree_add(tree **ppr_tree, int (*pfi_compare)(),
+tree_add(tree **ppr_tree, int (*pfi_compare)(tree_t, tree_t),
tree_t p_user, void (*pfv_uar)())
{
int i_balance = FALSE;
@@ -140,7 +140,7 @@ tree_add(tree **ppr_tree, int (*pfi_compare)(),
}
int
-tree_delete(tree **ppr_p, int (*pfi_compare)(),
+tree_delete(tree **ppr_p, int (*pfi_compare)(tree_t, tree_t),
tree_t p_user, void (*pfv_uar)())
{
int i_balance = FALSE, i_uar_called = FALSE;
@@ -151,7 +151,7 @@ tree_delete(tree **ppr_p, int (*pfi_compare)(),
}
int
-tree_trav(tree **ppr_tree, int (*pfi_uar)()) {
+tree_trav(tree **ppr_tree, int (*pfi_uar)(tree_t)) {
ENTER("tree_trav")
if (!*ppr_tree)
@@ -167,7 +167,7 @@ tree_trav(tree **ppr_tree, int (*pfi_uar)()) {
}
void
-tree_mung(tree **ppr_tree, void (*pfv_uar)()) {
+tree_mung(tree **ppr_tree, void (*pfv_uar)(tree_t)) {
ENTER("tree_mung")
if (*ppr_tree) {
tree_mung(&(**ppr_tree).left, pfv_uar);
@@ -182,7 +182,7 @@ tree_mung(tree **ppr_tree, void (*pfv_uar)()) {
static tree *
sprout(tree **ppr, tree_t p_data, int *pi_balance,
- int (*pfi_compare)(), void (*pfv_delete)())
+ int (*pfi_compare)(tree_t, tree_t), void (*pfv_delete)(tree_t))
{
tree *p1, *p2, *sub;
int cmp;
@@ -335,8 +335,8 @@ sprout(tree **ppr, tree_t p_data, int *pi_balance,
}
static int
-delete(tree **ppr_p, int (*pfi_compare)(), tree_t p_user,
- void (*pfv_uar)(), int *pi_balance, int *pi_uar_called)
+delete(tree **ppr_p, int (*pfi_compare)(tree_t, tree_t), tree_t p_user,
+ void (*pfv_uar)(tree_t), int *pi_balance, int *pi_uar_called)
{
tree *pr_q;
int i_comp, i_ret;
@@ -390,7 +390,7 @@ delete(tree **ppr_p, int (*pfi_compare)(), tree_t p_user,
static void
del(tree **ppr_r, int *pi_balance, tree **ppr_q,
- void (*pfv_uar)(), int *pi_uar_called)
+ void (*pfv_uar)(tree_t), int *pi_uar_called)
{
ENTER("del")
diff --git a/contrib/bind/lib/isc/tree.mdoc b/contrib/bind/lib/isc/tree.mdoc
index 422344e..43d1b7e 100644
--- a/contrib/bind/lib/isc/tree.mdoc
+++ b/contrib/bind/lib/isc/tree.mdoc
@@ -1,4 +1,4 @@
-.\" $Id: tree.mdoc,v 8.2 1999/01/08 19:25:48 vixie Exp $
+.\" $Id: tree.mdoc,v 8.3 2001/08/08 07:50:28 marka Exp $
.\"
.\"Copyright (c) 1995-1999 by Internet Software Consortium
.\"
@@ -32,15 +32,15 @@
.Ft void *
.Fn tree_srch "void **tree" "int (*compare)()" "void *data"
.Ft void
-.Fn tree_add(tree, compare, data, del_uar) "void **tree" "int (*compare)()" \
+.Fn tree_add "void **tree" "int (*compare)()" \
"void *data" "void (*del_uar)()"
.Ft int
-.Fn tree_delete(tree, compare, data, del_uar) "void **tree" "int (*compare)()" \
+.Fn tree_delete "void **tree" "int (*compare)()" \
"void *data" "void (*del_uar)()"
.Ft int
-.Fn tree_trav(tree, trav_uar) "void **tree" "int (*trav_uar)()"
+.Fn tree_trav "void **tree" "int (*trav_uar)()"
.Ft void
-.Fn tree_mung(tree, del_uar) "void **tree" "void (*del_uar)()"
+.Fn tree_mung "void **tree" "void (*del_uar)()"
.Sh DESCRIPTION
These functions create and manipulate a balanced binary (AVL) tree. Each node
of the tree contains the expected left & right subtree pointers, a short int
@@ -88,19 +88,19 @@ returns 0.
inserts or replaces a node in the specified tree. The tree specified by
.Dq Fa tree
is searched as in
-.Fn tree_srch,
+.Fn tree_srch ,
and if a node is found to match
-.Dq Fa data,
+.Dq Fa data ,
then the
.Fn del_uar
function, if non\-\s-2NULL\s+2, is called with the address of the user data
block for the node (this routine should deallocate any dynamic memory which
is referenced exclusively by the node); the user data pointer for the node
is then replaced by the value of
-.Dq Fa data.
+.Dq Fa data .
If no node is found to match, a new node is added (which may or may not
cause a transparent rebalance operation), with a user data pointer equal to
-.Dq Fa data.
+.Dq Fa data .
A rebalance may or may not occur, depending on where the node is added
and what the rest of the tree looks like.
.Fn Tree_add
@@ -110,7 +110,7 @@ pointer unless catastrophe occurs in which case it will return \s-2NULL\s+2.
.Pp
.Fn Tree_delete
deletes a node from
-.Dq Fa tree.
+.Dq Fa tree .
A rebalance may or may not occur, depending on where the node is removed from
and what the rest of the tree looks like.
.Fn Tree_delete
@@ -118,7 +118,7 @@ returns TRUE if a node was deleted, FALSE otherwise.
.Pp
.Fn Tree_trav
traverses all of
-.Dq Fa tree,
+.Dq Fa tree ,
calling
.Fn trav_uar
with the address of each user data block. If
@@ -132,7 +132,7 @@ will return TRUE.
.Pp
.Fn Tree_mung
deletes every node in
-.Dq Fa tree,
+.Dq Fa tree ,
calling
.Fn del_uar
(if it is not \s-2NULL\s+2) with the user data address from each node (see
OpenPOWER on IntegriCloud