Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/dist/bind/lib Pull up revision 1.1 (new) (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/9244fedabd1f
branches:  netbsd-1-4
changeset: 469803:9244fedabd1f
user:      he <he%NetBSD.org@localhost>
date:      Sat Dec 04 17:05:53 1999 +0000

description:
Pull up revision 1.1 (new) (requested by christos and veego):
  Update to BIND 8.2.2-P5.

diffstat:

 dist/bind/lib/isc/ev_connects.c       |  339 ++++++++++++++
 dist/bind/lib/isc/ev_files.c          |  274 +++++++++++
 dist/bind/lib/isc/ev_streams.c        |  300 ++++++++++++
 dist/bind/lib/isc/ev_timers.c         |  406 ++++++++++++++++
 dist/bind/lib/isc/ev_waits.c          |  246 ++++++++++
 dist/bind/lib/isc/eventlib.c          |  677 ++++++++++++++++++++++++++++
 dist/bind/lib/isc/eventlib_p.h        |  201 ++++++++
 dist/bind/lib/isc/heap.c              |  223 +++++++++
 dist/bind/lib/isc/logging.c           |  688 ++++++++++++++++++++++++++++
 dist/bind/lib/isc/logging_p.h         |   60 ++
 dist/bind/lib/isc/memcluster.c        |  512 +++++++++++++++++++++
 dist/bind/lib/isc/tree.c              |  534 ++++++++++++++++++++++
 dist/bind/lib/nameser/ns_date.c       |  130 +++++
 dist/bind/lib/nameser/ns_name.c       |  642 ++++++++++++++++++++++++++
 dist/bind/lib/nameser/ns_netint.c     |   58 ++
 dist/bind/lib/nameser/ns_parse.c      |  200 ++++++++
 dist/bind/lib/nameser/ns_print.c      |  820 ++++++++++++++++++++++++++++++++++
 dist/bind/lib/nameser/ns_samedomain.c |  208 ++++++++
 dist/bind/lib/nameser/ns_sign.c       |  350 ++++++++++++++
 dist/bind/lib/nameser/ns_ttl.c        |  161 ++++++
 dist/bind/lib/nameser/ns_verify.c     |  473 +++++++++++++++++++
 dist/bind/lib/resolv/herror.c         |  123 +++++
 dist/bind/lib/resolv/res_comp.c       |  253 ++++++++++
 23 files changed, 7878 insertions(+), 0 deletions(-)

diffs (truncated from 7970 to 300 lines):

diff -r 018e95580008 -r 9244fedabd1f dist/bind/lib/isc/ev_connects.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/dist/bind/lib/isc/ev_connects.c   Sat Dec 04 17:05:53 1999 +0000
@@ -0,0 +1,339 @@
+/*     $NetBSD: ev_connects.c,v 1.1.1.1.2.2 1999/12/04 17:05:53 he Exp $       */
+
+/*
+ * Copyright (c) 1995-1999 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.
+ */
+
+/* ev_connects.c - implement asynch connect/accept for the eventlib
+ * vix 16sep96 [initial]
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "Id: ev_connects.c,v 8.25 1999/10/07 20:44:04 vixie Exp";
+#endif
+
+/* Import. */
+
+#include "port_before.h"
+#include "fd_setsize.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <unistd.h>
+
+#include <isc/eventlib.h>
+#include <isc/assertions.h>
+#include "eventlib_p.h"
+
+#include "port_after.h"
+
+/* Macros. */
+
+#define GETXXXNAME(f, s, sa, len) ( \
+       (f((s), (&sa), (&len)) >= 0) ? 0 : \
+               (errno != EAFNOSUPPORT && errno != EOPNOTSUPP) ? -1 : ( \
+                       memset(&(sa), 0, sizeof (sa)), \
+                       (len) = sizeof (sa), \
+                       (sa).sa_family = AF_UNIX, \
+                       0 \
+               ) \
+       )
+
+/* Forward. */
+
+static void    listener(evContext ctx, void *uap, int fd, int evmask);
+static void    connector(evContext ctx, void *uap, int fd, int evmask);
+
+/* Public. */
+
+int
+evListen(evContext opaqueCtx, int fd, int maxconn,
+        evConnFunc func, void *uap, evConnID *id)
+{
+       evContext_p *ctx = opaqueCtx.opaque;
+       evConn *new;
+       int mode;
+
+       OKNEW(new);
+       new->flags = EV_CONN_LISTEN;
+       OK(mode = fcntl(fd, F_GETFL, NULL));    /* side effect: validate fd. */
+       /*
+        * Remember the nonblocking status.  We assume that either evSelectFD
+        * has not been done to this fd, or that if it has then the caller
+        * will evCancelConn before they evDeselectFD.  If our assumptions
+        * are not met, then we might restore the old nonblocking status
+        * incorrectly.
+        */
+       if ((mode & PORT_NONBLOCK) == 0) {
+               OK(fcntl(fd, F_SETFL, mode | PORT_NONBLOCK));
+               new->flags |= EV_CONN_BLOCK;
+       }
+       OK(listen(fd, maxconn));
+       if (evSelectFD(opaqueCtx, fd, EV_READ, listener, new, &new->file) < 0){
+               int save = errno;
+
+               FREE(new);
+               errno = save;
+               return (-1);
+       }
+       new->flags |= EV_CONN_SELECTED;
+       new->func = func;
+       new->uap = uap;
+       new->fd = fd;
+       if (ctx->conns != NULL)
+               ctx->conns->prev = new;
+       new->prev = NULL;
+       new->next = ctx->conns;
+       ctx->conns = new;
+       if (id)
+               id->opaque = new;
+       return (0);
+}
+
+int
+evConnect(evContext opaqueCtx, int fd, void *ra, int ralen,
+         evConnFunc func, void *uap, evConnID *id)
+{
+       evContext_p *ctx = opaqueCtx.opaque;
+       evConn *new;
+
+       OKNEW(new);
+       new->flags = 0;
+       /* Do the select() first to get the socket into nonblocking mode. */
+       if (evSelectFD(opaqueCtx, fd, EV_MASK_ALL,
+                      connector, new, &new->file) < 0) {
+               int save = errno;
+
+               FREE(new);
+               errno = save;
+               return (-1);
+       }
+       new->flags |= EV_CONN_SELECTED;
+       if (connect(fd, ra, ralen) < 0 &&
+           errno != EWOULDBLOCK &&
+           errno != EAGAIN &&
+           errno != EINPROGRESS) {
+               int save = errno;
+
+               (void) evDeselectFD(opaqueCtx, new->file);
+               FREE(new);
+               errno = save;
+               return (-1);
+       }
+       /* No error, or EWOULDBLOCK.  select() tells when it's ready. */
+       new->func = func;
+       new->uap = uap;
+       new->fd = fd;
+       if (ctx->conns != NULL)
+               ctx->conns->prev = new;
+       new->prev = NULL;
+       new->next = ctx->conns;
+       ctx->conns = new;
+       if (id)
+               id->opaque = new;
+       return (0);
+}
+
+int
+evCancelConn(evContext opaqueCtx, evConnID id) {
+       evContext_p *ctx = opaqueCtx.opaque;
+       evConn *this = id.opaque;
+       evAccept *acc, *nxtacc;
+       int mode;
+
+       if ((this->flags & EV_CONN_SELECTED) != 0)
+               (void) evDeselectFD(opaqueCtx, this->file);
+       if ((this->flags & EV_CONN_BLOCK) != 0) {
+               mode = fcntl(this->fd, F_GETFL, NULL);
+               if (mode == -1) {
+                       if (errno != EBADF)
+                               return (-1);
+               } else
+                       OK(fcntl(this->fd, F_SETFL, mode | PORT_NONBLOCK));
+       }
+       
+       /* Unlink from ctx->conns. */
+       if (this->prev != NULL)
+               this->prev->next = this->next;
+       else
+               ctx->conns = this->next;
+       if (this->next != NULL)
+               this->next->prev = this->prev;
+
+       /*
+        * Remove `this' from the ctx->accepts list (zero or more times).
+        */
+       for (acc = HEAD(ctx->accepts), nxtacc = NULL;
+            acc != NULL;
+            acc = nxtacc)
+       {
+               nxtacc = NEXT(acc, link);
+               if (acc->conn == this) {
+                       UNLINK(ctx->accepts, acc, link);
+                       close(acc->fd);
+                       FREE(acc);
+               }
+       }
+
+       /* Wrap up and get out. */
+       FREE(this);
+       return (0);
+}
+
+int evHold(evContext opaqueCtx, evConnID id) {
+       evConn *this = id.opaque;
+
+       if ((this->flags & EV_CONN_LISTEN) == 0) {
+               errno = EINVAL;
+               return (-1);
+       }
+       if ((this->flags & EV_CONN_SELECTED) == 0)
+               return (0);
+       this->flags &= ~EV_CONN_SELECTED;
+       return (evDeselectFD(opaqueCtx, this->file));
+}
+
+int evUnhold(evContext opaqueCtx, evConnID id) {
+       evConn *this = id.opaque;
+       int ret;
+
+       if ((this->flags & EV_CONN_LISTEN) == 0) {
+               errno = EINVAL;
+               return (-1);
+       }
+       if ((this->flags & EV_CONN_SELECTED) != 0)
+               return (0);
+       ret = evSelectFD(opaqueCtx, this->fd, EV_READ, listener, this,
+                        &this->file);
+       if (ret == 0)
+               this->flags |= EV_CONN_SELECTED;
+       return (ret);
+}
+
+int
+evTryAccept(evContext opaqueCtx, evConnID id, int *sys_errno) {
+       evContext_p *ctx = opaqueCtx.opaque;
+       evConn *conn = id.opaque;
+       evAccept *new;
+
+       if ((conn->flags & EV_CONN_LISTEN) == 0) {
+               errno = EINVAL;
+               return (-1);
+       }
+       OKNEW(new);
+       new->conn = conn;
+       new->ralen = sizeof new->ra;
+       new->fd = accept(conn->fd, &new->ra, &new->ralen);
+       if (new->fd > ctx->highestFD) {
+               close(new->fd);
+               new->fd = -1;
+               new->ioErrno = ENOTSOCK;
+       }
+       if (new->fd >= 0) {
+               new->lalen = sizeof new->la;
+               if (GETXXXNAME(getsockname, new->fd, new->la, new->lalen) < 0) {
+                       new->ioErrno = errno;
+                       (void) close(new->fd);
+                       new->fd = -1;
+               } else
+                       new->ioErrno = 0;
+       } else {
+               new->ioErrno = errno;
+               if (errno == EAGAIN || errno == EWOULDBLOCK) {
+                       FREE(new);
+                       return (-1);
+               }
+       }
+       APPEND(ctx->accepts, new, link);
+       *sys_errno = new->ioErrno;
+       return (0);
+}
+
+/* Private. */
+
+static void
+listener(evContext opaqueCtx, void *uap, int fd, int evmask) {
+       evContext_p *ctx = opaqueCtx.opaque;
+       evConn *conn = uap;
+       struct sockaddr la, ra;
+       int new, lalen, ralen;
+
+       REQUIRE((evmask & EV_READ) != 0);
+       ralen = sizeof ra;
+       new = accept(fd, &ra, &ralen);
+       if (new > ctx->highestFD) {
+               close(new);
+               new = -1;
+               errno = ENOTSOCK;
+       }
+       if (new >= 0) {
+               lalen = sizeof la;
+               if (GETXXXNAME(getsockname, new, la, lalen) < 0) {
+                       int save = errno;
+
+                       (void) close(new);
+                       errno = save;
+                       new = -1;
+               }
+       } else if (errno == EAGAIN || errno == EWOULDBLOCK)
+               return;
+       (*conn->func)(opaqueCtx, conn->uap, new, &la, lalen, &ra, ralen);
+}
+



Home | Main Index | Thread Index | Old Index