]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
* Commit Andres Kroonmaa's chunked memory pool allocator
authoradrian <>
Sat, 6 Apr 2002 15:49:21 +0000 (15:49 +0000)
committeradrian <>
Sat, 6 Apr 2002 15:49:21 +0000 (15:49 +0000)
* bootstrap

55 files changed:
Makefile.in
configure
configure.in
doc/Makefile.in
doc/Programming-Guide/prog-guide.sgml
errors/Makefile.in
helpers/basic_auth/LDAP/Makefile.in
helpers/basic_auth/MSNT/Makefile.in
helpers/basic_auth/Makefile.in
helpers/basic_auth/NCSA/Makefile.in
helpers/basic_auth/PAM/Makefile.in
helpers/basic_auth/SASL/Makefile.in
helpers/basic_auth/SMB/Makefile.in
helpers/basic_auth/YP/Makefile.in
helpers/basic_auth/getpwnam/Makefile.in
helpers/basic_auth/multi-domain-NTLM/Makefile.in
helpers/digest_auth/Makefile.in
helpers/digest_auth/password/Makefile.in
helpers/ntlm_auth/Makefile.in
helpers/ntlm_auth/SMB/Makefile.in
helpers/ntlm_auth/fakeauth/Makefile.in
helpers/ntlm_auth/no_check/Makefile.in
icons/Makefile.in
include/MemPool.h [new file with mode: 0644]
include/autoconf.h.in
include/memMeter.h [new file with mode: 0644]
include/splay.h
include/util.h
lib/Makefile.am
lib/Makefile.in
lib/MemPool.c [new file with mode: 0644]
lib/splay.c
lib/util.c
src/Makefile.am
src/Makefile.in
src/auth/Makefile.in
src/auth/basic/auth_basic.cc
src/auth/digest/auth_digest.cc
src/auth/ntlm/auth_ntlm.cc
src/defines.h
src/fs/Makefile.in
src/fs/coss/store_dir_coss.cc
src/fs/diskd/Makefile.in
src/fs/diskd/store_dir_diskd.cc
src/fs/ufs/store_dir_ufs.cc
src/main.cc
src/mem.cc
src/protos.h
src/repl/Makefile.in
src/repl/lru/store_repl_lru.cc
src/squid.h
src/stat.cc
src/structs.h
src/tools.cc
src/typedefs.h

index 5a8726cd89db906bb098788e2ebdb52d7901b2c5..2b78f06a169664df4bb9862e3d6f93360a270c5f 100644 (file)
@@ -14,7 +14,7 @@
 @SET_MAKE@
 
 #
-# $Id: Makefile.in,v 1.10 2002/03/30 16:48:31 hno Exp $
+# $Id: Makefile.in,v 1.11 2002/04/06 08:49:21 adrian Exp $
 #
 
 SHELL = @SHELL@
index a57e146b7ea54e77785cca63087c2e423c30555e..661759a46b8bfba9986295ab1be79cba925829ac 100755 (executable)
--- a/configure
+++ b/configure
@@ -188,6 +188,8 @@ ac_help="$ac_help
   --enable-ntlm-fail-open Enable NTLM fail open, where a helper that fails one of the
                           Authentication steps can allow squid to still authenticate
                           the user."
+ac_help="$ac_help
+  --disable-mempools      Disable memPools"
 ac_help="$ac_help
   --disable-unlinkd       Do not use unlinkd"
 ac_help="$ac_help
@@ -744,7 +746,7 @@ am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd`
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:748: checking for a BSD compatible install" >&5
+echo "configure:750: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -797,7 +799,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:801: checking whether build environment is sane" >&5
+echo "configure:803: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftest.file
@@ -868,7 +870,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:872: checking for $ac_word" >&5
+echo "configure:874: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -898,7 +900,7 @@ test -n "$AWK" && break
 done
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:902: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:904: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1019,7 +1021,7 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
 
 # From configure.in Revision: 1.260 
 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:1023: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:1025: checking whether to enable maintainer-specific portions of Makefiles" >&5
     # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
 if test "${enable_maintainer_mode+set}" = set; then
   enableval="$enable_maintainer_mode"
@@ -1051,7 +1053,7 @@ PRESET_CFLAGS="$CFLAGS"
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1055: checking for $ac_word" >&5
+echo "configure:1057: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1081,7 +1083,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1085: checking for $ac_word" >&5
+echo "configure:1087: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1132,7 +1134,7 @@ fi
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1136: checking for $ac_word" >&5
+echo "configure:1138: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1164,7 +1166,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1168: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1170: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1175,12 +1177,12 @@ cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 1179 "configure"
+#line 1181 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -1206,12 +1208,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1210: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1212: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1215: checking whether we are using GNU C" >&5
+echo "configure:1217: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1220,7 +1222,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1224: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1226: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -1239,7 +1241,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1243: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1245: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1278,7 +1280,7 @@ doit:
 END
 # If we don't find an include directive, just comment out the code.
 echo $ac_n "checking for style of include used by $am_make""... $ac_c" 1>&6
-echo "configure:1282: checking for style of include used by $am_make" >&5
+echo "configure:1284: checking for style of include used by $am_make" >&5
 am__include='#'
 am__quote=
 _am_result=none
@@ -1312,7 +1314,7 @@ rm -f confinc confmf
 depcc="$CC"   am_compiler_list=
 
 echo $ac_n "checking dependency style of $depcc""... $ac_c" 1>&6
-echo "configure:1316: checking dependency style of $depcc" >&5
+echo "configure:1318: checking dependency style of $depcc" >&5
 if eval "test \"`echo '$''{'am_cv_CC_dependencies_compiler_type'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1380,10 +1382,10 @@ CCDEPMODE="depmode=$am_cv_CC_dependencies_compiler_type"
 
 if test "x$CC" != xcc; then
   echo $ac_n "checking whether $CC and cc understand -c and -o together""... $ac_c" 1>&6
-echo "configure:1384: checking whether $CC and cc understand -c and -o together" >&5
+echo "configure:1386: checking whether $CC and cc understand -c and -o together" >&5
 else
   echo $ac_n "checking whether cc understands -c and -o together""... $ac_c" 1>&6
-echo "configure:1387: checking whether cc understands -c and -o together" >&5
+echo "configure:1389: checking whether cc understands -c and -o together" >&5
 fi
 set dummy $CC; ac_cc="`echo $2 |
                       sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`"
@@ -1395,16 +1397,16 @@ else
 # We do the test twice because some compilers refuse to overwrite an
 # existing .o file with -o, though they will create one.
 ac_try='${CC-cc} -c conftest.c -o conftest.o 1>&5'
-if { (eval echo configure:1399: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
-   test -f conftest.o && { (eval echo configure:1400: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
+if { (eval echo configure:1401: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
+   test -f conftest.o && { (eval echo configure:1402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
 then
   eval ac_cv_prog_cc_${ac_cc}_c_o=yes
   if test "x$CC" != xcc; then
     # Test first that cc exists at all.
-    if { ac_try='cc -c conftest.c 1>&5'; { (eval echo configure:1405: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+    if { ac_try='cc -c conftest.c 1>&5'; { (eval echo configure:1407: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
       ac_try='cc -c conftest.c -o conftest.o 1>&5'
-      if { (eval echo configure:1407: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
-        test -f conftest.o && { (eval echo configure:1408: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
+      if { (eval echo configure:1409: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
+        test -f conftest.o && { (eval echo configure:1410: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
       then
         # cc works too.
         :
@@ -1450,7 +1452,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:1454: checking host system type" >&5
+echo "configure:1456: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -1477,12 +1479,12 @@ REGEXLIB=''     # -lregex
 LIBREGEX=''    # libregex.a
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:1481: checking for Cygwin environment" >&5
+echo "configure:1483: checking for Cygwin environment" >&5
 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1486 "configure"
+#line 1488 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1493,7 +1495,7 @@ int main() {
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:1497: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1499: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -1510,19 +1512,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6
 CYGWIN=
 test "$ac_cv_cygwin" = yes && CYGWIN=yes
 echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:1514: checking for mingw32 environment" >&5
+echo "configure:1516: checking for mingw32 environment" >&5
 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1519 "configure"
+#line 1521 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:1526: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1528: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -1541,7 +1543,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1545: checking for executable suffix" >&5
+echo "configure:1547: checking for executable suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1551,10 +1553,10 @@ else
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:1555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:1557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
-      *.c | *.o | *.obj) ;;
+      *.c | *.C | *.o | *.obj) ;;
       *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
       esac
     done
@@ -1572,13 +1574,13 @@ echo "$ac_t""${ac_cv_exeext}" 1>&6
 ac_exeext=$EXEEXT
 
 echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:1576: checking for object suffix" >&5
+echo "configure:1578: checking for object suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   rm -f conftest*
 echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:1582: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1584: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   for ac_file in conftest.*; do
     case $ac_file in
     *.c) ;;
@@ -1653,6 +1655,298 @@ cat >> confdefs.h <<EOF
 EOF
 
 
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1662: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="gcc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1692: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_prog_rejected=no
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+        ac_prog_rejected=yes
+       continue
+      fi
+      ac_cv_prog_CC="cc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# -gt 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    set dummy "$ac_dir/$ac_word" "$@"
+    shift
+    ac_cv_prog_CC="$@"
+  fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  if test -z "$CC"; then
+    case "`uname -s`" in
+    *win32* | *WIN32*)
+      # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1743: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="cl"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+ ;;
+    esac
+  fi
+  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1775: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 1786 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:1791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  ac_cv_prog_cc_works=yes
+  # If we can't run a trivial program, we are probably using a cross compiler.
+  if (./conftest; exit) 2>/dev/null; then
+    ac_cv_prog_cc_cross=no
+  else
+    ac_cv_prog_cc_cross=yes
+  fi
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1817: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1822: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1831: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+  ac_cv_prog_gcc=yes
+else
+  ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1850: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+  ac_cv_prog_cc_g=yes
+else
+  ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+
+depcc="$CC"   am_compiler_list=
+
+echo $ac_n "checking dependency style of $depcc""... $ac_c" 1>&6
+echo "configure:1884: checking dependency style of $depcc" >&5
+if eval "test \"`echo '$''{'am_cv_CC_dependencies_compiler_type'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    echo '#include "conftest.h"' > conftest.c
+    echo 'int i;' > conftest.h
+    echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=conftest.c object=conftest.o \
+       depfile=conftest.Po tmpdepfile=conftest.TPo \
+       $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
+       grep conftest.h conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      am_cv_CC_dependencies_compiler_type=$depmode
+      break
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+
+echo "$ac_t""$am_cv_CC_dependencies_compiler_type" 1>&6
+CCDEPMODE="depmode=$am_cv_CC_dependencies_compiler_type"
+
+
+
 case "$host" in
     mab-next-nextstep3)
        CC="$CC -arch m68k -arch i486 -arch hppa -arch sparc"
@@ -1789,6 +2083,10 @@ if test "$use_dlmalloc" = yes; then
     ac_cv_header_gnumalloc_h="no"
     ac_cv_lib_malloc="no"
     ac_cv_enabled_dlmalloc="yes"
+    cat >> confdefs.h <<\EOF
+#define USE_DLMALLOC 1
+EOF
+
 fi
 
 
@@ -2782,6 +3080,25 @@ EOF
 fi
 
 
+# Check whether --enable-mempools or --disable-mempools was given.
+if test "${enable_mempools+set}" = set; then
+  enableval="$enable_mempools"
+   if test "$enableval" = "no" ; then
+    echo "memPools disabled"
+    cat >> confdefs.h <<\EOF
+#define DISABLE_POOLS 1
+EOF
+
+  else
+    cat >> confdefs.h <<\EOF
+#define DISABLE_POOLS 0
+EOF
+
+  fi
+
+fi
+
+
 # Check whether --enable-unlinkd or --disable-unlinkd was given.
 if test "${enable_unlinkd+set}" = set; then
   enableval="$enable_unlinkd"
@@ -2875,7 +3192,7 @@ case "$host" in
 esac
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2879: checking how to run the C preprocessor" >&5
+echo "configure:3196: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -2890,13 +3207,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 2894 "configure"
+#line 3211 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2900: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3217: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -2907,13 +3224,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 2911 "configure"
+#line 3228 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2917: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3234: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -2924,13 +3241,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 2928 "configure"
+#line 3245 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2934: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3251: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -2966,7 +3283,7 @@ echo "$ac_t""$CPP" 1>&6
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:2970: checking for a BSD compatible install" >&5
+echo "configure:3287: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3021,7 +3338,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3025: checking for $ac_word" >&5
+echo "configure:3342: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3049,7 +3366,7 @@ else
 fi
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:3053: checking whether ln -s works" >&5
+echo "configure:3370: checking whether ln -s works" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3072,7 +3389,7 @@ fi
 # Extract the first word of "sh", so it can be a program name with args.
 set dummy sh; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3076: checking for $ac_word" >&5
+echo "configure:3393: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_SH'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3108,7 +3425,7 @@ fi
 # Extract the first word of "false", so it can be a program name with args.
 set dummy false; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3112: checking for $ac_word" >&5
+echo "configure:3429: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_FALSE'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3144,7 +3461,7 @@ fi
 # Extract the first word of "true", so it can be a program name with args.
 set dummy true; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3148: checking for $ac_word" >&5
+echo "configure:3465: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_TRUE'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3180,7 +3497,7 @@ fi
 # Extract the first word of "rm", so it can be a program name with args.
 set dummy rm; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3184: checking for $ac_word" >&5
+echo "configure:3501: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3216,7 +3533,7 @@ fi
 # Extract the first word of "mv", so it can be a program name with args.
 set dummy mv; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3220: checking for $ac_word" >&5
+echo "configure:3537: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_MV'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3252,7 +3569,7 @@ fi
 # Extract the first word of "mkdir", so it can be a program name with args.
 set dummy mkdir; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3256: checking for $ac_word" >&5
+echo "configure:3573: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_MKDIR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3288,7 +3605,7 @@ fi
 # Extract the first word of "ln", so it can be a program name with args.
 set dummy ln; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3292: checking for $ac_word" >&5
+echo "configure:3609: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_LN'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3324,7 +3641,7 @@ fi
 # Extract the first word of "perl", so it can be a program name with args.
 set dummy perl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3328: checking for $ac_word" >&5
+echo "configure:3645: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3360,7 +3677,7 @@ fi
 # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3364: checking for $ac_word" >&5
+echo "configure:3681: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3420,12 +3737,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:3424: checking for $ac_hdr that defines DIR" >&5
+echo "configure:3741: checking for $ac_hdr that defines DIR" >&5
 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3429 "configure"
+#line 3746 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -3433,7 +3750,7 @@ int main() {
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:3437: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3754: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -3458,7 +3775,7 @@ done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
 echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:3462: checking for opendir in -ldir" >&5
+echo "configure:3779: checking for opendir in -ldir" >&5
 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3466,7 +3783,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3470 "configure"
+#line 3787 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3477,7 +3794,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:3481: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3499,7 +3816,7 @@ fi
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:3503: checking for opendir in -lx" >&5
+echo "configure:3820: checking for opendir in -lx" >&5
 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3507,7 +3824,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3511 "configure"
+#line 3828 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3518,7 +3835,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:3522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3541,12 +3858,12 @@ fi
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:3545: checking for ANSI C header files" >&5
+echo "configure:3862: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3550 "configure"
+#line 3867 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -3554,7 +3871,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3558: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3875: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3571,7 +3888,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 3575 "configure"
+#line 3892 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -3589,7 +3906,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 3593 "configure"
+#line 3910 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -3610,7 +3927,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 3614 "configure"
+#line 3931 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -3621,7 +3938,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:3625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -3726,17 +4043,17 @@ for ac_hdr in \
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3730: checking for $ac_hdr" >&5
+echo "configure:4047: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3735 "configure"
+#line 4052 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3740: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4057: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3764,12 +4081,12 @@ done
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:3768: checking for working const" >&5
+echo "configure:4085: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3773 "configure"
+#line 4090 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3818,7 +4135,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:3822: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4139: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -3839,14 +4156,14 @@ EOF
 fi
 
 echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:3843: checking whether byte ordering is bigendian" >&5
+echo "configure:4160: checking whether byte ordering is bigendian" >&5
 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_bigendian=unknown
 # See if sys/param.h defines the BYTE_ORDER macro.
 cat > conftest.$ac_ext <<EOF
-#line 3850 "configure"
+#line 4167 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3857,11 +4174,11 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3861: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4178: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   # It does; now see whether it defined to BIG_ENDIAN or not.
 cat > conftest.$ac_ext <<EOF
-#line 3865 "configure"
+#line 4182 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3872,7 +4189,7 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3876: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_bigendian=yes
 else
@@ -3892,7 +4209,7 @@ if test "$cross_compiling" = yes; then
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 3896 "configure"
+#line 4213 "configure"
 #include "confdefs.h"
 main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
@@ -3905,7 +4222,7 @@ main () {
   exit (u.c[sizeof (long) - 1] == 1);
 }
 EOF
