diff -ur thttpd-2.15-orig/configure thttpd-2.15/configure --- thttpd-2.15-orig/configure Sun Feb 6 20:31:20 2000 +++ thttpd-2.15/configure Mon Jun 5 13:56:18 2000 @@ -1061,13 +1061,50 @@ fi done +ac_safe=`echo "linux/devpoll.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for linux/devpoll.h""... $ac_c" 1>&6 +echo "configure:1067: checking for linux/devpoll.h" >&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 +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1077: \"$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* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_LINUX_DEVPOLL_H 1 +EOF + + LIBOBJS="$LIBOBJS devpoll.o" +else + echo "$ac_t""no" 1>&6 +fi + echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1066: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1103: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1076,7 +1113,7 @@ struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1080: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1117: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1101,12 +1138,12 @@ 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:1105: checking for $ac_hdr that defines DIR" >&5 +echo "configure:1142: 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 < #include <$ac_hdr> @@ -1114,7 +1151,7 @@ DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1118: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -1139,7 +1176,7 @@ # 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:1143: checking for opendir in -ldir" >&5 +echo "configure:1180: 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 @@ -1147,7 +1184,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1199: \"$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 @@ -1180,7 +1217,7 @@ else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1184: checking for opendir in -lx" >&5 +echo "configure:1221: 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 @@ -1188,7 +1225,7 @@ ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1240: \"$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 @@ -1224,7 +1261,7 @@ d="/usr/local/v6/lib" echo $ac_n "checking for $d""... $ac_c" 1>&6 -echo "configure:1228: checking for $d" >&5 +echo "configure:1265: checking for $d" >&5 if test -d $d; then echo "$ac_t""yes (Adding -L$d to LDFLAGS)" 1>&6 LDFLAGS="$LDFLAGS -L$d" @@ -1234,12 +1271,12 @@ V_NETLIBS="" echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:1238: checking for gethostbyname" >&5 +echo "configure:1275: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -1281,7 +1318,7 @@ echo "$ac_t""no" 1>&6 # Some OSes (eg. Solaris) place it in libnsl: echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:1285: checking for gethostbyname in -lnsl" >&5 +echo "configure:1322: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname'_' | sed 'y%./+- %__p__%'` if eval "test \"`echo '$''{'ac_cv_lbl_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1289,7 +1326,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lbl_lib_$ac_lib_var=yes" else @@ -1320,7 +1357,7 @@ echo "$ac_t""no" 1>&6 # Some strange OSes (SINIX) have it in libsocket: echo $ac_n "checking for gethostbyname in -lsocket""... $ac_c" 1>&6 -echo "configure:1324: checking for gethostbyname in -lsocket" >&5 +echo "configure:1361: checking for gethostbyname in -lsocket" >&5 ac_lib_var=`echo socket'_'gethostbyname'_' | sed 'y%./+- %__p__%'` if eval "test \"`echo '$''{'ac_cv_lbl_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1328,7 +1365,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lbl_lib_$ac_lib_var=yes" else @@ -1361,7 +1398,7 @@ # AC_CHECK_LIB's API is essentially broken so the # following ugliness is necessary: echo $ac_n "checking for gethostbyname in -lsocket""... $ac_c" 1>&6 -echo "configure:1365: checking for gethostbyname in -lsocket" >&5 +echo "configure:1402: checking for gethostbyname in -lsocket" >&5 ac_lib_var=`echo socket'_'gethostbyname'_'-lnsl | sed 'y%./+- %__p__%'` if eval "test \"`echo '$''{'ac_cv_lbl_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1369,7 +1406,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket -lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1421: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lbl_lib_$ac_lib_var=yes" else @@ -1399,7 +1436,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for gethostbyname in -lresolv""... $ac_c" 1>&6 -echo "configure:1403: checking for gethostbyname in -lresolv" >&5 +echo "configure:1440: checking for gethostbyname in -lresolv" >&5 ac_lib_var=`echo resolv'_'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 @@ -1407,7 +1444,7 @@ ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1459: \"$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 @@ -1447,12 +1484,12 @@ fi echo $ac_n "checking for socket""... $ac_c" 1>&6 -echo "configure:1451: checking for socket" >&5 +echo "configure:1488: checking for socket" >&5 if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_socket=yes" else @@ -1493,7 +1530,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:1497: checking for socket in -lsocket" >&5 +echo "configure:1534: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1501,7 +1538,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1553: \"$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 @@ -1531,7 +1568,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:1535: checking for socket in -lsocket" >&5 +echo "configure:1572: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket'_'-lnsl | sed 'y%./+- %__p__%'` if eval "test \"`echo '$''{'ac_cv_lbl_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1539,7 +1576,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket -lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lbl_lib_$ac_lib_var=yes" else @@ -1576,7 +1613,7 @@ echo $ac_n "checking for main in -linet6""... $ac_c" 1>&6 -echo "configure:1580: checking for main in -linet6" >&5 +echo "configure:1617: checking for main in -linet6" >&5 ac_lib_var=`echo inet6'_'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 @@ -1584,14 +1621,14 @@ ac_save_LIBS="$LIBS" LIBS="-linet6 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1632: \"$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 @@ -1620,12 +1657,12 @@ echo $ac_n "checking for crypt""... $ac_c" 1>&6 -echo "configure:1624: checking for crypt" >&5 +echo "configure:1661: checking for crypt" >&5 if eval "test \"`echo '$''{'ac_cv_func_crypt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_crypt=yes" else @@ -1666,7 +1703,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:1670: checking for crypt in -lcrypt" >&5 +echo "configure:1707: 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 @@ -1674,7 +1711,7 @@ ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1726: \"$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 @@ -1715,12 +1752,12 @@ fi echo $ac_n "checking for hstrerror""... $ac_c" 1>&6 -echo "configure:1719: checking for hstrerror" >&5 +echo "configure:1756: checking for hstrerror" >&5 if eval "test \"`echo '$''{'ac_cv_func_hstrerror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_hstrerror=yes" else @@ -1761,7 +1798,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for hstrerror in -lresolv""... $ac_c" 1>&6 -echo "configure:1765: checking for hstrerror in -lresolv" >&5 +echo "configure:1802: checking for hstrerror in -lresolv" >&5 ac_lib_var=`echo resolv'_'hstrerror | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1769,7 +1806,7 @@ ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1821: \"$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 @@ -1806,12 +1843,12 @@ for ac_func in strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1810: checking for $ac_func" >&5 +echo "configure:1847: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1875: \"$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 @@ -1863,12 +1900,12 @@ for ac_func in waitpid vsnprintf daemon setsid setlogin getaddrinfo getnameinfo gai_strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1867: checking for $ac_func" >&5 +echo "configure:1904: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1932: \"$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 @@ -1919,17 +1956,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1923: checking for $ac_hdr" >&5 +echo "configure:1960: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1933: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1970: \"$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* @@ -1958,12 +1995,12 @@ for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1962: checking for $ac_func" >&5 +echo "configure:1999: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2027: \"$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 @@ -2011,7 +2048,7 @@ done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:2015: checking for working mmap" >&5 +echo "configure:2052: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2019,7 +2056,7 @@ ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2200: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -2187,12 +2224,12 @@ for ac_func in poll do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2191: checking for $ac_func" >&5 +echo "configure:2228: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2256: \"$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 @@ -2244,12 +2281,12 @@ for ac_func in select poll do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2248: checking for $ac_func" >&5 +echo "configure:2285: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2313: \"$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 @@ -2300,12 +2337,12 @@ esac echo $ac_n "checking if struct tm has tm_gmtoff member""... $ac_c" 1>&6 -echo "configure:2304: checking if struct tm has tm_gmtoff member" >&5 +echo "configure:2341: checking if struct tm has tm_gmtoff member" >&5 if eval "test \"`echo '$''{'ac_cv_acme_tm_has_tm_gmtoff'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2314,7 +2351,7 @@ u_int i = sizeof(((struct tm *)0)->tm_gmtoff) ; return 0; } EOF -if { (eval echo configure:2318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2355: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_acme_tm_has_tm_gmtoff=yes else @@ -2334,12 +2371,12 @@ fi echo $ac_n "checking if struct sockaddr_storage exists""... $ac_c" 1>&6 -echo "configure:2338: checking if struct sockaddr_storage exists" >&5 +echo "configure:2375: checking if struct sockaddr_storage exists" >&5 if eval "test \"`echo '$''{'ac_cv_acme_sockaddr_storage'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2348,7 +2385,7 @@ struct sockaddr_storage sas ; return 0; } EOF -if { (eval echo configure:2352: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2389: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_acme_sockaddr_storage=yes else @@ -2368,12 +2405,12 @@ fi echo $ac_n "checking if struct sockaddr_in6 exists""... $ac_c" 1>&6 -echo "configure:2372: checking if struct sockaddr_in6 exists" >&5 +echo "configure:2409: checking if struct sockaddr_in6 exists" >&5 if eval "test \"`echo '$''{'ac_cv_acme_sockaddr_in6'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2385,7 +2422,7 @@ struct sockaddr_in6 sa6 ; return 0; } EOF -if { (eval echo configure:2389: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2426: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_acme_sockaddr_in6=yes else @@ -2406,7 +2443,7 @@ fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:2410: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:2447: 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 @@ -2444,7 +2481,7 @@ # 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:2448: checking for a BSD compatible install" >&5 +echo "configure:2485: 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 diff -ur thttpd-2.15-orig/configure.in thttpd-2.15/configure.in --- thttpd-2.15-orig/configure.in Sun Feb 6 20:31:16 2000 +++ thttpd-2.15/configure.in Mon Jun 5 13:56:10 2000 @@ -65,6 +65,9 @@ fi AC_CHECK_HEADERS(fcntl.h grp.h memory.h paths.h poll.h sys/poll.h netinet6/in6.h) +AC_CHECK_HEADER(linux/devpoll.h, + AC_DEFINE(HAVE_LINUX_DEVPOLL_H) + LIBOBJS="$LIBOBJS devpoll.o", ) AC_HEADER_TIME AC_HEADER_DIRENT diff -ur thttpd-2.15-orig/fdwatch.c thttpd-2.15/fdwatch.c --- thttpd-2.15-orig/fdwatch.c Tue Jan 18 23:14:31 2000 +++ thttpd-2.15/fdwatch.c Mon Jun 5 14:06:19 2000 @@ -36,6 +36,12 @@ #define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif +#ifdef HAVE_LINUX_DEVPOLL_H +#undef HAVE_SELECT +#undef HAVE_SELECT_H +#include /* POLLREMOVE needs to be propagated */ +#include "devpoll.h" +#else /* HAVE_LINUX_DEVPOLL_H */ #ifdef HAVE_POLL_H #include #else /* HAVE_POLL */ @@ -43,6 +49,7 @@ #include #endif /* HAVE_SYS_POLL_H */ #endif /* HAVE_POLL */ +#endif /* HAVE_LINUX_DEVPOLL_H */ #include "fdwatch.h" @@ -83,6 +90,7 @@ #ifdef HAVE_POLL static struct pollfd* pollfds; static int* fd_idx; +int* con_idx; static int npollfds; #endif /* HAVE_POLL */ @@ -131,9 +139,15 @@ nselect = npoll = 0; #ifdef HAVE_POLL +#ifdef HAVE_LINUX_DEVPOLL_H + pollfds = (struct pollfd *)open_devpoll(nfiles); +#else pollfds = (struct pollfd*) malloc( sizeof(struct pollfd) * nfiles ); +#endif fd_idx = (int*) malloc( sizeof(int) * nfiles ); - if ( pollfds == (struct pollfd*) 0 || fd_idx == (int*) 0 ) + con_idx = (int*) malloc( sizeof(int) * nfiles ); + if ( pollfds == (struct pollfd*) 0 || fd_idx == (int*) 0 || + con_idx == (int*) 0) return -1; #endif /* HAVE_POLL */ @@ -160,10 +174,18 @@ #endif /* HAVE_POLL */ } +void +fdwatch_send(void) +{ +#ifdef HAVE_LINUX_DEVPOLL_H + update_devpoll(pollfds, npollfds); + fdwatch_clear(); +#endif +} /* Add a descriptor to the watch list. rw is either FDW_READ or FDW_WRITE. */ void -fdwatch_add_fd( int fd, int rw ) +fdwatch_add_fd( int fd, int conn, int rw ) { #ifdef HAVE_SELECT_AND_POLL ++numfds; @@ -187,10 +209,22 @@ case FDW_WRITE: pollfds[npollfds].events = POLLOUT; break; } fd_idx[fd] = npollfds; + con_idx[fd] = conn; ++npollfds; #endif /* HAVE_POLL */ } +/* remove a descriptor from the watch list. */ +void +fdwatch_delete_fd( int fd) + { +#ifdef HAVE_LINUX_DEVPOLL_H + pollfds[npollfds].fd = fd; + pollfds[npollfds].events = POLLREMOVE; + ++npollfds; +#endif /* HAVE_LINUX_DEVPOLL_H */ + } + /* Do the watch. Return value is the number of descriptors that are ready, ** or 0 if the timeout expired, or -1 on errors. A timeout of INFTIM means @@ -237,8 +271,27 @@ # endif /* HAVE_SELECT */ # ifdef HAVE_POLL +# ifdef HAVE_LINUX_DEVPOLL_H + int result; +# endif ++npoll; - return poll( pollfds, npollfds, (int) timeout_msecs ); +# ifdef HAVE_LINUX_DEVPOLL_H + result = poll_devpoll(nfiles, (int) timeout_msecs); + if (result >= 1) { + int i; + /* rewrite the fds into connection */ + for (i = 0; i < result; i++) { + /* DEBUG + fprintf(stderr, "Rewrite: %d -> %d\n", mmap_fds[i], + con_idx[mmap_fds[i]]); + */ + fd_idx[mmap_pollfds[i].fd] = i; + } + } + return result; +# else + return poll( pollfds, npollfds, (int) timeout_msecs); +# endif /* HAVE_LINUX_DEVPOLL_H */ # endif /* HAVE_POLL */ #endif /* HAVE_SELECT_AND_POLL */ @@ -304,6 +357,9 @@ # endif /* HAVE_SELECT */ # ifdef HAVE_POLL + if (pollfds[fd_idx[fd]].fd != fd) + return 0; + switch ( rw ) { case FDW_READ: return pollfds[fd_idx[fd]].revents & POLLIN; diff -ur thttpd-2.15-orig/fdwatch.h thttpd-2.15/fdwatch.h --- thttpd-2.15-orig/fdwatch.h Wed Dec 22 12:00:10 1999 +++ thttpd-2.15/fdwatch.h Sun Mar 19 20:07:15 2000 @@ -67,7 +67,10 @@ extern void fdwatch_clear( void ); /* Add a descriptor to the watch list. rw is either FDW_READ or FDW_WRITE. */ -extern void fdwatch_add_fd( int fd, int rw ); +extern void fdwatch_add_fd( int fd, int conn, int rw ); + +/* Remove a descriptor from the watch list. */ +extern void fdwatch_delete_fd( int fd); /* Do the watch. Return value is the number of descriptors that are ready, ** or 0 if the timeout expired, or -1 on errors. A timeout of INFTIM means @@ -81,4 +84,7 @@ /* Return usage stats on the fdwatch package. */ extern void fdwatch_stats( long* nselectP, long* npollP ); +extern void fdwatch_send(void); + +extern int *con_idx; #endif /* _FDWATCH_H_ */ diff -ur thttpd-2.15-orig/libhttpd.c thttpd-2.15/libhttpd.c --- thttpd-2.15-orig/libhttpd.c Tue Feb 8 03:48:51 2000 +++ thttpd-2.15/libhttpd.c Sun Mar 19 20:07:15 2000 @@ -2101,7 +2101,7 @@ if ( hc->conn_fd >= 0 ) { (void) close( hc->conn_fd ); - hc->conn_fd = -1; + /* XXX, why ? hc->conn_fd = -1; */ } } diff -ur thttpd-2.15-orig/thttpd.c thttpd-2.15/thttpd.c --- thttpd-2.15-orig/thttpd.c Fri Mar 31 17:34:07 2000 +++ thttpd-2.15/thttpd.c Mon Jun 5 13:37:23 2000 @@ -59,6 +59,10 @@ #include "timers.h" #include "match.h" +#ifdef HAVE_LINUX_DEVPOLL_H +#include +#include "devpoll.h" +#endif static char* argv0; static int debug; @@ -125,7 +129,6 @@ static int fdwatch_recompute; - /* Forwards. */ static void parse_args( int argc, char** argv ); static void usage( void ); @@ -197,6 +200,27 @@ } +static void inline +fdwatch_compute(void) +{ + int cnum; + + fdwatch_clear(); + if ( numconnects > 0 ) + for ( cnum = 0; cnum < maxconnects; ++cnum ) + switch ( connects[cnum].conn_state ) { + case CNST_READING: + case CNST_LINGERING: + fdwatch_add_fd( connects[cnum].hc->conn_fd, cnum, FDW_READ ); + break; + case CNST_SENDING: + fdwatch_add_fd( connects[cnum].hc->conn_fd, cnum, FDW_WRITE ); + break; + } + if ( hs != (httpd_server*) 0 ) + fdwatch_add_fd( hs->listen_fd, -1, FDW_READ ); +} + int main( int argc, char** argv ) { @@ -461,6 +485,9 @@ connects[cnum].hc = (httpd_conn*) 0; } numconnects = 0; +#ifdef HAVE_LINUX_DEVPOLL_H + fdwatch_compute(); +#endif fdwatch_recompute = 1; /* Main loop. */ @@ -469,21 +496,11 @@ { if ( fdwatch_recompute ) { - fdwatch_clear(); - if ( numconnects > 0 ) - for ( cnum = 0; cnum < maxconnects; ++cnum ) - switch ( connects[cnum].conn_state ) - { - case CNST_READING: - case CNST_LINGERING: - fdwatch_add_fd( connects[cnum].hc->conn_fd, FDW_READ ); - break; - case CNST_SENDING: - fdwatch_add_fd( connects[cnum].hc->conn_fd, FDW_WRITE ); - break; - } - if ( hs != (httpd_server*) 0 ) - fdwatch_add_fd( hs->listen_fd, FDW_READ ); +#ifdef HAVE_LINUX_DEVPOLL_H + fdwatch_send(); +#else + fdwatch_compute(); +#endif fdwatch_recompute = 0; } @@ -491,7 +508,7 @@ num_ready = fdwatch( tmr_mstimeout( &tv ) ); if ( num_ready < 0 ) { - /* if ( errno == EINTR ) */ + if ( errno == EINTR ) continue; /* try again */ syslog( LOG_ERR, "fdwatch - %m" ); exit( 1 ); @@ -519,11 +536,19 @@ ** we fall through. */ } - +#ifdef HAVE_LINUX_DEVPOLL_H + /* Find the connections that need servicing directly. */ + for (cnum = 0; cnum < num_ready; cnum++ ) + { + if (con_idx[mmap_pollfds[cnum].fd] == -1) + continue; + c = &connects[con_idx[mmap_pollfds[cnum].fd]]; +#else /* Find the connections that need servicing. */ for ( cnum = 0; num_ready > 0 && cnum < maxconnects; ++cnum ) { c = &connects[cnum]; +#endif hc = c->hc; if ( c->conn_state == CNST_READING && fdwatch_check_fd( hc->conn_fd, FDW_READ ) ) @@ -1154,7 +1179,6 @@ return 1; } c->conn_state = CNST_READING; - fdwatch_recompute = 1; ++numconnects; client_data.p = c; c->idle_read_timer = tmr_create( @@ -1173,6 +1197,11 @@ else if ( fcntl( c->hc->conn_fd, F_SETFL, flags | O_NDELAY ) < 0 ) syslog( LOG_ERR, "fcntl O_NDELAY - %m" ); +#ifdef HAVE_LINUX_DEVPOLL_H + fdwatch_add_fd( connects[cnum].hc->conn_fd, cnum, FDW_READ ); +#endif + fdwatch_recompute = 1; + #ifdef STATS_TIME ++stats_connections; if ( numconnects > stats_simultaneous ) @@ -1278,7 +1307,6 @@ /* Cool, we have a valid connection and a file to send to it. */ c->conn_state = CNST_SENDING; - fdwatch_recompute = 1; c->started_at = tvP->tv_sec; c->wouldblock_delay = 0; client_data.p = c; @@ -1287,6 +1315,15 @@ c->idle_send_timer = tmr_create( tvP, idle_send_connection, client_data, IDLE_SEND_TIMELIMIT * 1000L, 0 ); +#ifdef HAVE_LINUX_DEVPOLL_H + { + int cnum = ((char *)c - (char *)connects) / sizeof(*c); + if (connects[cnum].conn_state != CNST_SENDING) + exit(1); + fdwatch_add_fd( connects[cnum].hc->conn_fd, cnum, FDW_WRITE ); + } +#endif + fdwatch_recompute = 1; } @@ -1335,6 +1372,12 @@ */ c->wouldblock_delay += MIN_WOULDBLOCK_DELAY; c->conn_state = CNST_PAUSING; +#ifdef HAVE_LINUX_DEVPOLL_H + { + int cnum = ((char *)c - (char *)connects) / sizeof(*c); + fdwatch_delete_fd( connects[cnum].hc->conn_fd ); + } +#endif fdwatch_recompute = 1; client_data.p = c; c->wakeup_timer = tmr_create( @@ -1399,6 +1442,12 @@ if ( elapsed == 0 || c->bytes_sent / elapsed > c->limit ) { c->conn_state = CNST_PAUSING; +#ifdef HAVE_LINUX_DEVPOLL_H + { + int cnum = ((char *)c - (char *)connects) / sizeof(*c); + fdwatch_delete_fd( connects[cnum].hc->conn_fd ); + } +#endif fdwatch_recompute = 1; /* When should we send the next c->limit bytes ** to get back on schedule? If less than a second @@ -1518,6 +1567,12 @@ if ( c->hc->should_linger ) { c->conn_state = CNST_LINGERING; +#ifdef HAVE_LINUX_DEVPOLL_H + { + int cnum = ((char *)c - (char *)connects) / sizeof(*c); + fdwatch_add_fd( connects[cnum].hc->conn_fd, cnum, FDW_READ ); + } +#endif fdwatch_recompute = 1; client_data.p = c; c->linger_timer = tmr_create( @@ -1539,6 +1594,12 @@ c->linger_timer = 0; } c->conn_state = CNST_FREE; +#ifdef HAVE_LINUX_DEVPOLL_H + { + int cnum = ((char *)c - (char *)connects) / sizeof(*c); + fdwatch_delete_fd( connects[cnum].hc->conn_fd ); + } +#endif fdwatch_recompute = 1; --numconnects; } @@ -1589,6 +1650,14 @@ if ( c->conn_state == CNST_PAUSING ) { c->conn_state = CNST_SENDING; +#ifdef HAVE_LINUX_DEVPOLL_H + { + int cnum = ((char *)c - (char *)connects) / sizeof(*c); + if (connects[cnum].conn_state != CNST_SENDING) + exit(1); + fdwatch_add_fd( connects[cnum].hc->conn_fd, cnum, FDW_WRITE ); + } +#endif fdwatch_recompute = 1; } } --- /dev/null Tue May 5 16:32:27 1998 +++ thttpd-2.15/devpoll.h Sun Mar 19 20:07:15 2000 @@ -0,0 +1,19 @@ +/* + * Suport for mmap'ed /dev/poll + * by Niels Provos + * + * Copyright 2000 Niels Provos + */ + +#ifndef _DEVPOLL_H +#define _DEVPOLL_H + +u_char *open_devpoll(int nfiles); +int poll_devpoll(int nfiles, int timout); + +struct pollfd; +int update_devpoll(struct pollfd *pfds, int nfds); + +extern struct pollfd *mmap_pollfds; +extern int *mmap_fds; +#endif --- /dev/null Tue May 5 16:32:27 1998 +++ thttpd-2.15/devpoll.c Mon Jun 5 13:41:37 2000 @@ -0,0 +1,73 @@ +/* + * Suport for mmap'ed /dev/poll + * by Niels Provos + * + * Copyright 2000 Niels Provos + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "devpoll.h" + +int devpoll_fd; +struct pollfd *mmap_pollfds; + +u_char * +open_devpoll(int nfiles) +{ + u_char *address; + + devpoll_fd = open("/dev/poll", O_RDWR, 0); + if (devpoll_fd == -1) { + perror("open"); + return NULL; + } + + if (ioctl(devpoll_fd, DP_ALLOC, nfiles) == -1) { + perror("ioctl"); + return NULL; + } + + address = mmap(0, DP_MMAP_SIZE(nfiles), + PROT_WRITE|PROT_READ, + MAP_SHARED, + devpoll_fd, 0); + + if (address == MAP_FAILED) { + perror("mmap"); + return NULL; + } + + mmap_pollfds = (struct pollfd *)address; + + return address; +} + +int +poll_devpoll(int nfds, int timeout) +{ + struct dvpoll dopoll; + + dopoll.dp_fds = NULL; + dopoll.dp_nfds = nfds; + dopoll.dp_timeout = timeout; + + return ioctl(devpoll_fd, DP_POLL, &dopoll); +} + +int +update_devpoll(struct pollfd *pfds, int nfds) +{ + return write(devpoll_fd, pfds, nfds * sizeof(struct pollfd)); +}