+ - Another 'rm -rf' fix for store.c (Bernd Ernesti).
+ - Use of the Host: header for httpd_accel requests is now
+ disabled unless 'httpd_accel_uses_host_header' is set.
+ - Have configure check for libgnumalloc.a.
+ - Added support for using poll() instead of select()
+ (Stewart Forster, Anthony Baxter).
+
Changes to squid-1.1.beta25 ():
- Check if we should delete-behind large objects when above LOW
-# From configure.in Revision: 1.55
+# From configure.in Revision: 1.56
ac_aux_dir=
for ac_dir in aux $srcdir/aux; do
if test -f $ac_dir/install-sh; then
netdb.h \
netinet/in.h \
netinet/tcp.h \
+ poll.h \
pwd.h \
regex.h \
resolv.h \
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1475 "configure"
+#line 1476 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1480: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1481: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1510 "configure"
+#line 1511 "configure"
#include "confdefs.h"
int main() { return 0; }
; return 0; }
EOF
-if { (eval echo configure:1560: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1561: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
echo $ac_n "checking if ANSI prototypes work""... $ac_c" 1>&6
cat > conftest.$ac_ext <<EOF
-#line 1582 "configure"
+#line 1583 "configure"
#include "confdefs.h"
int foo(char *); int foo (char *bar) { }
int main() { return 0; }
return 1;
; return 0; }
EOF
-if { (eval echo configure:1590: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1591: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_ANSI_PROTOTYPES 1
echo $ac_n "checking for tm->tm_gmtoff""... $ac_c" 1>&6
cat > conftest.$ac_ext <<EOF
-#line 1606 "configure"
+#line 1607 "configure"
#include "confdefs.h"
#include <time.h>
#include <sys/time.h>
foo.tm_gmtoff = 0;
; return 0; }
EOF
-if { (eval echo configure:1616: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1617: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_TM_GMTOFF 1
echo $ac_n "checking for extended mallinfo""... $ac_c" 1>&6
cat > conftest.$ac_ext <<EOF
-#line 1632 "configure"
+#line 1633 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <malloc.h>
foo.mxfast = 0;
; return 0; }
EOF
-if { (eval echo configure:1642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1643: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_EXT_MALLINFO 1
echo $ac_n "checking for ip->ip_hl""... $ac_c" 1>&6
cat > conftest.$ac_ext <<EOF
-#line 1658 "configure"
+#line 1659 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <netinet/in.h>
ip.ip_hl= 0;
; return 0; }
EOF
-if { (eval echo configure:1670: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1671: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_IP_HL 1
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1692 "configure"
+#line 1693 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
exit(0);
}
EOF
-{ (eval echo configure:1703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
+{ (eval echo configure:1704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
ac_cv_sizeof_int=`cat conftestval`
else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1726 "configure"
+#line 1727 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
exit(0);
}
EOF
-{ (eval echo configure:1737: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
+{ (eval echo configure:1738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
ac_cv_sizeof_long=`cat conftestval`
else
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1760 "configure"
+#line 1761 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() { return 0; }
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:1768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
ac_cv_header_alloca_h=yes
else
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1792 "configure"
+#line 1793 "configure"
#include "confdefs.h"
#ifdef __GNUC__
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:1816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1817: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
ac_cv_func_alloca=yes
else
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1851 "configure"
+#line 1852 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1880 "configure"
+#line 1881 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:1904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 1936 "configure"
+#line 1937 "configure"
#include "confdefs.h"
find_stack_direction ()
{
exit (find_stack_direction() < 0);
}
EOF
-{ (eval echo configure:1955: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
+{ (eval echo configure:1956: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
ac_cv_c_stack_direction=1
else
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1978 "configure"
+#line 1979 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2009 "configure"
+#line 2010 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2040 "configure"
+#line 2041 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2075 "configure"
+#line 2076 "configure"
#include "confdefs.h"
int main() { return 0; }
main()
; return 0; }
EOF
-if { (eval echo configure:2083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2115 "configure"
+#line 2116 "configure"
#include "confdefs.h"
int main() { return 0; }
main()
; return 0; }
EOF
-if { (eval echo configure:2123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ac_save_LIBS="$LIBS"
LIBS="-lgnumalloc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2155 "configure"
+#line 2156 "configure"
#include "confdefs.h"
int main() { return 0; }
main()
; return 0; }
EOF
-if { (eval echo configure:2163: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ac_save_LIBS="$LIBS"
LIBS="-lmalloc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2204 "configure"
+#line 2205 "configure"
#include "confdefs.h"
int main() { return 0; }
main()
; return 0; }
EOF
-if { (eval echo configure:2212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ac_save_LIBS="$LIBS"
LIBS="-lbsd $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2247 "configure"
+#line 2248 "configure"
#include "confdefs.h"
int main() { return 0; }
main()
; return 0; }
EOF
-if { (eval echo configure:2255: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ac_save_LIBS="$LIBS"
LIBS="-lregex $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2287 "configure"
+#line 2288 "configure"
#include "confdefs.h"
int main() { return 0; }
main()
; return 0; }
EOF
-if { (eval echo configure:2295: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ac_save_LIBS="$LIBS"
LIBS="-lresolv $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2321 "configure"
+#line 2322 "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
inet_aton()
; return 0; }
EOF
-if { (eval echo configure:2333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ac_save_LIBS="$LIBS"
LIBS="-l44bsd $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2354 "configure"
+#line 2355 "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
inet_aton()
; return 0; }
EOF
-if { (eval echo configure:2366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ac_save_LIBS="$LIBS"
LIBS="-lresolv $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2402 "configure"
+#line 2403 "configure"
#include "confdefs.h"
int main() { return 0; }
main()
; return 0; }
EOF
-if { (eval echo configure:2410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ac_save_LIBS="$LIBS"
LIBS="-lcrypt $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2443 "configure"
+#line 2444 "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
crypt()
; return 0; }
EOF
-if { (eval echo configure:2455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2456: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ac_save_LIBS="$LIBS"
LIBS="-lshadow $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2483 "configure"
+#line 2484 "configure"
#include "confdefs.h"
int main() { return 0; }
main()
; return 0; }
EOF
-if { (eval echo configure:2491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2492: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ac_save_LIBS="$LIBS"
LIBS="-labi $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2525 "configure"
+#line 2526 "configure"
#include "confdefs.h"
int main() { return 0; }
main()
; return 0; }
EOF
-if { (eval echo configure:2533: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ac_save_LIBS="$LIBS"
LIBS="-lposix4 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2559 "configure"
+#line 2560 "configure"
#include "confdefs.h"
int main() { return 0; }
main()
; return 0; }
EOF
-if { (eval echo configure:2567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2568: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
memcpy \
memmove \
mktime \
+ poll \
pw_encrypt \
regcomp \
regexec \
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2670 "configure"
+#line 2672 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:2694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2745 "configure"
+#line 2747 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:2769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:2771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
SQUID_MAXFD=256
else
cat > conftest.$ac_ext <<EOF
-#line 2795 "configure"
+#line 2797 "configure"
#include "confdefs.h"
#include <unistd.h>
}
EOF
-{ (eval echo configure:2846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
+{ (eval echo configure:2848: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
SQUID_MAXFD=`cat conftestval`
else
SQUID_UDP_SO_SNDBUF=16384
else
cat > conftest.$ac_ext <<EOF
-#line 2865 "configure"
+#line 2867 "configure"
#include "confdefs.h"
#include <sys/types.h>
}
EOF
-{ (eval echo configure:2882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
+{ (eval echo configure:2884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
SQUID_UDP_SO_SNDBUF=`cat conftestval`
else
SQUID_UDP_SO_RCVBUF=16384
else
cat > conftest.$ac_ext <<EOF
-#line 2901 "configure"
+#line 2903 "configure"
#include "confdefs.h"
#include <sys/types.h>
}
EOF
-{ (eval echo configure:2918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
+{ (eval echo configure:2920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
SQUID_UDP_SO_RCVBUF=`cat conftestval`
else
SQUID_TCP_SO_SNDBUF=16384
else
cat > conftest.$ac_ext <<EOF
-#line 2937 "configure"
+#line 2939 "configure"
#include "confdefs.h"
#include <sys/types.h>
}
EOF
-{ (eval echo configure:2954: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
+{ (eval echo configure:2956: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
SQUID_TCP_SO_SNDBUF=`cat conftestval`
else
SQUID_TCP_SO_RCVBUF=16384
else
cat > conftest.$ac_ext <<EOF
-#line 2973 "configure"
+#line 2975 "configure"
#include "confdefs.h"
#include <sys/types.h>
}
EOF
-{ (eval echo configure:2990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
+{ (eval echo configure:2992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
SQUID_TCP_SO_RCVBUF=`cat conftestval`
else
echo $ac_n "checking if sys_errlist is already defined""... $ac_c" 1>&6
cat > conftest.$ac_ext <<EOF
-#line 3006 "configure"
+#line 3008 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() { return 0; }
char *s = sys_errlist[0];
; return 0; }
EOF
-if { (eval echo configure:3014: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3016: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
else
echo $ac_n "checking for libresolv _dns_ttl_ hack""... $ac_c" 1>&6
cat > conftest.$ac_ext <<EOF
-#line 3030 "configure"
+#line 3032 "configure"
#include "confdefs.h"
extern int _dns_ttl_;
int main() { return 0; }
return _dns_ttl_;
; return 0; }
EOF
-if { (eval echo configure:3038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:3040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
dnl
dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
dnl
-dnl $Id: configure.in,v 1.56 1996/12/02 19:12:08 wessels Exp $
+dnl $Id: configure.in,v 1.57 1996/12/03 00:46:04 wessels Exp $
dnl
dnl
dnl
AC_INIT(src/main.c)
AC_CONFIG_HEADER(include/autoconf.h)
-AC_REVISION($Revision: 1.56 $)dnl
+AC_REVISION($Revision: 1.57 $)dnl
AC_PREFIX_DEFAULT(/usr/local/squid)
AC_CONFIG_AUX_DIR(aux)
netdb.h \
netinet/in.h \
netinet/tcp.h \
+ poll.h \
pwd.h \
regex.h \
resolv.h \
memcpy \
memmove \
mktime \
+ poll \
pw_encrypt \
regcomp \
regexec \
/* Define if you have the mktime function. */
#undef HAVE_MKTIME
+/* Define if you have the poll function. */
+#undef HAVE_POLL
+
/* Define if you have the pw_encrypt function. */
#undef HAVE_PW_ENCRYPT
/* Define if you have the <netinet/tcp.h> header file. */
#undef HAVE_NETINET_TCP_H
+/* Define if you have the <poll.h> header file. */
+#undef HAVE_POLL_H
+
/* Define if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
#
# Makefile for the Squid Object Cache server
#
-# $Id: Makefile.in,v 1.58 1996/12/02 05:54:42 wessels Exp $
+# $Id: Makefile.in,v 1.59 1996/12/03 00:46:11 wessels Exp $
#
# Uncomment and customize the following to suit your needs:
#
DELAY_HACK = # -DDELAY_HACK=1
USERAGENT_OPT = # -DUSE_USERAGENT_LOG=1
KILL_PARENT_OPT = # -DKILL_PARENT_OPT
-DEFINES = $(HOST_OPT) $(AIO_OPT) $(AUTH_OPT) $(LOG_HDRS_OPT) \
- $(ICMP_OPT) $(DELAY_HACK) $(USERAGENT_OPT) \
- $(KILL_PARENT_OPT)
+USE_POLL_OPT = # -DUSE_POLL
+DEFINES = $(HOST_OPT) $(AIO_OPT) $(AUTH_OPT) $(LOG_HDRS_OPT) \
+ $(ICMP_OPT) $(DELAY_HACK) $(USERAGENT_OPT) \
+ $(KILL_PARENT_OPT) $(USE_POLL_OPT)
prefix = @prefix@
exec_prefix = @exec_prefix@
/*
- * $Id: comm.cc,v 1.113 1996/12/02 05:55:05 wessels Exp $
+ * $Id: comm.cc,v 1.114 1996/12/03 00:46:12 wessels Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
/* STATIC */
static int commBind _PARAMS((int s, struct in_addr, u_short port));
static int comm_cleanup_fd_entry _PARAMS((int));
+#ifndef USE_POLL
static int examine_select _PARAMS((fd_set *, fd_set *));
+#endif
static void checkTimeouts _PARAMS((void));
static void checkLifetimes _PARAMS((void));
static void Reserve_More_FDs _PARAMS((void));
fd_table[fd].stall_until = squid_curtime + delta;
}
+
+#ifdef USE_POLL
+
+/* poll() version by:
+ * Stewart Forster <slf@connect.com.au>, and
+ * Anthony Baxter <arb@connect.com.au> */
+
+static void
+comm_select_incoming(void)
+{
+ int fd = 0;
+ int fds[3];
+ struct pollfd pfds[3];
+ int N = 0;
+ int i = 0;
+ PF hdl = NULL;
+ if (theInIcpConnection >= 0)
+ fds[N++] = theInIcpConnection;
+ if (theHttpConnection >= 0 && fdstat_are_n_free_fd(RESERVED_FD))
+ fds[N++] = theHttpConnection;
+ fds[N++] = 0;
+ for (i = 0; i < N; i++) {
+ fd = fds[i];
+ pfds[i].events = 0;
+ pfds[i].revents = 0;
+ pfds[i].fd = fd;
+ if (fd_table[fd].read_handler) {
+ pfds[i].events |= POLLRDNORM;
+ }
+ if (fd_table[fd].write_handler) {
+ pfds[i].events |= POLLWRNORM;
+ }
+ if (pfds[i].events == 0)
+ pfds[i].fd = -1;
+ }
+ pfds[N].fd = -1; /* just in case... */
+ pfds[N].events = 0;
+ if (poll(pfds, N, (int) 0) < 1)
+ return;
+ getCurrentTime();
+ for (i = 0; i < N; i++) {
+ if ((pfds[i].revents == 0) || (pfds[i].fd == -1))
+ continue;
+ fd = fds[i];
+ if (pfds[i].revents & (POLLRDNORM | POLLIN | POLLHUP | POLLERR)) {
+ hdl = fd_table[fd].read_handler;
+ fd_table[fd].read_handler = 0;
+ hdl(fd, fd_table[fd].read_data);
+ }
+ if (pfds[i].revents & (POLLWRNORM | POLLOUT | POLLHUP | POLLERR)) {
+ hdl = fd_table[fd].write_handler;
+ fd_table[fd].write_handler = 0;
+ hdl(fd, fd_table[fd].write_data);
+ }
+ }
+ /* TO FIX: repoll ICP connection here */
+}
+
+#else
+
static void
comm_select_incoming(void)
{
int N = 0;
int i = 0;
PF hdl = NULL;
-
FD_ZERO(&read_mask);
FD_ZERO(&write_mask);
-
if (theHttpConnection >= 0 && fdstat_are_n_free_fd(RESERVED_FD))
fds[N++] = theHttpConnection;
if (theInIcpConnection >= 0)
fds[N++] = theInIcpConnection;
fds[N++] = 0;
-
for (i = 0; i < N; i++) {
fd = fds[i];
if (fd_table[fd].read_handler) {
maxfd = fd;
}
}
-
if (maxfd++ == 0)
return;
- if (select(maxfd, &read_mask, &write_mask, NULL, &zero_tv) > 0) {
- getCurrentTime();
- for (i = 0; i < N; i++) {
- fd = fds[i];
- if (FD_ISSET(fd, &read_mask)) {
- hdl = fd_table[fd].read_handler;
- fd_table[fd].read_handler = 0;
- hdl(fd, fd_table[fd].read_data);
+ if (select(maxfd, &read_mask, &write_mask, NULL, &zero_tv) < 1)
+ return;
+ getCurrentTime();
+ for (i = 0; i < N; i++) {
+ fd = fds[i];
+ if (FD_ISSET(fd, &read_mask)) {
+ hdl = fd_table[fd].read_handler;
+ fd_table[fd].read_handler = 0;
+ hdl(fd, fd_table[fd].read_data);
+ }
+ if (FD_ISSET(fd, &write_mask)) {
+ hdl = fd_table[fd].write_handler;
+ fd_table[fd].write_handler = 0;
+ hdl(fd, fd_table[fd].write_data);
+ }
+ }
+}
+#endif
+
+
+#ifdef USE_POLL
+/* poll all sockets; call handlers for those that are ready. */
+int
+comm_select(time_t sec)
+{
+ struct pollfd pfds[FD_SETSIZE];
+ PF hdl = NULL;
+ int fd;
+ int i;
+ int maxfd;
+ int nfds;
+ int incnfd;
+ int num;
+ int httpindex;
+ static time_t last_timeout = 0;
+ int poll_time = 0;
+ time_t timeout;
+ struct close_handler *ch = NULL;
+ struct close_handler *next = NULL;
+ FD_ENTRY *f = NULL;
+ /* assume all process are very fast (less than 1 second). Call
+ * time() only once */
+ getCurrentTime();
+ /* use only 1 second granularity */
+ timeout = squid_curtime + sec;
+ do {
+ if (sec > 60)
+ fatal_dump(NULL);
+ if (shutdown_pending || reread_pending) {
+ serverConnectionsClose();
+ ftpServerClose();
+ dnsShutdownServers();
+ redirectShutdownServers();
+ if (shutdown_pending > 0)
+ setSocketShutdownLifetimes(Config.lifetimeShutdown);
+ else
+ setSocketShutdownLifetimes(0);
+ }
+ nfds = 0;
+ maxfd = fdstat_biggest_fd() + 1;
+ httpindex = -1;
+ for (i = 0; i < maxfd; i++) {
+ pfds[nfds].fd = -1;
+ pfds[nfds].events = 0;
+#if USE_ASYNC_IO
+ /* Using async IO for disk handle, so don't select on them */
+ if (fdstatGetType(i) == FD_FILE)
+ continue;
+#endif
+ /* Check each open socket for a handler. */
+ incnfd = 0;
+ if (fd_table[i].read_handler && fd_table[i].stall_until <= squid_curtime) {
+ pfds[nfds].events |= POLLRDNORM;
+ pfds[nfds].fd = i;
+ incnfd = 1;
}
- if (FD_ISSET(fd, &write_mask)) {
- hdl = fd_table[fd].write_handler;
- fd_table[fd].write_handler = 0;
- hdl(fd, fd_table[fd].write_data);
+ if (fd_table[i].write_handler) {
+ pfds[nfds].events |= POLLWRNORM;
+ pfds[nfds].fd = i;
+ incnfd = 1;
+ }
+ if (incnfd == 1) {
+ if (i == theHttpConnection)
+ httpindex = nfds;
+ nfds++;
}
}
- }
+ /* If we're out of free fd's, don't poll the http incoming fd */
+ if (!fdstat_are_n_free_fd(RESERVED_FD) && httpindex >= 0) {
+ pfds[httpindex].fd = -1;
+ pfds[httpindex].events = 0;
+ }
+ pfds[nfds].fd = -1; /* just in case */
+ pfds[nfds].events = 0;
+ if (shutdown_pending || reread_pending)
+ debug(5, 2, "comm_select: Still waiting on %d FDs\n", nfds);
+ if (nfds == 0)
+ return COMM_SHUTDOWN;
+ for (;;) {
+#if USE_ASYNC_IO
+ /* Another CPU vs latency tradeoff for async IO */
+ poll_time = 250;
+#else
+ poll_time = sec > 0 ? 1000 : 0;
+#endif
+ num = poll(pfds, nfds, poll_time);
+ getCurrentTime();
+ if (num >= 0)
+ break;
+ if (errno == EINTR)
+ break;
+ debug(5, 0, "comm_select: poll failure: %s\n",
+ xstrerror());
+ if (errno == EINVAL) {
+ /* nfds greater than OPEN_MAX?? How possible? Time */
+ /* to bail - write out nfds to cache.log and start */
+ /* emergency shutdown by sending SIGTERM to self */
+ debug(20, 1, " Poll died with EINVAL. Tried to poll %d FD's\n", nfds);
+ kill(getpid(), SIGTERM);
+ }
+ /* examine_select is handled below and efficiently too */
+ /*examine_select(&readfds, &writefds); XXXXX TO FIX */
+ return COMM_ERROR;
+ /* NOTREACHED */
+ }
+#if USE_ASYNC_IO
+ aioExamine(); /* See if any IO completed */
+#endif
+ if (num < 0)
+ continue; /* redo the top loop */
+ debug(5, num ? 5 : 8, "comm_select: %d sockets ready at %d\n",
+ num, (int) squid_curtime);
+ /* Check lifetime and timeout handlers ONCE each second.
+ * Replaces brain-dead check every time through the loop! */
+ if (squid_curtime > last_timeout) {
+ last_timeout = squid_curtime;
+ checkTimeouts();
+ checkLifetimes();
+ }
+ if (num == 0)
+ continue;
+ /* scan each socket but the accept socket. Poll this
+ * more frequently to minimiize losses due to the 5 connect
+ * limit in SunOS */
+ for (i = 0; i < nfds; i++) {
+ fd = pfds[i].fd;
+ if ((fd == -1) || (pfds[i].revents == 0))
+ continue;
+ /*
+ * Admit more connections quickly until we hit the hard limit.
+ * Don't forget to keep the UDP acks coming and going.
+ */
+ comm_select_incoming();
+ if ((fd == theInIcpConnection) || (fd == theHttpConnection))
+ continue;
+ if (pfds[i].revents & (POLLRDNORM | POLLIN | POLLHUP | POLLERR)) {
+ debug(5, 6, "comm_select: FD %d ready for reading\n", fd);
+ if (fd_table[fd].read_handler) {
+ hdl = fd_table[fd].read_handler;
+ fd_table[fd].read_handler = 0;
+ hdl(fd, fd_table[fd].read_data);
+ }
+ }
+ if (pfds[i].revents & (POLLWRNORM | POLLOUT | POLLHUP | POLLERR)) {
+ debug(5, 5, "comm_select: FD %d ready for writing\n", fd);
+ if (fd_table[fd].write_handler) {
+ hdl = fd_table[fd].write_handler;
+ fd_table[fd].write_handler = 0;
+ hdl(fd, fd_table[fd].write_data);
+ }
+ }
+ if (pfds[i].revents & POLLNVAL) {
+ f = &fd_table[fd];
+ debug(5, 0, "WARNING: FD %d has handlers, but it's invalid.\n", fd);
+ debug(5, 0, "FD %d is a %s\n", fd, fdstatTypeStr[fdstatGetType(fd)]);
+ debug(5, 0, "--> %s\n", fd_note(fd, NULL));
+ debug(5, 0, "lifetm:%p tmout:%p read:%p write:%p\n",
+ f->lifetime_handler,
+ f->timeout_handler,
+ f->read_handler,
+ f->write_handler);
+ for (ch = f->close_handler; ch; ch = ch->next)
+ debug(5, 0, " close handler: %p\n", ch->handler);
+ if (f->close_handler) {
+ for (ch = f->close_handler; ch; ch = next) {
+ next = ch->next;
+ ch->handler(fd, ch->data);
+ safe_free(ch);
+ }
+ } else if (f->lifetime_handler) {
+ debug(5, 0, "examine_select: Calling Lifetime Handler\n");
+ f->lifetime_handler(fd, f->lifetime_data);
+ } else if (f->timeout_handler) {
+ debug(5, 0, "examine_select: Calling Timeout Handler\n");
+ f->timeout_handler(fd, f->timeout_data);
+ }
+ f->close_handler = NULL;
+ f->lifetime_handler = NULL;
+ f->timeout_handler = NULL;
+ f->read_handler = NULL;
+ f->write_handler = NULL;
+ }
+ }
+ return COMM_OK;
+ } while (timeout > getCurrentTime());
+ debug(5, 8, "comm_select: time out: %d.\n", squid_curtime);
+ return COMM_TIMEOUT;
}
+#else
/* Select on all sockets; call handlers for those that are ready. */
int
debug(5, 8, "comm_select: time out: %d.\n", squid_curtime);
return COMM_TIMEOUT;
}
+#endif
void
commSetSelect(int fd, unsigned int type, PF handler, void *client_data, time_t timeout)
}
+#ifndef USE_POLL
/*
* examine_select - debug routine.
*
}
return 0;
}
+#endif
char *
fd_note(int fd, const char *s)
/*
- * $Id: squid.h,v 1.80 1996/12/02 07:06:56 wessels Exp $
+ * $Id: squid.h,v 1.81 1996/12/03 00:46:13 wessels Exp $
*
* AUTHOR: Duane Wessels
*
#include <getopt.h>
#endif
+#if defined(USE_POLL) && HAVE_POLL
+#if HAVE_POLL_H
+#include <poll.h>
+#endif /* HAVE_POLL_H */
+#else
+#undef USE_POLL
+#endif
+
#ifdef __STDC__
#include <stdarg.h>
#else