-if { (eval echo configure:3909: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_bigendian=no
 else
@@ -3930,20 +4247,20 @@ fi
 
 
 echo $ac_n "checking if ANSI prototypes work""... $ac_c" 1>&6
-echo "configure:3934: checking if ANSI prototypes work" >&5
+echo "configure:4251: checking if ANSI prototypes work" >&5
 if eval "test \"`echo '$''{'ac_cv_have_ansi_prototypes'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
   cat > conftest.$ac_ext <<EOF
-#line 3940 "configure"
+#line 4257 "configure"
 #include "confdefs.h"
 int foo(char *); int foo (char *bar) {return 1;}
 int main() {
 foo("bar")
 ; return 0; }
 EOF
-if { (eval echo configure:3947: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4264: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_have_ansi_prototypes="yes"
 else
@@ -3965,13 +4282,13 @@ EOF
 fi
 
 echo $ac_n "checking for tm->tm_gmtoff""... $ac_c" 1>&6
-echo "configure:3969: checking for tm->tm_gmtoff" >&5
+echo "configure:4286: checking for tm->tm_gmtoff" >&5
 if eval "test \"`echo '$''{'ac_cv_have_tm_gmoff'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
   cat > conftest.$ac_ext <<EOF
-#line 3975 "configure"
+#line 4292 "configure"
 #include "confdefs.h"
 #include <time.h>
 #include <sys/time.h>
@@ -3980,7 +4297,7 @@ struct tm foo;
       foo.tm_gmtoff = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:3984: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4301: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_have_tm_gmoff="yes"
 else
@@ -4002,13 +4319,13 @@ EOF
 fi
 
 echo $ac_n "checking for struct mallinfo""... $ac_c" 1>&6
-echo "configure:4006: checking for struct mallinfo" >&5
+echo "configure:4323: checking for struct mallinfo" >&5
 if eval "test \"`echo '$''{'ac_cv_have_struct_mallinfo'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
   cat > conftest.$ac_ext <<EOF
-#line 4012 "configure"
+#line 4329 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if HAVE_MALLOC_H
@@ -4026,7 +4343,7 @@ struct mallinfo foo;
     foo.keepcost = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:4030: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4347: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_have_struct_mallinfo="yes"
 else
@@ -4048,13 +4365,13 @@ EOF
 fi
 
 echo $ac_n "checking for extended mallinfo""... $ac_c" 1>&6
-echo "configure:4052: checking for extended mallinfo" >&5
+echo "configure:4369: checking for extended mallinfo" >&5
 if eval "test \"`echo '$''{'ac_cv_have_ext_mallinfo'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
   cat > conftest.$ac_ext <<EOF
-#line 4058 "configure"
+#line 4375 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <malloc.h>
@@ -4063,7 +4380,7 @@ struct mallinfo foo;
       foo.mxfast = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:4067: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4384: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_have_ext_mallinfo="yes"
 else
@@ -4085,13 +4402,13 @@ EOF
 fi
 
 echo $ac_n "checking for struct rusage""... $ac_c" 1>&6
-echo "configure:4089: checking for struct rusage" >&5
+echo "configure:4406: checking for struct rusage" >&5
 if eval "test \"`echo '$''{'ac_cv_have_struct_rusage'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
   cat > conftest.$ac_ext <<EOF
-#line 4095 "configure"
+#line 4412 "configure"
 #include "confdefs.h"
 
 #if HAVE_SYS_TIME_H
@@ -4104,7 +4421,7 @@ int main() {
 struct rusage R;
 ; return 0; }
 EOF
-if { (eval echo configure:4108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4425: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_have_struct_rusage="yes"
 else
@@ -4126,13 +4443,13 @@ EOF
 fi
 
 echo $ac_n "checking for ip->ip_hl""... $ac_c" 1>&6
-echo "configure:4130: checking for ip->ip_hl" >&5
+echo "configure:4447: checking for ip->ip_hl" >&5
 if eval "test \"`echo '$''{'ac_cv_have_ip_hl'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
   cat > conftest.$ac_ext <<EOF
-#line 4136 "configure"
+#line 4453 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <netinet/in.h>
@@ -4151,7 +4468,7 @@ struct iphdr ip;
       ip.ip_hl= 0;
 ; return 0; }
 EOF
-if { (eval echo configure:4155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4472: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_have_ip_hl="yes"
 else
@@ -4173,7 +4490,7 @@ EOF
 fi
 
 echo $ac_n "checking size of void *""... $ac_c" 1>&6
-echo "configure:4177: checking size of void *" >&5
+echo "configure:4494: checking size of void *" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_void_p'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4181,7 +4498,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4185 "configure"
+#line 4502 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4192,7 +4509,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4513: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_void_p=`cat conftestval`
 else
@@ -4212,7 +4529,7 @@ EOF
 
 
 echo $ac_n "checking size of short""... $ac_c" 1>&6
-echo "configure:4216: checking size of short" >&5
+echo "configure:4533: checking size of short" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4220,7 +4537,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4224 "configure"
+#line 4541 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4231,7 +4548,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_short=`cat conftestval`
 else
@@ -4251,7 +4568,7 @@ EOF
 
 
 echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:4255: checking size of int" >&5
+echo "configure:4572: checking size of int" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4259,7 +4576,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4263 "configure"
+#line 4580 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4270,7 +4587,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_int=`cat conftestval`
 else
@@ -4290,7 +4607,7 @@ EOF
 
 
 echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:4294: checking size of long" >&5
+echo "configure:4611: checking size of long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4298,7 +4615,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4302 "configure"
+#line 4619 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4309,7 +4626,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_long=`cat conftestval`
 else
@@ -4329,7 +4646,7 @@ EOF
 
 
 echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:4333: checking size of long long" >&5
+echo "configure:4650: checking size of long long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4337,7 +4654,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4341 "configure"
+#line 4658 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4348,7 +4665,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_long_long=`cat conftestval`
 else
@@ -4368,7 +4685,7 @@ EOF
 
 
 echo $ac_n "checking size of __int64""... $ac_c" 1>&6
-echo "configure:4372: checking size of __int64" >&5
+echo "configure:4689: checking size of __int64" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof___int64'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4376,7 +4693,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4380 "configure"
+#line 4697 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4387,7 +4704,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4708: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof___int64=`cat conftestval`
 else
@@ -4407,7 +4724,7 @@ EOF
 
 
 echo $ac_n "checking size of int16_t""... $ac_c" 1>&6
-echo "configure:4411: checking size of int16_t" >&5
+echo "configure:4728: checking size of int16_t" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_int16_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4415,7 +4732,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4419 "configure"
+#line 4736 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4426,7 +4743,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_int16_t=`cat conftestval`
 else
@@ -4446,7 +4763,7 @@ EOF
 
 
 echo $ac_n "checking size of uint16_t""... $ac_c" 1>&6
-echo "configure:4450: checking size of uint16_t" >&5
+echo "configure:4767: checking size of uint16_t" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_uint16_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4454,7 +4771,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4458 "configure"
+#line 4775 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4465,7 +4782,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_uint16_t=`cat conftestval`
 else
@@ -4485,7 +4802,7 @@ EOF
 
 
 echo $ac_n "checking size of u_int16_t""... $ac_c" 1>&6
-echo "configure:4489: checking size of u_int16_t" >&5
+echo "configure:4806: checking size of u_int16_t" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_u_int16_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4493,7 +4810,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4497 "configure"
+#line 4814 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4504,7 +4821,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_u_int16_t=`cat conftestval`
 else
@@ -4524,7 +4841,7 @@ EOF
 
 
 echo $ac_n "checking size of int32_t""... $ac_c" 1>&6
-echo "configure:4528: checking size of int32_t" >&5
+echo "configure:4845: checking size of int32_t" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_int32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4532,7 +4849,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4536 "configure"
+#line 4853 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4543,7 +4860,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4864: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_int32_t=`cat conftestval`
 else
@@ -4563,7 +4880,7 @@ EOF
 
 
 echo $ac_n "checking size of uint32_t""... $ac_c" 1>&6
-echo "configure:4567: checking size of uint32_t" >&5
+echo "configure:4884: checking size of uint32_t" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_uint32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4571,7 +4888,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4575 "configure"
+#line 4892 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4582,7 +4899,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_uint32_t=`cat conftestval`
 else
@@ -4602,7 +4919,7 @@ EOF
 
 
 echo $ac_n "checking size of u_int32_t""... $ac_c" 1>&6
-echo "configure:4606: checking size of u_int32_t" >&5
+echo "configure:4923: checking size of u_int32_t" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_u_int32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4610,7 +4927,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4614 "configure"
+#line 4931 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4621,7 +4938,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_u_int32_t=`cat conftestval`
 else
@@ -4641,7 +4958,7 @@ EOF
 
 
 echo $ac_n "checking size of int64_t""... $ac_c" 1>&6
-echo "configure:4645: checking size of int64_t" >&5
+echo "configure:4962: checking size of int64_t" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_int64_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4649,7 +4966,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4653 "configure"
+#line 4970 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4660,7 +4977,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_int64_t=`cat conftestval`
 else
@@ -4680,7 +4997,7 @@ EOF
 
 
 echo $ac_n "checking size of uint64_t""... $ac_c" 1>&6
-echo "configure:4684: checking size of uint64_t" >&5
+echo "configure:5001: checking size of uint64_t" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_uint64_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4688,7 +5005,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4692 "configure"
+#line 5009 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4699,7 +5016,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_uint64_t=`cat conftestval`
 else
@@ -4719,7 +5036,7 @@ EOF
 
 
 echo $ac_n "checking size of u_int64_t""... $ac_c" 1>&6
-echo "configure:4723: checking size of u_int64_t" >&5
+echo "configure:5040: checking size of u_int64_t" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_u_int64_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4727,7 +5044,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4731 "configure"
+#line 5048 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4738,7 +5055,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_u_int64_t=`cat conftestval`
 else
@@ -4760,12 +5077,12 @@ EOF
 
 if test "x$ac_cv_sizeof_short" = "x2"; then
        echo $ac_n "checking for int16_t""... $ac_c" 1>&6
-echo "configure:4764: checking for int16_t" >&5
+echo "configure:5081: checking for int16_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_int16_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4769 "configure"
+#line 5086 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4794,12 +5111,12 @@ fi
 
 elif test "x$ac_cv_sizeof_int" = "x2"; then
        echo $ac_n "checking for int16_t""... $ac_c" 1>&6
-echo "configure:4798: checking for int16_t" >&5
+echo "configure:5115: checking for int16_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_int16_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4803 "configure"
+#line 5120 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4829,12 +5146,12 @@ fi
 fi
 if test "x$ac_cv_sizeof_uint16_t" = "x2"; then
        echo $ac_n "checking for u_int16_t""... $ac_c" 1>&6
-echo "configure:4833: checking for u_int16_t" >&5
+echo "configure:5150: checking for u_int16_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_u_int16_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4838 "configure"
+#line 5155 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4863,12 +5180,12 @@ fi
 
 elif test "x$ac_cv_sizeof_short" = "x2"; then
        echo $ac_n "checking for u_int16_t""... $ac_c" 1>&6
-echo "configure:4867: checking for u_int16_t" >&5
+echo "configure:5184: checking for u_int16_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_u_int16_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4872 "configure"
+#line 5189 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4897,12 +5214,12 @@ fi
 
 elif test "x$ac_cv_sizeof_int" = "x2"; then
        echo $ac_n "checking for u_int16_t""... $ac_c" 1>&6
-echo "configure:4901: checking for u_int16_t" >&5
+echo "configure:5218: checking for u_int16_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_u_int16_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4906 "configure"
+#line 5223 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4932,12 +5249,12 @@ fi
 fi
 if test "x$ac_cv_sizeof_int" = "x4"; then
        echo $ac_n "checking for int32_t""... $ac_c" 1>&6
-echo "configure:4936: checking for int32_t" >&5
+echo "configure:5253: checking for int32_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_int32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4941 "configure"
+#line 5258 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4966,12 +5283,12 @@ fi
 
 elif "x$ac_cv_sizeof_long" = "x4"; then
        echo $ac_n "checking for int32_t""... $ac_c" 1>&6
-echo "configure:4970: checking for int32_t" >&5
+echo "configure:5287: checking for int32_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_int32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4975 "configure"
+#line 5292 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5001,12 +5318,12 @@ fi
 fi
 if test "x$ac_cv_sizeof_uint32_t" = "x4"; then
        echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
-echo "configure:5005: checking for u_int32_t" >&5
+echo "configure:5322: checking for u_int32_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5010 "configure"
+#line 5327 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5035,12 +5352,12 @@ fi
 
 elif test "x$ac_cv_sizeof_int" = "x4"; then
        echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
-echo "configure:5039: checking for u_int32_t" >&5
+echo "configure:5356: checking for u_int32_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5044 "configure"
+#line 5361 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5069,12 +5386,12 @@ fi
 
 elif test "x$ac_cv_sizeof_long" = "x4"; then
        echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
-echo "configure:5073: checking for u_int32_t" >&5
+echo "configure:5390: checking for u_int32_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5078 "configure"
+#line 5395 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5104,12 +5421,12 @@ fi
 fi
 if test "x$ac_cv_sizeof_long" = "x8"; then
        echo $ac_n "checking for int64_t""... $ac_c" 1>&6
-echo "configure:5108: checking for int64_t" >&5
+echo "configure:5425: checking for int64_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_int64_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5113 "configure"
+#line 5430 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5138,12 +5455,12 @@ fi
 
 elif test "x$ac_cv_sizeof_long_long" = "x8"; then
        echo $ac_n "checking for int64_t""... $ac_c" 1>&6
-echo "configure:5142: checking for int64_t" >&5
+echo "configure:5459: checking for int64_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_int64_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5147 "configure"
+#line 5464 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5172,12 +5489,12 @@ fi
 
 elif test "x$ac_cv_sizeof___int64" = "x8"; then
        echo $ac_n "checking for int64_t""... $ac_c" 1>&6
-echo "configure:5176: checking for int64_t" >&5
+echo "configure:5493: checking for int64_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_int64_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5181 "configure"
+#line 5498 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5207,12 +5524,12 @@ fi
 fi
 if test "x$ac_cv_sizeof_uint64_t" = "x8"; then
        echo $ac_n "checking for u_int64_t""... $ac_c" 1>&6
-echo "configure:5211: checking for u_int64_t" >&5
+echo "configure:5528: checking for u_int64_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_u_int64_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5216 "configure"
+#line 5533 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5241,12 +5558,12 @@ fi
 
 elif test "x$ac_cv_sizeof_long" = "x8"; then
        echo $ac_n "checking for u_int64_t""... $ac_c" 1>&6
-echo "configure:5245: checking for u_int64_t" >&5
+echo "configure:5562: checking for u_int64_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_u_int64_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5250 "configure"
+#line 5567 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5275,12 +5592,12 @@ fi
 
 elif test "x$ac_cv_sizeof_long_long" = "x8"; then
        echo $ac_n "checking for u_int64_t""... $ac_c" 1>&6
-echo "configure:5279: checking for u_int64_t" >&5
+echo "configure:5596: checking for u_int64_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_u_int64_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5284 "configure"
+#line 5601 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5309,12 +5626,12 @@ fi
 
 elif test "x$ac_cv_sizeof___int64" = "x8"; then
        echo $ac_n "checking for int64_t""... $ac_c" 1>&6
-echo "configure:5313: checking for int64_t" >&5
+echo "configure:5630: checking for int64_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_int64_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5318 "configure"
+#line 5635 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5344,12 +5661,12 @@ fi
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:5348: checking for pid_t" >&5
+echo "configure:5665: checking for pid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5353 "configure"
+#line 5670 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5377,12 +5694,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:5381: checking for size_t" >&5
+echo "configure:5698: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5386 "configure"
+#line 5703 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5410,12 +5727,12 @@ EOF
 fi
 
 echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
-echo "configure:5414: checking for ssize_t" >&5
+echo "configure:5731: checking for ssize_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5419 "configure"
+#line 5736 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5443,12 +5760,12 @@ EOF
 fi
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:5447: checking for off_t" >&5
+echo "configure:5764: checking for off_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5452 "configure"
+#line 5769 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5476,12 +5793,12 @@ EOF
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:5480: checking for mode_t" >&5
+echo "configure:5797: checking for mode_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5485 "configure"
+#line 5802 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5509,12 +5826,12 @@ EOF
 fi
 
 echo $ac_n "checking for fd_mask""... $ac_c" 1>&6
-echo "configure:5513: checking for fd_mask" >&5
+echo "configure:5830: checking for fd_mask" >&5
 if eval "test \"`echo '$''{'ac_cv_type_fd_mask'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5518 "configure"
+#line 5835 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5545,19 +5862,19 @@ fi
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
 echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:5549: checking for working alloca.h" >&5
+echo "configure:5866: checking for working alloca.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5554 "configure"
+#line 5871 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:5561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_header_alloca_h=yes
 else
@@ -5578,12 +5895,12 @@ EOF
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:5582: checking for alloca" >&5
+echo "configure:5899: checking for alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5587 "configure"
+#line 5904 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -5611,7 +5928,7 @@ int main() {
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:5615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_func_alloca_works=yes
 else
@@ -5643,12 +5960,12 @@ EOF
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:5647: checking whether alloca needs Cray hooks" >&5
+echo "configure:5964: checking whether alloca needs Cray hooks" >&5
 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5652 "configure"
+#line 5969 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -5673,12 +5990,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
 if test $ac_cv_os_cray = yes; then
 for ac_func in _getb67 GETB67 getb67; do
   echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5677: checking for $ac_func" >&5
+echo "configure:5994: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5682 "configure"
+#line 5999 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5701,7 +6018,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:5705: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -5728,7 +6045,7 @@ done
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:5732: checking stack direction for C alloca" >&5
+echo "configure:6049: checking stack direction for C alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5736,7 +6053,7 @@ else
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 5740 "configure"
+#line 6057 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -5755,7 +6072,7 @@ main ()
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:5759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_stack_direction=1
 else
@@ -5779,13 +6096,13 @@ fi
 
 
 echo $ac_n "checking for socklen_t""... $ac_c" 1>&6
-echo "configure:5783: checking for socklen_t" >&5
+echo "configure:6100: checking for socklen_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
   cat > conftest.$ac_ext <<EOF
-#line 5789 "configure"
+#line 6106 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -5816,13 +6133,13 @@ EOF
 fi
 
 echo $ac_n "checking for mtyp_t""... $ac_c" 1>&6
-echo "configure:5820: checking for mtyp_t" >&5
+echo "configure:6137: checking for mtyp_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_mtyp_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
   cat > conftest.$ac_ext <<EOF
-#line 5826 "configure"
+#line 6143 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/ipc.h>
@@ -5850,7 +6167,7 @@ EOF
  fi
 
 echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:5854: checking for main in -lnsl" >&5
+echo "configure:6171: checking for main in -lnsl" >&5
 ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5858,14 +6175,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5862 "configure"
+#line 6179 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:5869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5893,7 +6210,7 @@ else
 fi
 
 echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:5897: checking for main in -lsocket" >&5
+echo "configure:6214: checking for main in -lsocket" >&5
 ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5901,14 +6218,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5905 "configure"
+#line 6222 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:5912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5937,13 +6254,13 @@ fi
 
 
 echo $ac_n "checking for unix domain sockets""... $ac_c" 1>&6
-echo "configure:5941: checking for unix domain sockets" >&5
+echo "configure:6258: checking for unix domain sockets" >&5
 if eval "test \"`echo '$''{'squid_cv_unixsocket'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 5947 "configure"
+#line 6264 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -5958,7 +6275,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:5962: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6279: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   squid_cv_unixsocket=yes
 else
@@ -5982,7 +6299,7 @@ if test "x$ac_cv_enabled_dlmalloc" = "xyes" ; then
   echo "skipping libmalloc check (--enable-dlmalloc specified)"
 else
   echo $ac_n "checking for main in -lgnumalloc""... $ac_c" 1>&6
-echo "configure:5986: checking for main in -lgnumalloc" >&5
+echo "configure:6303: checking for main in -lgnumalloc" >&5
 ac_lib_var=`echo gnumalloc'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5990,14 +6307,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgnumalloc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5994 "configure"
+#line 6311 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:6001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6040,7 +6357,7 @@ fi
                        *)
   
                                echo $ac_n "checking for main in -lmalloc""... $ac_c" 1>&6
-echo "configure:6044: checking for main in -lmalloc" >&5
+echo "configure:6361: checking for main in -lmalloc" >&5
 ac_lib_var=`echo malloc'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6048,14 +6365,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lmalloc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6052 "configure"
+#line 6369 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:6059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6376: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6088,7 +6405,7 @@ fi
 fi
 
 echo $ac_n "checking for main in -lbsd""... $ac_c" 1>&6
-echo "configure:6092: checking for main in -lbsd" >&5
+echo "configure:6409: checking for main in -lbsd" >&5
 ac_lib_var=`echo bsd'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6096,14 +6413,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lbsd  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6100 "configure"
+#line 6417 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:6107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6131,7 +6448,7 @@ else
 fi
 
 echo $ac_n "checking for main in -lregex""... $ac_c" 1>&6
-echo "configure:6135: checking for main in -lregex" >&5
+echo "configure:6452: checking for main in -lregex" >&5
 ac_lib_var=`echo regex'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6139,14 +6456,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lregex  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6143 "configure"
+#line 6460 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:6150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6167,7 +6484,7 @@ else
 fi
 
 echo $ac_n "checking for gethostbyname in -lbind""... $ac_c" 1>&6
-echo "configure:6171: checking for gethostbyname in -lbind" >&5
+echo "configure:6488: checking for gethostbyname in -lbind" >&5
 ac_lib_var=`echo bind'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6175,7 +6492,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lbind  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6179 "configure"
+#line 6496 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6186,7 +6503,7 @@ int main() {
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:6190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6507: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6220,7 +6537,7 @@ if test $ac_cv_lib_bind_gethostbyname = "no" ; then
                ;;
        *)
                echo $ac_n "checking for inet_aton in -lresolv""... $ac_c" 1>&6
-echo "configure:6224: checking for inet_aton in -lresolv" >&5
+echo "configure:6541: checking for inet_aton in -lresolv" >&5
 ac_lib_var=`echo resolv'_'inet_aton | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6228,7 +6545,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6232 "configure"
+#line 6549 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6239,7 +6556,7 @@ int main() {
 inet_aton()
 ; return 0; }
 EOF
-if { (eval echo configure:6243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6255,7 +6572,7 @@ fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   echo $ac_n "checking for inet_aton in -l44bsd""... $ac_c" 1>&6
-echo "configure:6259: checking for inet_aton in -l44bsd" >&5
+echo "configure:6576: checking for inet_aton in -l44bsd" >&5
 ac_lib_var=`echo 44bsd'_'inet_aton | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6263,7 +6580,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-l44bsd  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6267 "configure"
+#line 6584 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6274,7 +6591,7 @@ int main() {
 inet_aton()
 ; return 0; }
 EOF
-if { (eval echo configure:6278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6306,7 +6623,7 @@ else
 fi
 
                echo $ac_n "checking for main in -lresolv""... $ac_c" 1>&6
-echo "configure:6310: checking for main in -lresolv" >&5
+echo "configure:6627: checking for main in -lresolv" >&5
 ac_lib_var=`echo resolv'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6314,14 +6631,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6318 "configure"
+#line 6635 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:6325: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6352,7 +6669,7 @@ fi
     esac
 fi
 echo $ac_n "checking for main in -lm""... $ac_c" 1>&6
-echo "configure:6356: checking for main in -lm" >&5
+echo "configure:6673: checking for main in -lm" >&5
 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6360,14 +6677,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6364 "configure"
+#line 6681 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:6371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6396,7 +6713,7 @@ fi
 
 
 echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:6400: checking for crypt in -lcrypt" >&5
+echo "configure:6717: checking for crypt in -lcrypt" >&5
 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6404,7 +6721,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcrypt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6408 "configure"
+#line 6725 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6415,7 +6732,7 @@ int main() {
 crypt()
 ; return 0; }
 EOF
-if { (eval echo configure:6419: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6736: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6438,7 +6755,7 @@ fi
 
 
 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:6442: checking for dlopen in -ldl" >&5
+echo "configure:6759: checking for dlopen in -ldl" >&5
 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6446,7 +6763,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6450 "configure"
+#line 6767 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6457,7 +6774,7 @@ int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:6461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6480,7 +6797,7 @@ fi
 
 
 echo $ac_n "checking for main in -lpthread""... $ac_c" 1>&6
-echo "configure:6484: checking for main in -lpthread" >&5
+echo "configure:6801: checking for main in -lpthread" >&5
 ac_lib_var=`echo pthread'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6488,14 +6805,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpthread  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6492 "configure"
+#line 6809 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:6499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6518,7 +6835,7 @@ fi
 
 
 echo $ac_n "checking for aio_read in -lrt""... $ac_c" 1>&6
-echo "configure:6522: checking for aio_read in -lrt" >&5
+echo "configure:6839: checking for aio_read in -lrt" >&5
 ac_lib_var=`echo rt'_'aio_read | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6526,7 +6843,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lrt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6530 "configure"
+#line 6847 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6537,7 +6854,7 @@ int main() {
 aio_read()
 ; return 0; }
 EOF
-if { (eval echo configure:6541: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6858: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6562,7 +6879,7 @@ fi
 case "$host" in
        *-pc-sco3.2*)
                echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6
-echo "configure:6566: checking for strftime in -lintl" >&5
+echo "configure:6883: checking for strftime in -lintl" >&5
 ac_lib_var=`echo intl'_'strftime | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6570,7 +6887,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lintl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6574 "configure"
+#line 6891 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6581,7 +6898,7 @@ int main() {
 strftime()
 ; return 0; }
 EOF
-if { (eval echo configure:6585: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6902: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6767,12 +7084,12 @@ for ac_func in \
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6771: checking for $ac_func" >&5
+echo "configure:7088: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6776 "configure"
+#line 7093 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6795,7 +7112,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6853,7 +7170,7 @@ echo "Using ${SELECT_TYPE} for select loop."
 
 
 echo $ac_n "checking if setresuid is implemented""... $ac_c" 1>&6
-echo "configure:6857: checking if setresuid is implemented" >&5
+echo "configure:7174: checking if setresuid is implemented" >&5
 if eval "test \"`echo '$''{'ac_cv_func_setresuid'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6861,7 +7178,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 6865 "configure"
+#line 7182 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -6874,7 +7191,7 @@ else
   }
   
 EOF
-if { (eval echo configure:6878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_setresuid="yes"
 else
@@ -6920,7 +7237,7 @@ fi
   
 if test "$IPF_TRANSPARENT" ; then
     echo $ac_n "checking if IP-Filter header files are installed""... $ac_c" 1>&6
-echo "configure:6924: checking if IP-Filter header files are installed" >&5
+echo "configure:7241: checking if IP-Filter header files are installed" >&5
     # hold on to your hats...
     if test "$ac_cv_header_ip_compat_h" = "yes" ||
         test "$ac_cv_header_ip_fil_compat_h" = "yes" ||
@@ -6961,7 +7278,7 @@ fi
 
 if test "$LINUX_NETFILTER" ; then
     echo $ac_n "checking if Linux 2.4 kernel header files are installed""... $ac_c" 1>&6
-echo "configure:6965: checking if Linux 2.4 kernel header files are installed" >&5
+echo "configure:7282: checking if Linux 2.4 kernel header files are installed" >&5
     # hold on to your hats...
     if test "$ac_cv_header_linux_netfilter_ipv4_h" = "yes"; then
         LINUX_NETFILTER="yes"
@@ -6995,13 +7312,13 @@ if test -z "$USE_GNUREGEX" ; then
     esac
 fi
 echo $ac_n "checking if GNUregex needs to be compiled""... $ac_c" 1>&6
-echo "configure:6999: checking if GNUregex needs to be compiled" >&5
+echo "configure:7316: checking if GNUregex needs to be compiled" >&5
 if test -z "$USE_GNUREGEX"; then
 if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
        USE_GNUREGEX="yes"
 else
        cat > conftest.$ac_ext <<EOF
-#line 7005 "configure"
+#line 7322 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <regex.h>
@@ -7009,7 +7326,7 @@ int main() {
 regex_t t; regcomp(&t,"",0);
 ; return 0; }
 EOF
-if { (eval echo configure:7013: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7330: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   USE_GNUREGEX="no"
 else
@@ -7040,12 +7357,12 @@ for ac_func in \
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7044: checking for $ac_func" >&5
+echo "configure:7361: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7049 "configure"
+#line 7366 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -7068,7 +7385,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:7072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -7096,12 +7413,12 @@ done
 
 
 echo $ac_n "checking Default FD_SETSIZE value""... $ac_c" 1>&6
-echo "configure:7100: checking Default FD_SETSIZE value" >&5
+echo "configure:7417: checking Default FD_SETSIZE value" >&5
 if test "$cross_compiling" = yes; then
   DEFAULT_FD_SETSIZE=256
 else
   cat > conftest.$ac_ext <<EOF
-#line 7105 "configure"
+#line 7422 "configure"
 #include "confdefs.h"
 
 #if HAVE_STDIO_H
@@ -7126,7 +7443,7 @@ main() {
 }
 
 EOF
-if { (eval echo configure:7130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7447: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   DEFAULT_FD_SETSIZE=`cat conftestval`
 else
@@ -7145,7 +7462,7 @@ EOF
 
 
 echo $ac_n "checking Maximum number of filedescriptors we can open""... $ac_c" 1>&6
-echo "configure:7149: checking Maximum number of filedescriptors we can open" >&5
+echo "configure:7466: checking Maximum number of filedescriptors we can open" >&5
 TLDFLAGS="$LDFLAGS"
 case $host in
 i386-unknown-freebsd*)
@@ -7157,7 +7474,7 @@ if test "$cross_compiling" = yes; then
   SQUID_MAXFD=256
 else
   cat > conftest.$ac_ext <<EOF
-#line 7161 "configure"
+#line 7478 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -7217,7 +7534,7 @@ main() {
 }
 
 EOF
-if { (eval echo configure:7221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   SQUID_MAXFD=`cat conftestval`
 else
@@ -7244,12 +7561,12 @@ fi
 LDFLAGS="$TLDFLAGS"
 
 echo $ac_n "checking Default UDP send buffer size""... $ac_c" 1>&6
-echo "configure:7248: checking Default UDP send buffer size" >&5
+echo "configure:7565: checking Default UDP send buffer size" >&5
 if test "$cross_compiling" = yes; then
   SQUID_UDP_SO_SNDBUF=16384
 else
   cat > conftest.$ac_ext <<EOF
-#line 7253 "configure"
+#line 7570 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -7270,7 +7587,7 @@ main ()
 }
 
 EOF
-if { (eval echo configure:7274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   SQUID_UDP_SO_SNDBUF=`cat conftestval`
 else
@@ -7289,12 +7606,12 @@ EOF
 
 
 echo $ac_n "checking Default UDP receive buffer size""... $ac_c" 1>&6
-echo "configure:7293: checking Default UDP receive buffer size" >&5
+echo "configure:7610: checking Default UDP receive buffer size" >&5
 if test "$cross_compiling" = yes; then
   SQUID_UDP_SO_RCVBUF=16384
 else
   cat > conftest.$ac_ext <<EOF
-#line 7298 "configure"
+#line 7615 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -7315,7 +7632,7 @@ main ()
 }
 
 EOF
-if { (eval echo configure:7319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   SQUID_UDP_SO_RCVBUF=`cat conftestval`
 else
@@ -7334,12 +7651,12 @@ EOF
 
 
 echo $ac_n "checking Default TCP send buffer size""... $ac_c" 1>&6
-echo "configure:7338: checking Default TCP send buffer size" >&5
+echo "configure:7655: checking Default TCP send buffer size" >&5
 if test "$cross_compiling" = yes; then
   SQUID_TCP_SO_SNDBUF=16384
 else
   cat > conftest.$ac_ext <<EOF
-#line 7343 "configure"
+#line 7660 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -7360,7 +7677,7 @@ main ()
 }
 
 EOF
-if { (eval echo configure:7364: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   SQUID_TCP_SO_SNDBUF=`cat conftestval`
 else
@@ -7379,12 +7696,12 @@ EOF
 
 
 echo $ac_n "checking Default TCP receive buffer size""... $ac_c" 1>&6
-echo "configure:7383: checking Default TCP receive buffer size" >&5
+echo "configure:7700: checking Default TCP receive buffer size" >&5
 if test "$cross_compiling" = yes; then
   SQUID_TCP_SO_RCVBUF=16384
 else
   cat > conftest.$ac_ext <<EOF
-#line 7388 "configure"
+#line 7705 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -7405,7 +7722,7 @@ main ()
 }
 
 EOF
-if { (eval echo configure:7409: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   SQUID_TCP_SO_RCVBUF=`cat conftestval`
 else
@@ -7424,19 +7741,19 @@ EOF
 
 
 echo $ac_n "checking if sys_errlist is already defined""... $ac_c" 1>&6
-echo "configure:7428: checking if sys_errlist is already defined" >&5
+echo "configure:7745: checking if sys_errlist is already defined" >&5
 if eval "test \"`echo '$''{'ac_cv_needs_sys_errlist'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7433 "configure"
+#line 7750 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int main() {
 char *s = sys_errlist;
 ; return 0; }
 EOF
-if { (eval echo configure:7440: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_needs_sys_errlist="no"
 else
@@ -7458,16 +7775,16 @@ EOF
 fi
 
 echo $ac_n "checking for libresolv _dns_ttl_ hack""... $ac_c" 1>&6
-echo "configure:7462: checking for libresolv _dns_ttl_ hack" >&5
+echo "configure:7779: checking for libresolv _dns_ttl_ hack" >&5
 cat > conftest.$ac_ext <<EOF
-#line 7464 "configure"
+#line 7781 "configure"
 #include "confdefs.h"
 extern int _dns_ttl_;
 int main() {
 return _dns_ttl_;
 ; return 0; }
 EOF
-if { (eval echo configure:7471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7788: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 cat >> confdefs.h <<\EOF
@@ -7483,12 +7800,12 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking if inet_ntoa() actually works""... $ac_c" 1>&6
-echo "configure:7487: checking if inet_ntoa() actually works" >&5
+echo "configure:7804: checking if inet_ntoa() actually works" >&5
 if test "$cross_compiling" = yes; then
   INET_NTOA_RESULT="broken"
 else
   cat > conftest.$ac_ext <<EOF
-#line 7492 "configure"
+#line 7809 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -7507,7 +7824,7 @@ main ()
 }
 
 EOF
-if { (eval echo configure:7511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   INET_NTOA_RESULT=`cat conftestval`
 else
@@ -7533,9 +7850,9 @@ fi
 
 if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
 echo $ac_n "checking for working statvfs() interface""... $ac_c" 1>&6
-echo "configure:7537: checking for working statvfs() interface" >&5
+echo "configure:7854: checking for working statvfs() interface" >&5
 cat > conftest.$ac_ext <<EOF
-#line 7539 "configure"
+#line 7856 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -7552,7 +7869,7 @@ statvfs("/tmp", &sfs);
 
 ; return 0; }
 EOF
-if { (eval echo configure:7556: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7873: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_func_statvfs=yes
 else
@@ -7572,12 +7889,12 @@ fi
 fi
 
 echo $ac_n "checking for _res.nsaddr_list""... $ac_c" 1>&6
-echo "configure:7576: checking for _res.nsaddr_list" >&5
+echo "configure:7893: checking for _res.nsaddr_list" >&5
 if eval "test \"`echo '$''{'ac_cv_have_res_nsaddr_list'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7581 "configure"
+#line 7898 "configure"
 #include "confdefs.h"
 
 #if HAVE_SYS_TYPES_H
@@ -7600,7 +7917,7 @@ int main() {
 _res.nsaddr_list[0];
 ; return 0; }
 EOF
-if { (eval echo configure:7604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7921: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_have_res_nsaddr_list="yes"
 else
@@ -7622,12 +7939,12 @@ fi
 
 if test $ac_cv_have_res_nsaddr_list = "no" ; then
 echo $ac_n "checking for _res.ns_list""... $ac_c" 1>&6
-echo "configure:7626: checking for _res.ns_list" >&5
+echo "configure:7943: checking for _res.ns_list" >&5
 if eval "test \"`echo '$''{'ac_cv_have_res_ns_list'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7631 "configure"
+#line 7948 "configure"
 #include "confdefs.h"
 
 #if HAVE_SYS_TYPES_H
@@ -7650,7 +7967,7 @@ int main() {
 _res.ns_list[0].addr;
 ; return 0; }
 EOF
-if { (eval echo configure:7654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7971: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_have_res_ns_list="yes"
 else
index ad2d38c2d9aa8ecc93e3ad5b87ae4eb0e4bc326a..da4d30685da47c5e69eb63ee93e82d4022ae4cc8 100644 (file)
@@ -3,7 +3,7 @@ dnl  Configuration input file for Squid
 dnl
 dnl  Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
 dnl
-dnl  $Id: configure.in,v 1.260 2002/04/04 23:59:25 hno Exp $
+dnl  $Id: configure.in,v 1.261 2002/04/06 08:49:21 adrian Exp $
 dnl
 dnl
 dnl
@@ -11,7 +11,7 @@ AC_INIT(src/main.c)
 AC_CONFIG_AUX_DIR(cfgaux)
 AM_INIT_AUTOMAKE(squid, 2.6-DEVEL)
 AM_CONFIG_HEADER(include/autoconf.h)
-AC_REVISION($Revision: 1.260 $)dnl
+AC_REVISION($Revision: 1.261 $)dnl
 AC_PREFIX_DEFAULT(/usr/local/squid)
 AM_MAINTAINER_MODE
 
@@ -68,6 +68,9 @@ AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host")
 
 AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args")
 
+dnl Check for GNU cc
+AC_PROG_CC
+
 dnl Gerben Wierda <Gerben_Wierda@RnA.nl>
 case "$host" in
     mab-next-nextstep3)
@@ -205,6 +208,7 @@ if test "$use_dlmalloc" = yes; then
     ac_cv_header_gnumalloc_h="no"
     ac_cv_lib_malloc="no"
     ac_cv_enabled_dlmalloc="yes"
+    AC_DEFINE(USE_DLMALLOC, 1)
 fi
 
 AC_SUBST(LIBDLMALLOC)
@@ -993,6 +997,17 @@ AC_ARG_ENABLE(ntlm-fail-open,
   fi
 ])
 
+dnl Disable "memPools" code
+AC_ARG_ENABLE(mempools,
+[  --disable-mempools      Disable memPools],
+[ if test "$enableval" = "no" ; then
+    echo "memPools disabled"
+    AC_DEFINE(DISABLE_POOLS, 1)
+  else
+    AC_DEFINE(DISABLE_POOLS, 0)
+  fi
+])
+
 dnl Disable "unlinkd" code
 AC_ARG_ENABLE(unlinkd,
 [  --disable-unlinkd       Do not use unlinkd],
index 930af4c0f2a2407dec7a10c869e0dfb0524af886..f7be7f5d49456918bc63f434bd54d7b060726c7a 100644 (file)
@@ -16,7 +16,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.3 2002/02/26 15:48:10 adrian Exp $
+#  $Id: Makefile.in,v 1.4 2002/04/06 08:49:22 adrian Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
index 340d57e6855a0285e9d0cbba1196ebdf4ccd2177..e156e15187c808a5e8dea4dfd4b655537a0d531f 100644 (file)
@@ -2,7 +2,7 @@
 <article>
 <title>Squid Programmers Guide</title>
 <author>Squid Developers</author>
-<date>$Id: prog-guide.sgml,v 1.47 2002/01/13 01:04:49 robertc Exp $</date>
+<date>$Id: prog-guide.sgml,v 1.48 2002/04/06 08:49:22 adrian Exp $</date>
 
 <abstract>
 Squid is a WWW Cache application developed by the National Laboratory
@@ -3085,4 +3085,262 @@ candidates for leaks.  The filename and line numbers tell you where
 that pointer was last accessed.  If there is a leak, then the bug
 occurs somewhere after that point of the code.
 
+<sect>MemPools
+
+<p>
+MemPools are a pooled memory allocator running on top of malloc(). It's
+purpose is to reduce memory fragmentation and provide detailed statistics
+on memory consumption.
+
+<p>
+Preferably all memory allocations in Squid should be done using MemPools
+or one of the types built on top of it (i.e. cbdata).
+
+<p>
+Note: Usually it is better to use cbdata types as these gives you additional
+safeguards in references and typechecking. However, for high usage pools where
+the cbdata functionality of cbdata is not required directly using a MemPool
+might be the way to go.
+
+<sect1>Public API
+
+<p>
+This defines the public API definitions
+
+<sect2>createMemPool
+
+<p>
+<verb>
+       MemPool * pool = memPoolCreate(char *name, size_t element_size);
+</verb>
+
+       <p>
+       Creates a MemPool of elements with the given size.
+
+<sect2>memPoolAlloc
+
+<p>
+<verb>
+       type * data = memPoolAlloc(pool);
+</verb>
+
+       <p>
+       Allocate one element from the pool
+
+<sect2>memPoolFree
+
+<p>
+<verb>
+       memPoolFree(pool, data);
+</verb>
+
+       <p>
+       Free a element allocated by memPoolAlloc();
+
+<sect2>memPoolDestroy
+
+<p>
+<verb>
+       memPoolDestroy(&amp;pool);
+</verb>
+
+       <p>
+       Destroys a memory pool created by memPoolCreate() and reset pool to NULL.
+
+       <p>
+       Typical usage could be:
+<verb>
+       ...
+       myStructType *myStruct;
+       MemPool * myType_pool = memPoolCreate("This is cute pool", sizeof(myStructType));
+       myStruct = memPoolAlloc(myType_pool);
+       myStruct->item = xxx;
+          ...
+       memPoolFree(myStruct, myType_pool);
+       memPoolDestroy(&amp;myType_pool)
+</verb>
+
+<sect2>memPoolIterate
+
+<p>
+<verb>
+       MemPoolIterator * iter = memPoolIterate(void);
+</verb>
+
+       <p>
+       Initialise iteration through all of the pools.
+
+<sect2>memPoolIterateNext
+
+<p>
+<verb>
+       MemPool * pool = memPoolIterateNext(MemPoolIterator * iter);
+</verb>
+
+       <p>
+       Get next pool pointer, until getting NULL pointer.
+
+       <P>
+<verb>
+       MemPoolIterator *iter;
+       iter = memPoolIterate();
+       while ( (pool = memPoolIterateNext(iter)) ) {
+           ... handle(pool);
+       }
+       memPoolIterateDone(&amp;iter);
+</verb>
+
+<sect2>memPoolIterateDone
+
+<p>
+<verb>
+       memPoolIterateDone(MemPoolIterator ** iter);
+</verb>
+
+       <p>
+       Should be called after finished with iterating through all pools.
+
+<sect2>memPoolSetChunkSize
+
+<p>
+<verb>
+       memPoolSetChunkSize(MemPool * pool, size_t chunksize);
+</verb>
+
+       <p>
+       Allows you tune chunk size of pooling. Objects are allocated in chunks
+       instead of individually. This conserves memory, reduces fragmentation.
+       Because of that memory can be freed also only in chunks. Therefore
+       there is tradeoff between memory conservation due to chunking and free
+       memory fragmentation.
+       As a general guideline, increase chunk size only for pools that keep very
+       many items for relatively long time. 
+
+<sect2>memPoolSetIdleLimit
+
+<p>
+<verb>
+       memPoolSetIdleLimit(size_t new_idle_limit);
+</verb>
+
+       <p>
+       Sets upper limit in bytes to amount of free ram kept in pools. This is
+       not strict upper limit, but a hint. When MemPools are over this limit,
+       totally free chunks are immediately considered for release. Otherwise
+       only chunks that have not been referenced for a long time are checked.
+
+<sect2>memPoolGetStats
+
+<p>
+<verb>
+       int inuse = memPoolGetStats(MemPoolStats * stats, MemPool * pool);
+</verb>
+
+       <p>
+       Fills MemPoolStats struct with statistical data about pool. As a
+       return value returns number of objects in use, ie. allocated.
+       <p>
+<verb>
+       struct _MemPoolStats {
+           MemPool *pool;
+           const char *label;
+           MemPoolMeter *meter;
+           int obj_size;
+           int chunk_capacity;
+           int chunk_size;
+
+           int chunks_alloc;
+           int chunks_inuse;
+           int chunks_partial;
+           int chunks_free;
+
+           int items_alloc;
+           int items_inuse;
+           int items_idle;
+
+           int overhead;
+       };
+
+       /* object to track per-pool cumulative counters */
+       typedef struct {
+           double count;
+           double bytes;
+       } mgb_t;
+
+       /* object to track per-pool memory usage (alloc = inuse+idle) */
+       struct _MemPoolMeter {
+           MemMeter alloc;
+           MemMeter inuse;
+           MemMeter idle;
+           mgb_t gb_saved;             /* account Allocations */
+           mgb_t gb_osaved;            /* history Allocations */
+           mgb_t gb_freed;             /* account Free calls */
+       };
+</verb>
+
+<sect2>memPoolGetGlobalStats
+
+<p>
+<verb>
+       int pools_inuse = memPoolGetGlobalStats(MemPoolGlobalStats * stats);
+</verb>
+
+       <p>
+       Fills MemPoolGlobalStats struct with statistical data about overall
+       usage for all pools. As a return value returns number of pools that
+       have at least one object in use. Ie. number of dirty pools.
+       <p>
+<verb>
+       struct _MemPoolGlobalStats {
+           MemPoolMeter *TheMeter;
+
+           int tot_pools_alloc;
+           int tot_pools_inuse;
+           int tot_pools_mempid;
+
+           int tot_chunks_alloc;
+           int tot_chunks_inuse;
+           int tot_chunks_partial;
+           int tot_chunks_free;
+
+           int tot_items_alloc;
+           int tot_items_inuse;
+           int tot_items_idle;
+
+           int tot_overhead;
+           int mem_idle_limit;
+       };
+</verb>
+
+<sect2>memPoolClean
+
+<p>
+<verb>
+       memPoolClean(time_t maxage);
+</verb>
+
+<p>
+       Main cleanup handler. For MemPools to stay within upper idle limits,
+       this function needs to be called periodically, preferrably at some
+       constant rate, eg. from Squid event. It looks through all pools and
+       chunks, cleans up internal states and checks for releasable chunks.
+<p>
+       Between the calls to this function objects are placed onto internal
+       cache instead of returning to their home chunks, mainly for speedup     
+       purpose. During that time state of chunk is not known, it is not
+       known whether chunk is free or in use. This call returns all objects
+       to their chunks and restores consistency.
+<p>
+       Should be called relatively often, as it sorts chunks in suitable
+       order as to reduce free memory fragmentation and increase chunk
+       utilisation.
+<p>
+       Parameter maxage instructs to release all totally idle chunks that
+       have not been referenced for maxage seconds.
+<p>
+       Suitable frequency for cleanup is in range of few tens of seconds to
+       few minutes, depending of memory activity.
+       Several functions above call memPoolClean internally to operate on
+       consistent states.
+
 </article>
index 0e12850ed20bdd4222fa792763c217486858d1f8..f3b901671416df9bc350b10840b4eff8a340473c 100644 (file)
@@ -14,7 +14,7 @@
 @SET_MAKE@
 
 #
-# $Id: Makefile.in,v 1.19 2002/04/02 01:34:08 hno Exp $
+# $Id: Makefile.in,v 1.20 2002/04/06 08:49:23 adrian Exp $
 #
 
 SHELL = @SHELL@
index 7ff0367aa96de8851ed05dab56fdb2146a7013ce..8c3d33234bed72d68ffac89041477ece61360a49 100644 (file)
@@ -16,7 +16,7 @@
 #
 #  Makefile for the Squid LDAP authentication helper
 #
-#  $Id: Makefile.in,v 1.11 2002/02/26 15:48:18 adrian Exp $
+#  $Id: Makefile.in,v 1.12 2002/04/06 08:49:32 adrian Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
index cbe53dec0b4c9f7fa6037cd13a2a5624899e584f..d6d62f810021cfe39a65c6761cd7663f58cd1700 100644 (file)
@@ -16,7 +16,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.9 2002/02/26 15:48:19 adrian Exp $
+#  $Id: Makefile.in,v 1.10 2002/04/06 08:49:33 adrian Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
index 8e5cd83c1d25c37eb03c0affbdc4e54b2c761a21..28dee9bc38aaae31873a5f348cb29a8505ebdc8d 100644 (file)
@@ -15,7 +15,7 @@
 
 #  Makefile for storage modules in the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.9 2002/03/30 16:46:22 hno Exp $
+#  $Id: Makefile.in,v 1.10 2002/04/06 08:49:32 adrian Exp $
 #
 
 SHELL = @SHELL@
index 80af054c85ad28af2bf2bebad3922991cb0bac26..de8f027c93dae8cdf5e6caa25b8c2d272d016969 100644 (file)
@@ -16,7 +16,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.9 2002/02/26 15:48:20 adrian Exp $
+#  $Id: Makefile.in,v 1.10 2002/04/06 08:49:33 adrian Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
index 7c5d6c246ddbc3f5c72266782ecbdd0fa4fb9510..c6d069d5889658a511c2acd1b6e82ab348a1cecc 100644 (file)
@@ -16,7 +16,7 @@
 #
 #  Makefile for the Squid PAM authentication helper
 #
-#  $Id: Makefile.in,v 1.10 2002/02/26 15:48:20 adrian Exp $
+#  $Id: Makefile.in,v 1.11 2002/04/06 08:49:34 adrian Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
index 7cfea5cc2d1f716230c8253e160168f19640039b..71ab0775f82a6cfc62446a3f93c8b10ac6ab2ea7 100644 (file)
@@ -16,7 +16,7 @@
 #
 #  Makefile for the Squid SASL authentication helper
 #
-#  $Id: Makefile.in,v 1.6 2002/04/01 12:14:54 hno Exp $
+#  $Id: Makefile.in,v 1.7 2002/04/06 08:49:35 adrian Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
index 97cc97ea63fb277c0dbc85b83127f30ccdb78c1f..ccba918ae67c6e71b663dbad0ac3d8e6fb5a1b3e 100644 (file)
@@ -16,7 +16,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.9 2002/02/26 15:48:21 adrian Exp $
+#  $Id: Makefile.in,v 1.10 2002/04/06 08:49:35 adrian Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
index f0b1a35e0cbc7707377fe36bf429e92f6edfa27d..3b78242ae59fcb8bc4a24e72c141bee117ecb41f 100644 (file)
@@ -16,7 +16,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.11 2002/02/26 15:48:22 adrian Exp $
+#  $Id: Makefile.in,v 1.12 2002/04/06 08:49:36 adrian Exp $
 #
 #
 
index 3ae4fd09ade948db401f848514875d621b80d0a5..992fda94d76f39ee0f39bfa085f63c40716d1742 100644 (file)
@@ -16,7 +16,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.9 2002/02/26 15:48:23 adrian Exp $
+#  $Id: Makefile.in,v 1.10 2002/04/06 08:49:36 adrian Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
index 59d026e488c1033a810ae789764b9158b2f1d6a1..a79a589a8d38cf975e3e6125327d8d53809cf482 100644 (file)
@@ -16,7 +16,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.7 2002/02/26 15:48:24 adrian Exp $
+#  $Id: Makefile.in,v 1.8 2002/04/06 08:49:37 adrian Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
index c7a5cc86b3059516bbe7faf4f010e909012ea51a..cf6fa3f8510deb77215fee07bfd094f2cfb42cf5 100644 (file)
@@ -15,7 +15,7 @@
 
 #  Makefile for digest auth helpers in the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.7 2002/02/26 15:48:24 adrian Exp $
+#  $Id: Makefile.in,v 1.8 2002/04/06 08:49:38 adrian Exp $
 #
 
 SHELL = @SHELL@
index 59073c336360074933f269ed652f0fd92889caf5..e5c65930815a44b8eb4a54667d586599de7b84f4 100644 (file)
@@ -16,7 +16,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.9 2002/02/26 15:48:25 adrian Exp $
+#  $Id: Makefile.in,v 1.10 2002/04/06 08:49:39 adrian Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
index f418f6a479ef2995e32b5e649c52c74891241784..0a867561bc4ac9a853884a0312d4336ba65b9532 100644 (file)
@@ -15,7 +15,7 @@
 
 #  Makefile for storage modules in the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.8 2002/02/26 15:48:26 adrian Exp $
+#  $Id: Makefile.in,v 1.9 2002/04/06 08:49:40 adrian Exp $
 #
 
 SHELL = @SHELL@
index 9c7657daa3029f61b3a0ed60f483da1191e5ba83..53ff974ba687621de7610714c721909e14984502 100644 (file)
@@ -16,7 +16,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.9 2002/02/26 15:48:26 adrian Exp $
+#  $Id: Makefile.in,v 1.10 2002/04/06 08:49:40 adrian Exp $
 #
 
 SHELL = @SHELL@
index 5add29227c03bb2ba1d7598c1e1e8ae5631ccac6..f7df167eb6aaa630a99cd24b9b0da5a4fa5e3d50 100644 (file)
@@ -16,7 +16,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.9 2002/02/26 15:48:27 adrian Exp $
+#  $Id: Makefile.in,v 1.10 2002/04/06 08:49:41 adrian Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
index 084f8284525b215d0d98426cf3cf8788214c1cef..eeaa33ce5b01fa9c9bbe8deb67f7af91d06b0c85 100644 (file)
@@ -16,7 +16,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.10 2002/02/26 15:48:28 adrian Exp $
+#  $Id: Makefile.in,v 1.11 2002/04/06 08:49:42 adrian Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
index 9d0ad81a4176db63f521cfd8a2baf11bf49a755a..07c59134294dd914ec4978aa1828209ab016b73f 100644 (file)
@@ -13,7 +13,7 @@
 
 @SET_MAKE@
 
-# $Id: Makefile.in,v 1.22 2002/02/26 15:48:11 adrian Exp $
+# $Id: Makefile.in,v 1.23 2002/04/06 08:49:24 adrian Exp $
 #
 
 SHELL = @SHELL@
diff --git a/include/MemPool.h b/include/MemPool.h
new file mode 100644 (file)
index 0000000..9229972
--- /dev/null
@@ -0,0 +1,169 @@
+
+#ifndef _MEM_POOLS_H_
+#define _MEM_POOLS_H_
+
+#include "config.h"
+#include "Stack.h"
+#include "util.h"
+#include "splay.h"
+#include "memMeter.h"
+
+#if HAVE_GNUMALLOC_H
+#include <gnumalloc.h>
+#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#include <malloc.h>
+#endif
+
+#if HAVE_MEMORY_H
+#include <memory.h>
+#endif
+
+#if !M_MMAP_MAX
+#if USE_DLMALLOC
+#define M_MMAP_MAX -4
+#endif
+#endif
+
+#if PURIFY
+#define DISABLE_POOLS 1                /* Disabling Memory pools under purify */
+#endif
+
+#define MB ((size_t)1024*1024)
+#define mem_unlimited_size 2 * 1024 * MB
+#define toMB(size) ( ((double) size) / MB )
+#define toKB(size) ( (size + 1024 - 1) / 1024 )
+
+#define MEM_PAGE_SIZE 4096
+#define MEM_CHUNK_SIZE 4096 * 4
+#define MEM_CHUNK_MAX_SIZE  256 * 1024 /* 2MB */
+#define MEM_MIN_FREE  32
+#define MEM_MAX_FREE  65535    /* ushort is max number of items per chunk */
+
+typedef struct _MemPoolMeter MemPoolMeter;
+typedef struct _MemPool MemPool;
+typedef struct _MemChunk MemChunk;
+typedef struct _MemPoolStats MemPoolStats;
+typedef struct _MemPoolGlobalStats MemPoolGlobalStats;
+typedef struct _MemPoolIterator MemPoolIterator;
+
+struct _MemPoolIterator {
+    MemPool *pool;
+    MemPoolIterator * next;
+};
+
+/* object to track per-pool cumulative counters */
+typedef struct {
+    double count;
+    double bytes;
+} mgb_t;
+
+/* object to track per-pool memory usage (alloc = inuse+idle) */
+struct _MemPoolMeter {
+    MemMeter alloc;
+    MemMeter inuse;
+    MemMeter idle;
+    mgb_t gb_saved;            /* account Allocations */
+    mgb_t gb_osaved;           /* history Allocations */
+    mgb_t gb_freed;            /* account Free calls */
+};
+
+/* a pool is a [growing] space for objects of the same size */
+struct _MemPool {
+    const char *label;
+    size_t obj_size;
+    size_t chunk_size;
+    int chunk_capacity;
+    int memPID;
+    int chunkCount;
+    size_t alloc_calls;
+    size_t free_calls;
+    size_t inuse;
+    size_t idle;
+    void *freeCache;
+    MemChunk *nextFreeChunk;
+    MemChunk *Chunks;
+    MemPoolMeter meter;
+    splayNode *allChunks;
+    MemPool *next;
+};
+
+struct _MemChunk {
+    void *freeList;
+    void *objCache;
+    int inuse_count;
+    MemChunk *nextFreeChunk;
+    MemChunk *next;
+    time_t lastref;
+};
+
+struct _MemPoolStats {
+    MemPool *pool;
+    const char *label;
+    MemPoolMeter *meter;
+    int obj_size;
+    int chunk_capacity;
+    int chunk_size;
+
+    int chunks_alloc;
+    int chunks_inuse;
+    int chunks_partial;
+    int chunks_free;
+
+    int items_alloc;
+    int items_inuse;
+    int items_idle;
+
+    int overhead;
+};
+
+struct _MemPoolGlobalStats {
+    MemPoolMeter *TheMeter;
+
+    int tot_pools_alloc;
+    int tot_pools_inuse;
+    int tot_pools_mempid;
+
+    int tot_chunks_alloc;
+    int tot_chunks_inuse;
+    int tot_chunks_partial;
+    int tot_chunks_free;
+
+    int tot_items_alloc;
+    int tot_items_inuse;
+    int tot_items_idle;
+
+    int tot_overhead;
+    int mem_idle_limit;
+};
+
+#define SIZEOF_CHUNK  ( ( sizeof(MemChunk) + sizeof(double) -1) / sizeof(double) ) * sizeof(double);
+
+/* memPools */
+
+/* Allocator API */
+extern MemPool *memPoolCreate(const char *label, size_t obj_size);
+extern void *memPoolAlloc(MemPool * pool);
+extern void memPoolFree(MemPool * pool, void *obj);
+extern void memPoolDestroy(MemPool ** pool);
+
+extern MemPoolIterator * memPoolIterate(void);
+extern MemPool * memPoolIterateNext(MemPoolIterator * iter);
+extern void memPoolIterateDone(MemPoolIterator ** iter);
+
+/* Tune API */
+extern void memPoolSetChunkSize(MemPool * pool, size_t chunksize);
+extern void memPoolSetIdleLimit(size_t new_idle_limit);
+
+/* Stats API */
+extern int memPoolGetStats(MemPoolStats * stats, MemPool * pool);
+extern int memPoolGetGlobalStats(MemPoolGlobalStats * stats);
+
+/* Module housekeeping API */
+extern void memPoolClean(time_t maxage);
+
+#if UNUSED
+/* Stats history API */
+extern void memPoolCheckRates(); /* stats history checkpoints */
+#endif
+
+#endif /* _MEM_POOLS_H_ */
index dc1b86736d2d0de3eab05e27d62ae7b5b9894342..e11647f0a76ffd3eecad05c676e4e30f9d757dc4 100644 (file)
 #undef CACHE_ICP_PORT
 #endif
 
+/* Compile & use the malloc package by Doug Lea] */
+#undef USE_DLMALLOC
+
 /* Define to have malloc statistics */
 #undef XMALLOC_STATISTICS
 
 #undef FORW_VIA_DB
 
+/* Define if you have problems with memPools and want to disable Pools */
+#undef DISABLE_POOLS
+
 /* Defines how many threads aufs uses for I/O */
 #undef AUFS_IO_THREADS
 
diff --git a/include/memMeter.h b/include/memMeter.h
new file mode 100644 (file)
index 0000000..b353f33
--- /dev/null
@@ -0,0 +1,21 @@
+
+#ifndef _MEM_METER_H_
+#define _MEM_METER_H_
+
+typedef struct _MemMeter MemMeter;
+
+/* object to track per-action memory usage (e.g. #idle objects) */
+struct _MemMeter {
+    ssize_t level;              /* current level (count or volume) */
+    ssize_t hwater_level;       /* high water mark */
+    time_t hwater_stamp;        /* timestamp of last high water mark change */
+};
+
+#define memMeterSyncHWater(m)  { (m).hwater_level = (m).level; (m).hwater_stamp = squid_curtime; }
+#define memMeterCheckHWater(m) { if ((m).hwater_level < (m).level) memMeterSyncHWater((m)); }
+#define memMeterInc(m) { (m).level++; memMeterCheckHWater(m); }
+#define memMeterDec(m) { (m).level--; }
+#define memMeterAdd(m, sz) { (m).level += (sz); memMeterCheckHWater(m); }
+#define memMeterDel(m, sz) { (m).level -= (sz); }
+
+#endif /* _MEM_METER_H_ */
index cb87ffc735f9c4b8ccab66821614fa68d435084f..470a558aeaf598ffa75a081a42131a2d21e84691 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: splay.h,v 1.10 2001/10/08 16:18:31 hno Exp $
+ * $Id: splay.h,v 1.11 2002/04/06 08:49:24 adrian Exp $
  */
 
 #ifndef SQUID_SPLAY_H
@@ -19,6 +19,7 @@ extern int splayLastResult;
 
 extern splayNode *splay_insert(void *, splayNode *, SPLAYCMP *);
 extern splayNode *splay_splay(const void *, splayNode *, SPLAYCMP *);
+extern splayNode *splay_delete(const void *, splayNode *, SPLAYCMP *);
 extern void splay_destroy(splayNode *, SPLAYFREE *);
 extern void splay_walk(splayNode *, SPLAYWALKEE *, void *);
 
index a2ef5a88c4d0c71ec426979a8548638d6e82cf0e..ad9348c4542ceddbc9edf0acbd05ee3ef95e5cdb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: util.h,v 1.62 2001/10/17 01:36:07 hno Exp $
+ * $Id: util.h,v 1.63 2002/04/06 08:49:24 adrian Exp $
  *
  * AUTHOR: Harvest Derived
  *
@@ -127,6 +127,22 @@ extern const char *xitoa(int num);
 double drand48(void);
 #endif
 
+typedef struct {
+    size_t count;
+    size_t bytes;
+    size_t gb;
+} gb_t;
+
+/* gb_type operations */
+#define gb_flush_limit (0x3FFFFFFF)
+#define gb_inc(gb, delta) { if ((gb)->bytes > gb_flush_limit || delta > gb_flush_limit) gb_flush(gb); (gb)->bytes += delta; (gb)->count++; }
+#define gb_incb(gb, delta) { if ((gb)->bytes > gb_flush_limit || delta > gb_flush_limit) gb_flush(gb); (gb)->bytes += delta; }
+#define gb_incc(gb, delta) { if ((gb)->bytes > gb_flush_limit || delta > gb_flush_limit) gb_flush(gb); (gb)->count+= delta; }
+extern double gb_to_double(const gb_t *);
+extern const char *double_to_str(char *buf, int buf_size, double value);
+extern const char *gb_to_str(const gb_t *);
+extern void gb_flush(gb_t *);  /* internal, do not use this */
+
 /*
  * Returns the amount of known allocated memory
  */
index 5c3f8dadfabfb14cd222b19b9f2e7d0f6f9c5f89..f5239cc0e9df708180862f54c2c1172a637c6b18 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 #
-#  $Id: Makefile.am,v 1.3 2001/11/21 23:47:12 hno Exp $
+#  $Id: Makefile.am,v 1.4 2002/04/06 08:49:26 adrian Exp $
 #
 
 if NEED_OWN_SNPRINTF
@@ -26,6 +26,7 @@ EXTRA_libmiscutil_a_SOURCES = \
        md5.c \
        snprintf.c
 libmiscutil_a_SOURCES = \
+       MemPool.c \
        Array.c \
        base64.c \
        getfullhostname.c \
index 94dad7f5c758514b668ae9a0b3fb3e037c5394db..ab51181ea118786cf09baec35bd4fa7f59c3d14f 100644 (file)
@@ -14,7 +14,7 @@
 @SET_MAKE@
 
 #
-#  $Id: Makefile.in,v 1.58 2002/02/26 15:48:12 adrian Exp $
+#  $Id: Makefile.in,v 1.59 2002/04/06 08:49:26 adrian Exp $
 #
 
 SHELL = @SHELL@
@@ -142,6 +142,7 @@ EXTRA_libmiscutil_a_SOURCES = \
        snprintf.c
 
 libmiscutil_a_SOURCES = \
+       MemPool.c \
        Array.c \
        base64.c \
        getfullhostname.c \
@@ -197,13 +198,14 @@ libmiscutil_a_DEPENDENCIES = @LIBOBJS@
 @NEED_OWN_MD5_FALSE@am__objects_1 =
 @NEED_OWN_SNPRINTF_TRUE@am__objects_2 = snprintf.$(OBJEXT)
 @NEED_OWN_SNPRINTF_FALSE@am__objects_2 =
-am_libmiscutil_a_OBJECTS = Array.$(OBJEXT) base64.$(OBJEXT) \
-       getfullhostname.$(OBJEXT) hash.$(OBJEXT) heap.$(OBJEXT) \
-       html_quote.$(OBJEXT) iso3307.$(OBJEXT) $(am__objects_1) \
-       radix.$(OBJEXT) rfc1035.$(OBJEXT) rfc1123.$(OBJEXT) \
-       rfc1738.$(OBJEXT) rfc2617.$(OBJEXT) safe_inet_addr.$(OBJEXT) \
-       $(am__objects_2) splay.$(OBJEXT) Stack.$(OBJEXT) \
-       stub_memaccount.$(OBJEXT) util.$(OBJEXT) uudecode.$(OBJEXT)
+am_libmiscutil_a_OBJECTS = MemPool.$(OBJEXT) Array.$(OBJEXT) \
+       base64.$(OBJEXT) getfullhostname.$(OBJEXT) hash.$(OBJEXT) \
+       heap.$(OBJEXT) html_quote.$(OBJEXT) iso3307.$(OBJEXT) \
+       $(am__objects_1) radix.$(OBJEXT) rfc1035.$(OBJEXT) \
+       rfc1123.$(OBJEXT) rfc1738.$(OBJEXT) rfc2617.$(OBJEXT) \
+       safe_inet_addr.$(OBJEXT) $(am__objects_2) splay.$(OBJEXT) \
+       Stack.$(OBJEXT) stub_memaccount.$(OBJEXT) util.$(OBJEXT) \
+       uudecode.$(OBJEXT)
 libmiscutil_a_OBJECTS = $(am_libmiscutil_a_OBJECTS)
 libntlmauth_a_AR = $(AR) cru
 libntlmauth_a_DEPENDENCIES = @LIBOBJS@
@@ -221,19 +223,19 @@ LDFLAGS = @LDFLAGS@
 LIBS = @LIBS@
 depcomp = $(SHELL) $(top_srcdir)/cfgaux/depcomp
 @AMDEP_TRUE@DEP_FILES = $(DEPDIR)/Array.Po $(DEPDIR)/GNUregex.Po \
-@AMDEP_TRUE@   $(DEPDIR)/Stack.Po $(DEPDIR)/base64.Po \
-@AMDEP_TRUE@   $(DEPDIR)/dlmalloc.Po $(DEPDIR)/drand48.Po \
-@AMDEP_TRUE@   $(DEPDIR)/getfullhostname.Po $(DEPDIR)/hash.Po \
-@AMDEP_TRUE@   $(DEPDIR)/heap.Po $(DEPDIR)/html_quote.Po \
-@AMDEP_TRUE@   $(DEPDIR)/inet_ntoa.Po $(DEPDIR)/iso3307.Po \
-@AMDEP_TRUE@   $(DEPDIR)/md5.Po $(DEPDIR)/ntlmauth.Po \
-@AMDEP_TRUE@   $(DEPDIR)/radix.Po $(DEPDIR)/rfc1035.Po \
-@AMDEP_TRUE@   $(DEPDIR)/rfc1123.Po $(DEPDIR)/rfc1738.Po \
-@AMDEP_TRUE@   $(DEPDIR)/rfc2617.Po $(DEPDIR)/safe_inet_addr.Po \
-@AMDEP_TRUE@   $(DEPDIR)/snprintf.Po $(DEPDIR)/splay.Po \
-@AMDEP_TRUE@   $(DEPDIR)/strerror.Po $(DEPDIR)/stub_memaccount.Po \
-@AMDEP_TRUE@   $(DEPDIR)/tempnam.Po $(DEPDIR)/util.Po \
-@AMDEP_TRUE@   $(DEPDIR)/uudecode.Po
+@AMDEP_TRUE@   $(DEPDIR)/MemPool.Po $(DEPDIR)/Stack.Po \
+@AMDEP_TRUE@   $(DEPDIR)/base64.Po $(DEPDIR)/dlmalloc.Po \
+@AMDEP_TRUE@   $(DEPDIR)/drand48.Po $(DEPDIR)/getfullhostname.Po \
+@AMDEP_TRUE@   $(DEPDIR)/hash.Po $(DEPDIR)/heap.Po \
+@AMDEP_TRUE@   $(DEPDIR)/html_quote.Po $(DEPDIR)/inet_ntoa.Po \
+@AMDEP_TRUE@   $(DEPDIR)/iso3307.Po $(DEPDIR)/md5.Po \
+@AMDEP_TRUE@   $(DEPDIR)/ntlmauth.Po $(DEPDIR)/radix.Po \
+@AMDEP_TRUE@   $(DEPDIR)/rfc1035.Po $(DEPDIR)/rfc1123.Po \
+@AMDEP_TRUE@   $(DEPDIR)/rfc1738.Po $(DEPDIR)/rfc2617.Po \
+@AMDEP_TRUE@   $(DEPDIR)/safe_inet_addr.Po $(DEPDIR)/snprintf.Po \
+@AMDEP_TRUE@   $(DEPDIR)/splay.Po $(DEPDIR)/strerror.Po \
+@AMDEP_TRUE@   $(DEPDIR)/stub_memaccount.Po $(DEPDIR)/tempnam.Po \
+@AMDEP_TRUE@   $(DEPDIR)/util.Po $(DEPDIR)/uudecode.Po
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
@@ -287,6 +289,7 @@ distclean-compile:
 
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/Array.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/GNUregex.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/MemPool.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/Stack.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/base64.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/dlmalloc.Po@am__quote@
diff --git a/lib/MemPool.c b/lib/MemPool.c
new file mode 100644 (file)
index 0000000..4e5b13d
--- /dev/null
@@ -0,0 +1,740 @@
+
+/*
+ * $Id: MemPool.c,v 1.7 2002/04/06 08:49:26 adrian Exp $
+ *
+ * DEBUG: section 63    Low Level Memory Pool Management
+ * AUTHOR: Alex Rousskov, Andres Kroonmaa
+ *
+ * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
+ * ----------------------------------------------------------
+ *
+ *  Squid is the result of efforts by numerous individuals from the
+ *  Internet community.  Development is led by Duane Wessels of the
+ *  National Laboratory for Applied Network Research and funded by the
+ *  National Science Foundation.  Squid is Copyrighted (C) 1998 by
+ *  the Regents of the University of California.  Please see the
+ *  COPYRIGHT file for full details.  Squid incorporates software
+ *  developed and/or copyrighted by other sources.  Please see the
+ *  CREDITS file for full details.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+/*
+ * Old way:
+ *   xmalloc each item separately, upon free stack into idle pool array.
+ *   each item is individually malloc()ed from system, imposing libmalloc
+ *   overhead, and additionally we add our overhead of pointer size per item
+ *   as we keep a list of pointer to free items.
+ * 
+ * Chunking:
+ *   xmalloc Chunk that fits at least MEM_MIN_FREE (32) items in an array, but
+ *   limit Chunk size to MEM_CHUNK_MAX_SIZE (256K). Chunk size is rounded up to
+ *   MEM_PAGE_SIZE (4K), trying to have chunks in multiples of VM_PAGE size.
+ *   Minimum Chunk size is MEM_CHUNK_SIZE (16K).
+ *   A number of items fits into a single chunk, depending on item size.
+ *   Maximum number of items per chunk is limited to MEM_MAX_FREE (65535).
+ * 
+ *   We populate Chunk with a linkedlist, each node at first word of item,
+ *   and pointing at next free item. Chunk->FreeList is pointing at first
+ *   free node. Thus we stuff free housekeeping into the Chunk itself, and
+ *   omit pointer overhead per item.
+ * 
+ *   Chunks are created on demand, and new chunks are inserted into linklist
+ *   of chunks so that Chunks with smaller pointer value are placed closer
+ *   to the linklist head. Head is a hotspot, servicing most of requests, so
+ *   slow sorting occurs and Chunks in highest memory tend to become idle
+ *   and freeable.
+ * 
+ *   event is registered that runs every 15 secs and checks reference time
+ *   of each idle chunk. If a chunk is not referenced for 15 secs, it is
+ *   released.
+ * 
+ *   [If mem_idle_limit is exceeded with pools, every chunk that becomes
+ *   idle is immediately considered for release, unless this is the only
+ *   chunk with free items in it.] (not implemented)
+ * 
+ *   In cachemgr output, there are new columns for chunking. Special item,
+ *   Frag, is shown to estimate approximately fragmentation of chunked
+ *   pools. Fragmentation is calculated by taking amount of items in use,
+ *   calculating needed amount of chunks to fit all, and then comparing to
+ *   actual amount of chunks in use. Frag number, in percent, is showing
+ *   how many percent of chunks are in use excessively. 100% meaning that
+ *   twice the needed amount of chunks are in use.
+ *   "part" item shows number of chunks partially filled. This shows how
+ *   badly fragmentation is spread across all chunks.
+ * 
+ *   Andres Kroonmaa.
+ */
+
+#define FLUSH_LIMIT 1000       /* Flush memPool counters to memMeters after flush limit calls */
+#define MEM_MAX_MMAP_CHUNKS 2048
+
+#include <assert.h>
+
+#include "config.h"
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#include "MemPool.h"
+
+/*
+ * XXX This is a boundary violation between lib and src.. would be good
+ * if it could be solved otherwise, but left for now.
+ */
+extern time_t squid_curtime;
+
+/* Allocator API */
+extern MemPool *memPoolCreate(const char *label, size_t obj_size);
+extern void *memPoolAlloc(MemPool * pool);
+extern void memPoolFree(MemPool * pool, void *obj);
+extern void memPoolDestroy(MemPool ** pool);
+
+extern MemPoolIterator *memPoolIterate(void);
+extern MemPool *memPoolIterateNext(MemPoolIterator * iter);
+extern void memPoolIterateDone(MemPoolIterator ** iter);
+
+/* Tune API */
+extern void memPoolSetChunkSize(MemPool * pool, size_t chunksize);
+extern void memPoolSetIdleLimit(size_t new_idle_limit);
+
+/* Stats API */
+extern int memPoolGetStats(MemPoolStats * stats, MemPool * pool);
+extern int memPoolGetGlobalStats(MemPoolGlobalStats * stats);
+
+/* Module housekeeping API */
+extern void memPoolClean(time_t maxage);
+
+/* local data */
+static int mempool_initialised = 0;
+static int mem_idle_limit = 0;
+static MemPool *memPools = NULL;
+static int memPools_alloc = 0;
+
+static MemPoolMeter TheMeter;
+static MemPoolIterator Iterator;
+
+static int Pool_id_counter = 0;
+static MemPool *lastPool;
+
+/* local prototypes */
+static int memCompChunks(MemChunk * chunkA, MemChunk * chunkB);
+static int memCompObjChunks(void *obj, MemChunk * chunk);
+static MemChunk *memPoolChunkNew(MemPool * pool);
+static void memPoolChunkDestroy(MemPool * pool, MemChunk * chunk);
+static void memPoolPush(MemPool * pool, void *obj);
+static void *memPoolGet(MemPool * pool);
+static void memPoolCreateChunk(MemPool * pool);
+static void memPoolFlushMeters(MemPool * pool);
+static void memPoolFlushMetersFull(MemPool * pool);
+static void memPoolFlushMetersAll(void);
+static void memPoolCleanOne(MemPool * pool, time_t maxage);
+
+static void memPoolInit(void);
+
+MemPoolIterator *
+memPoolIterate(void)
+{
+    Iterator.pool = memPools;
+    return &Iterator;
+}
+
+void
+memPoolIterateDone(MemPoolIterator ** iter)
+{
+    assert(iter);
+    Iterator.pool = NULL;
+    *iter = NULL;
+}
+
+MemPool *
+memPoolIterateNext(MemPoolIterator * iter)
+{
+    MemPool *pool;
+    assert(iter);
+
+    pool = iter->pool;
+    if (!pool)
+       return NULL;
+
+    iter->pool = pool->next;
+    return pool;
+}
+
+void
+memPoolSetIdleLimit(size_t new_idle_limit)
+{
+    mem_idle_limit = new_idle_limit;
+}
+
+/* Compare chunks */
+static int
+memCompChunks(MemChunk * chunkA, MemChunk * chunkB)
+{
+    return chunkA->objCache - chunkB->objCache;
+}
+
+/* Compare object to chunk */
+static int
+memCompObjChunks(void *obj, MemChunk * chunk)
+{
+    int bounds;
+    bounds = obj - chunk->objCache;
+    if (bounds < 0)
+       return -1;
+    if (bounds < lastPool->chunk_size)
+       return 0;
+    return 1;
+}
+
+static MemChunk *
+memPoolChunkNew(MemPool * pool)
+{
+    int i;
+    void **Free;
+    MemChunk *chunk;
+
+    chunk = xcalloc(1, sizeof(MemChunk));      /* should have a pool for this too */
+    chunk->objCache = xcalloc(1, pool->chunk_size);
+    Free = chunk->freeList = chunk->objCache;
+
+    for (i = 1; i < pool->chunk_capacity; i++) {
+       *Free = (void *) Free + pool->obj_size;
+       Free = *Free;
+    }
+    chunk->nextFreeChunk = pool->nextFreeChunk;
+    pool->nextFreeChunk = chunk;
+
+    memMeterAdd(pool->meter.alloc, pool->chunk_capacity);
+    memMeterAdd(pool->meter.idle, pool->chunk_capacity);
+    pool->idle += pool->chunk_capacity;
+    pool->chunkCount++;
+    chunk->lastref = squid_curtime;
+    lastPool = pool;
+    pool->allChunks = splay_insert(chunk, pool->allChunks, (SPLAYCMP *) memCompChunks);
+    return chunk;
+}
+
+static void
+memPoolChunkDestroy(MemPool * pool, MemChunk * chunk)
+{
+    memMeterDel(pool->meter.alloc, pool->chunk_capacity);
+    memMeterDel(pool->meter.idle, pool->chunk_capacity);
+    pool->idle -= pool->chunk_capacity;
+    pool->chunkCount--;
+    lastPool = pool;
+    pool->allChunks = splay_delete(chunk, pool->allChunks, (SPLAYCMP *) memCompChunks);
+    xfree(chunk->objCache);
+    xfree(chunk);
+}
+
+static void
+memPoolPush(MemPool * pool, void *obj)
+{
+    void **Free;
+    if ((pool->obj_size % 2048) != 0)
+       memset(obj, 0, pool->obj_size);
+    Free = obj;
+    *Free = pool->freeCache;
+    pool->freeCache = obj;
+    return;
+}
+
+/*
+ * Find a chunk with a free item.
+ * Create new chunk on demand if no chunk with frees found.
+ * Insert new chunk in front of lowest ram chunk, making it preferred in future,
+ * and resulting slow compaction towards lowest ram area.
+ */
+static void *
+memPoolGet(MemPool * pool)
+{
+    MemChunk *chunk;
+    void **Free;
+
+    /* first, try cache */
+    if (pool->freeCache) {
+       Free = pool->freeCache;
+       pool->freeCache = *Free;
+       *Free = NULL;
+       return Free;
+    }
+    /* then try perchunk freelist chain */
+    if (pool->nextFreeChunk == NULL) {
+       /* no chunk with frees, so create new one */
+       memPoolCreateChunk(pool);
+    }
+    /* now we have some in perchunk freelist chain */
+    chunk = pool->nextFreeChunk;
+
+    Free = chunk->freeList;
+    chunk->freeList = *Free;
+    *Free = NULL;
+    chunk->inuse_count++;
+    chunk->lastref = squid_curtime;
+
+    if (chunk->freeList == NULL) {
+       /* last free in this chunk, so remove us from perchunk freelist chain */
+       pool->nextFreeChunk = chunk->nextFreeChunk;
+    }
+    return Free;
+}
+
+/* just create a new chunk and place it into a good spot in the chunk chain */
+static void
+memPoolCreateChunk(MemPool * pool)
+{
+    MemChunk *chunk, *new;
+
+    new = memPoolChunkNew(pool);
+
+    chunk = pool->Chunks;
+    if (chunk == NULL) {       /* first chunk in pool */
+       pool->Chunks = new;
+       return;
+    }
+    if (new->objCache < chunk->objCache) {
+       /* we are lowest ram chunk, insert as first chunk */
+       new->next = chunk;
+       pool->Chunks = new;
+       return;
+    }
+    while (chunk->next) {
+       if (new->objCache < chunk->next->objCache) {
+           /* new chunk is in lower ram, insert here */
+           new->next = chunk->next;
+           chunk->next = new;
+           return;
+       }
+       chunk = chunk->next;
+    }
+    /* we are the worst chunk in chain, add as last */
+    chunk->next = new;
+    return;
+}
+
+static void
+memPoolInit(void)
+{
+    memPools = NULL;
+    memPools_alloc = 0;
+    memset(&TheMeter, 0, sizeof(TheMeter));
+    mem_idle_limit = 2 * MB;
+    mempool_initialised = 1;
+#if HAVE_MALLOPT && M_MMAP_MAX
+    mallopt(M_MMAP_MAX, MEM_MAX_MMAP_CHUNKS);
+#endif
+}
+
+void
+memPoolSetChunkSize(MemPool * pool, size_t chunksize)
+{
+    int cap;
+    size_t csize = chunksize;
+
+    if (pool->Chunks)          /* unsafe to tamper */
+       return;
+
+    csize = ((csize + MEM_PAGE_SIZE - 1) / MEM_PAGE_SIZE) * MEM_PAGE_SIZE;     /* round up to page size */
+    cap = csize / pool->obj_size;
+
+    if (cap < MEM_MIN_FREE)
+       cap = MEM_MIN_FREE;
+    if (cap * pool->obj_size > MEM_CHUNK_MAX_SIZE)
+       cap = MEM_CHUNK_MAX_SIZE / pool->obj_size;
+    if (cap > MEM_MAX_FREE)
+       cap = MEM_MAX_FREE;
+    if (cap < 1)
+       cap = 1;
+
+    csize = cap * pool->obj_size;
+    csize = ((csize + MEM_PAGE_SIZE - 1) / MEM_PAGE_SIZE) * MEM_PAGE_SIZE;     /* round up to page size */
+    cap = csize / pool->obj_size;
+
+    pool->chunk_capacity = cap;
+    pool->chunk_size = csize;
+}
+
+MemPool *
+memPoolCreate(const char *label, size_t obj_size)
+{
+    MemPool *pool, *last_pool;
+
+    if (!mempool_initialised)
+       memPoolInit();
+
+    pool = xcalloc(1, sizeof(MemPool));
+    assert(label && obj_size);
+    pool->label = label;
+    pool->obj_size = obj_size;
+    pool->obj_size =
+       ((obj_size + sizeof(void *) - 1) / sizeof(void *)) * sizeof(void *);
+
+    memPoolSetChunkSize(pool, MEM_CHUNK_SIZE);
+
+    /* Append as Last */
+    for (last_pool = memPools; last_pool && last_pool->next;)
+       last_pool = last_pool->next;
+    if (last_pool)
+       last_pool->next = pool;
+    else
+       memPools = pool;
+
+    memPools_alloc++;
+    pool->memPID = ++Pool_id_counter;
+    return pool;
+}
+
+/*
+ * warning: we do not clean this entry from Pools assuming memPoolDestroy
+ * is used at the end of the program only
+ */
+void
+memPoolDestroy(MemPool ** pool)
+{
+    MemChunk *chunk, *fchunk;
+    MemPool *find_pool, *free_pool, *prev_pool;
+
+    assert(pool);
+    assert(*pool);
+    free_pool = *pool;
+    memPoolFlushMetersFull(free_pool);
+    memPoolCleanOne(free_pool, 0);
+    assert(free_pool->inuse == 0 && "While trying to destroy pool");
+
+    for (chunk = free_pool->Chunks; (fchunk = chunk) != NULL; chunk = chunk->next)
+       memPoolChunkDestroy(free_pool, fchunk);
+
+    assert(memPools && "Called memPoolDestroy, but no pool exists!");
+
+    /* Pool clean, remove it from List and free */
+    for (find_pool = memPools, prev_pool = NULL; (find_pool && free_pool != find_pool); find_pool = find_pool->next)
+       prev_pool = find_pool;
+    assert(find_pool && "pool to destroy not found");
+
+    if (prev_pool)
+       prev_pool->next = free_pool->next;
+    else
+       memPools = free_pool->next;
+    xfree(free_pool);
+    memPools_alloc--;
+    *pool = NULL;
+}
+
+static void
+memPoolFlushMeters(MemPool * pool)
+{
+    size_t calls;
+
+    calls = pool->free_calls;
+    if (calls) {
+       pool->meter.gb_freed.count += calls;
+       memMeterDel(pool->meter.inuse, calls);
+#if !DISABLE_POOLS
+       memMeterAdd(pool->meter.idle, calls);
+#endif
+       pool->free_calls = 0;
+    }
+    calls = pool->alloc_calls;
+    if (calls) {
+       pool->meter.gb_saved.count += calls;
+       memMeterAdd(pool->meter.inuse, calls);
+#if !DISABLE_POOLS
+       memMeterDel(pool->meter.idle, calls);
+#endif
+       pool->alloc_calls = 0;
+    }
+}
+
+static void
+memPoolFlushMetersFull(MemPool * pool)
+{
+    memPoolFlushMeters(pool);
+    pool->meter.gb_saved.bytes = pool->meter.gb_saved.count * pool->obj_size;
+    pool->meter.gb_freed.bytes = pool->meter.gb_freed.count * pool->obj_size;
+}
+
+/*
+ * Updates all pool counters, and recreates TheMeter totals from all pools
+ */
+static void
+memPoolFlushMetersAll(void)
+{
+    MemPool *pool;
+    MemPoolIterator *iter;
+
+    TheMeter.alloc.level = 0;
+    TheMeter.inuse.level = 0;
+    TheMeter.idle.level = 0;
+    TheMeter.gb_saved.count = 0;
+    TheMeter.gb_saved.bytes = 0;
+    TheMeter.gb_freed.count = 0;
+    TheMeter.gb_freed.bytes = 0;
+
+    iter = memPoolIterate();
+    while ((pool = memPoolIterateNext(iter))) {
+       memPoolFlushMetersFull(pool);
+       memMeterAdd(TheMeter.alloc, pool->meter.alloc.level * pool->obj_size);
+       memMeterAdd(TheMeter.inuse, pool->meter.inuse.level * pool->obj_size);
+       memMeterAdd(TheMeter.idle, pool->meter.idle.level * pool->obj_size);
+       TheMeter.gb_saved.count += pool->meter.gb_saved.count;
+       TheMeter.gb_freed.count += pool->meter.gb_freed.count;
+       TheMeter.gb_saved.bytes += pool->meter.gb_saved.bytes;
+       TheMeter.gb_freed.bytes += pool->meter.gb_freed.bytes;
+    }
+    memPoolIterateDone(&iter);
+}
+
+void *
+memPoolAlloc(MemPool * pool)
+{
+    void *p;
+    assert(pool);
+#if !DISABLE_POOLS
+    p = memPoolGet(pool);
+    assert(pool->idle);
+    pool->idle--;
+    pool->inuse++;
+#else
+    p = xcalloc(1, pool->obj_size);
+#endif
+    if (++pool->alloc_calls == FLUSH_LIMIT)
+       memPoolFlushMeters(pool);
+
+    return p;
+}
+
+void
+memPoolFree(MemPool * pool, void *obj)
+{
+    assert(pool && obj);
+#if !DISABLE_POOLS
+
+    memPoolPush(pool, obj);
+    assert(pool->inuse);
+    pool->inuse--;
+    pool->idle++;
+#else
+    xfree(obj);
+#endif
+    ++pool->free_calls;
+
+}
+
+/* removes empty Chunks from pool */
+static void
+memPoolCleanOne(MemPool * pool, time_t maxage)
+{
+    MemChunk *chunk, *freechunk, *listTail;
+    void **Free;
+    time_t age;
+
+    if (!pool)
+       return;
+    if (!pool->Chunks)
+       return;
+
+    memPoolFlushMetersFull(pool);
+    /*
+     * OK, so we have to go through all the global freeCache and find the Chunk
+     * any given Free belongs to, and stuff it into that Chunk's freelist 
+     */
+
+    while ((Free = pool->freeCache) != NULL) {
+       lastPool = pool;
+       pool->allChunks = splay_splay(Free, pool->allChunks, (SPLAYCMP *) memCompObjChunks);
+       assert(splayLastResult == 0);
+       chunk = pool->allChunks->data;
+       assert(chunk->inuse_count > 0);
+       chunk->inuse_count--;
+       pool->freeCache = *Free;        /* remove from global cache */
+       *Free = chunk->freeList;        /* stuff into chunks freelist */
+       chunk->freeList = Free;
+       chunk->lastref = squid_curtime;
+    }
+
+    /* Now we have all chunks in this pool cleared up, all free items returned to their home */
+    /* We start now checking all chunks to see if we can release any */
+    /* We start from pool->Chunks->next, so first chunk is not released */
+    /* Recreate nextFreeChunk list from scratch */
+
+    chunk = pool->Chunks;
+    while ((freechunk = chunk->next) != NULL) {
+       age = squid_curtime - freechunk->lastref;
+       freechunk->nextFreeChunk = NULL;
+       if (freechunk->inuse_count == 0)
+           if (age >= maxage) {
+               chunk->next = freechunk->next;
+               memPoolChunkDestroy(pool, freechunk);
+               freechunk = NULL;
+           }
+       if (chunk->next == NULL)
+           break;
+       chunk = chunk->next;
+    }
+
+    /* Recreate nextFreeChunk list from scratch */
+    /* Populate nextFreeChunk list in order of "most filled chunk first" */
+    /* in case of equal fill, put chunk in lower ram first */
+    /* First (create time) chunk is always on top, no matter how full */
+
+    chunk = pool->Chunks;
+    pool->nextFreeChunk = chunk;
+    chunk->nextFreeChunk = NULL;
+
+    while (chunk->next) {
+       chunk->next->nextFreeChunk = NULL;
+       if (chunk->next->inuse_count < pool->chunk_capacity) {
+           listTail = pool->nextFreeChunk;
+           while (listTail->nextFreeChunk) {
+               if (chunk->next->inuse_count > listTail->nextFreeChunk->inuse_count)
+                   break;
+               if ((chunk->next->inuse_count == listTail->nextFreeChunk->inuse_count) &&
+                   (chunk->next->objCache < listTail->nextFreeChunk->objCache))
+                   break;
+               listTail = listTail->nextFreeChunk;
+           }
+           chunk->next->nextFreeChunk = listTail->nextFreeChunk;
+           listTail->nextFreeChunk = chunk->next;
+       }
+       chunk = chunk->next;
+    }
+    /* We started from 2nd chunk. If first chunk is full, remove it */
+    if (pool->nextFreeChunk->inuse_count == pool->chunk_capacity)
+       pool->nextFreeChunk = pool->nextFreeChunk->nextFreeChunk;
+
+    return;
+}
+
+/* 
+ * Returns all cached frees to their home chunks
+ * If chunks unreferenced age is over, destroys Idle chunk
+ * Flushes meters for a pool
+ * If pool is not specified, iterates through all pools.
+ * When used for all pools, if new_idle_limit is above -1, new
+ * idle memory limit is set before Cleanup. This allows to shrink
+ * memPool memory usage to specified minimum.
+ */
+void
+memPoolClean(time_t maxage)
+{
+    MemPool *pool;
+    MemPoolIterator *iter;
+
+    int shift = 1;
+    memPoolFlushMetersAll();
+    if (TheMeter.idle.level > mem_idle_limit)
+       maxage = shift = 0;
+
+    iter = memPoolIterate();
+    while ((pool = memPoolIterateNext(iter))) {
+       if (pool->meter.idle.level > (pool->chunk_capacity << shift)) {
+           memPoolCleanOne(pool, maxage);
+       }
+    }
+    memPoolIterateDone(&iter);
+}
+
+/* Persistent Pool stats. for GlobalStats accumulation */
+static MemPoolStats pp_stats;
+
+/*
+ * Update MemPoolStats struct for single pool
+ */
+int
+memPoolGetStats(MemPoolStats * stats, MemPool * pool)
+{
+    MemChunk *chunk;
+    int chunks_free = 0;
+    int chunks_partial = 0;
+
+    if (stats != &pp_stats)    /* need skip memset for GlobalStats accumulation */
+       memset(stats, 0, sizeof(MemPoolStats));
+
+    memPoolCleanOne(pool, (time_t) 555555);    /* don't want to get chunks released before reporting */
+
+    stats->pool = pool;
+    stats->label = pool->label;
+    stats->meter = &pool->meter;
+    stats->obj_size = pool->obj_size;
+    stats->chunk_capacity = pool->chunk_capacity;
+
+    /* gather stats for each Chunk */
+    chunk = pool->Chunks;
+    while (chunk) {
+       if (chunk->inuse_count == 0)
+           chunks_free++;
+       else if (chunk->inuse_count < pool->chunk_capacity)
+           chunks_partial++;
+       chunk = chunk->next;
+    }
+
+    stats->chunks_alloc += pool->chunkCount;
+    stats->chunks_inuse += pool->chunkCount - chunks_free;
+    stats->chunks_partial += chunks_partial;
+    stats->chunks_free += chunks_free;
+
+    stats->items_alloc += pool->meter.alloc.level;
+    stats->items_inuse += pool->meter.inuse.level;
+    stats->items_idle += pool->meter.idle.level;
+
+    stats->overhead += sizeof(MemPool) + pool->chunkCount * sizeof(MemChunk) + strlen(pool->label) + 1;
+
+    return pool->meter.inuse.level;
+}
+
+/*
+ * Totals statistics is returned
+ */
+int
+memPoolGetGlobalStats(MemPoolGlobalStats * stats)
+{
+    int pools_inuse = 0;
+    MemPool *pool;
+    MemPoolIterator *iter;
+
+    memset(stats, 0, sizeof(MemPoolGlobalStats));
+    memset(&pp_stats, 0, sizeof(MemPoolStats));
+
+    memPoolFlushMetersAll();   /* recreate TheMeter */
+
+    /* gather all stats for Totals */
+    iter = memPoolIterate();
+    while ((pool = memPoolIterateNext(iter))) {
+       if (memPoolGetStats(&pp_stats, pool) > 0)
+           pools_inuse++;
+    }
+    memPoolIterateDone(&iter);
+
+    stats->TheMeter = &TheMeter;
+
+    stats->tot_pools_alloc = memPools_alloc;
+    stats->tot_pools_inuse = pools_inuse;
+    stats->tot_pools_mempid = Pool_id_counter;
+
+    stats->tot_chunks_alloc = pp_stats.chunks_alloc;
+    stats->tot_chunks_inuse = pp_stats.chunks_inuse;
+    stats->tot_chunks_partial = pp_stats.chunks_partial;
+    stats->tot_chunks_free = pp_stats.chunks_free;
+    stats->tot_items_alloc = pp_stats.items_alloc;
+    stats->tot_items_inuse = pp_stats.items_inuse;
+    stats->tot_items_idle = pp_stats.items_idle;
+
+    stats->tot_overhead += pp_stats.overhead + memPools_alloc * sizeof(MemPool *);
+    stats->mem_idle_limit = mem_idle_limit;
+
+    return pools_inuse;
+}
index 04ad32e6c7853d6d10a718208c4aa8cdd524f91d..fd4a1abcfb28c9444190bed9fc76306b579a1474 100644 (file)
@@ -1,5 +1,8 @@
 /*
- * $Id: splay.c,v 1.12 1999/10/04 05:04:52 wessels Exp $
+ * $Id: splay.c,v 1.13 2002/04/06 08:49:26 adrian Exp $
+ *
+ * based on ftp://ftp.cs.cmu.edu/user/sleator/splaying/top-down-splay.c
+ * http://bobo.link.cs.cmu.edu/cgi-bin/splay/splay-cgi.pl
  */
 
 #include "config.h"
@@ -99,6 +102,26 @@ splay_splay(const void *data, splayNode * top, SPLAYCMP * compare)
     return top;
 }
 
+splayNode *
+splay_delete(const void *data, splayNode * top, SPLAYCMP * compare)
+{
+    splayNode *x;
+    if (top == NULL)
+        return NULL;
+    top = splay_splay(data, top, compare);
+    if (splayLastResult == 0) {                /* found it */
+       if (top->left == NULL) {
+           x = top->right;
+       } else {
+           x = splay_splay(data, top->left, compare);
+           x->right = top->right;
+       }
+       xfree(top);
+       return x;
+    }
+    return top;                                /* It wasn't there */
+}
+
 void
 splay_destroy(splayNode * top, SPLAYFREE * free_func)
 {
index 9f50ccdb27e8161faa86ba007ad59f457896300c..a2d6b6936f7fa967dbf971e88af06d836c25e735 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: util.c,v 1.83 2001/10/17 19:50:50 hno Exp $
+ * $Id: util.c,v 1.84 2002/04/06 08:49:26 adrian Exp $
  *
  * DEBUG: 
  * AUTHOR: Harvest Derived
@@ -757,3 +757,53 @@ default_failure_notify(const char *message)
     write(2, "\n", 1);
     abort();
 }
+
+void
+gb_flush(gb_t * g)
+{
+    g->gb += (g->bytes >> 30);
+    g->bytes &= (1 << 30) - 1;
+}
+
+double
+gb_to_double(const gb_t * g)
+{
+    return ((double) g->gb) * ((double) (1 << 30)) + ((double) g->bytes);
+}
+
+const char *
+double_to_str(char *buf, int buf_size, double value)
+{
+    /* select format */
+    if (value < 1e9)
+        snprintf(buf, buf_size, "%.2f MB", value / 1e6);
+    else if (value < 1e12)
+        snprintf(buf, buf_size, "%.3f GB", value / 1e9);
+    else
+        snprintf(buf, buf_size, "%.4f TB", value / 1e12);
+    return buf;
+}
+
+const char *
+gb_to_str(const gb_t * g)
+{
+    /*
+     * it is often convenient to call gb_to_str several times for _one_ printf
+     */
+#define max_cc_calls 5
+    typedef char GbBuf[32];
+    static GbBuf bufs[max_cc_calls];
+    static int call_id = 0;
+    double value = gb_to_double(g);
+    char *buf = bufs[call_id++];
+    if (call_id >= max_cc_calls)
+       call_id = 0;
+    /* select format */
+    if (value < 1e9)
+       snprintf(buf, sizeof(GbBuf), "%.2f MB", value / 1e6);
+    else if (value < 1e12)
+       snprintf(buf, sizeof(GbBuf), "%.2f GB", value / 1e9);
+    else
+       snprintf(buf, sizeof(GbBuf), "%.2f TB", value / 1e12);
+    return buf;
+}
index 8f025abf18e3d615d2715e925e3eb4eff95c9559..331c2300c51b9c9957f50e34a63b212039c818e7 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.am,v 1.20 2002/01/01 09:47:48 adrian Exp $
+#  $Id: Makefile.am,v 1.21 2002/04/06 08:49:27 adrian Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -155,7 +155,6 @@ squid_SOURCES = \
        logfile.c \
        main.c \
        mem.c \
-       MemPool.c \
        MemBuf.c \
        mime.c \
        multicast.c \
index a83f7e01084289fc76ebbc124534d8540f21d7ab..f70b11a075054b09ad967d84b0b038c5554a9e8b 100644 (file)
@@ -16,7 +16,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.231 2002/02/26 15:48:13 adrian Exp $
+#  $Id: Makefile.in,v 1.232 2002/04/06 08:49:27 adrian Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -256,7 +256,6 @@ squid_SOURCES = \
        logfile.c \
        main.c \
        mem.c \
-       MemPool.c \
        MemBuf.c \
        mime.c \
        multicast.c \
@@ -473,13 +472,12 @@ am_squid_OBJECTS = access_log.$(OBJEXT) acl.$(OBJEXT) asn.$(OBJEXT) \
        HttpRequest.$(OBJEXT) icmp.$(OBJEXT) icp_v2.$(OBJEXT) \
        icp_v3.$(OBJEXT) ident.$(OBJEXT) internal.$(OBJEXT) \
        ipc.$(OBJEXT) ipcache.$(OBJEXT) $(am__objects_6) \
-       logfile.$(OBJEXT) main.$(OBJEXT) mem.$(OBJEXT) \
-       MemPool.$(OBJEXT) MemBuf.$(OBJEXT) mime.$(OBJEXT) \
-       multicast.$(OBJEXT) neighbors.$(OBJEXT) net_db.$(OBJEXT) \
-       Packer.$(OBJEXT) pconn.$(OBJEXT) peer_digest.$(OBJEXT) \
-       peer_select.$(OBJEXT) redirect.$(OBJEXT) referer.$(OBJEXT) \
-       refresh.$(OBJEXT) send-announce.$(OBJEXT) $(am__objects_7) \
-       ssl.$(OBJEXT) $(am__objects_8) stat.$(OBJEXT) \
+       logfile.$(OBJEXT) main.$(OBJEXT) mem.$(OBJEXT) MemBuf.$(OBJEXT) \
+       mime.$(OBJEXT) multicast.$(OBJEXT) neighbors.$(OBJEXT) \
+       net_db.$(OBJEXT) Packer.$(OBJEXT) pconn.$(OBJEXT) \
+       peer_digest.$(OBJEXT) peer_select.$(OBJEXT) redirect.$(OBJEXT) \
+       referer.$(OBJEXT) refresh.$(OBJEXT) send-announce.$(OBJEXT) \
+       $(am__objects_7) ssl.$(OBJEXT) $(am__objects_8) stat.$(OBJEXT) \
        StatHist.$(OBJEXT) String.$(OBJEXT) stmem.$(OBJEXT) \
        store.$(OBJEXT) store_io.$(OBJEXT) store_client.$(OBJEXT) \
        store_digest.$(OBJEXT) store_dir.$(OBJEXT) \
@@ -516,38 +514,37 @@ depcomp = $(SHELL) $(top_srcdir)/cfgaux/depcomp
 @AMDEP_TRUE@   $(DEPDIR)/HttpHeaderTools.Po $(DEPDIR)/HttpMsg.Po \
 @AMDEP_TRUE@   $(DEPDIR)/HttpReply.Po $(DEPDIR)/HttpRequest.Po \
 @AMDEP_TRUE@   $(DEPDIR)/HttpStatusLine.Po $(DEPDIR)/MemBuf.Po \
-@AMDEP_TRUE@   $(DEPDIR)/MemPool.Po $(DEPDIR)/Packer.Po \
-@AMDEP_TRUE@   $(DEPDIR)/StatHist.Po $(DEPDIR)/String.Po \
-@AMDEP_TRUE@   $(DEPDIR)/access_log.Po $(DEPDIR)/acl.Po \
-@AMDEP_TRUE@   $(DEPDIR)/asn.Po $(DEPDIR)/auth_modules.Po \
-@AMDEP_TRUE@   $(DEPDIR)/authenticate.Po $(DEPDIR)/cache_cf.Po \
-@AMDEP_TRUE@   $(DEPDIR)/cache_manager.Po $(DEPDIR)/cachemgr.Po \
-@AMDEP_TRUE@   $(DEPDIR)/carp.Po $(DEPDIR)/cbdata.Po \
-@AMDEP_TRUE@   $(DEPDIR)/cf_gen.Po $(DEPDIR)/client.Po \
-@AMDEP_TRUE@   $(DEPDIR)/client_db.Po $(DEPDIR)/client_side.Po \
-@AMDEP_TRUE@   $(DEPDIR)/comm.Po $(DEPDIR)/comm_kqueue.Po \
-@AMDEP_TRUE@   $(DEPDIR)/comm_poll.Po $(DEPDIR)/comm_select.Po \
-@AMDEP_TRUE@   $(DEPDIR)/debug.Po $(DEPDIR)/delay_pools.Po \
-@AMDEP_TRUE@   $(DEPDIR)/disk.Po $(DEPDIR)/dns.Po \
-@AMDEP_TRUE@   $(DEPDIR)/dns_internal.Po $(DEPDIR)/dnsserver.Po \
-@AMDEP_TRUE@   $(DEPDIR)/errorpage.Po $(DEPDIR)/event.Po \
-@AMDEP_TRUE@   $(DEPDIR)/fd.Po $(DEPDIR)/filemap.Po \
-@AMDEP_TRUE@   $(DEPDIR)/forward.Po $(DEPDIR)/fqdncache.Po \
-@AMDEP_TRUE@   $(DEPDIR)/ftp.Po $(DEPDIR)/globals.Po \
-@AMDEP_TRUE@   $(DEPDIR)/gopher.Po $(DEPDIR)/helper.Po \
-@AMDEP_TRUE@   $(DEPDIR)/htcp.Po $(DEPDIR)/http.Po \
-@AMDEP_TRUE@   $(DEPDIR)/icmp.Po $(DEPDIR)/icp_v2.Po \
-@AMDEP_TRUE@   $(DEPDIR)/icp_v3.Po $(DEPDIR)/ident.Po \
-@AMDEP_TRUE@   $(DEPDIR)/internal.Po $(DEPDIR)/ipc.Po \
-@AMDEP_TRUE@   $(DEPDIR)/ipcache.Po $(DEPDIR)/leakfinder.Po \
-@AMDEP_TRUE@   $(DEPDIR)/logfile.Po $(DEPDIR)/main.Po \
-@AMDEP_TRUE@   $(DEPDIR)/mem.Po $(DEPDIR)/mime.Po \
-@AMDEP_TRUE@   $(DEPDIR)/multicast.Po $(DEPDIR)/neighbors.Po \
-@AMDEP_TRUE@   $(DEPDIR)/net_db.Po $(DEPDIR)/pconn.Po \
-@AMDEP_TRUE@   $(DEPDIR)/peer_digest.Po $(DEPDIR)/peer_select.Po \
-@AMDEP_TRUE@   $(DEPDIR)/pinger.Po $(DEPDIR)/redirect.Po \
-@AMDEP_TRUE@   $(DEPDIR)/referer.Po $(DEPDIR)/refresh.Po \
-@AMDEP_TRUE@   $(DEPDIR)/repl_modules.Po \
+@AMDEP_TRUE@   $(DEPDIR)/Packer.Po $(DEPDIR)/StatHist.Po \
+@AMDEP_TRUE@   $(DEPDIR)/String.Po $(DEPDIR)/access_log.Po \
+@AMDEP_TRUE@   $(DEPDIR)/acl.Po $(DEPDIR)/asn.Po \
+@AMDEP_TRUE@   $(DEPDIR)/auth_modules.Po $(DEPDIR)/authenticate.Po \
+@AMDEP_TRUE@   $(DEPDIR)/cache_cf.Po $(DEPDIR)/cache_manager.Po \
+@AMDEP_TRUE@   $(DEPDIR)/cachemgr.Po $(DEPDIR)/carp.Po \
+@AMDEP_TRUE@   $(DEPDIR)/cbdata.Po $(DEPDIR)/cf_gen.Po \
+@AMDEP_TRUE@   $(DEPDIR)/client.Po $(DEPDIR)/client_db.Po \
+@AMDEP_TRUE@   $(DEPDIR)/client_side.Po $(DEPDIR)/comm.Po \
+@AMDEP_TRUE@   $(DEPDIR)/comm_kqueue.Po $(DEPDIR)/comm_poll.Po \
+@AMDEP_TRUE@   $(DEPDIR)/comm_select.Po $(DEPDIR)/debug.Po \
+@AMDEP_TRUE@   $(DEPDIR)/delay_pools.Po $(DEPDIR)/disk.Po \
+@AMDEP_TRUE@   $(DEPDIR)/dns.Po $(DEPDIR)/dns_internal.Po \
+@AMDEP_TRUE@   $(DEPDIR)/dnsserver.Po $(DEPDIR)/errorpage.Po \
+@AMDEP_TRUE@   $(DEPDIR)/event.Po $(DEPDIR)/fd.Po \
+@AMDEP_TRUE@   $(DEPDIR)/filemap.Po $(DEPDIR)/forward.Po \
+@AMDEP_TRUE@   $(DEPDIR)/fqdncache.Po $(DEPDIR)/ftp.Po \
+@AMDEP_TRUE@   $(DEPDIR)/globals.Po $(DEPDIR)/gopher.Po \
+@AMDEP_TRUE@   $(DEPDIR)/helper.Po $(DEPDIR)/htcp.Po \
+@AMDEP_TRUE@   $(DEPDIR)/http.Po $(DEPDIR)/icmp.Po \
+@AMDEP_TRUE@   $(DEPDIR)/icp_v2.Po $(DEPDIR)/icp_v3.Po \
+@AMDEP_TRUE@   $(DEPDIR)/ident.Po $(DEPDIR)/internal.Po \
+@AMDEP_TRUE@   $(DEPDIR)/ipc.Po $(DEPDIR)/ipcache.Po \
+@AMDEP_TRUE@   $(DEPDIR)/leakfinder.Po $(DEPDIR)/logfile.Po \
+@AMDEP_TRUE@   $(DEPDIR)/main.Po $(DEPDIR)/mem.Po \
+@AMDEP_TRUE@   $(DEPDIR)/mime.Po $(DEPDIR)/multicast.Po \
+@AMDEP_TRUE@   $(DEPDIR)/neighbors.Po $(DEPDIR)/net_db.Po \
+@AMDEP_TRUE@   $(DEPDIR)/pconn.Po $(DEPDIR)/peer_digest.Po \
+@AMDEP_TRUE@   $(DEPDIR)/peer_select.Po $(DEPDIR)/pinger.Po \
+@AMDEP_TRUE@   $(DEPDIR)/redirect.Po $(DEPDIR)/referer.Po \
+@AMDEP_TRUE@   $(DEPDIR)/refresh.Po $(DEPDIR)/repl_modules.Po \
 @AMDEP_TRUE@   $(DEPDIR)/send-announce.Po $(DEPDIR)/snmp_agent.Po \
 @AMDEP_TRUE@   $(DEPDIR)/snmp_core.Po $(DEPDIR)/ssl.Po \
 @AMDEP_TRUE@   $(DEPDIR)/ssl_support.Po $(DEPDIR)/stat.Po \
@@ -686,7 +683,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/HttpRequest.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/HttpStatusLine.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/MemBuf.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/MemPool.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/Packer.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/StatHist.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/String.Po@am__quote@
index a7ab5cbaaf2601ad916a3986f0f1e213783ad9de..2fcb2af78192eb376095d3cc03d174e3ff3c0d8f 100644 (file)
@@ -15,7 +15,7 @@
 
 #  Makefile for authentication modules in the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.7 2002/02/26 15:48:18 adrian Exp $
+#  $Id: Makefile.in,v 1.8 2002/04/06 08:49:30 adrian Exp $
 #
 
 SHELL = @SHELL@
index ff57cad4320bec680089c03df60065829b6a88ba..5613592a3e4bbfb3b19448c2af136ae52cd808de 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: auth_basic.cc,v 1.15 2002/04/04 23:59:26 hno Exp $
+ * $Id: auth_basic.cc,v 1.16 2002/04/06 08:49:31 adrian Exp $
  *
  * DEBUG: section 29    Authenticator
  * AUTHOR: Duane Wessels
@@ -120,7 +120,7 @@ authBasicDone(void)
        helperFree(basicauthenticators);
     basicauthenticators = NULL;
     if (basic_data_pool) {
-       memPoolDestroy(basic_data_pool);
+       memPoolDestroy(&basic_data_pool);
        basic_data_pool = NULL;
     }
     debug(29, 2) ("authBasicDone: Basic authentication Shutdown.\n");
index d9a73af734eb8d8c2449de09f12fa180e6b41b01..e6e8f6c2813e0b04fa26e00261040402dd69a450 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: auth_digest.cc,v 1.12 2002/04/04 23:59:27 hno Exp $
+ * $Id: auth_digest.cc,v 1.13 2002/04/06 08:49:37 adrian Exp $
  *
  * DEBUG: section 29    Authenticator
  * AUTHOR: Robert Collins
@@ -238,8 +238,7 @@ authenticateDigestNonceShutdown(void)
     }
     if (digest_nonce_pool) {
        assert(memPoolInUseCount(digest_nonce_pool) == 0);
-       memPoolDestroy(digest_nonce_pool);
-       digest_nonce_pool = NULL;
+       memPoolDestroy(&digest_nonce_pool);
     }
     debug(29, 2) ("authenticateDigestNonceShutdown: Nonce cache shutdown\n");
 }
@@ -480,8 +479,7 @@ authDigestUserShutdown(void)
     }
     if (digest_user_pool) {
        assert(memPoolInUseCount(digest_user_pool) == 0);
-       memPoolDestroy(digest_user_pool);
-       digest_user_pool = NULL;
+       memPoolDestroy(&digest_user_pool);
     }
 }
 
@@ -544,8 +542,7 @@ authDigestRequestShutdown(void)
     /* No requests should be in progress when we get here */
     if (digest_request_pool) {
        assert(memPoolInUseCount(digest_request_pool) == 0);
-       memPoolDestroy(digest_request_pool);
-       digest_request_pool = NULL;
+       memPoolDestroy(&digest_request_pool);
     }
 }
 
index 3b64922a7b24cc5c8d66ce9a5a7946b9bb7f296f..25b00317c04f82f29a4937fbb9ea791ec1f0acd5 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: auth_ntlm.cc,v 1.19 2002/04/04 23:59:27 hno Exp $
+ * $Id: auth_ntlm.cc,v 1.20 2002/04/06 08:49:39 adrian Exp $
  *
  * DEBUG: section 29    NTLM Authenticator
  * AUTHOR: Robert Collins
@@ -109,18 +109,15 @@ authNTLMDone(void)
     ntlmauthenticators = NULL;
     if (ntlm_helper_state_pool) {
        assert(memPoolInUseCount(ntlm_helper_state_pool) == 0);
-       memPoolDestroy(ntlm_helper_state_pool);
-       ntlm_helper_state_pool = NULL;
+       memPoolDestroy(&ntlm_helper_state_pool);
     }
     if (ntlm_request_pool) {
        assert(memPoolInUseCount(ntlm_request_pool) == 0);
-       memPoolDestroy(ntlm_request_pool);
-       ntlm_request_pool = NULL;
+       memPoolDestroy(&ntlm_request_pool);
     }
     if (ntlm_user_pool) {
        assert(memPoolInUseCount(ntlm_user_pool) == 0);
-       memPoolDestroy(ntlm_user_pool);
-       ntlm_user_pool = NULL;
+       memPoolDestroy(&ntlm_user_pool);
     }
     debug(29, 2) ("authNTLMDone: NTLM authentication Shutdown.\n");
 }
index 76699c2f177c5a8f9a1c1ba656a70ffed8e53ab3..4b33a5d07cc61eb92fba4fd62f481a02e4526366 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: defines.h,v 1.100 2002/04/04 23:59:25 hno Exp $
+ * $Id: defines.h,v 1.101 2002/04/06 08:49:27 adrian Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
 /* were to look for errors if config path fails */
 #define DEFAULT_SQUID_ERROR_DIR "/usr/local/squid/etc/errors"
 
-/* gb_type operations */
-#define gb_flush_limit (0x3FFFFFFF)
-#define gb_inc(gb, delta) { if ((gb)->bytes > gb_flush_limit || delta > gb_flush_limit) gb_flush(gb); (gb)->bytes += delta; (gb)->count++; }
-
 /* iteration for HttpHdrRange */
 #define HttpHdrRangeInitPos (-1)
 
index cb56568ff57c90da1a6cbbbeb58774ba0e9b29d3..94af63c9ffcd6e41e82b05d7b6369c78b1451552 100644 (file)
@@ -15,7 +15,7 @@
 
 #  Makefile for storage modules in the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.9 2002/02/26 15:48:29 adrian Exp $
+#  $Id: Makefile.in,v 1.10 2002/04/06 08:49:42 adrian Exp $
 #
 
 SHELL = @SHELL@
index b1de0502a767d156ec31217fb9806ef165305b8e..e5e956f10de9def77bfe63229d96296936de1cbc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_coss.cc,v 1.31 2002/04/01 21:53:21 hno Exp $
+ * $Id: store_dir_coss.cc,v 1.32 2002/04/06 08:49:43 adrian Exp $
  *
  * DEBUG: section 81    Store COSS Directory Routines
  * AUTHOR: Eric Stern
@@ -879,7 +879,8 @@ storeCossDirPick(void)
 static void
 storeCossDirDone(void)
 {
-    memPoolDestroy(coss_state_pool);
+    memPoolDestroy(&coss_state_pool);
+/*  memPoolDestroy(&coss_index_pool);  XXX Should be here? */
     coss_initialised = 0;
 }
 
index 13d4dc0528d1b5242ca16d46310068479482385a..75a74e4c598e4265cc00d342b94efa73ab0155e0 100644 (file)
@@ -16,7 +16,7 @@
 #
 #  Makefile for the DISKD storage driver for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.7 2002/02/26 15:48:29 adrian Exp $
+#  $Id: Makefile.in,v 1.8 2002/04/06 08:49:43 adrian Exp $
 #
 
 SHELL = @SHELL@
index ca69be98db47cbb5c002698b9cdbc9a507edb291..cf6c1b9147c5624611810ee88f60ee92e0649def 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_diskd.cc,v 1.61 2002/04/04 23:59:28 hno Exp $
+ * $Id: store_dir_diskd.cc,v 1.62 2002/04/06 08:49:43 adrian Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -1941,7 +1941,7 @@ storeDiskdDirParse(SwapDir * sd, int index, char *path)
 static void
 storeDiskdDirDone(void)
 {
-    memPoolDestroy(diskd_state_pool);
+    memPoolDestroy(&diskd_state_pool);
     diskd_initialised = 0;
 }
 
index 6adb6555337afab4933707bda3466a7b95a85487..6839a650c5a0c21ddfcfc2249d7d1fd9f5249fd6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_ufs.cc,v 1.41 2002/04/01 21:53:22 hno Exp $
+ * $Id: store_dir_ufs.cc,v 1.42 2002/04/06 08:49:44 adrian Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -1670,7 +1670,7 @@ storeUfsDirParse(SwapDir * sd, int index, char *path)
 static void
 storeUfsDirDone(void)
 {
-    memPoolDestroy(ufs_state_pool);
+    memPoolDestroy(&ufs_state_pool);
     ufs_initialised = 0;
 }
 
index 312903ded3e154998ca21876b8d9811dda4187dd..3f25577373acc9173d83df174d51f1c4354e3f91 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.cc,v 1.348 2002/04/04 21:33:27 hno Exp $
+ * $Id: main.cc,v 1.349 2002/04/06 08:49:27 adrian Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -555,6 +555,7 @@ mainInitialize(void)
            eventAdd("start_announce", start_announce, NULL, 3600.0, 1);
        eventAdd("ipcache_purgelru", ipcache_purgelru, NULL, 10.0, 1);
        eventAdd("fqdncache_purgelru", fqdncache_purgelru, NULL, 15.0, 1);
+       eventAdd("memPoolCleanIdlePools", memPoolCleanIdlePools, NULL, 15.0, 1);
     }
     configured_once = 1;
 }
index 8bc8ff6d62a882d5f2dda11ae6afdc4b4a80789a..9dd694a01154626e11fb214bc96dccaa8bece6c0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: mem.cc,v 1.62 2002/02/26 15:48:15 adrian Exp $
+ * $Id: mem.cc,v 1.63 2002/04/06 08:49:27 adrian Exp $
  *
  * DEBUG: section 13    High Level Memory Pool Management
  * AUTHOR: Harvest Derived
  */
 
 #include "squid.h"
+#include "memMeter.h"
 
 /* module globals */
 
+/* local prototypes */
+static void memStringStats(StoreEntry * sentry);
+static void memStats(StoreEntry * sentry);
+static void memPoolReport(const MemPoolStats * mp_st, const MemPoolMeter * AllMeter, StoreEntry * e);
+
+/* module locals */
 static MemPool *MemPools[MEM_MAX];
+static double xm_time = 0;
+static double xm_deltat = 0;
 
 /* string pools */
 #define mem_str_pool_count 3
@@ -115,11 +124,27 @@ memStats(StoreEntry * sentry)
     storeBufferFlush(sentry);
 }
 
-
 /*
  * public routines
  */
 
+int
+memPoolInUseCount(MemPool * pool)
+{
+    MemPoolStats stats;
+    assert(pool);
+    memPoolGetStats(&stats, pool);
+    return stats.items_inuse;
+}
+
+int
+memPoolsTotalAllocated(void)
+{
+    MemPoolGlobalStats stats;
+    memPoolGetGlobalStats(&stats);
+    return stats.TheMeter->alloc.level;
+}
+
 /*
  * we have a limit on _total_ amount of idle memory so we ignore
  * max_pages for now
@@ -128,6 +153,7 @@ void
 memDataInit(mem_type type, const char *name, size_t size, int max_pages_notused)
 {
     assert(name && size);
+    assert(MemPools[type] == NULL);
     MemPools[type] = memPoolCreate(name, size);
 }
 
@@ -264,12 +290,43 @@ memFreeBuf(size_t size, void *buf)
     }
 }
 
+static double clean_interval = 15.0;   /* time to live of idle chunk before release */
+
+void
+memPoolCleanIdlePools(void *unused)
+{
+    memPoolClean(clean_interval);
+    eventAdd("memPoolCleanIdlePools", memPoolCleanIdlePools, NULL, clean_interval, 1);
+}
+
+static int mem_idle_limit = 0;
+
+void
+memConfigure(void)
+{
+    int new_pool_limit;
+    /* set to configured value first */
+    if (!Config.onoff.mem_pools)
+       new_pool_limit = 0;
+    else if (Config.MemPools.limit > 0)
+       new_pool_limit = Config.MemPools.limit;
+    else
+       new_pool_limit = mem_unlimited_size;
+
+    if (mem_idle_limit > new_pool_limit)
+       debug(63, 1) ("Shrinking idle mem pools to %.2f MB\n", toMB(new_pool_limit));
+    memPoolSetIdleLimit(new_pool_limit);
+    mem_idle_limit = new_pool_limit;
+}
 
 void
 memInit(void)
 {
     int i;
-    memInitModule();
+
+    debug(63, 1) ("Memory pools are '%s'; limit: %.2f MB\n",
+       (Config.onoff.mem_pools ? "on" : "off"), toMB(mem_idle_limit));
+
     /* set all pointers to null */
     memset(MemPools, '\0', sizeof(MemPools));
     /*
@@ -323,9 +380,11 @@ memInit(void)
     memDataInit(MEM_REQUEST_T, "request_t", sizeof(request_t),
        Squid_MaxFD >> 3);
     memDataInit(MEM_STOREENTRY, "StoreEntry", sizeof(StoreEntry), 0);
+    memPoolSetChunkSize(MemPools[MEM_STOREENTRY], 2048 * 1024);
     memDataInit(MEM_WORDLIST, "wordlist", sizeof(wordlist), 0);
     memDataInit(MEM_CLIENT_INFO, "ClientInfo", sizeof(ClientInfo), 0);
     memDataInit(MEM_MD5_DIGEST, "MD5 digest", MD5_DIGEST_CHARS, 0);
+    memPoolSetChunkSize(MemPools[MEM_MD5_DIGEST], 512 * 1024);
     memDataInit(MEM_HELPER_REQUEST, "helper_request",
        sizeof(helper_request), 0);
     memDataInit(MEM_HELPER_STATEFUL_REQUEST, "helper_stateful_request",
@@ -360,10 +419,29 @@ memCheckInit(void)
     }
 }
 
+#if UNUSED_CODE
+/* to-do: make debug level a parameter? */
+static void memPoolDescribe(const MemPool * pool);
+static void
+memPoolDescribe(const MemPool * pool)
+{
+    assert(pool);
+    debug(63, 2) ("%-20s: %6d x %4d bytes = %5d KB\n",
+       pool->label, memPoolInUseCount(pool), pool->obj_size,
+       toKB(pool->obj_size * pool->meter.inuse.level));
+}
+#endif
+
 void
 memClean(void)
 {
-    memCleanModule();
+    MemPoolGlobalStats stats;
+    memPoolSetIdleLimit(0);
+    memPoolClean(0);
+    memPoolGetGlobalStats(&stats);
+    if (stats.tot_items_inuse)
+       debug(63, 2) ("memCleanModule: %d items in %d chunks and %d pools are left dirty\n", stats.tot_items_inuse,
+           stats.tot_chunks_inuse, stats.tot_pools_inuse);
 }
 
 int
@@ -433,3 +511,145 @@ memFreeBufFunc(size_t size)
        return xfree;
     }
 }
+
+/* MemPoolMeter */
+
+static void
+memPoolReport(const MemPoolStats * mp_st, const MemPoolMeter * AllMeter, StoreEntry * e)
+{
+    int excess;
+    int needed = 0;
+    MemPoolMeter *pm = mp_st->meter;
+
+    storeAppendPrintf(e, "%-20s\t %4d\t ",
+       mp_st->label, mp_st->obj_size);
+
+    /* Chunks */
+    storeAppendPrintf(e, "%4d\t %4d\t ",
+       toKB(mp_st->obj_size * mp_st->chunk_capacity), mp_st->chunk_capacity);
+
+    if (mp_st->chunk_capacity) {
+       needed = mp_st->items_inuse / mp_st->chunk_capacity;
+       if (mp_st->items_inuse % mp_st->chunk_capacity)
+           needed++;
+       excess = mp_st->chunks_inuse - needed;
+    }
+    storeAppendPrintf(e, "%4d\t %4d\t %4d\t %4d\t %.1f\t ",
+       mp_st->chunks_alloc, mp_st->chunks_inuse, mp_st->chunks_free, mp_st->chunks_partial,
+       xpercent(excess, needed));
+/*
+ *  Fragmentation calculation:
+ *    needed = inuse.level / chunk_capacity
+ *    excess = used - needed
+ *    fragmentation = excess / needed * 100%
+ *
+ *    Fragm = (alloced - (inuse / obj_ch) ) / alloced
+ */
+
+    storeAppendPrintf(e,
+       "%d\t %d\t %d\t %.2f\t %.1f\t"  /* alloc */
+       "%d\t %d\t %d\t %.1f\t" /* in use */
+       "%d\t %d\t %d\t"        /* idle */
+       "%.0f\t %.1f\t %.1f\t %.1f\n",  /* saved */
+    /* alloc */
+       mp_st->items_alloc,
+       toKB(mp_st->obj_size * pm->alloc.level),
+       toKB(mp_st->obj_size * pm->alloc.hwater_level),
+       (double) ((squid_curtime - pm->alloc.hwater_stamp) / 3600.),
+       xpercent(mp_st->obj_size * pm->alloc.level, AllMeter->alloc.level),
+    /* in use */
+       mp_st->items_inuse,
+       toKB(mp_st->obj_size * pm->inuse.level),
+       toKB(mp_st->obj_size * pm->inuse.hwater_level),
+       xpercent(pm->inuse.level, pm->alloc.level),
+    /* idle */
+       mp_st->items_idle,
+       toKB(mp_st->obj_size * pm->idle.level),
+       toKB(mp_st->obj_size * pm->idle.hwater_level),
+    /* saved */
+       pm->gb_saved.count,
+       xpercent(pm->gb_saved.count, AllMeter->gb_saved.count),
+       xpercent(pm->gb_saved.bytes, AllMeter->gb_saved.bytes),
+       xdiv(pm->gb_saved.count - pm->gb_osaved.count, xm_deltat));
+    pm->gb_osaved.count = pm->gb_saved.count;
+}
+
+void
+memReport(StoreEntry * e)
+{
+    static char buf[64];
+    static MemPoolStats mp_stats;
+    static MemPoolGlobalStats mp_total;
+    int not_used = 0;
+    MemPoolIterator *iter;
+    MemPool *pool;
+
+    /* caption */
+    storeAppendPrintf(e, "Current memory usage:\n");
+    /* heading */
+    storeAppendPrintf(e,
+       "Pool\t Obj Size\t"
+       "Chunks\t\t\t\t\t\t\t"
+       "Allocated\t\t\t\t\t"
+       "In Use\t\t\t\t"
+       "Idle\t\t\t"
+       "Allocations Saved\t\t\t"
+       "Hit Rate\t"
+       "\n"
+       " \t (bytes)\t"
+       "KB/ch\t obj/ch\t"
+       "(#)\t used\t free\t part\t %%Frag\t "
+       "(#)\t (KB)\t high (KB)\t high (hrs)\t %%Tot\t"
+       "(#)\t (KB)\t high (KB)\t %%alloc\t"
+       "(#)\t (KB)\t high (KB)\t"
+       "(#)\t %%cnt\t %%vol\t"
+       "(#) / sec\t"
+       "\n");
+    xm_deltat = current_dtime - xm_time;
+    xm_time = current_dtime;
+
+    /* Get stats for Totals report line */
+    memPoolGetGlobalStats(&mp_total);
+
+    /* main table */
+    iter = memPoolIterate();
+    while ((pool = memPoolIterateNext(iter))) {
+       memPoolGetStats(&mp_stats, pool);
+       if (!mp_stats.pool)     /* pool destroyed */
+           continue;
+       if (mp_stats.pool->meter.gb_saved.count > 0)    /* this pool has been used */
+           memPoolReport(&mp_stats, mp_total.TheMeter, e);
+       else
+           not_used++;
+    }
+    memPoolIterateDone(&iter);
+
+    mp_stats.pool = NULL;
+    mp_stats.label = "Total";
+    mp_stats.meter = mp_total.TheMeter;
+    mp_stats.obj_size = 1;
+    mp_stats.chunk_capacity = 0;
+    mp_stats.chunk_size = 0;
+    mp_stats.chunks_alloc = mp_total.tot_chunks_alloc;
+    mp_stats.chunks_inuse = mp_total.tot_chunks_inuse;
+    mp_stats.chunks_partial = mp_total.tot_chunks_partial;
+    mp_stats.chunks_free = mp_total.tot_chunks_free;
+    mp_stats.items_alloc = mp_total.tot_items_alloc;
+    mp_stats.items_inuse = mp_total.tot_items_inuse;
+    mp_stats.items_idle = mp_total.tot_items_idle;
+    mp_stats.overhead = mp_total.tot_overhead;
+
+    memPoolReport(&mp_stats, mp_total.TheMeter, e);
+
+    /* Cumulative */
+    storeAppendPrintf(e, "Cumulative allocated volume: %s\n", double_to_str(buf, 64, mp_total.TheMeter->gb_saved.bytes));
+    /* overhead */
+    storeAppendPrintf(e, "Current overhead: %d bytes (%.3f%%)\n",
+       mp_total.tot_overhead, xpercent(mp_total.tot_overhead, mp_total.TheMeter->inuse.level));
+    /* limits */
+    storeAppendPrintf(e, "Idle pool limit: %.2f MB\n", toMB(mp_total.mem_idle_limit));
+    /* limits */
+    storeAppendPrintf(e, "Total Pools created: %d\n", mp_total.tot_pools_alloc);
+    storeAppendPrintf(e, "Pools ever used:     %d (shown above)\n",mp_total.tot_pools_alloc - not_used);
+    storeAppendPrintf(e, "Currently in use:    %d\n", mp_total.tot_pools_inuse);
+}
index 5ec1b9f1bf1b638c9287a2ebb177e8d4d5fc6c72..ee9c2d8d29c53bbd0a0a761831c06837a06dd9b2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.431 2002/04/04 21:33:27 hno Exp $
+ * $Id: protos.h,v 1.432 2002/04/06 08:49:27 adrian Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -826,14 +826,6 @@ extern StatHistBinDumper statHistEnumDumper;
 extern StatHistBinDumper statHistIntDumper;
 
 
-/* MemMeter */
-extern void memMeterSyncHWater(MemMeter * m);
-#define memMeterCheckHWater(m) { if ((m).hwater_level < (m).level) memMeterSyncHWater(&(m)); }
-#define memMeterInc(m) { (m).level++; memMeterCheckHWater(m); }
-#define memMeterDec(m) { (m).level--; }
-#define memMeterAdd(m, sz) { (m).level += (sz); memMeterCheckHWater(m); }
-#define memMeterDel(m, sz) { (m).level -= (sz); }
-
 /* mem */
 extern void memInit(void);
 extern void memClean(void);
@@ -851,23 +843,28 @@ extern void memFreeString(size_t size, void *);
 extern void memFreeBuf(size_t size, void *);
 extern FREE *memFreeBufFunc(size_t size);
 extern int memInUse(mem_type);
-extern size_t memTotalAllocated(void);
 extern void memDataInit(mem_type, const char *, size_t, int);
 extern void memCheckInit(void);
 
 /* MemPool */
 extern MemPool *memPoolCreate(const char *label, size_t obj_size);
-extern void memPoolDestroy(MemPool * pool);
 extern void *memPoolAlloc(MemPool * pool);
 extern void memPoolFree(MemPool * pool, void *obj);
-extern int memPoolWasUsed(const MemPool * pool);
-extern int memPoolInUseCount(const MemPool * pool);
-extern size_t memPoolInUseSize(const MemPool * pool);
-extern int memPoolUsedCount(const MemPool * pool);
-extern void memPoolReport(const MemPool * pool, StoreEntry * e);
+extern void memPoolDestroy(MemPool ** pool);
+extern MemPoolIterator * memPoolGetFirst(void);
+extern MemPool * memPoolGetNext(MemPoolIterator ** iter);
+extern void memPoolSetChunkSize(MemPool * pool, size_t chunksize);
+extern void memPoolSetIdleLimit(size_t new_idle_limit);
+extern int memPoolGetStats(MemPoolStats * stats, MemPool * pool);
+extern int memPoolGetGlobalStats(MemPoolGlobalStats * stats);
+extern void memPoolClean(time_t maxage);
 
 /* Mem */
 extern void memReport(StoreEntry * e);
+extern void memConfigure(void);
+extern void memPoolCleanIdlePools(void *unused);
+extern int memPoolInUseCount(MemPool * pool);
+extern int memPoolsTotalAllocated(void);
 
 extern int stmemFreeDataUpto(mem_hdr *, int);
 extern void stmemAppend(mem_hdr *, const char *, int);
@@ -1153,9 +1150,6 @@ extern void dlinkNodeDelete(dlink_node * m);
 extern dlink_node *dlinkNodeNew(void);
 
 extern void kb_incr(kb_t *, size_t);
-extern double gb_to_double(const gb_t *);
-extern const char *gb_to_str(const gb_t *);
-extern void gb_flush(gb_t *);  /* internal, do not use this */
 extern int stringHasWhitespace(const char *);
 extern int stringHasCntl(const char *);
 extern void linklistPush(link_list **, void *);
index 4eede125c0dda00de8b19e8ff19358d3c31b60e0..31f9a3624a3ddc03d8936dfeab14dbe7b336789d 100644 (file)
@@ -15,7 +15,7 @@
 
 #  Makefile for storage modules in the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.9 2002/02/26 15:48:31 adrian Exp $
+#  $Id: Makefile.in,v 1.10 2002/04/06 08:49:45 adrian Exp $
 #
 
 SHELL = @SHELL@
index 93eb4f6c1728a83ed132345100410cdc25e0e081..db7dcc65710439d765a1dde2c8fb68405bd99dcb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_repl_lru.cc,v 1.10 2001/08/16 00:16:22 hno Exp $
+ * $Id: store_repl_lru.cc,v 1.11 2002/04/06 08:49:46 adrian Exp $
  *
  * DEBUG: section ?     LRU Removal policy
  * AUTHOR: Henrik Nordstrom
@@ -281,8 +281,10 @@ createRemovalPolicy_lru(wordlist * args)
     /* no arguments expected or understood */
     assert(!args);
     /* Initialize */
-    if (!lru_node_pool)
+    if (!lru_node_pool) {
        lru_node_pool = memPoolCreate("LRU policy node", sizeof(LruNode));
+       memPoolSetChunkSize(lru_node_pool, 512 * 1024);
+    }
     /* Allocate the needed structures */
     lru_data = xcalloc(1, sizeof(*lru_data));
     policy = cbdataAlloc(RemovalPolicy);
index cd05eed0a9d309c17749a3618b789457ef9af78d..de0063c52ee9ef8dca280749aebbf0e6498b9c18 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: squid.h,v 1.217 2002/01/05 04:34:42 hno Exp $
+ * $Id: squid.h,v 1.218 2002/04/06 08:49:27 adrian Exp $
  *
  * AUTHOR: Duane Wessels
  *
@@ -406,14 +406,16 @@ struct rusage {
 #include "hash.h"
 #include "rfc1035.h"
 
+
 #include "defines.h"
 #include "enums.h"
 #include "typedefs.h"
+#include "util.h"
+#include "MemPool.h"
 #include "structs.h"
 #include "protos.h"
 #include "globals.h"
 
-#include "util.h"
 
 #if !HAVE_TEMPNAM
 #include "tempnam.h"
index bfd5e89bd44a16c9ddbb6bf531d74f16b4c9bcb3..8926dc87639a33ece958c2e8570769fbf5c6d54a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.353 2002/02/26 15:48:15 adrian Exp $
+ * $Id: stat.cc,v 1.354 2002/04/06 08:49:27 adrian Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -571,10 +571,13 @@ info_get(StoreEntry * sentry)
        mp.fordblks >> 10);
     t = mp.uordblks + mp.usmblks + mp.hblkhd;
     storeAppendPrintf(sentry, "\tTotal in use:          %6d KB %d%%\n",
-       t >> 10, percent(t, mp.arena));
+       t >> 10, percent(t, mp.arena + mp.hblkhd));
     t = mp.fsmblks + mp.fordblks;
     storeAppendPrintf(sentry, "\tTotal free:            %6d KB %d%%\n",
-       t >> 10, percent(t, mp.arena));
+       t >> 10, percent(t, mp.arena + mp.hblkhd));
+    t = mp.arena + mp.hblkhd;
+    storeAppendPrintf(sentry, "\tTotal size:            %6d KB\n",
+       t >> 10);
 #if HAVE_EXT_MALLINFO
     storeAppendPrintf(sentry, "\tmax size of small blocks:\t%d\n", mp.mxfast);
     storeAppendPrintf(sentry, "\tnumber of small blocks in a holding block:\t%d\n",
@@ -589,13 +592,25 @@ info_get(StoreEntry * sentry)
 #endif /* HAVE_EXT_MALLINFO */
 #endif /* HAVE_MALLINFO */
     storeAppendPrintf(sentry, "Memory accounted for:\n");
+#if !(HAVE_MSTATS && HAVE_GNUMALLOC_H) && HAVE_MALLINFO && HAVE_STRUCT_MALLINFO
+    storeAppendPrintf(sentry, "\tTotal accounted:       %6d KB %3d%%\n",
+       statMemoryAccounted() >> 10, percent(statMemoryAccounted(), t));
+#else
     storeAppendPrintf(sentry, "\tTotal accounted:       %6d KB\n",
        statMemoryAccounted() >> 10);
-    storeAppendPrintf(sentry, "\tmemPoolAlloc calls: %d\n",
-       mem_pool_alloc_calls);
-    storeAppendPrintf(sentry, "\tmemPoolFree calls: %d\n",
-       mem_pool_free_calls);
-
+#endif
+    {
+       MemPoolGlobalStats mp_stats;
+       memPoolGetGlobalStats(&mp_stats);
+       storeAppendPrintf(sentry, "\tmemPool accounted:     %6d KB %3d%%\n",
+           mp_stats.TheMeter->alloc.level >> 10, percent(mp_stats.TheMeter->alloc.level, t));
+       storeAppendPrintf(sentry, "\tmemPool unaccounted:   %6d KB %3d%%\n",
+           (t - mp_stats.TheMeter->alloc.level) >> 10, percent((t - mp_stats.TheMeter->alloc.level), t));
+       storeAppendPrintf(sentry, "\tmemPoolAlloc calls: %9.0f\n",
+           mp_stats.TheMeter->gb_saved.count);
+       storeAppendPrintf(sentry, "\tmemPoolFree calls:  %9.0f\n",
+           mp_stats.TheMeter->gb_freed.count);
+    }
     storeAppendPrintf(sentry, "File descriptor usage for %s:\n", appname);
     storeAppendPrintf(sentry, "\tMaximum number of file descriptors:   %4d\n",
        Squid_MaxFD);
@@ -1520,10 +1535,10 @@ statGraphDump(StoreEntry * e)
     GENGRAPH(cputime, "cputime", "CPU utilisation");
 }
 
+#endif /* STAT_GRAPHS */
+
 int
 statMemoryAccounted(void)
 {
-    memTotalAllocated();
+    return memPoolsTotalAllocated();
 }
-
-#endif /* STAT_GRAPHS */
index 455beeaaea0f0860ea3d5969a5e6017f697ff619..e75a446fe837a6acea4bef6a28f3688ff235b6b3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.413 2002/04/04 21:03:47 hno Exp $
+ * $Id: structs.h,v 1.414 2002/04/06 08:49:28 adrian Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -1899,30 +1899,6 @@ struct _storeSwapLogData {
     unsigned char key[MD5_DIGEST_CHARS];
 };
 
-/* object to track per-action memory usage (e.g. #idle objects) */
-struct _MemMeter {
-    ssize_t level;             /* current level (count or volume) */
-    ssize_t hwater_level;      /* high water mark */
-    time_t hwater_stamp;       /* timestamp of last high water mark change */
-};
-
-/* object to track per-pool memory usage (alloc = inuse+idle) */
-struct _MemPoolMeter {
-    MemMeter alloc;
-    MemMeter inuse;
-    MemMeter idle;
-    gb_t saved;
-    gb_t total;
-};
-
-/* a pool is a [growing] space for objects of the same size */
-struct _MemPool {
-    const char *label;
-    size_t obj_size;
-    Stack pstack;              /* stack for free pointers */
-    MemPoolMeter meter;
-};
-
 struct _ClientInfo {
     hash_link hash;            /* must be first */
     struct in_addr addr;
index f4f50ad0192add291b009b86c1272d3155b02800..1d28d7579ff33215315f013ecd356df112d51ef8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.215 2002/04/04 21:33:27 hno Exp $
+ * $Id: tools.cc,v 1.216 2002/04/06 08:49:28 adrian Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -833,43 +833,6 @@ kb_incr(kb_t * k, size_t v)
     k->bytes &= 0x3FF;
 }
 
-void
-gb_flush(gb_t * g)
-{
-    g->gb += (g->bytes >> 30);
-    g->bytes &= (1 << 30) - 1;
-}
-
-double
-gb_to_double(const gb_t * g)
-{
-    return ((double) g->gb) * ((double) (1 << 30)) + ((double) g->bytes);
-}
-
-const char *
-gb_to_str(const gb_t * g)
-{
-    /*
-     * it is often convenient to call gb_to_str several times for _one_ printf
-     */
-#define max_cc_calls 5
-    typedef char GbBuf[32];
-    static GbBuf bufs[max_cc_calls];
-    static int call_id = 0;
-    double value = gb_to_double(g);
-    char *buf = bufs[call_id++];
-    if (call_id >= max_cc_calls)
-       call_id = 0;
-    /* select format */
-    if (value < 1e9)
-       snprintf(buf, sizeof(GbBuf), "%.2f MB", value / 1e6);
-    else if (value < 1e12)
-       snprintf(buf, sizeof(GbBuf), "%.2f GB", value / 1e9);
-    else
-       snprintf(buf, sizeof(GbBuf), "%.2f TB", value / 1e12);
-    return buf;
-}
-
 void
 debugObj(int section, int level, const char *label, void *obj, ObjPackMethod pm)
 {
index 0a307e758ec9acd561bcc30102d50263cc3465d0..7874d85268ee9248b800d2f50f0efc622a2781bd 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: typedefs.h,v 1.132 2001/10/10 15:17:42 adrian Exp $
+ * $Id: typedefs.h,v 1.133 2002/04/06 08:49:28 adrian Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -46,12 +46,6 @@ typedef struct {
     size_t kb;
 } kb_t;
 
-typedef struct {
-    size_t count;
-    size_t bytes;
-    size_t gb;
-} gb_t;
-
 /*
  * grep '^struct' structs.h \
  * | perl -ne '($a,$b)=split;$c=$b;$c=~s/^_//; print "typedef struct $b $c;\n";'
@@ -163,9 +157,6 @@ typedef struct _authConfig authConfig;
 typedef struct _cacheSwap cacheSwap;
 typedef struct _StatHist StatHist;
 typedef struct _String String;
-typedef struct _MemMeter MemMeter;
-typedef struct _MemPoolMeter MemPoolMeter;
-typedef struct _MemPool MemPool;
 typedef struct _ClientInfo ClientInfo;
 typedef struct _cd_guess_stats cd_guess_stats;
 typedef struct _CacheDigest CacheDigest;