base cygwin patches

greg andruk gja at meowing.net
Sat Aug 31 13:28:05 UTC 2002



Configure goo for cygwin:
 - make <arpa/nameser.h> and <resolv.h> optional for innfeed
 - fixup libperl's name, cygwin's looks like "libperl5_6_1.a"
 - cygwin's IOV_MAX is 2147483646, which breaks an assumption about
   array sizes in nnrpd, so force an arbitrary typical size in
   configure.  Rename to INN_IOV_MAX to avoid #undef/#define confusion

Need to give autoheader a crank to pick up the IOV stuff.


--- configure.in.orig	2002-08-29 01:17:53.000000000 -0400
+++ configure.in	2002-08-31 01:33:44.000000000 -0400
@@ -779,6 +779,11 @@
     *-linux*)
         inn_perl_core_libs=`echo "$inn_perl_core_libs" | sed 's/ -lgdbm / /'`
         ;;
+    *-cygwin*)
+        inn_libperl_name=`$_PATH_PERL -MConfig -e 'print "$Config{libperl}"'\
+            | sed "s/^lib//;s/\.a$//"`
+	inn_perl_core_libs="${inn_perl_core_libs} -l$inn_libperl_name"
+        ;;
     esac
     inn_perl_core_libs=`echo "$inn_perl_core_libs" | sed 's/^  *//'`
     inn_perl_core_libs=`echo "$inn_perl_core_libs" | sed 's/  *$//'`
@@ -904,9 +909,10 @@
 AC_HEADER_SYS_WAIT
 
 dnl Generic checks for header files.
-AC_CHECK_HEADERS(crypt.h inttypes.h limits.h ndbm.h stdbool.h stddef.h \
-                 stdint.h string.h sys/bitypes.h sys/filio.h sys/loadavg.h \
-                 sys/param.h sys/select.h sys/sysinfo.h sys/time.h unistd.h)
+AC_CHECK_HEADERS(arpa/nameser.h crypt.h inttypes.h limits.h ndbm.h resolv.h \
+                 stdbool.h stddef.h stdint.h string.h sys/bitypes.h \
+                 sys/filio.h sys/loadavg.h sys/param.h sys/select.h \
+                 sys/sysinfo.h sys/time.h unistd.h)
 
 dnl Some Linux systems have db1/ndbm.h instead of ndbm.h.
 if test x"$ac_cv_header_ndbm_h" = xno ; then
@@ -1087,7 +1093,11 @@
   FILE *f = fopen ("conftestval", "w");
   if (!f) return 1;
 #ifdef IOV_MAX
+# ifdef __CYGWIN__
+  fprintf(f, "1024\n");
+# else
   fprintf (f, "set in limits.h\n");
+# endif /* __CYGWIN__ */
 #else
 # ifdef UIO_MAXIOV
   fprintf (f, "%d\n", UIO_MAXIOV);
@@ -1117,9 +1127,10 @@
 dnl in <iovec.h> included from <sys/uio.h>.  The platforms that have IOV_MAX
 dnl appear to also offer it via sysconf(3), but it should be a constant for a
 dnl given implementation.  Set IOV_MAX if it's not defined in <sys/uio.h> or
-dnl <limits.h>.
+dnl <limits.h>.  Cygwin allows an IOV_MAX of MAXINT - 1, so force it to a
+dnl value small enough to be useful in an array.
 AC_DEFUN([INN_MACRO_IOV_MAX],
-[AC_MSG_CHECKING(value of IOV_MAX)
+[AC_MSG_CHECKING(value of INN_IOV_MAX)
 AC_CACHE_VAL(inn_cv_macro_iov_max,
 [AC_TRY_RUN(_INN_MACRO_IOV_MAX_SOURCE(),
             inn_cv_macro_iov_max=`cat conftestval`,
@@ -1131,7 +1142,7 @@
     AC_MSG_RESULT($inn_cv_macro_iov_max)
 fi])
 if test x"$inn_cv_macro_iov_max" != x"set in limits.h" ; then
-    AC_DEFINE_UNQUOTED(IOV_MAX, $inn_cv_macro_iov_max,
+    AC_DEFINE_UNQUOTED(INN_IOV_MAX, $inn_cv_macro_iov_max,
                        [Define to the max vectors in an iovec.])
 fi])
 INN_MACRO_IOV_MAX
--- innfeed/endpoint.c.orig	2002-08-25 22:17:11.000000000 -0400
+++ innfeed/endpoint.c	2002-08-31 00:52:44.000000000 -0400
@@ -992,7 +992,7 @@
   for (i = currIdx ; buffers && buffers [i] != NULL ; i++)
     bCount++ ;
 
-  bCount = (bCount > IOV_MAX ? IOV_MAX : bCount) ;
+  bCount = (bCount > INN_IOV_MAX ? INN_IOV_MAX : bCount) ;
 
   i = 0 ;
 
@@ -1117,7 +1117,7 @@
   for (i = currIdx ; buffers && buffers [i] != NULL ; i++)
     bCount++ ;
 
-  bCount = (bCount > IOV_MAX ? IOV_MAX : bCount) ;
+  bCount = (bCount > INN_IOV_MAX ? INN_IOV_MAX : bCount) ;
 
   i = 0 ;
   
--- innfeed/misc.c.orig	2002-08-25 22:17:13.000000000 -0400
+++ innfeed/misc.c	2002-08-31 01:39:03.000000000 -0400
@@ -39,14 +39,18 @@
 #include "config.h"
 #include "clibrary.h"
 
-#include <arpa/nameser.h>
+#ifdef HAVE_ARPA_NAMESER_H
+# include <arpa/nameser.h>
+#endif
 #include <assert.h>
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <netdb.h>
 #include <netinet/in.h>
-#include <resolv.h>
+#ifdef HAVE_RESOLV_H
+# include <resolv.h>
+#endif
 #include <signal.h>
 #include <syslog.h>
 #include <sys/param.h>
--- nnrpd/article.c.orig	2002-08-13 01:57:02.000000000 -0400
+++ nnrpd/article.c	2002-08-31 00:52:06.000000000 -0400
@@ -54,7 +54,7 @@
 };
 
 
-static struct iovec	iov[IOV_MAX];
+static struct iovec	iov[INN_IOV_MAX];
 static int		queued_iov = 0;
 
 static bool PushIOvHelper(struct iovec* vec, int* countp) {
@@ -72,7 +72,7 @@
 
 static bool PushIOvRateLimited(void) {
     struct timeval      start, end;
-    struct iovec        newiov[IOV_MAX];
+    struct iovec        newiov[INN_IOV_MAX];
     int                 newiov_len;
     int                 sentiov;
     int                 i;
@@ -150,7 +150,7 @@
     }
     iov[queued_iov].iov_base = (char*)p;
     iov[queued_iov++].iov_len = len;
-    if (queued_iov == IOV_MAX)
+    if (queued_iov == INN_IOV_MAX)
         return PushIOv();
     return TRUE;
 }



More information about the inn-patches mailing list