From 67e0f3ce71726dc4058c2f80a813341a59244dbd Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 11 Jun 1998 05:01:49 +0000 Subject: Import final bind-8.1.2 release. Obtained from: ftp.isc.org --- contrib/bind/CHANGES | 47 ++++++++++++++++++++ contrib/bind/INSTALL | 38 ++++++++++++----- contrib/bind/README | 4 +- contrib/bind/Version | 2 +- contrib/bind/bin/named-xfer/Makefile | 4 +- contrib/bind/bin/named/named.conf | 9 ++-- contrib/bind/bin/named/ns_config.c | 5 ++- contrib/bind/bin/named/ns_defs.h | 4 +- contrib/bind/bin/named/ns_glob.h | 4 +- contrib/bind/bin/named/ns_main.c | 40 ++++++++++++----- contrib/bind/bin/named/ns_maint.c | 3 +- contrib/bind/bin/named/ns_update.c | 10 +++-- contrib/bind/doc/html/logging.html | 4 +- contrib/bind/doc/html/options.html | 9 +++- contrib/bind/doc/man/named.8 | 19 +++++++++ contrib/bind/include/resolv.h | 4 +- contrib/bind/lib/isc/memcluster.c | 59 +++++++++++++++++++++----- contrib/bind/port/freebsd/include/port_after.h | 1 + 18 files changed, 212 insertions(+), 54 deletions(-) (limited to 'contrib/bind') diff --git a/contrib/bind/CHANGES b/contrib/bind/CHANGES index a09b7d4..f987e5c 100644 --- a/contrib/bind/CHANGES +++ b/contrib/bind/CHANGES @@ -1,4 +1,51 @@ + --- 8.1.2 released --- + + 380. [bug] Replaying the dynamic update log could trigger an + INSIST. + + 379. [port] Updated IRIX port. + + 378. [bug] The declaration for res_freeupdrec() in resolv.h + didn't use __P(). + + 377. [func] The server now sets SO_SNDBUF on UDP sockets. + + 376. [port] The malloc() implementation on many systems didn't + like memcluster.c's 4KB block allocations, sometimes + causing huge amounts of memory to be wasted. + memcluster.c now allocates bigger chunks and makes + its own 4KB blocks. + + 375. [bug] If more than (sizeof u_long) gets occurred for a + particular memory bucket, an INSIST about puts < gets + might have been erroneously trigged. Now total + gets and outstanding gets are counted. + + 374. [port] SCO 3.2v4.2 doesn't have initgroups(), so we do not + want to define CAN_CHANGE_ID. + + 373. [port] Updated LynxOS port. + + 372. [port] Updated SCO 3.2v5.0.x port. + + 371. [bug] "make install" could fail on some Linux systems + because src/port/linux/include/net/Makefile didn't + cope with an empty HFILES variable. + + 370. [bug] Trying to update an expired slave zone would cause + the server to panic. + + 369. [bug] The Makefile for named-xfer didn't try to create + ${DESTDIR}${DESTEXEC} if it didn't exist. + + 368. [bug] Interface scanning could get confused on BSD-like + systems if the sa_len of the address was less than + sizeof (struct sockaddr). + + 367. [func] The default value for the host-statistics option has + been changed to "no". + --- 8.1.2-T3B released --- 366. [bug] Z_AUTH was set on the cache zone do_reload(). diff --git a/contrib/bind/INSTALL b/contrib/bind/INSTALL index 0b6a0eb..5672a6d 100644 --- a/contrib/bind/INSTALL +++ b/contrib/bind/INSTALL @@ -79,11 +79,10 @@ Installation DESTETC configuration file DESTRUN PID file location - These variables may be specified on the command line of the 'make' - or in the Makefile.set for your port (e.g. if you use Solaris, in - src/port/solaris/Makefile.set). + These variables should be specified in the Makefile.set for your + port (e.g. if you use Solaris, in src/port/solaris/Makefile.set). - Before doing 'make install' using either method, you must + Before doing 'make install', you must rm .settings @@ -117,9 +116,27 @@ Using BIND 8 Library Routines Operating System Notes - SunOS 4.1.4 + AIX - An ANSI/ISO C compiler is required; we used gcc 2.7.2.1. + Build problems have been reported with the AIX "make". + We recommend using GNU "make" instead. + + Linux + + "make links" and "make stdlinks" cause problems on + some Linux kernels because there are too many levels of + symbolic links. + + QNX + + Read src/port/qnx/README before trying to build. + + SCO 5.0.x + + To build using gcc, copy "port/sco50/Makefile.set.gcc" to + "port/sco50/Makefile.set". To go back to using SCO's + compilers, copy "port/sco50/Makefile.set.sco" to + "port/sco50/Makefile.set". Solaris @@ -136,6 +153,10 @@ Operating System Notes suitably large number) before execing "named". On Solaris 2.5 and later, the server will do this itself. + SunOS 4.1.4 + + An ANSI/ISO C compiler is required; we used gcc 2.7.2.1. + Certain older versions of FreeBSD, NetBSD and BSD/OS These systems have a /bin/sh based on "ash", which doesn't @@ -143,11 +164,6 @@ Operating System Notes the problem. Either run make with "SH=bash" on the command line, or edit src/Makefile and change "SH=sh" to "SH=bash". - QNX - - Read src/port/qnx/README before trying to build. - - FD_SETSIZE The highest numbered file descriptor that the server and the resolver diff --git a/contrib/bind/README b/contrib/bind/README index 45b984f..d3831d1 100644 --- a/contrib/bind/README +++ b/contrib/bind/README @@ -1,4 +1,4 @@ -This is the source portion of BIND version 8.1.2-T3B. Its companions are +This is the source portion of BIND version 8.1.2. Its companions are "doc" and "contrib" so you are probably not missing anything. See the CHANGES file for a detailed listing of all changes. See the INSTALL @@ -26,7 +26,7 @@ BIND 8.1.2 Highlights Updates to a number of ports. New ports for QNX, LynxOS, HP-UX 9.x, and HP MPE. - "limit files unlimited" now works as expected on systems where setting + "files unlimited" now works as expected on systems where setting an infinite rlim_max for RLIMIT_NOFILE works. Adding and deleting the same record in the same dynamic update no diff --git a/contrib/bind/Version b/contrib/bind/Version index e6ea01a..6b409d9 100644 --- a/contrib/bind/Version +++ b/contrib/bind/Version @@ -1 +1 @@ -8.1.2-T3B +8.1.2 diff --git a/contrib/bind/bin/named-xfer/Makefile b/contrib/bind/bin/named-xfer/Makefile index 9243c0f..8db8b6e 100644 --- a/contrib/bind/bin/named-xfer/Makefile +++ b/contrib/bind/bin/named-xfer/Makefile @@ -13,7 +13,7 @@ ## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ## SOFTWARE. -# $Id: Makefile,v 8.20 1997/06/19 03:22:09 halley Exp $ +# $Id: Makefile,v 8.21 1998/04/14 00:39:03 halley Exp $ DESTDIR= CC= cc @@ -70,7 +70,7 @@ depend: ${SRCS} ${DESTDIR}${DESTEXEC}: mkdir -p ${DESTDIR}${DESTEXEC} -install: ${DESTDIR}${DESTSBIN} ${PROG} +install: ${DESTDIR}${DESTEXEC} ${PROG} ${INSTALL} ${STRIP} -c -m 755 ${PROG} ${DESTDIR}${DESTEXEC}/${PROG} links: FRC diff --git a/contrib/bind/bin/named/named.conf b/contrib/bind/bin/named/named.conf index 8df9bc1..ab96666 100644 --- a/contrib/bind/bin/named/named.conf +++ b/contrib/bind/bin/named/named.conf @@ -24,7 +24,7 @@ options { check-names master fail; check-names slave warn; check-names response ignore; - host-statistics yes; + host-statistics no; deallocate-on-exit no; // Painstakingly deallocate all // objects when exiting instead of // letting the OS clean up for us. @@ -285,12 +285,15 @@ logging { * }; * * channel default_debug { - * file "named.run"; + * file "named.run"; // note: stderr is used instead + * // of "named.run" if the server + * // is started with the "-f" + * // option. * severity dynamic; // this means log debugging * // at whatever debugging level * // the server is at, and don't * // log anything if not - * // debugging + * // debugging. * }; * * channel null { // this is the bit bucket; diff --git a/contrib/bind/bin/named/ns_config.c b/contrib/bind/bin/named/ns_config.c index ff26156..4f95410 100644 --- a/contrib/bind/bin/named/ns_config.c +++ b/contrib/bind/bin/named/ns_config.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static char rcsid[] = "$Id: ns_config.c,v 8.34 1998/03/27 00:19:47 halley Exp $"; +static char rcsid[] = "$Id: ns_config.c,v 8.35 1998/05/05 19:44:48 halley Exp $"; #endif /* not lint */ /* @@ -2322,6 +2322,8 @@ load_configuration(const char *filename) { ns_debug(ns_log_config, 3, "load configuration %s", filename); + loading = 1; + /* * Clean up any previous configuration and initialize * global data structures we'll be updating. @@ -2363,4 +2365,5 @@ load_configuration(const char *filename) { opensocket_f(); initial_configuration = 0; + loading = 0; } diff --git a/contrib/bind/bin/named/ns_defs.h b/contrib/bind/bin/named/ns_defs.h index f81a383..8d4bba7 100644 --- a/contrib/bind/bin/named/ns_defs.h +++ b/contrib/bind/bin/named/ns_defs.h @@ -1,6 +1,6 @@ /* * from ns.h 4.33 (Berkeley) 8/23/90 - * $Id: ns_defs.h,v 8.38 1998/03/17 03:22:27 halley Exp $ + * $Id: ns_defs.h,v 8.39 1998/04/14 00:35:09 halley Exp $ */ /* @@ -145,7 +145,7 @@ #define OPTION_HOSTSTATS 0x0080 /* Maintain per-host statistics? */ #define OPTION_DEALLOC_ON_EXIT 0x0100 /* Deallocate everything on exit? */ -#define DEFAULT_OPTION_FLAGS (OPTION_HOSTSTATS) +#define DEFAULT_OPTION_FLAGS 0 #ifdef BIND_UPDATE #define SOAINCRINTVL 300 /* default value for the time after which diff --git a/contrib/bind/bin/named/ns_glob.h b/contrib/bind/bin/named/ns_glob.h index 35f3041..8f39c84 100644 --- a/contrib/bind/bin/named/ns_glob.h +++ b/contrib/bind/bin/named/ns_glob.h @@ -1,6 +1,6 @@ /* * from ns.h 4.33 (Berkeley) 8/23/90 - * $Id: ns_glob.h,v 8.34 1998/03/20 01:18:07 halley Exp $ + * $Id: ns_glob.h,v 8.35 1998/05/05 19:44:20 halley Exp $ */ /* Copyright (c) 1986 @@ -315,3 +315,5 @@ DECL char * user_name INIT(NULL); DECL gid_t group_id; DECL char * group_name INIT(NULL); DECL char * chroot_dir INIT(NULL); + +DECL int loading INIT(0); diff --git a/contrib/bind/bin/named/ns_main.c b/contrib/bind/bin/named/ns_main.c index a4b4360..194d368 100644 --- a/contrib/bind/bin/named/ns_main.c +++ b/contrib/bind/bin/named/ns_main.c @@ -1,6 +1,6 @@ #if !defined(lint) && !defined(SABER) static char sccsid[] = "@(#)ns_main.c 4.55 (Berkeley) 7/1/91"; -static char rcsid[] = "$Id: ns_main.c,v 8.65 1998/04/06 23:45:32 halley Exp $"; +static char rcsid[] = "$Id: ns_main.c,v 8.67 1998/04/28 19:17:46 halley Exp $"; #endif /* not lint */ /* @@ -140,10 +140,10 @@ char copyright[] = static LIST(struct _interface) iflist; static int iflist_initialized = 0; - /* UDP receive, TCP send buffer size */ -static const int rbufsize = 8 * 1024, - /* TCP send window size */ - sbufsize = 16 * 1024; + +static const int drbufsize = 8 * 1024, /* UDP rcv buf size */ + dsbufsize = 16 * 1024, /* UDP snd buf size */ + sbufsize = 16 * 1024; /* TCP snd buf size */ static u_int16_t nsid_state; static int needs; @@ -1040,7 +1040,16 @@ getnetconf(int periodic_scan) { if (ifreq.ifr_addr.sa_len == 0) ifreq.ifr_addr.sa_len = 16; #endif +#ifdef HAVE_MINIMUM_IFREQ + ns_debug(ns_log_default, 2, "%s sa_len = %d", + ifreq.ifr_name, (int)ifreq.ifr_addr.sa_len); + cpsize = sizeof ifreq; + if (ifreq.ifr_addr.sa_len > sizeof (struct sockaddr)) + cpsize += (int)ifreq.ifr_addr.sa_len - + (int)(sizeof (struct sockaddr)); +#else cpsize = sizeof ifreq.ifr_name + ifreq.ifr_addr.sa_len; +#endif /* HAVE_MINIMUM_IFREQ */ #elif defined SIOCGIFCONF_ADDR cpsize = sizeof ifreq; #else @@ -1052,14 +1061,14 @@ getnetconf(int periodic_scan) { continue; } #endif - ina = ina_get((u_char *)&((struct sockaddr_in *) - &ifreq.ifr_addr)->sin_addr); if (ifreq.ifr_addr.sa_family != AF_INET) { ns_debug(ns_log_default, 2, - "getnetconf: af %d != INET", - ifreq.ifr_addr.sa_family); + "getnetconf: %s AF %d != INET", + ifreq.ifr_name, ifreq.ifr_addr.sa_family); continue; } + ina = ina_get((u_char *)&((struct sockaddr_in *) + &ifreq.ifr_addr)->sin_addr); ns_debug(ns_log_default, 1, "getnetconf: considering %s [%s]", ifreq.ifr_name, inet_ntoa(ina)); @@ -1284,11 +1293,20 @@ opensocket_d(interface *ifp) { m = sizeof n; if ((getsockopt(ifp->dfd, SOL_SOCKET, SO_RCVBUF, (char*)&n, &m) >= 0) && (m == sizeof n) - && (n < rbufsize)) { + && (n < drbufsize)) { (void) setsockopt(ifp->dfd, SOL_SOCKET, SO_RCVBUF, - (char *)&rbufsize, sizeof(rbufsize)); + (char *)&drbufsize, sizeof drbufsize); } #endif /* SO_RCVBUF */ +#ifndef CANNOT_SET_SNDBUF + if (setsockopt(ifp->dfd, SOL_SOCKET, SO_SNDBUF, + (char*)&dsbufsize, sizeof dsbufsize) < 0) { + ns_info(ns_log_default, + "setsockopt(dfd=%d, SO_SNDBUF, %d): %s", + ifp->dfd, dsbufsize, strerror(errno)); + /* XXX press on regardless, this is not too serious. */ + } +#endif if (bind(ifp->dfd, (struct sockaddr *)&nsa, sizeof nsa)) { ns_error(ns_log_default, "bind(dfd=%d, %s): %s", ifp->dfd, sin_ntoa(nsa), strerror(errno)); diff --git a/contrib/bind/bin/named/ns_maint.c b/contrib/bind/bin/named/ns_maint.c index ad6e7f8..75568ff 100644 --- a/contrib/bind/bin/named/ns_maint.c +++ b/contrib/bind/bin/named/ns_maint.c @@ -1,6 +1,6 @@ #if !defined(lint) && !defined(SABER) static char sccsid[] = "@(#)ns_maint.c 4.39 (Berkeley) 3/2/91"; -static char rcsid[] = "$Id: ns_maint.c,v 8.38 1998/03/16 19:40:25 halley Exp $"; +static char rcsid[] = "$Id: ns_maint.c,v 8.39 1998/04/14 00:34:39 halley Exp $"; #endif /* not lint */ /* @@ -174,6 +174,7 @@ zone_maint(struct zoneinfo *zp) { if (zp->z_serial != 0 && ((zp->z_lastupdate+zp->z_expire) < (u_int32_t)tt.tv_sec)) { zp->z_serial = 0; + /* XXX should we clear Z_AUTH here? */ } if (zp->z_flags & (Z_NEED_RELOAD|Z_NEED_XFER|Z_QSERIAL)) { ns_retrytime(zp, tt.tv_sec); diff --git a/contrib/bind/bin/named/ns_update.c b/contrib/bind/bin/named/ns_update.c index e6fdd8d..48db076 100644 --- a/contrib/bind/bin/named/ns_update.c +++ b/contrib/bind/bin/named/ns_update.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static char rcsid[] = "$Id: ns_update.c,v 8.24 1998/03/20 00:49:16 halley Exp $"; +static char rcsid[] = "$Id: ns_update.c,v 8.26 1998/05/05 19:45:10 halley Exp $"; #endif /* not lint */ /* @@ -770,7 +770,8 @@ class=%s, type=%s, ttl=%d, dp=0x%0x", cancel_soa_update(zp); schedmaint = 1; #ifdef BIND_NOTIFY - sysnotify(zp->z_origin, zp->z_class, T_SOA); + if (!loading) + sysnotify(zp->z_origin, zp->z_class, T_SOA); #endif } else { if (schedule_soa_update(zp, numupdated)) @@ -837,7 +838,6 @@ req_update_private(HEADER *hp, u_char *cp, u_char *eom, u_char *msg, if (matches == 1) { zonenum = zonelist[0]; zp = &zones[zonenum]; - old_serial = get_serial(zp); if (zp->z_class != (int)class || (zp->z_type != z_master && zp->z_type != z_slave)) matches = 0; @@ -916,6 +916,7 @@ req_update_private(HEADER *hp, u_char *cp, u_char *eom, u_char *msg, dname); return (Refuse); } + old_serial = get_serial(zp); ns_debug(ns_log_update, 3, "req_update: update request for zone %s, class %s", zp->z_origin, p_class(class)); @@ -2330,7 +2331,8 @@ set_serial(struct zoneinfo *zp, u_int32_t serial) { zp->z_soaincrtime = 0; zp->z_updatecnt = 0; #ifdef BIND_NOTIFY - sysnotify(zp->z_origin, zp->z_class, T_SOA); + if (!loading) + sysnotify(zp->z_origin, zp->z_class, T_SOA); #endif /* * Note: caller is responsible for scheduling a dump diff --git a/contrib/bind/doc/html/logging.html b/contrib/bind/doc/html/logging.html index 4af8050..4d00219 100644 --- a/contrib/bind/doc/html/logging.html +++ b/contrib/bind/doc/html/logging.html @@ -172,6 +172,8 @@ used is described in the next section, The category phrase. channel default_debug { file "named.run"; # write to named.run in the working directory + # Note: stderr is used instead of "named.run" + # if the server is started with the "-f" option. severity dynamic; # log at the server's current debug level }; @@ -340,7 +342,7 @@ Messages arising from response checking, such as
-Last Updated: $Id: logging.html,v 1.6 1998/03/21 01:03:13 halley Exp $ +Last Updated: $Id: logging.html,v 1.7 1998/04/23 19:58:35 halley Exp $
diff --git a/contrib/bind/doc/html/options.html b/contrib/bind/doc/html/options.html index 5f0ddce..515ee96 100644 --- a/contrib/bind/doc/html/options.html +++ b/contrib/bind/doc/html/options.html @@ -23,6 +23,7 @@ options { [ deallocate-on-exit yes_or_no; ] [ fake-iquery yes_or_no; ] [ fetch-glue yes_or_no; ] + [ host-statistics yes_or_no; ] [ multiple-cnames yes_or_no; ] [ notify yes_or_no; ] [ recursion yes_or_no; ] @@ -136,6 +137,12 @@ a response. fetch-glue no can be used in conjunction with recursion no to prevent the server's cache from growing or becoming corrupted (at the cost of requiring more work from the client). +
host-statistics +
+If yes, then statistics are kept for every host that the +the nameserver interacts with. The default is no. Note: +turning on host-statistics can consume huge amounts of memory. +
multiple-cnames
If yes, then multiple CNAME resource records will be @@ -456,7 +463,7 @@ of all.
-Last Updated: $Id: options.html,v 1.9 1998/03/21 01:02:59 halley Exp $ +Last Updated: $Id: options.html,v 1.10 1998/05/05 19:50:28 halley Exp $
diff --git a/contrib/bind/doc/man/named.8 b/contrib/bind/doc/man/named.8 index e3c0b82..b07dc7a 100644 --- a/contrib/bind/doc/man/named.8 +++ b/contrib/bind/doc/man/named.8 @@ -69,6 +69,9 @@ .Ar config_file .Oc .Op Fl f q r +.Op Fl u Ar user_name +.Op Fl g Ar group_name +.Op Fl t Ar directory .Op Fl w Ar directory .Op Ar config_file .Sh DESCRIPTION @@ -186,6 +189,22 @@ This option can be overridden by and is deprecated in favor of the clause of the configuration file's .Dq Li options statement. +.It Fl u Ar user_name +Specifies the user the server should run as after it initializes. The value +specified may be either a username or a numeric user id. If the +.Dq Fl g +flag is not specified, then the group id used will be the primary group of +the user specified (initgroups() is called, so all of the user's groups will +be available to the server). +.Pp +.It Fl g Ar group_name +Specifies the group the server should run as after it initializes. The value +specified may be either a groupname or a numeric group id. +.Pp +.It Fl t Ar directory +Specifies the directory the server should chroot() into as soon as it is +finshed processing command line arguments. +.Pp .It Fl w Ar directory Sets the working directory of the server. The .Dq Li directory diff --git a/contrib/bind/include/resolv.h b/contrib/bind/include/resolv.h index 7f359fe..3bfd6bb 100644 --- a/contrib/bind/include/resolv.h +++ b/contrib/bind/include/resolv.h @@ -50,7 +50,7 @@ /* * @(#)resolv.h 8.1 (Berkeley) 6/2/93 - * $Id: resolv.h,v 8.11 1998/01/26 23:09:53 halley Exp $ + * $Id: resolv.h,v 8.12 1998/04/28 19:36:46 halley Exp $ */ #ifndef _RESOLV_H_ @@ -297,7 +297,7 @@ const char * p_section __P((int section, int opcode)); int res_update __P((ns_updrec *)); int res_mkupdate __P((ns_updrec *, u_char *, int)); ns_updrec * res_mkupdrec __P((int, const char *, u_int, u_int, u_long)); -void res_freeupdrec(ns_updrec *rrecp); +void res_freeupdrec __P((ns_updrec *)); __END_DECLS #endif /* !_RESOLV_H_ */ diff --git a/contrib/bind/lib/isc/memcluster.c b/contrib/bind/lib/isc/memcluster.c index 0cdd3d4..761fe98 100644 --- a/contrib/bind/lib/isc/memcluster.c +++ b/contrib/bind/lib/isc/memcluster.c @@ -16,7 +16,7 @@ */ #if !defined(LINT) && !defined(CODECENTER) -static char rcsid[] = "$Id: memcluster.c,v 8.7 1998/03/27 00:17:31 halley Exp $"; +static char rcsid[] = "$Id: memcluster.c,v 8.10 1998/05/05 19:00:52 halley Exp $"; #endif /* not lint */ #include "port_before.h" @@ -51,9 +51,14 @@ typedef struct { #define SMALL_SIZE_LIMIT sizeof(memcluster_element) #define P_SIZE sizeof(void *) +#ifndef MEMCLUSTER_LITTLE_MALLOC +#define MEMCLUSTER_BIG_MALLOC 1 +#define NUM_BASIC_BLOCKS 64 +#endif + struct stats { u_long gets; - u_long puts; + u_long totalgets; u_long blocks; u_long freefrags; }; @@ -65,6 +70,9 @@ static size_t mem_target; static size_t mem_target_half; static size_t mem_target_fudge; static memcluster_element ** freelists; +#ifdef MEMCLUSTER_BIG_MALLOC +static memcluster_element * basic_blocks; +#endif static struct stats * stats; /* Forward. */ @@ -100,7 +108,9 @@ meminit(size_t init_max_size, size_t target_size) { memset(freelists, 0, max_size * sizeof (memcluster_element *)); memset(stats, 0, (max_size + 1) * sizeof (struct stats)); - +#ifdef MEMCLUSTER_BIG_MALLOC + basic_blocks = NULL; +#endif return (0); } @@ -119,6 +129,7 @@ __memget(size_t size) { if (size >= max_size || new_size >= max_size) { /* memget() was called on something beyond our upper limit. */ stats[max_size].gets++; + stats[max_size].totalgets++; return (malloc(size)); } @@ -133,6 +144,31 @@ __memget(size_t size) { void *new; char *curr, *next; +#ifdef MEMCLUSTER_BIG_MALLOC + if (basic_blocks == NULL) { + new = malloc(NUM_BASIC_BLOCKS * mem_target); + if (new == NULL) { + errno = ENOMEM; + return (NULL); + } + curr = new; + next = curr + mem_target; + for (i = 0; i < (NUM_BASIC_BLOCKS - 1); i++) { + ((memcluster_element *)curr)->next = next; + curr = next; + next += mem_target; + } + /* + * curr is now pointing at the last block in the + * array. + */ + ((memcluster_element *)curr)->next = NULL; + basic_blocks = new; + } + total_size = mem_target; + new = basic_blocks; + basic_blocks = basic_blocks->next; +#else if (new_size > mem_target_half) total_size = mem_target_fudge; else @@ -142,6 +178,7 @@ __memget(size_t size) { errno = ENOMEM; return (NULL); } +#endif frags = total_size / new_size; stats[new_size].blocks++; stats[new_size].freefrags += frags; @@ -169,6 +206,7 @@ __memget(size_t size) { * max_size. */ stats[size].gets++; + stats[size].totalgets++; stats[new_size].freefrags--; return (ret); } @@ -190,8 +228,8 @@ __memput(void *mem, size_t size) { if (size == max_size || new_size >= max_size) { /* memput() called on something beyond our upper limit */ free(mem); - INSIST(stats[max_size].puts < stats[max_size].gets); - stats[max_size].puts++; + INSIST(stats[max_size].gets != 0); + stats[max_size].gets--; return; } @@ -205,8 +243,8 @@ __memput(void *mem, size_t size) { * max. size (max_size) ends up getting recorded as a call to * max_size. */ - INSIST(stats[size].puts < stats[size].gets); - stats[size].puts++; + INSIST(stats[size].gets != 0); + stats[size].gets--; stats[new_size].freefrags++; } @@ -238,12 +276,11 @@ memstats(FILE *out) { for (i = 1; i <= max_size; i++) { const struct stats *s = &stats[i]; - if (s->gets == 0 && s->puts == 0) + if (s->totalgets == 0 && s->gets == 0) continue; - INSIST(s->gets >= s->puts); - fprintf(out, "%s%5d: %11lu get, %11lu put, %11lu rem", + fprintf(out, "%s%5d: %11lu gets, %11lu rem", (i == max_size) ? ">=" : " ", - i, s->gets, s->puts, s->gets - s->puts); + i, s->totalgets, s->gets); if (s->blocks != 0) fprintf(out, " (%lu bl, %lu ff)", s->blocks, s->freefrags); diff --git a/contrib/bind/port/freebsd/include/port_after.h b/contrib/bind/port/freebsd/include/port_after.h index c2bc49a..20c92b5 100644 --- a/contrib/bind/port/freebsd/include/port_after.h +++ b/contrib/bind/port/freebsd/include/port_after.h @@ -7,6 +7,7 @@ #define HAVE_FCHMOD #define NEED_PSELECT #define HAVE_SA_LEN +#define HAVE_MINIMUM_IFREQ #define USE_LOG_CONS #define HAVE_CHROOT #define CAN_CHANGE_ID -- cgit v1.1