diff options
author | dougb <dougb@FreeBSD.org> | 2007-06-02 23:21:47 +0000 |
---|---|---|
committer | dougb <dougb@FreeBSD.org> | 2007-06-02 23:21:47 +0000 |
commit | 6df9693fc1899de774712d6421c2fc401db2eadd (patch) | |
tree | 6e65ba28d6d850f4d5c07cd37f26842e97b4aecf /contrib/bind9/lib/isc/unix | |
parent | fb8cb3b3a3d2367752c01dc81b68c0b7390f7760 (diff) | |
download | FreeBSD-src-6df9693fc1899de774712d6421c2fc401db2eadd.zip FreeBSD-src-6df9693fc1899de774712d6421c2fc401db2eadd.tar.gz |
Vendor import of BIND 9.4.1
Diffstat (limited to 'contrib/bind9/lib/isc/unix')
37 files changed, 634 insertions, 285 deletions
diff --git a/contrib/bind9/lib/isc/unix/Makefile.in b/contrib/bind9/lib/isc/unix/Makefile.in index 49845d4..afb77a6 100644 --- a/contrib/bind9/lib/isc/unix/Makefile.in +++ b/contrib/bind9/lib/isc/unix/Makefile.in @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.35.2.1.10.2 2004/06/22 02:48:36 marka Exp $ +# $Id: Makefile.in,v 1.38.18.1 2004/06/22 02:54:06 marka Exp $ srcdir = @srcdir@ VPATH = @srcdir@ diff --git a/contrib/bind9/lib/isc/unix/app.c b/contrib/bind9/lib/isc/unix/app.c index 811d67b..59b1f6c 100644 --- a/contrib/bind9/lib/isc/unix/app.c +++ b/contrib/bind9/lib/isc/unix/app.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,7 +15,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: app.c,v 1.43.2.3.8.5 2004/03/08 02:08:05 marka Exp $ */ +/* $Id: app.c,v 1.50.18.2 2005/04/29 00:17:06 marka Exp $ */ + +/*! \file */ #include <config.h> @@ -54,7 +56,7 @@ static isc_eventlist_t on_run; static isc_mutex_t lock; static isc_boolean_t shutdown_requested = ISC_FALSE; static isc_boolean_t running = ISC_FALSE; -/* +/*! * We assume that 'want_shutdown' can be read and written atomically. */ static isc_boolean_t want_shutdown = ISC_FALSE; @@ -69,14 +71,14 @@ static pthread_t blockedthread; #endif /* ISC_PLATFORM_USETHREADS */ #ifdef HAVE_LINUXTHREADS -/* +/*! * Linux has sigwait(), but it appears to prevent signal handlers from * running, even if they're not in the set being waited for. This makes * it impossible to get the default actions for SIGILL, SIGSEGV, etc. * Instead of messing with it, we just use sigsuspend() instead. */ #undef HAVE_SIGWAIT -/* +/*! * We need to remember which thread is the main thread... */ static pthread_t main_thread; @@ -291,7 +293,7 @@ isc_app_onrun(isc_mem_t *mctx, isc_task_t *task, isc_taskaction_t action, } #ifndef ISC_PLATFORM_USETHREADS -/* +/*! * Event loop for nonthreaded programs. */ static isc_result_t @@ -371,14 +373,14 @@ evloop() { * is set by isc_condition_signal(). */ -/* - * True iff we are currently executing in the recursive +/*! + * \brief True if 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 +/*! + * \brief True if we are exiting the event loop as the result of * a call to isc_condition_signal() rather than a shutdown * or reload. */ diff --git a/contrib/bind9/lib/isc/unix/dir.c b/contrib/bind9/lib/isc/unix/dir.c index 85a1217..b627c88 100644 --- a/contrib/bind9/lib/isc/unix/dir.c +++ b/contrib/bind9/lib/isc/unix/dir.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,9 +15,10 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dir.c,v 1.18.2.1.2.3 2004/03/08 09:04:55 marka Exp $ */ +/* $Id: dir.c,v 1.20.18.3 2005/09/05 00:18:30 marka Exp $ */ -/* Principal Authors: DCL */ +/*! \file + * \author Principal Authors: DCL */ #include <config.h> @@ -50,18 +51,37 @@ isc_dir_init(isc_dir_t *dir) { dir->magic = ISC_DIR_MAGIC; } -/* - * Allocate workspace and open directory stream. If either one fails, +/*! + * \brief Allocate workspace and open directory stream. If either one fails, * NULL will be returned. */ isc_result_t isc_dir_open(isc_dir_t *dir, const char *dirname) { + char *p; isc_result_t result = ISC_R_SUCCESS; REQUIRE(VALID_DIR(dir)); REQUIRE(dirname != NULL); /* + * Copy directory name. Need to have enough space for the name, + * a possible path separator, the wildcard, and the final NUL. + */ + if (strlen(dirname) + 3 > sizeof(dir->dirname)) + /* XXXDCL ? */ + return (ISC_R_NOSPACE); + strcpy(dir->dirname, dirname); + + /* + * Append path separator, if needed, and "*". + */ + p = dir->dirname + strlen(dir->dirname); + if (dir->dirname < p && *(p - 1) != '/') + *p++ = '/'; + *p++ = '*'; + *p++ = '\0'; + + /* * Open stream. */ dir->handle = opendir(dirname); @@ -72,8 +92,10 @@ isc_dir_open(isc_dir_t *dir, const char *dirname) { return (result); } -/* - * Return previously retrieved file or get next one. Unix's dirent has +/*! + * \brief Return previously retrieved file or get next one. + + * Unix's dirent has * separate open and read functions, but the Win32 and DOS interfaces open * the dir stream and reads the first file in one operation. */ @@ -107,8 +129,8 @@ isc_dir_read(isc_dir_t *dir) { return (ISC_R_SUCCESS); } -/* - * Close directory stream. +/*! + * \brief Close directory stream. */ void isc_dir_close(isc_dir_t *dir) { @@ -118,8 +140,8 @@ isc_dir_close(isc_dir_t *dir) { dir->handle = NULL; } -/* - * Reposition directory stream at start. +/*! + * \brief Reposition directory stream at start. */ isc_result_t isc_dir_reset(isc_dir_t *dir) { @@ -132,8 +154,8 @@ isc_dir_reset(isc_dir_t *dir) { isc_result_t isc_dir_chdir(const char *dirname) { - /* - * Change the current directory to 'dirname'. + /*! + * \brief Change the current directory to 'dirname'. */ REQUIRE(dirname != NULL); @@ -165,8 +187,8 @@ isc_dir_createunique(char *templet) { REQUIRE(templet != NULL); - /* - * mkdtemp is not portable, so this emulates it. + /*! + * \brief mkdtemp is not portable, so this emulates it. */ pid = getpid(); diff --git a/contrib/bind9/lib/isc/unix/entropy.c b/contrib/bind9/lib/isc/unix/entropy.c index d52849a..4c0d0d0 100644 --- a/contrib/bind9/lib/isc/unix/entropy.c +++ b/contrib/bind9/lib/isc/unix/entropy.c @@ -15,10 +15,11 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: entropy.c,v 1.60.2.3.8.14 2006/03/02 23:29:17 marka Exp $ */ +/* $Id: entropy.c,v 1.71.18.7 2006/12/07 04:53:03 marka Exp $ */ -/* - * This is the system depenedent part of the ISC entropy API. +/* \file unix/entropy.c + * \brief + * This is the system dependent part of the ISC entropy API. */ #include <config.h> @@ -41,7 +42,7 @@ #include "errno2result.h" -/* +/*% * There is only one variable in the entropy data structures that is not * system independent, but pulling the structure that uses it into this file * ultimately means pulling several other independent structures here also to @@ -486,8 +487,6 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) { LOCK(&ent->lock); - source = NULL; - if (stat(fname, &_stat) < 0) { ret = isc__errno2result(errno); goto errout; @@ -589,9 +588,6 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) { (void)close(fd); errout: - if (source != NULL) - isc_mem_put(ent->mctx, source, sizeof(isc_entropysource_t)); - UNLOCK(&ent->lock); return (ret); diff --git a/contrib/bind9/lib/isc/unix/errno2result.c b/contrib/bind9/lib/isc/unix/errno2result.c index 66a4e91..d4b188f 100644 --- a/contrib/bind9/lib/isc/unix/errno2result.c +++ b/contrib/bind9/lib/isc/unix/errno2result.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2002 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,7 +15,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: errno2result.c,v 1.8.2.4.8.1 2004/03/06 08:14:59 marka Exp $ */ +/* $Id: errno2result.c,v 1.13.18.2 2005/04/29 00:17:07 marka Exp $ */ + +/*! \file */ #include <config.h> @@ -25,7 +27,7 @@ #include "errno2result.h" -/* +/*% * Convert a POSIX errno value into an isc_result_t. The * list of supported errno values is not complete; new users * of this function should add any expected errors that are diff --git a/contrib/bind9/lib/isc/unix/errno2result.h b/contrib/bind9/lib/isc/unix/errno2result.h index 9a8d07c..5e36116 100644 --- a/contrib/bind9/lib/isc/unix/errno2result.h +++ b/contrib/bind9/lib/isc/unix/errno2result.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,11 +15,13 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: errno2result.h,v 1.7.206.1 2004/03/06 08:14:59 marka Exp $ */ +/* $Id: errno2result.h,v 1.8.18.2 2005/04/29 00:17:07 marka Exp $ */ #ifndef UNIX_ERRNO2RESULT_H #define UNIX_ERRNO2RESULT_H 1 +/*! \file */ + /* XXXDCL this should be moved to lib/isc/include/isc/errno2result.h. */ #include <errno.h> /* Provides errno. */ diff --git a/contrib/bind9/lib/isc/unix/file.c b/contrib/bind9/lib/isc/unix/file.c index 7ed6272..e45e0fe 100644 --- a/contrib/bind9/lib/isc/unix/file.c +++ b/contrib/bind9/lib/isc/unix/file.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2002 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -48,7 +48,9 @@ * SUCH DAMAGE. */ -/* $Id: file.c,v 1.38.12.8 2004/03/16 05:50:25 marka Exp $ */ +/* $Id: file.c,v 1.47.18.2 2005/04/29 00:17:07 marka Exp $ */ + +/*! \file */ #include <config.h> @@ -154,7 +156,7 @@ isc_file_settime(const char *file, isc_time_t *time) { } #undef TEMPLATE -#define TEMPLATE "tmp-XXXXXXXXXX" /* 14 characters. */ +#define TEMPLATE "tmp-XXXXXXXXXX" /*%< 14 characters. */ isc_result_t isc_file_mktemplate(const char *path, char *buf, size_t buflen) { diff --git a/contrib/bind9/lib/isc/unix/fsaccess.c b/contrib/bind9/lib/isc/unix/fsaccess.c index 3745ca2..f3ed60f 100644 --- a/contrib/bind9/lib/isc/unix/fsaccess.c +++ b/contrib/bind9/lib/isc/unix/fsaccess.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2006 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: fsaccess.c,v 1.6.206.3 2006/08/25 05:25:50 marka Exp $ */ +/* $Id: fsaccess.c,v 1.7.18.4 2006/08/25 05:25:51 marka Exp $ */ #include <config.h> @@ -26,7 +26,8 @@ #include "errno2result.h" -/* +/*! \file + * \brief * The OS-independent part of the API is in lib/isc. */ #include "../fsaccess.c" diff --git a/contrib/bind9/lib/isc/unix/ifiter_getifaddrs.c b/contrib/bind9/lib/isc/unix/ifiter_getifaddrs.c index ad6e1e0..7e359aa 100644 --- a/contrib/bind9/lib/isc/unix/ifiter_getifaddrs.c +++ b/contrib/bind9/lib/isc/unix/ifiter_getifaddrs.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2003 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,28 +15,33 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ifiter_getifaddrs.c,v 1.2.68.3 2004/03/06 08:14:59 marka Exp $ */ +/* $Id: ifiter_getifaddrs.c,v 1.4.18.2 2005/04/29 00:17:08 marka Exp $ */ -/* +/*! \file + * \brief * Obtain the list of network interfaces using the getifaddrs(3) library. */ #include <ifaddrs.h> +/*% Iterator Magic */ #define IFITER_MAGIC ISC_MAGIC('I', 'F', 'I', 'G') +/*% Valid Iterator */ #define VALID_IFITER(t) ISC_MAGIC_VALID(t, IFITER_MAGIC) +/*% Iterator structure */ struct isc_interfaceiter { - unsigned int magic; /* Magic number. */ + unsigned int magic; /*%< Magic number. */ isc_mem_t *mctx; - void *buf; /* (unused) */ - unsigned int bufsize; /* (always 0) */ - struct ifaddrs *ifaddrs; /* List of ifaddrs */ - struct ifaddrs *pos; /* Ptr to current ifaddr */ - isc_interface_t current; /* Current interface data. */ - isc_result_t result; /* Last result code. */ + void *buf; /*%< (unused) */ + unsigned int bufsize; /*%< (always 0) */ + struct ifaddrs *ifaddrs; /*%< List of ifaddrs */ + struct ifaddrs *pos; /*%< Ptr to current ifaddr */ + isc_interface_t current; /*%< Current interface data. */ + isc_result_t result; /*%< Last result code. */ }; + isc_result_t isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) { isc_interfaceiter_t *iter; diff --git a/contrib/bind9/lib/isc/unix/ifiter_ioctl.c b/contrib/bind9/lib/isc/unix/ifiter_ioctl.c index 68a1365..5ebcef8 100644 --- a/contrib/bind9/lib/isc/unix/ifiter_ioctl.c +++ b/contrib/bind9/lib/isc/unix/ifiter_ioctl.c @@ -15,9 +15,10 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ifiter_ioctl.c,v 1.19.2.5.2.19 2006/02/03 23:51:37 marka Exp $ */ +/* $Id: ifiter_ioctl.c,v 1.44.18.11 2006/02/03 23:51:38 marka Exp $ */ -/* +/*! \file + * \brief * Obtain the list of network interfaces using the SIOCGLIFCONF ioctl. * See netintro(4). */ @@ -93,7 +94,7 @@ struct isc_interfaceiter { #endif -/* +/*% * Size of buffer for SIOCGLIFCONF, in bytes. We assume no sane system * will have more than a megabyte of interface configuration data. */ diff --git a/contrib/bind9/lib/isc/unix/ifiter_sysctl.c b/contrib/bind9/lib/isc/unix/ifiter_sysctl.c index b10a2d2..212a478 100644 --- a/contrib/bind9/lib/isc/unix/ifiter_sysctl.c +++ b/contrib/bind9/lib/isc/unix/ifiter_sysctl.c @@ -15,9 +15,10 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ifiter_sysctl.c,v 1.14.12.9 2005/03/17 03:58:33 marka Exp $ */ +/* $Id: ifiter_sysctl.c,v 1.20.18.3 2005/04/27 05:02:35 sra Exp $ */ -/* +/*! \file + * \brief * Obtain the list of network interfaces using sysctl. * See TCP/IP Illustrated Volume 2, sections 19.8, 19.14, * and 19.16. diff --git a/contrib/bind9/lib/isc/unix/include/Makefile.in b/contrib/bind9/lib/isc/unix/include/Makefile.in index 5a06022..78eba44 100644 --- a/contrib/bind9/lib/isc/unix/include/Makefile.in +++ b/contrib/bind9/lib/isc/unix/include/Makefile.in @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.11.206.1 2004/03/06 08:15:03 marka Exp $ +# $Id: Makefile.in,v 1.12 2004/03/05 05:11:50 marka Exp $ srcdir = @srcdir@ VPATH = @srcdir@ diff --git a/contrib/bind9/lib/isc/unix/include/isc/Makefile.in b/contrib/bind9/lib/isc/unix/include/isc/Makefile.in index 4c5bae2..9599f7c 100644 --- a/contrib/bind9/lib/isc/unix/include/isc/Makefile.in +++ b/contrib/bind9/lib/isc/unix/include/isc/Makefile.in @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.27.206.1 2004/03/06 08:15:03 marka Exp $ +# $Id: Makefile.in,v 1.28 2004/03/05 05:11:52 marka Exp $ srcdir = @srcdir@ VPATH = @srcdir@ diff --git a/contrib/bind9/lib/isc/unix/include/isc/dir.h b/contrib/bind9/lib/isc/unix/include/isc/dir.h index 53b51df..cc85706 100644 --- a/contrib/bind9/lib/isc/unix/include/isc/dir.h +++ b/contrib/bind9/lib/isc/unix/include/isc/dir.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,13 +15,15 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dir.h,v 1.15.12.3 2004/03/08 09:04:57 marka Exp $ */ +/* $Id: dir.h,v 1.17.18.2 2005/04/29 00:17:09 marka Exp $ */ /* Principal Authors: DCL */ #ifndef ISC_DIR_H #define ISC_DIR_H 1 +/*! \file */ + #include <sys/types.h> /* Required on some systems. */ #include <dirent.h> @@ -31,8 +33,9 @@ #define ISC_DIR_NAMEMAX 256 #define ISC_DIR_PATHMAX 1024 +/*% Directory Entry */ typedef struct isc_direntry { - /* + /*! * Ideally, this should be NAME_MAX, but AIX does not define it by * default and dynamically allocating the space based on pathconf() * complicates things undesirably, as does adding special conditionals @@ -42,9 +45,10 @@ typedef struct isc_direntry { unsigned int length; } isc_direntry_t; +/*% Directory */ typedef struct isc_dir { unsigned int magic; - /* + /*! * As with isc_direntry_t->name, making this "right" for all systems * is slightly problematic because AIX does not define PATH_MAX. */ @@ -78,7 +82,7 @@ isc_dir_chroot(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 diff --git a/contrib/bind9/lib/isc/unix/include/isc/int.h b/contrib/bind9/lib/isc/unix/include/isc/int.h index be36ccb..1e1de7b 100644 --- a/contrib/bind9/lib/isc/unix/include/isc/int.h +++ b/contrib/bind9/lib/isc/unix/include/isc/int.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,11 +15,13 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: int.h,v 1.11.206.1 2004/03/06 08:15:04 marka Exp $ */ +/* $Id: int.h,v 1.12.18.2 2005/04/29 00:17:09 marka Exp $ */ #ifndef ISC_INT_H #define ISC_INT_H 1 +/*! \file */ + typedef char isc_int8_t; typedef unsigned char isc_uint8_t; typedef short isc_int16_t; @@ -37,7 +39,7 @@ typedef unsigned long long isc_uint64_t; #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". diff --git a/contrib/bind9/lib/isc/unix/include/isc/keyboard.h b/contrib/bind9/lib/isc/unix/include/isc/keyboard.h index 31005b1..4b28cc0 100644 --- a/contrib/bind9/lib/isc/unix/include/isc/keyboard.h +++ b/contrib/bind9/lib/isc/unix/include/isc/keyboard.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,11 +15,13 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: keyboard.h,v 1.6.206.1 2004/03/06 08:15:04 marka Exp $ */ +/* $Id: keyboard.h,v 1.7.18.2 2005/04/29 00:17:09 marka Exp $ */ #ifndef ISC_KEYBOARD_H #define ISC_KEYBOARD_H 1 +/*! \file */ + #include <termios.h> #include <isc/lang.h> diff --git a/contrib/bind9/lib/isc/unix/include/isc/net.h b/contrib/bind9/lib/isc/unix/include/isc/net.h index f1a015f..bdd8c14 100644 --- a/contrib/bind9/lib/isc/unix/include/isc/net.h +++ b/contrib/bind9/lib/isc/unix/include/isc/net.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: net.h,v 1.31.2.2.10.8 2004/04/29 01:31:23 marka Exp $ */ +/* $Id: net.h,v 1.39.18.4 2005/04/27 05:02:37 sra Exp $ */ #ifndef ISC_NET_H #define ISC_NET_H 1 @@ -24,19 +24,20 @@ ***** Module Info *****/ -/* +/*! \file + * \brief * Basic Networking Types * * This module is responsible for defining the following basic networking * types: * - * struct in_addr - * struct in6_addr - * struct in6_pktinfo - * struct sockaddr - * struct sockaddr_in - * struct sockaddr_in6 - * in_port_t + *\li struct in_addr + *\li struct in6_addr + *\li struct in6_pktinfo + *\li struct sockaddr + *\li struct sockaddr_in + *\li struct sockaddr_in6 + *\li in_port_t * * It ensures that the AF_ and PF_ macros are defined. * @@ -44,27 +45,27 @@ * * It declares inet_aton(), inet_ntop(), and inet_pton(). * - * It ensures that INADDR_LOOPBACK, INADDR_ANY, IN6ADDR_ANY_INIT, + * It ensures that #INADDR_LOOPBACK, #INADDR_ANY, #IN6ADDR_ANY_INIT, * in6addr_any, and in6addr_loopback are available. * * It ensures that IN_MULTICAST() is available to check for multicast * addresses. * * MP: - * No impact. + *\li No impact. * * Reliability: - * No anticipated impact. + *\li No anticipated impact. * * Resources: - * N/A. + *\li N/A. * * Security: - * No anticipated impact. + *\li No anticipated impact. * * Standards: - * BSD Socket API - * RFC 2553 + *\li BSD Socket API + *\li RFC2553 */ /*** @@ -94,19 +95,19 @@ #include <isc/types.h> #ifdef ISC_PLATFORM_HAVEINADDR6 -#define in6_addr in_addr6 /* Required for pre RFC2133 implementations. */ +#define in6_addr in_addr6 /*%< Required for pre RFC2133 implementations. */ #endif #ifdef ISC_PLATFORM_HAVEIPV6 -/* +#ifndef IN6ADDR_ANY_INIT +#ifdef s6_addr +/*% * Required for some pre RFC2133 implementations. * IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT were added in * draft-ietf-ipngwg-bsd-api-04.txt or draft-ietf-ipngwg-bsd-api-05.txt. * If 's6_addr' is defined then assume that there is a union and three * levels otherwise assume two levels required. */ -#ifndef IN6ADDR_ANY_INIT -#ifdef s6_addr #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } #else #define IN6ADDR_ANY_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } @@ -115,6 +116,7 @@ #ifndef IN6ADDR_LOOPBACK_INIT #ifdef s6_addr +/*% IPv6 address loopback init */ #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } #else #define IN6ADDR_LOOPBACK_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } @@ -122,12 +124,14 @@ #endif #ifndef IN6_IS_ADDR_V4MAPPED +/*% Is IPv6 address V4 mapped? */ #define IN6_IS_ADDR_V4MAPPED(x) \ (memcmp((x)->s6_addr, in6addr_any.s6_addr, 10) == 0 && \ (x)->s6_addr[10] == 0xff && (x)->s6_addr[11] == 0xff) #endif #ifndef IN6_IS_ADDR_V4COMPAT +/*% Is IPv6 address V4 compatible? */ #define IN6_IS_ADDR_V4COMPAT(x) \ (memcmp((x)->s6_addr, in6addr_any.s6_addr, 12) == 0 && \ ((x)->s6_addr[12] != 0 || (x)->s6_addr[13] != 0 || \ @@ -136,50 +140,58 @@ #endif #ifndef IN6_IS_ADDR_MULTICAST +/*% Is IPv6 address multicast? */ #define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff) #endif #ifndef IN6_IS_ADDR_LINKLOCAL +/*% Is IPv6 address linklocal? */ #define IN6_IS_ADDR_LINKLOCAL(a) \ (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80)) #endif #ifndef IN6_IS_ADDR_SITELOCAL +/*% is IPv6 address sitelocal? */ #define IN6_IS_ADDR_SITELOCAL(a) \ (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0)) #endif #ifndef IN6_IS_ADDR_LOOPBACK +/*% is IPv6 address loopback? */ #define IN6_IS_ADDR_LOOPBACK(x) \ (memcmp((x)->s6_addr, in6addr_loopback.s6_addr, 16) == 0) #endif #endif #ifndef AF_INET6 +/*% IPv6 */ #define AF_INET6 99 #endif #ifndef PF_INET6 +/*% IPv6 */ #define PF_INET6 AF_INET6 #endif #ifndef INADDR_LOOPBACK +/*% inaddr loopback */ #define INADDR_LOOPBACK 0x7f000001UL #endif #ifndef ISC_PLATFORM_HAVEIN6PKTINFO +/*% IPv6 packet info */ struct in6_pktinfo { - struct in6_addr ipi6_addr; /* src/dst IPv6 address */ - unsigned int ipi6_ifindex; /* send/recv interface index */ + struct in6_addr ipi6_addr; /*%< src/dst IPv6 address */ + unsigned int ipi6_ifindex; /*%< send/recv interface index */ }; #endif -/* - * Cope with a missing in6addr_any and in6addr_loopback. - */ #if defined(ISC_PLATFORM_HAVEIPV6) && defined(ISC_PLATFORM_NEEDIN6ADDRANY) extern const struct in6_addr isc_net_in6addrany; +/*% + * Cope with a missing in6addr_any and in6addr_loopback. + */ #define in6addr_any isc_net_in6addrany #endif @@ -188,11 +200,12 @@ extern const struct in6_addr isc_net_in6addrloop; #define in6addr_loopback isc_net_in6addrloop #endif -/* - * Fix UnixWare 7.1.1's broken IN6_IS_ADDR_* definitions. - */ #ifdef ISC_PLATFORM_FIXIN6ISADDR #undef IN6_IS_ADDR_GEOGRAPHIC +/*! + * \brief + * Fix UnixWare 7.1.1's broken IN6_IS_ADDR_* definitions. + */ #define IN6_IS_ADDR_GEOGRAPHIC(a) (((a)->S6_un.S6_l[0] & 0xE0) == 0x80) #undef IN6_IS_ADDR_IPX #define IN6_IS_ADDR_IPX(a) (((a)->S6_un.S6_l[0] & 0xFE) == 0x04) @@ -208,24 +221,26 @@ extern const struct in6_addr isc_net_in6addrloop; #define IN6_IS_ADDR_SITELOCAL(a) (((a)->S6_un.S6_l[0] & 0xC0FF) == 0xC0FE) #endif /* ISC_PLATFORM_FIXIN6ISADDR */ -/* +#ifdef ISC_PLATFORM_NEEDPORTT +/*% * Ensure type in_port_t is defined. */ -#ifdef ISC_PLATFORM_NEEDPORTT typedef isc_uint16_t in_port_t; #endif -/* +#ifndef MSG_TRUNC +/*% * If this system does not have MSG_TRUNC (as returned from recvmsg()) * ISC_PLATFORM_RECVOVERFLOW will be defined. This will enable the MSG_TRUNC * faking code in socket.c. */ -#ifndef MSG_TRUNC #define ISC_PLATFORM_RECVOVERFLOW #endif +/*% IP address. */ #define ISC__IPADDR(x) ((isc_uint32_t)htonl((isc_uint32_t)(x))) +/*% Is IP address multicast? */ #define ISC_IPADDR_ISMULTICAST(i) \ (((isc_uint32_t)(i) & ISC__IPADDR(0xf0000000)) \ == ISC__IPADDR(0xe0000000)) @@ -242,40 +257,40 @@ ISC_LANG_BEGINDECLS isc_result_t isc_net_probeipv4(void); -/* +/*%< * Check if the system's kernel supports IPv4. * * Returns: * - * ISC_R_SUCCESS IPv4 is supported. - * ISC_R_NOTFOUND IPv4 is not supported. - * ISC_R_DISABLED IPv4 is disabled. - * ISC_R_UNEXPECTED + *\li #ISC_R_SUCCESS IPv4 is supported. + *\li #ISC_R_NOTFOUND IPv4 is not supported. + *\li #ISC_R_DISABLED IPv4 is disabled. + *\li #ISC_R_UNEXPECTED */ isc_result_t isc_net_probeipv6(void); -/* +/*%< * Check if the system's kernel supports IPv6. * * Returns: * - * ISC_R_SUCCESS IPv6 is supported. - * ISC_R_NOTFOUND IPv6 is not supported. - * ISC_R_DISABLED IPv6 is disabled. - * ISC_R_UNEXPECTED + *\li #ISC_R_SUCCESS IPv6 is supported. + *\li #ISC_R_NOTFOUND IPv6 is not supported. + *\li #ISC_R_DISABLED IPv6 is disabled. + *\li #ISC_R_UNEXPECTED */ isc_result_t isc_net_probe_ipv6only(void); -/* +/*%< * Check if the system's kernel supports the IPV6_V6ONLY socket option. * * Returns: * - * ISC_R_SUCCESS the option is supported for both TCP and UDP. - * ISC_R_NOTFOUND IPv6 itself or the option is not supported. - * ISC_R_UNEXPECTED + *\li #ISC_R_SUCCESS the option is supported for both TCP and UDP. + *\li #ISC_R_NOTFOUND IPv6 itself or the option is not supported. + *\li #ISC_R_UNEXPECTED */ isc_result_t @@ -286,9 +301,9 @@ isc_net_probe_ipv6pktinfo(void); * * Returns: * - * ISC_R_SUCCESS the option is supported. - * ISC_R_NOTFOUND IPv6 itself or the option is not supported. - * ISC_R_UNEXPECTED + * \li #ISC_R_SUCCESS the option is supported. + * \li #ISC_R_NOTFOUND IPv6 itself or the option is not supported. + * \li #ISC_R_UNEXPECTED */ void @@ -303,6 +318,12 @@ isc_net_enableipv4(void); void isc_net_enableipv6(void); +isc_result_t +isc_net_probeunix(void); +/* + * Returns whether UNIX domain sockets are supported. + */ + #ifdef ISC_PLATFORM_NEEDNTOP const char * isc_net_ntop(int af, const void *src, char *dst, size_t size); diff --git a/contrib/bind9/lib/isc/unix/include/isc/netdb.h b/contrib/bind9/lib/isc/unix/include/isc/netdb.h index beb9137..428f087 100644 --- a/contrib/bind9/lib/isc/unix/include/isc/netdb.h +++ b/contrib/bind9/lib/isc/unix/include/isc/netdb.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: netdb.h,v 1.6.206.1 2004/03/06 08:15:04 marka Exp $ */ +/* $Id: netdb.h,v 1.7.18.2 2005/04/29 00:17:10 marka Exp $ */ #ifndef ISC_NETDB_H #define ISC_NETDB_H 1 @@ -24,25 +24,26 @@ ***** Module Info *****/ -/* +/*! \file + * \brief * Portable netdb.h support. * * This module is responsible for defining the get<x>by<y> APIs. * * MP: - * No impact. + *\li No impact. * * Reliability: - * No anticipated impact. + *\li No anticipated impact. * * Resources: - * N/A. + *\li N/A. * * Security: - * No anticipated impact. + *\li No anticipated impact. * * Standards: - * BSD API + *\li BSD API */ /*** diff --git a/contrib/bind9/lib/isc/unix/include/isc/offset.h b/contrib/bind9/lib/isc/unix/include/isc/offset.h index 0ea1362..15fbad4 100644 --- a/contrib/bind9/lib/isc/unix/include/isc/offset.h +++ b/contrib/bind9/lib/isc/unix/include/isc/offset.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,12 +15,13 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: offset.h,v 1.10.206.1 2004/03/06 08:15:04 marka Exp $ */ +/* $Id: offset.h,v 1.11.18.2 2005/04/29 00:17:10 marka Exp $ */ #ifndef ISC_OFFSET_H #define ISC_OFFSET_H 1 -/* +/*! \file + * \brief * File offsets are operating-system dependent. */ #include <limits.h> /* Required for CHAR_BIT. */ @@ -28,7 +29,7 @@ typedef off_t isc_offset_t; -/* +/*% * POSIX says "Additionally, blkcnt_t and off_t are extended signed integral * types", so the maximum value is all 1s except for the high bit. * This definition is more complex than it really needs to be because it was diff --git a/contrib/bind9/lib/isc/unix/include/isc/stat.h b/contrib/bind9/lib/isc/unix/include/isc/stat.h index 4304208..d1b2489 100644 --- a/contrib/bind9/lib/isc/unix/include/isc/stat.h +++ b/contrib/bind9/lib/isc/unix/include/isc/stat.h @@ -1,6 +1,5 @@ /* * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") - * Copyright (C) 2003 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 @@ -15,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: stat.h,v 1.1.2.1.4.1 2004/03/06 08:15:05 marka Exp $ */ +/* $Id: stat.h,v 1.2.18.1 2004/08/19 04:42:54 marka Exp $ */ #ifndef ISC_STAT_H #define ISC_STAT_H 1 diff --git a/contrib/bind9/lib/isc/unix/include/isc/stdtime.h b/contrib/bind9/lib/isc/unix/include/isc/stdtime.h index 9b855c7..24a91d2 100644 --- a/contrib/bind9/lib/isc/unix/include/isc/stdtime.h +++ b/contrib/bind9/lib/isc/unix/include/isc/stdtime.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,31 +15,44 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: stdtime.h,v 1.8.206.1 2004/03/06 08:15:05 marka Exp $ */ +/* $Id: stdtime.h,v 1.9.18.3 2005/06/04 06:23:45 jinmei Exp $ */ #ifndef ISC_STDTIME_H #define ISC_STDTIME_H 1 +/*! \file */ + #include <isc/lang.h> #include <isc/int.h> -/* +/*% * It's public information that 'isc_stdtime_t' is an unsigned integral type. * Applications that want maximum portability should not assume anything * about its size. */ typedef isc_uint32_t isc_stdtime_t; +/* + * isc_stdtime32_t is a 32-bit version of isc_stdtime_t. A variable of this + * type should only be used as an opaque integer (e.g.,) to compare two + * time values. + */ +typedef isc_uint32_t isc_stdtime32_t; ISC_LANG_BEGINDECLS - +/* */ void isc_stdtime_get(isc_stdtime_t *t); -/* +/*%< * Set 't' to the number of seconds since 00:00:00 UTC, January 1, 1970. * * Requires: * - * 't' is a valid pointer. + *\li 't' is a valid pointer. + */ + +#define isc_stdtime_convert32(t, t32p) (*(t32p) = t) +/* + * Convert the standard time to its 32-bit version. */ ISC_LANG_ENDDECLS diff --git a/contrib/bind9/lib/isc/unix/include/isc/strerror.h b/contrib/bind9/lib/isc/unix/include/isc/strerror.h index f51fbdc..fb2e8a4 100644 --- a/contrib/bind9/lib/isc/unix/include/isc/strerror.h +++ b/contrib/bind9/lib/isc/unix/include/isc/strerror.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,20 +15,23 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: strerror.h,v 1.2.12.3 2004/03/08 09:04:57 marka Exp $ */ +/* $Id: strerror.h,v 1.4.18.2 2005/04/29 00:17:10 marka Exp $ */ #ifndef ISC_STRERROR_H #define ISC_STRERROR_H +/*! \file */ + #include <sys/types.h> #include <isc/lang.h> ISC_LANG_BEGINDECLS +/*% String Error Size */ #define ISC_STRERRORSIZE 128 -/* +/*% * Provide a thread safe wrapper to strerrror(). * * Requires: diff --git a/contrib/bind9/lib/isc/unix/include/isc/syslog.h b/contrib/bind9/lib/isc/unix/include/isc/syslog.h index 2c0625e..08adca1 100644 --- a/contrib/bind9/lib/isc/unix/include/isc/syslog.h +++ b/contrib/bind9/lib/isc/unix/include/isc/syslog.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,11 +15,13 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: syslog.h,v 1.2.206.1 2004/03/06 08:15:05 marka Exp $ */ +/* $Id: syslog.h,v 1.3.18.2 2005/04/29 00:17:10 marka Exp $ */ #ifndef ISC_SYSLOG_H #define ISC_SYSLOG_H 1 +/*! \file */ + #include <isc/lang.h> #include <isc/types.h> @@ -27,17 +29,17 @@ ISC_LANG_BEGINDECLS isc_result_t isc_syslog_facilityfromstring(const char *str, int *facilityp); -/* +/*%< * Convert 'str' to the appropriate syslog facility constant. * * Requires: * - * 'str' is not NULL - * 'facilityp' is not NULL + *\li 'str' is not NULL + *\li 'facilityp' is not NULL * * Returns: - * ISC_R_SUCCESS - * ISC_R_NOTFOUND + * \li #ISC_R_SUCCESS + * \li #ISC_R_NOTFOUND */ ISC_LANG_ENDDECLS diff --git a/contrib/bind9/lib/isc/unix/include/isc/time.h b/contrib/bind9/lib/isc/unix/include/isc/time.h index 6021c13..6579439 100644 --- a/contrib/bind9/lib/isc/unix/include/isc/time.h +++ b/contrib/bind9/lib/isc/unix/include/isc/time.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,11 +15,13 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: time.h,v 1.25.2.1.10.4 2004/03/08 09:04:58 marka Exp $ */ +/* $Id: time.h,v 1.30.18.2 2005/04/29 00:17:10 marka Exp $ */ #ifndef ISC_TIME_H #define ISC_TIME_H 1 +/*! \file */ + #include <isc/lang.h> #include <isc/types.h> @@ -27,7 +29,8 @@ *** Intervals ***/ -/* +/*! + * \brief * The contents of this structure are private, and MUST NOT be accessed * directly by callers. * @@ -45,32 +48,32 @@ ISC_LANG_BEGINDECLS void isc_interval_set(isc_interval_t *i, unsigned int seconds, unsigned int nanoseconds); -/* +/*%< * Set 'i' to a value representing an interval of 'seconds' seconds and * 'nanoseconds' nanoseconds, suitable for use in isc_time_add() and * isc_time_subtract(). * * Requires: * - * 't' is a valid pointer. - * nanoseconds < 1000000000. + *\li 't' is a valid pointer. + *\li nanoseconds < 1000000000. */ isc_boolean_t isc_interval_iszero(const isc_interval_t *i); -/* +/*%< * Returns ISC_TRUE iff. 'i' is the zero interval. * * Requires: * - * 'i' is a valid pointer. + *\li 'i' is a valid pointer. */ /*** *** Absolute Times ***/ -/* +/*% * The contents of this structure are private, and MUST NOT be accessed * directly by callers. * @@ -86,116 +89,118 @@ extern isc_time_t *isc_time_epoch; void isc_time_set(isc_time_t *t, unsigned int seconds, unsigned int nanoseconds); -/* +/*%< * Set 't' to a particular number of seconds + nanoseconds since the epoch. * * Notes: - * This call is equivalent to: - * + *\li This call is equivalent to: + *\code * isc_time_settoepoch(t); * isc_interval_set(i, seconds, nanoseconds); * isc_time_add(t, i, t); - * + *\endcode * Requires: - * 't' is a valid pointer. - * nanoseconds < 1000000000. + *\li 't' is a valid pointer. + *\li nanoseconds < 1000000000. */ void isc_time_settoepoch(isc_time_t *t); -/* +/*%< * Set 't' to the time of the epoch. * * Notes: - * The date of the epoch is platform-dependent. + * \li The date of the epoch is platform-dependent. * * Requires: * - * 't' is a valid pointer. + *\li 't' is a valid pointer. */ isc_boolean_t isc_time_isepoch(const isc_time_t *t); -/* +/*%< * Returns ISC_TRUE iff. 't' is the epoch ("time zero"). * * Requires: * - * 't' is a valid pointer. + *\li 't' is a valid pointer. */ isc_result_t isc_time_now(isc_time_t *t); -/* +/*%< * Set 't' to the current absolute time. * * Requires: * - * 't' is a valid pointer. + *\li 't' is a valid pointer. * * Returns: * - * Success - * Unexpected error + *\li Success + *\li Unexpected error * Getting the time from the system failed. - * Out of range + *\li Out of range * The time from the system is too large to be represented * in the current definition of isc_time_t. */ isc_result_t isc_time_nowplusinterval(isc_time_t *t, const isc_interval_t *i); -/* +/*%< * Set *t to the current absolute time + i. * * Note: - * This call is equivalent to: + *\li This call is equivalent to: * + *\code * isc_time_now(t); * isc_time_add(t, i, t); + *\endcode * * Requires: * - * 't' and 'i' are valid pointers. + *\li 't' and 'i' are valid pointers. * * Returns: * - * Success - * Unexpected error + *\li Success + *\li Unexpected error * Getting the time from the system failed. - * Out of range + *\li Out of range * The interval added to the time from the system is too large to * be represented in the current definition of isc_time_t. */ int isc_time_compare(const isc_time_t *t1, const isc_time_t *t2); -/* +/*%< * Compare the times referenced by 't1' and 't2' * * Requires: * - * 't1' and 't2' are valid pointers. + *\li 't1' and 't2' are valid pointers. * * Returns: * - * -1 t1 < t2 (comparing times, not pointers) - * 0 t1 = t2 - * 1 t1 > t2 + *\li -1 t1 < t2 (comparing times, not pointers) + *\li 0 t1 = t2 + *\li 1 t1 > t2 */ isc_result_t isc_time_add(const isc_time_t *t, const isc_interval_t *i, isc_time_t *result); -/* +/*%< * Add 'i' to 't', storing the result in 'result'. * * Requires: * - * 't', 'i', and 'result' are valid pointers. + *\li 't', 'i', and 'result' are valid pointers. * * Returns: - * Success - * Out of range + * \li Success + *\li Out of range * The interval added to the time is too large to * be represented in the current definition of isc_time_t. */ @@ -203,50 +208,50 @@ isc_time_add(const isc_time_t *t, const isc_interval_t *i, isc_time_t *result); isc_result_t isc_time_subtract(const isc_time_t *t, const isc_interval_t *i, isc_time_t *result); -/* +/*%< * Subtract 'i' from 't', storing the result in 'result'. * * Requires: * - * 't', 'i', and 'result' are valid pointers. + *\li 't', 'i', and 'result' are valid pointers. * * Returns: - * Success - * Out of range + *\li Success + *\li Out of range * The interval is larger than the time since the epoch. */ isc_uint64_t isc_time_microdiff(const isc_time_t *t1, const isc_time_t *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. + *\li 't1' and 't2' are valid pointers. * * Returns: - * The difference of t1 - t2, or 0 if t1 <= t2. + *\li The difference of t1 - t2, or 0 if t1 <= t2. */ isc_uint32_t isc_time_seconds(const isc_time_t *t); -/* +/*%< * Return the number of seconds since the epoch stored in a time structure. * * Requires: * - * 't' is a valid pointer. + *\li 't' is a valid pointer. */ isc_result_t isc_time_secondsastimet(const isc_time_t *t, time_t *secondsp); -/* +/*%< * Ensure the number of seconds in an isc_time_t is representable by a time_t. * * Notes: - * The number of seconds stored in an isc_time_t might be larger + *\li The number of seconds stored in an isc_time_t might be larger * than the number of seconds a time_t is able to handle. Since * time_t is mostly opaque according to the ANSI/ISO standard * (essentially, all you can be sure of is that it is an arithmetic type, @@ -256,41 +261,41 @@ isc_time_secondsastimet(const isc_time_t *t, time_t *secondsp); * time_t from an isc_time_t. * * Requires: - * 't' is a valid pointer. + *\li 't' is a valid pointer. * * Returns: - * Success - * Out of range + *\li Success + *\li Out of range */ isc_uint32_t isc_time_nanoseconds(const isc_time_t *t); -/* +/*%< * Return the number of nanoseconds stored in a time structure. * * Notes: - * This is the number of nanoseconds in excess of the the number + *\li This is the number of nanoseconds in excess of the the number * of seconds since the epoch; it will always be less than one * full second. * * Requires: - * 't' is a valid pointer. + *\li 't' is a valid pointer. * * Ensures: - * The returned value is less than 1*10^9. + *\li The returned value is less than 1*10^9. */ void isc_time_formattimestamp(const isc_time_t *t, char *buf, unsigned int len); -/* +/*%< * Format the time 't' into the buffer 'buf' of length 'len', * using a format like "30-Aug-2000 04:06:47.997" and the local time zone. * If the text does not fit in the buffer, the result is indeterminate, * but is always guaranteed to be null terminated. * * Requires: - * 'len' > 0 - * 'buf' points to an array of at least len chars + *\li 'len' > 0 + * \li 'buf' points to an array of at least len chars * */ diff --git a/contrib/bind9/lib/isc/unix/interfaceiter.c b/contrib/bind9/lib/isc/unix/interfaceiter.c index 9520bdeb..72ecdd2 100644 --- a/contrib/bind9/lib/isc/unix/interfaceiter.c +++ b/contrib/bind9/lib/isc/unix/interfaceiter.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,7 +15,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: interfaceiter.c,v 1.22.2.1.10.14 2004/08/28 06:25:22 marka Exp $ */ +/* $Id: interfaceiter.c,v 1.35.18.5 2005/04/29 00:17:08 marka Exp $ */ + +/*! \file */ #include <config.h> @@ -51,9 +53,9 @@ /* Common utility functions */ -/* +/*% * Extract the network address part from a "struct sockaddr". - * + * \brief * The address family is given explicitly * instead of using src->sa_family, because the latter does not work * for copying a network mask obtained by SIOCGIFNETMASK (it does diff --git a/contrib/bind9/lib/isc/unix/ipv6.c b/contrib/bind9/lib/isc/unix/ipv6.c index f11262f..3066e0c 100644 --- a/contrib/bind9/lib/isc/unix/ipv6.c +++ b/contrib/bind9/lib/isc/unix/ipv6.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2006 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,7 +15,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ipv6.c,v 1.7.206.3 2006/08/25 05:25:50 marka Exp $ */ +/* $Id: ipv6.c,v 1.8.18.4 2006/08/25 05:25:51 marka Exp $ */ + +/*! \file */ #include <config.h> diff --git a/contrib/bind9/lib/isc/unix/keyboard.c b/contrib/bind9/lib/isc/unix/keyboard.c index 146338a..db56b3c 100644 --- a/contrib/bind9/lib/isc/unix/keyboard.c +++ b/contrib/bind9/lib/isc/unix/keyboard.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: keyboard.c,v 1.9.12.3 2004/03/08 09:04:56 marka Exp $ */ +/* $Id: keyboard.c,v 1.11 2004/03/05 05:11:46 marka Exp $ */ #include <config.h> diff --git a/contrib/bind9/lib/isc/unix/net.c b/contrib/bind9/lib/isc/unix/net.c index e0aeccb..6169c2b 100644 --- a/contrib/bind9/lib/isc/unix/net.c +++ b/contrib/bind9/lib/isc/unix/net.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: net.c,v 1.22.2.2.10.9 2005/03/17 03:58:33 marka Exp $ */ +/* $Id: net.c,v 1.29.18.4 2005/03/16 01:22:50 marka Exp $ */ #include <config.h> @@ -43,6 +43,7 @@ static isc_once_t once_ipv6only = ISC_ONCE_INIT; static isc_once_t once_ipv6pktinfo = ISC_ONCE_INIT; static isc_result_t ipv4_result = ISC_R_NOTFOUND; static isc_result_t ipv6_result = ISC_R_NOTFOUND; +static isc_result_t unix_result = ISC_R_NOTFOUND; static isc_result_t ipv6only_result = ISC_R_NOTFOUND; static isc_result_t ipv6pktinfo_result = ISC_R_NOTFOUND; @@ -137,6 +138,9 @@ initialize_action(void) { #endif #endif #endif +#ifdef ISC_PLATFORM_HAVESYSUNH + unix_result = try_proto(PF_UNIX); +#endif } static void @@ -156,6 +160,12 @@ isc_net_probeipv6(void) { return (ipv6_result); } +isc_result_t +isc_net_probeunix(void) { + initialize(); + return (unix_result); +} + #ifdef ISC_PLATFORM_HAVEIPV6 #ifdef WANT_IPV6 static void diff --git a/contrib/bind9/lib/isc/unix/os.c b/contrib/bind9/lib/isc/unix/os.c index 4d34d8c..6bbf059 100644 --- a/contrib/bind9/lib/isc/unix/os.c +++ b/contrib/bind9/lib/isc/unix/os.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: os.c,v 1.11.12.6 2005/10/14 02:13:07 marka Exp $ */ +/* $Id: os.c,v 1.13.18.3 2005/10/14 02:13:08 marka Exp $ */ #include <config.h> diff --git a/contrib/bind9/lib/isc/unix/resource.c b/contrib/bind9/lib/isc/unix/resource.c index b6faf32..703ec27 100644 --- a/contrib/bind9/lib/isc/unix/resource.c +++ b/contrib/bind9/lib/isc/unix/resource.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: resource.c,v 1.11.206.1 2004/03/06 08:15:01 marka Exp $ */ +/* $Id: resource.c,v 1.12 2004/03/05 05:11:46 marka Exp $ */ #include <config.h> diff --git a/contrib/bind9/lib/isc/unix/socket.c b/contrib/bind9/lib/isc/unix/socket.c index f95e3c8..6b4c34c 100644 --- a/contrib/bind9/lib/isc/unix/socket.c +++ b/contrib/bind9/lib/isc/unix/socket.c @@ -15,13 +15,19 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket.c,v 1.207.2.19.2.26 2006/05/19 02:53:36 marka Exp $ */ +/* $Id: socket.c,v 1.237.18.24 2006/06/06 00:56:09 marka Exp $ */ + +/*! \file */ #include <config.h> #include <sys/param.h> #include <sys/types.h> #include <sys/socket.h> +#include <sys/stat.h> +#ifdef ISC_PLATFORM_HAVESYSUNH +#include <sys/un.h> +#endif #include <sys/time.h> #include <sys/uio.h> @@ -57,7 +63,7 @@ #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. */ @@ -65,7 +71,7 @@ #define ISC_SOCKADDR_LEN_T unsigned int #endif -/* +/*% * Define what the possible "soft" errors can be. These are non-fatal returns * of various network related functions, like recv() and so on. * @@ -80,7 +86,7 @@ #define DLVL(x) ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_DEBUG(x) -/* +/*!< * DLVL(90) -- Function entry/exit and other tracing. * DLVL(70) -- Socket "correctness" -- including returning of events, etc. * DLVL(60) -- Socket data send/receive @@ -104,7 +110,7 @@ typedef isc_event_t intev_t; #define SOCKET_MAGIC ISC_MAGIC('I', 'O', 'i', 'o') #define VALID_SOCKET(t) ISC_MAGIC_VALID(t, SOCKET_MAGIC) -/* +/*! * IPv6 control information. If the socket is an IPv6 socket we want * to collect the destination address and interface so the client can * set them on outgoing packets. @@ -115,7 +121,7 @@ typedef isc_event_t intev_t; #endif #endif -/* +/*% * NetBSD and FreeBSD can timestamp packets. XXXMLG Should we have * a setsockopt() like interface to request timestamps, and if the OS * doesn't do it for us, call gettimeofday() on every UDP receive? @@ -126,7 +132,12 @@ typedef isc_event_t intev_t; #endif #endif -/* +/*% + * The size to raise the recieve buffer to (from BIND 8). + */ +#define RCVBUFSIZE (32*1024) + +/*% * The number of times a send operation is repeated if the result is EINTR. */ #define NRETRIES 10 @@ -238,9 +249,9 @@ static void build_msghdr_recv(isc_socket_t *, isc_socketevent_t *, #define SELECT_POKE_SHUTDOWN (-1) #define SELECT_POKE_NOTHING (-2) #define SELECT_POKE_READ (-3) -#define SELECT_POKE_ACCEPT (-3) /* Same as _READ */ +#define SELECT_POKE_ACCEPT (-3) /*%< Same as _READ */ #define SELECT_POKE_WRITE (-4) -#define SELECT_POKE_CONNECT (-4) /* Same as _WRITE */ +#define SELECT_POKE_CONNECT (-4) /*%< Same as _WRITE */ #define SELECT_POKE_CLOSE (-5) #define SOCK_DEAD(s) ((s)->references == 0) @@ -870,6 +881,15 @@ set_dev_address(isc_sockaddr_t *address, isc_socket_t *sock, } } +static void +destroy_socketevent(isc_event_t *event) { + isc_socketevent_t *ev = (isc_socketevent_t *)event; + + INSIST(ISC_LIST_EMPTY(ev->bufferlist)); + + (ev->destroy)(event); +} + static isc_socketevent_t * allocate_socketevent(isc_socket_t *sock, isc_eventtype_t eventtype, isc_taskaction_t action, const void *arg) @@ -891,6 +911,8 @@ allocate_socketevent(isc_socket_t *sock, isc_eventtype_t eventtype, ev->n = 0; ev->offset = 0; ev->attributes = 0; + ev->destroy = ev->ev_destroy; + ev->ev_destroy = destroy_socketevent; return (ev); } @@ -1225,7 +1247,7 @@ allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type, isc_socket_t **socketp) { isc_socket_t *sock; - isc_result_t ret; + isc_result_t result; ISC_SOCKADDR_LEN_T cmsgbuflen; sock = isc_mem_get(manager->mctx, sizeof(*sock)); @@ -1233,7 +1255,7 @@ allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type, if (sock == NULL) return (ISC_R_NOMEMORY); - ret = ISC_R_UNEXPECTED; + result = ISC_R_UNEXPECTED; sock->magic = 0; sock->references = 0; @@ -1293,13 +1315,9 @@ allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type, /* * initialize the lock */ - if (isc_mutex_init(&sock->lock) != ISC_R_SUCCESS) { + result = isc_mutex_init(&sock->lock); + if (result != ISC_R_SUCCESS) { sock->magic = 0; - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_mutex_init() %s", - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed")); - ret = ISC_R_UNEXPECTED; goto error; } @@ -1327,7 +1345,7 @@ allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type, sock->sendcmsgbuflen); isc_mem_put(manager->mctx, sock, sizeof(*sock)); - return (ret); + return (result); } /* @@ -1379,19 +1397,23 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, isc_socket_t **socketp) { isc_socket_t *sock = NULL; - isc_result_t ret; + isc_result_t result; #if defined(USE_CMSG) || defined(SO_BSDCOMPAT) int on = 1; #endif +#if defined(SO_RCVBUF) + ISC_SOCKADDR_LEN_T optlen; + int size; +#endif char strbuf[ISC_STRERRORSIZE]; const char *err = "socket"; REQUIRE(VALID_MANAGER(manager)); REQUIRE(socketp != NULL && *socketp == NULL); - ret = allocate_socket(manager, type, &sock); - if (ret != ISC_R_SUCCESS) - return (ret); + result = allocate_socket(manager, type, &sock); + if (result != ISC_R_SUCCESS) + return (result); sock->pf = pf; switch (type) { @@ -1401,6 +1423,9 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, case isc_sockettype_tcp: sock->fd = socket(pf, SOCK_STREAM, IPPROTO_TCP); break; + case isc_sockettype_unix: + sock->fd = socket(pf, SOCK_STREAM, 0); + break; } #ifdef F_DUPFD @@ -1468,7 +1493,8 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, } #ifdef SO_BSDCOMPAT - if (setsockopt(sock->fd, SOL_SOCKET, SO_BSDCOMPAT, + if (type != isc_sockettype_unix && + setsockopt(sock->fd, SOL_SOCKET, SO_BSDCOMPAT, (void *)&on, sizeof(on)) < 0) { isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, @@ -1481,9 +1507,10 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, } #endif -#if defined(USE_CMSG) +#if defined(USE_CMSG) || defined(SO_RCVBUF) if (type == isc_sockettype_udp) { +#if defined(USE_CMSG) #if defined(SO_TIMESTAMP) if (setsockopt(sock->fd, SOL_SOCKET, SO_TIMESTAMP, (void *)&on, sizeof(on)) < 0 @@ -1553,9 +1580,30 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, } #endif #endif /* ISC_PLATFORM_HAVEIPV6 */ - +#endif /* defined(USE_CMSG) */ + +#if defined(SO_RCVBUF) + optlen = sizeof(size); + if (getsockopt(sock->fd, SOL_SOCKET, SO_RCVBUF, + (void *)&size, &optlen) >= 0 && + size < RCVBUFSIZE) { + size = RCVBUFSIZE; + if (setsockopt(sock->fd, SOL_SOCKET, SO_RCVBUF, + (void *)&size, sizeof(size)) == -1) { + isc__strerror(errno, strbuf, sizeof(strbuf)); + UNEXPECTED_ERROR(__FILE__, __LINE__, + "setsockopt(%d, SO_RCVBUF, %d) %s: %s", + sock->fd, size, + isc_msgcat_get(isc_msgcat, + ISC_MSGSET_GENERAL, + ISC_MSG_FAILED, + "failed"), + strbuf); + } + } +#endif } -#endif /* USE_CMSG */ +#endif /* defined(USE_CMSG) || defined(SO_RCVBUF) */ sock->references = 1; *socketp = sock; @@ -2316,6 +2364,7 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) { #ifdef ISC_PLATFORM_USETHREADS char strbuf[ISC_STRERRORSIZE]; #endif + isc_result_t result; REQUIRE(managerp != NULL && *managerp == NULL); @@ -2335,13 +2384,10 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) { manager->mctx = NULL; memset(manager->fds, 0, sizeof(manager->fds)); ISC_LIST_INIT(manager->socklist); - if (isc_mutex_init(&manager->lock) != ISC_R_SUCCESS) { + result = isc_mutex_init(&manager->lock); + if (result != ISC_R_SUCCESS) { isc_mem_put(mctx, manager, sizeof(*manager)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_mutex_init() %s", - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed")); - return (ISC_R_UNEXPECTED); + return (result); } #ifdef ISC_PLATFORM_USETHREADS if (isc_condition_init(&manager->shutdown_ok) != ISC_R_SUCCESS) { @@ -2884,6 +2930,190 @@ isc_socket_sendto2(isc_socket_t *sock, isc_region_t *region, return (socket_send(sock, event, task, address, pktinfo, flags)); } +void +isc_socket_cleanunix(isc_sockaddr_t *sockaddr, isc_boolean_t active) { +#ifdef ISC_PLATFORM_HAVESYSUNH + int s; + struct stat sb; + char strbuf[ISC_STRERRORSIZE]; + + if (sockaddr->type.sa.sa_family != AF_UNIX) + return; + +#ifndef S_ISSOCK +#if defined(S_IFMT) && defined(S_IFSOCK) +#define S_ISSOCK(mode) ((mode & S_IFMT)==S_IFSOCK) +#elif defined(_S_IFMT) && defined(S_IFSOCK) +#define S_ISSOCK(mode) ((mode & _S_IFMT)==S_IFSOCK) +#endif +#endif + +#ifndef S_ISFIFO +#if defined(S_IFMT) && defined(S_IFIFO) +#define S_ISFIFO(mode) ((mode & S_IFMT)==S_IFIFO) +#elif defined(_S_IFMT) && defined(S_IFIFO) +#define S_ISFIFO(mode) ((mode & _S_IFMT)==S_IFIFO) +#endif +#endif + +#if !defined(S_ISFIFO) && !defined(S_ISSOCK) +#error You need to define S_ISFIFO and S_ISSOCK as appropriate for your platform. See <sys/stat.h>. +#endif + +#ifndef S_ISFIFO +#define S_ISFIFO(mode) 0 +#endif + +#ifndef S_ISSOCK +#define S_ISSOCK(mode) 0 +#endif + + if (active) { + if (stat(sockaddr->type.sunix.sun_path, &sb) < 0) { + isc__strerror(errno, strbuf, sizeof(strbuf)); + isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, + ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, + "isc_socket_cleanunix: stat(%s): %s", + sockaddr->type.sunix.sun_path, strbuf); + return; + } + if (!(S_ISSOCK(sb.st_mode) || S_ISFIFO(sb.st_mode))) { + isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, + ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, + "isc_socket_cleanunix: %s: not a socket", + sockaddr->type.sunix.sun_path); + return; + } + if (unlink(sockaddr->type.sunix.sun_path) < 0) { + isc__strerror(errno, strbuf, sizeof(strbuf)); + isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, + ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, + "isc_socket_cleanunix: unlink(%s): %s", + sockaddr->type.sunix.sun_path, strbuf); + } + return; + } + + s = socket(AF_UNIX, SOCK_STREAM, 0); + if (s < 0) { + isc__strerror(errno, strbuf, sizeof(strbuf)); + isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, + ISC_LOGMODULE_SOCKET, ISC_LOG_WARNING, + "isc_socket_cleanunix: socket(%s): %s", + sockaddr->type.sunix.sun_path, strbuf); + return; + } + + if (stat(sockaddr->type.sunix.sun_path, &sb) < 0) { + switch (errno) { + case ENOENT: /* We exited cleanly last time */ + break; + default: + isc__strerror(errno, strbuf, sizeof(strbuf)); + isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, + ISC_LOGMODULE_SOCKET, ISC_LOG_WARNING, + "isc_socket_cleanunix: stat(%s): %s", + sockaddr->type.sunix.sun_path, strbuf); + break; + } + goto cleanup; + } + + if (!(S_ISSOCK(sb.st_mode) || S_ISFIFO(sb.st_mode))) { + isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, + ISC_LOGMODULE_SOCKET, ISC_LOG_WARNING, + "isc_socket_cleanunix: %s: not a socket", + sockaddr->type.sunix.sun_path); + goto cleanup; + } + + if (connect(s, (struct sockaddr *)&sockaddr->type.sunix, + sizeof(sockaddr->type.sunix)) < 0) { + switch (errno) { + case ECONNREFUSED: + case ECONNRESET: + if (unlink(sockaddr->type.sunix.sun_path) < 0) { + isc__strerror(errno, strbuf, sizeof(strbuf)); + isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, + ISC_LOGMODULE_SOCKET, + ISC_LOG_WARNING, + "isc_socket_cleanunix: " + "unlink(%s): %s", + sockaddr->type.sunix.sun_path, + strbuf); + } + break; + default: + isc__strerror(errno, strbuf, sizeof(strbuf)); + isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, + ISC_LOGMODULE_SOCKET, ISC_LOG_WARNING, + "isc_socket_cleanunix: connect(%s): %s", + sockaddr->type.sunix.sun_path, strbuf); + break; + } + } + cleanup: + close(s); +#else + UNUSED(sockaddr); + UNUSED(active); +#endif +} + +isc_result_t +isc_socket_permunix(isc_sockaddr_t *sockaddr, isc_uint32_t perm, + isc_uint32_t owner, isc_uint32_t group) +{ +#ifdef ISC_PLATFORM_HAVESYSUNH + isc_result_t result = ISC_R_SUCCESS; + char strbuf[ISC_STRERRORSIZE]; + char path[sizeof(sockaddr->type.sunix.sun_path)]; +#ifdef NEED_SECURE_DIRECTORY + char *slash; +#endif + + REQUIRE(sockaddr->type.sa.sa_family == AF_UNIX); + INSIST(strlen(sockaddr->type.sunix.sun_path) < sizeof(path)); + strcpy(path, sockaddr->type.sunix.sun_path); + +#ifdef NEED_SECURE_DIRECTORY + slash = strrchr(path, '/'); + if (slash != NULL) { + if (slash != path) + *slash = '\0'; + else + strcpy(path, "/"); + } else + strcpy(path, "."); +#endif + + if (chmod(path, perm) < 0) { + isc__strerror(errno, strbuf, sizeof(strbuf)); + isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, + ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, + "isc_socket_permunix: chmod(%s, %d): %s", + path, perm, strbuf); + result = ISC_R_FAILURE; + } + if (chown(path, owner, group) < 0) { + isc__strerror(errno, strbuf, sizeof(strbuf)); + isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, + ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, + "isc_socket_permunix: chown(%s, %d, %d): %s", + path, owner, group, + strbuf); + result = ISC_R_FAILURE; + } + return (result); +#else + UNUSED(sockaddr); + UNUSED(perm); + UNUSED(owner); + UNUSED(group); + return (ISC_R_NOTIMPLEMENTED); +#endif +} + isc_result_t isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) { char strbuf[ISC_STRERRORSIZE]; @@ -2900,6 +3130,10 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) { /* * Only set SO_REUSEADDR when we want a specific port. */ +#ifdef AF_UNIX + if (sock->pf == AF_UNIX) + goto bind_socket; +#endif if (isc_sockaddr_getport(sockaddr) != (in_port_t)0 && setsockopt(sock->fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on, sizeof(on)) < 0) { @@ -2909,6 +3143,9 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) { ISC_MSG_FAILED, "failed")); /* Press on... */ } +#ifdef AF_UNIX + bind_socket: +#endif if (bind(sock->fd, &sockaddr->type.sa, sockaddr->length) < 0) { UNLOCK(&sock->lock); switch (errno) { @@ -2985,7 +3222,8 @@ isc_socket_listen(isc_socket_t *sock, unsigned int backlog) { REQUIRE(!sock->listener); REQUIRE(sock->bound); - REQUIRE(sock->type == isc_sockettype_tcp); + REQUIRE(sock->type == isc_sockettype_tcp || + sock->type == isc_sockettype_unix); if (backlog == 0) backlog = SOMAXCONN; @@ -3016,7 +3254,7 @@ isc_socket_accept(isc_socket_t *sock, isc_socketmgr_t *manager; isc_task_t *ntask = NULL; isc_socket_t *nsock; - isc_result_t ret; + isc_result_t result; isc_boolean_t do_poke = ISC_FALSE; REQUIRE(VALID_SOCKET(sock)); @@ -3041,11 +3279,11 @@ isc_socket_accept(isc_socket_t *sock, } ISC_LINK_INIT(dev, ev_link); - ret = allocate_socket(manager, sock->type, &nsock); - if (ret != ISC_R_SUCCESS) { + result = allocate_socket(manager, sock->type, &nsock); + if (result != ISC_R_SUCCESS) { isc_event_free(ISC_EVENT_PTR(&dev)); UNLOCK(&sock->lock); - return (ret); + return (result); } /* @@ -3309,7 +3547,7 @@ internal_connect(isc_task_t *me, isc_event_t *ev) { isc_result_t isc_socket_getpeername(isc_socket_t *sock, isc_sockaddr_t *addressp) { - isc_result_t ret; + isc_result_t result; REQUIRE(VALID_SOCKET(sock)); REQUIRE(addressp != NULL); @@ -3318,20 +3556,20 @@ isc_socket_getpeername(isc_socket_t *sock, isc_sockaddr_t *addressp) { if (sock->connected) { *addressp = sock->address; - ret = ISC_R_SUCCESS; + result = ISC_R_SUCCESS; } else { - ret = ISC_R_NOTCONNECTED; + result = ISC_R_NOTCONNECTED; } UNLOCK(&sock->lock); - return (ret); + return (result); } isc_result_t isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) { ISC_SOCKADDR_LEN_T len; - isc_result_t ret; + isc_result_t result; char strbuf[ISC_STRERRORSIZE]; REQUIRE(VALID_SOCKET(sock)); @@ -3340,18 +3578,18 @@ isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) { LOCK(&sock->lock); if (!sock->bound) { - ret = ISC_R_NOTBOUND; + result = ISC_R_NOTBOUND; goto out; } - ret = ISC_R_SUCCESS; + result = ISC_R_SUCCESS; len = sizeof(addressp->type); if (getsockname(sock->fd, &addressp->type.sa, (void *)&len) < 0) { isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "getsockname: %s", strbuf); - ret = ISC_R_UNEXPECTED; + result = ISC_R_UNEXPECTED; goto out; } addressp->length = (unsigned int)len; @@ -3359,7 +3597,7 @@ isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) { out: UNLOCK(&sock->lock); - return (ret); + return (result); } /* diff --git a/contrib/bind9/lib/isc/unix/socket_p.h b/contrib/bind9/lib/isc/unix/socket_p.h index f430bf2..c260bbc 100644 --- a/contrib/bind9/lib/isc/unix/socket_p.h +++ b/contrib/bind9/lib/isc/unix/socket_p.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,11 +15,13 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket_p.h,v 1.6.206.1 2004/03/06 08:15:02 marka Exp $ */ +/* $Id: socket_p.h,v 1.7.18.2 2005/04/29 00:17:08 marka Exp $ */ #ifndef ISC_SOCKET_P_H #define ISC_SOCKET_P_H +/*! \file */ + #ifdef ISC_PLATFORM_NEEDSYSSELECTH #include <sys/select.h> #endif diff --git a/contrib/bind9/lib/isc/unix/stdio.c b/contrib/bind9/lib/isc/unix/stdio.c index 794164e..64db925 100644 --- a/contrib/bind9/lib/isc/unix/stdio.c +++ b/contrib/bind9/lib/isc/unix/stdio.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: stdio.c,v 1.5.206.1 2004/03/06 08:15:02 marka Exp $ */ +/* $Id: stdio.c,v 1.6 2004/03/05 05:11:47 marka Exp $ */ #include <config.h> diff --git a/contrib/bind9/lib/isc/unix/stdtime.c b/contrib/bind9/lib/isc/unix/stdtime.c index b8d818d..3f240b7 100644 --- a/contrib/bind9/lib/isc/unix/stdtime.c +++ b/contrib/bind9/lib/isc/unix/stdtime.c @@ -15,7 +15,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: stdtime.c,v 1.11.2.1.10.5 2005/06/09 23:54:31 marka Exp $ */ +/* $Id: stdtime.c,v 1.14.18.3 2005/06/08 02:07:57 marka Exp $ */ + +/*! \file */ #include <config.h> diff --git a/contrib/bind9/lib/isc/unix/strerror.c b/contrib/bind9/lib/isc/unix/strerror.c index 863867e..18cc367 100644 --- a/contrib/bind9/lib/isc/unix/strerror.c +++ b/contrib/bind9/lib/isc/unix/strerror.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,7 +15,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: strerror.c,v 1.1.2.1.10.3 2004/03/08 09:04:57 marka Exp $ */ +/* $Id: strerror.c,v 1.4.18.2 2005/04/29 00:17:08 marka Exp $ */ + +/*! \file */ #include <config.h> @@ -29,7 +31,7 @@ #include <isc/util.h> #ifdef HAVE_STRERROR -/* +/*% * We need to do this this way for profiled locks. */ static isc_mutex_t isc_strerror_lock; diff --git a/contrib/bind9/lib/isc/unix/syslog.c b/contrib/bind9/lib/isc/unix/syslog.c index e531544..cc99339 100644 --- a/contrib/bind9/lib/isc/unix/syslog.c +++ b/contrib/bind9/lib/isc/unix/syslog.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,7 +15,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: syslog.c,v 1.1.12.3 2004/03/08 09:04:57 marka Exp $ */ +/* $Id: syslog.c,v 1.3.18.2 2005/04/29 00:17:09 marka Exp $ */ + +/*! \file */ #include <config.h> diff --git a/contrib/bind9/lib/isc/unix/time.c b/contrib/bind9/lib/isc/unix/time.c index 39c851c..bac24d7 100644 --- a/contrib/bind9/lib/isc/unix/time.c +++ b/contrib/bind9/lib/isc/unix/time.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,7 +15,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: time.c,v 1.34.2.6.2.4 2004/03/06 08:15:03 marka Exp $ */ +/* $Id: time.c,v 1.47.18.2 2005/04/29 00:17:09 marka Exp $ */ + +/*! \file */ #include <config.h> @@ -33,9 +35,9 @@ #include <isc/time.h> #include <isc/util.h> -#define NS_PER_S 1000000000 /* Nanoseconds per second. */ -#define NS_PER_US 1000 /* Nanoseconds per microsecond. */ -#define US_PER_S 1000000 /* Microseconds per second. */ +#define NS_PER_S 1000000000 /*%< Nanoseconds per second. */ +#define NS_PER_US 1000 /*%< Nanoseconds per microsecond. */ +#define US_PER_S 1000000 /*%< Microseconds per second. */ /* * All of the INSIST()s checks of nanoseconds < NS_PER_S are for @@ -48,7 +50,7 @@ #define ISC_FIX_TV_USEC 1 #endif -/*** +/*% *** Intervals ***/ |