Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/dist/bind/lib/bsd BIND 8.2.4
details: https://anonhg.NetBSD.org/src/rev/28caf1905173
branches: trunk
changeset: 510047:28caf1905173
user: itojun <itojun%NetBSD.org@localhost>
date: Thu May 17 22:41:07 2001 +0000
description:
BIND 8.2.4
diffstat:
dist/bind/lib/bsd/.cvsignore | 2 +
dist/bind/lib/bsd/Makefile | 93 +++++++++++++++++++++++
dist/bind/lib/bsd/daemon.c | 79 ++++++++++++++++++++
dist/bind/lib/bsd/ftruncate.c | 63 +++++++++++++++
dist/bind/lib/bsd/gettimeofday.c | 62 +++++++++++++++
dist/bind/lib/bsd/mktemp.c | 154 +++++++++++++++++++++++++++++++++++++++
dist/bind/lib/bsd/putenv.c | 25 ++++++
dist/bind/lib/bsd/readv.c | 38 +++++++++
dist/bind/lib/bsd/setenv.c | 149 +++++++++++++++++++++++++++++++++++++
dist/bind/lib/bsd/setitimer.c | 27 ++++++
dist/bind/lib/bsd/strcasecmp.c | 122 ++++++++++++++++++++++++++++++
dist/bind/lib/bsd/strdup.c | 18 ++++
dist/bind/lib/bsd/strerror.c | 80 ++++++++++++++++++++
dist/bind/lib/bsd/strpbrk.c | 68 +++++++++++++++++
dist/bind/lib/bsd/strsep.c | 86 +++++++++++++++++++++
dist/bind/lib/bsd/strtoul.c | 117 +++++++++++++++++++++++++++++
dist/bind/lib/bsd/utimes.c | 39 +++++++++
dist/bind/lib/bsd/writev.c | 86 +++++++++++++++++++++
18 files changed, 1308 insertions(+), 0 deletions(-)
diffs (truncated from 1380 to 300 lines):
diff -r 758e69536753 -r 28caf1905173 dist/bind/lib/bsd/.cvsignore
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dist/bind/lib/bsd/.cvsignore Thu May 17 22:41:07 2001 +0000
@@ -0,0 +1,2 @@
+.depend
+threaded
diff -r 758e69536753 -r 28caf1905173 dist/bind/lib/bsd/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dist/bind/lib/bsd/Makefile Thu May 17 22:41:07 2001 +0000
@@ -0,0 +1,93 @@
+# Copyright (c) 1996,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.
+
+# $Id: Makefile,v 1.1.1.1 2001/05/17 22:48:45 itojun 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
+# this Makefile will be invoked with a lot of overrides for the following:
+SYSTYPE= freebsd
+DESTDIR =
+DESTLIB = /usr/local/lib
+O=o
+A=a
+CC= cc
+LD= ld
+SHELL= /bin/sh
+CDEBUG= -g -Wall
+TOP= ../..
+INCL = ${TOP}/include
+PORTINCL = ${TOP}/port/${SYSTYPE}/include
+LIBBIND = ${TOP}/lib/libbind.${A}
+LIBBINDR = ../${TOP}/lib/libbind_r.${A}
+CFLAGS= ${CDEBUG}
+CPPFLAGS= -I${PORTINCL} -I${INCL}
+LD_LIBFLAGS= -x -r
+AR= ar cru
+RANLIB= ranlib
+INSTALL= install
+INSTALL_EXEC=
+INSTALL_LIB=-o bin -g bin
+THREADED= threaded
+
+SRCS= daemon.c mktemp.c strcasecmp.c strerror.c strpbrk.c \
+ strsep.c strtoul.c putenv.c setenv.c setitimer.c \
+ strdup.c readv.c writev.c ftruncate.c \
+ gettimeofday.c utimes.c
+
+OBJS= daemon.${O} mktemp.${O} strcasecmp.${O} strerror.${O} strpbrk.${O} \
+ strsep.${O} strtoul.${O} putenv.${O} setenv.${O} setitimer.${O} \
+ strdup.${O} readv.${O} writev.${O} ftruncate.${O} \
+ gettimeofday.${O} utimes.${O}
+
+all: ${LIBBIND}
+
+${LIBBIND}: ${OBJS}
+ ( cd ${THREADED} ; \
+ ${AR} ${LIBBINDR} ${ARPREF} ${OBJS} ${ARSUFF} ; \
+ ${RANLIB} ${LIBBIND} )
+ ${AR} ${LIBBIND} ${ARPREF} ${OBJS} ${ARSUFF}
+ ${RANLIB} ${LIBBIND}
+
+.c.${O}:
+ if test ! -d ${THREADED} ; then mkdir ${THREADED} ; else true ; fi
+ ${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} ${REENTRANT} -c $*.c \
+ -o ${THREADED}/$*.${O}
+ -${LDS} ${LD} ${LD_LIBFLAGS} ${THREADED}/$*.${O} -o ${THREADED}/$*.out && \
+ ${LDS} mv ${THREADED}/$*.out ${THREADED}/$*.${O}
+ ${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} -c $*.c
+ -${LDS} ${LD} ${LD_LIBFLAGS} $*.${O} -o $*.out && \
+ ${LDS} mv $*.out $*.${O}
+
+distclean: clean
+
+clean: FRC
+ rm -f .depend a.out core ${LIB} tags
+ rm -f *.${O} *.BAK *.CKP *~
+ rm -f ${THREADED}/*.${O}
+ -if test -d ${THREADED} ; then rmdir ${THREADED}; else true; fi
+
+depend: FRC
+ mkdep -I${INCL} -I${PORTINCL} ${CPPFLAGS} ${SRCS}
+
+links: FRC
+ @set -e; ln -s SRC/*.[ch] .
+
+install:
+
+FRC:
+
+# DO NOT DELETE THIS LINE -- mkdep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
diff -r 758e69536753 -r 28caf1905173 dist/bind/lib/bsd/daemon.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dist/bind/lib/bsd/daemon.c Thu May 17 22:41:07 2001 +0000
@@ -0,0 +1,79 @@
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)daemon.c 8.1 (Berkeley) 6/4/93";
+static const char rcsid[] = "$Id: daemon.c,v 1.1.1.1 2001/05/17 22:48:45 itojun Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Copyright (c) 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 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
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "port_before.h"
+
+#include <fcntl.h>
+#include <paths.h>
+#include <unistd.h>
+
+#include "port_after.h"
+
+#ifndef NEED_DAEMON
+int __bind_daemon__;
+#else
+
+int
+daemon(int nochdir, int noclose) {
+ int fd;
+
+ switch (fork()) {
+ case -1:
+ return (-1);
+ case 0:
+ break;
+ default:
+ _exit(0);
+ }
+
+ if (setsid() == -1)
+ return (-1);
+
+ if (!nochdir)
+ (void)chdir("/");
+
+ if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
+ (void)dup2(fd, STDIN_FILENO);
+ (void)dup2(fd, STDOUT_FILENO);
+ (void)dup2(fd, STDERR_FILENO);
+ if (fd > 2)
+ (void)close (fd);
+ }
+ return (0);
+}
+#endif
diff -r 758e69536753 -r 28caf1905173 dist/bind/lib/bsd/ftruncate.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dist/bind/lib/bsd/ftruncate.c Thu May 17 22:41:07 2001 +0000
@@ -0,0 +1,63 @@
+#ifndef LINT
+static const char rcsid[] = "$Id: ftruncate.c,v 1.1.1.1 2001/05/17 22:48:45 itojun Exp $";
+#endif
+
+/*
+ * ftruncate - set file size, BSD Style
+ *
+ * shortens or enlarges the file as neeeded
+ * uses some undocumented locking call. It is known to work on SCO unix,
+ * other vendors should try.
+ * The #error directive prevents unsupported OSes
+ */
+
+#include "port_before.h"
+
+#if defined(M_UNIX)
+#define OWN_FTRUNCATE
+#include <stdio.h>
+#ifdef _XOPEN_SOURCE
+#undef _XOPEN_SOURCE
+#endif
+#ifdef _POSIX_SOURCE
+#undef _POSIX_SOURCE
+#endif
+
+#include <fcntl.h>
+
+#include "port_after.h"
+
+int
+__ftruncate(int fd, long wantsize) {
+ long cursize;
+
+ /* determine current file size */
+ if ((cursize = lseek(fd, 0L, 2)) == -1)
+ return (-1);
+
+ /* maybe lengthen... */
+ if (cursize < wantsize) {
+ if (lseek(fd, wantsize - 1, 0) == -1 ||
+ write(fd, "", 1) == -1) {
+ return (-1);
+ }
+ return (0);
+ }
+
+ /* maybe shorten... */
+ if (wantsize < cursize) {
+ struct flock fl;
+
+ fl.l_whence = 0;
+ fl.l_len = 0;
+ fl.l_start = wantsize;
+ fl.l_type = F_WRLCK;
+ return (fcntl(fd, F_FREESP, &fl));
+ }
+ return (0);
+}
+#endif
+
+#ifndef OWN_FTRUNCATE
+int __bindcompat_ftruncate;
+#endif
diff -r 758e69536753 -r 28caf1905173 dist/bind/lib/bsd/gettimeofday.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dist/bind/lib/bsd/gettimeofday.c Thu May 17 22:41:07 2001 +0000
@@ -0,0 +1,62 @@
+#ifndef LINT
+static const char rcsid[] = "$Id: gettimeofday.c,v 1.1.1.1 2001/05/17 22:41:07 itojun Exp $";
+#endif
+
+#include "port_before.h"
+#include <stdio.h>
+#include <syslog.h>
+#include <sys/time.h>
+#include "port_after.h"
+
+#if !defined(NEED_GETTIMEOFDAY)
+/*
+ * gettimeofday() occasionally returns invalid tv_usec on some platforms.
+ */
+#define MILLION 1000000
+#undef gettimeofday
+
+int
+isc__gettimeofday(struct timeval *tp, struct timezone *tzp) {
+ int res;
+
+ res = gettimeofday(tp, tzp);
+ if (res < 0)
+ return (res);
+ if (tp == NULL)
+ return (res);
+ if (tp->tv_usec < 0) {
+ do {
+ tp->tv_usec += MILLION;
+ tp->tv_sec--;
+ } while (tp->tv_usec < 0);
+ goto log;
+ } else if (tp->tv_usec > MILLION) {
+ do {
+ tp->tv_usec -= MILLION;
+ tp->tv_sec++;
+ } while (tp->tv_usec > MILLION);
+ goto log;
+ }
+ return (res);
+ log:
+ syslog(LOG_ERR, "gettimeofday: tv_usec out of range\n");
+ return (res);
Home |
Main Index |
Thread Index |
Old Index