OSSP CVS Repository

ossp - Check-in [2724]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2724
Date: 2002-Nov-03 17:31:34 (local)
2002-Nov-03 16:31:34 (UTC)
User:rse
Branch:
Comment: Add Autoconf option --with-fdsetsize=NUM which allows to force a particular (usually higher than the default) FD_SETSIZE value for building Pth. Additionally Pth makes sure that the application using Pth does not use an even larger size.

Original patch by: Nick Hudson <skrll@netbsd.org>

Tickets:
Inspections:
Files:
ossp-pkg/pth/ChangeLog      1.585 -> 1.586     6 inserted, 0 deleted
ossp-pkg/pth/aclocal.m4      1.98 -> 1.99     60 inserted, 0 deleted
ossp-pkg/pth/configure.ac      1.7 -> 1.8     3 inserted, 0 deleted
ossp-pkg/pth/pth.h.in      1.136 -> 1.137     7 inserted, 0 deleted
ossp-pkg/pth/pthread.h.in      1.64 -> 1.65     9 inserted, 0 deleted

ossp-pkg/pth/ChangeLog 1.585 -> 1.586

--- ChangeLog    2002/11/03 11:24:49     1.585
+++ ChangeLog    2002/11/03 16:31:34     1.586
@@ -21,6 +21,12 @@
 
   Changes between 1.4.1 and 1.5.0 (27-Jan-2002 to xx-Nov-2002)
 
+   *) Add Autoconf option --with-fdsetsize=NUM which allows to
+      force a particular (usually higher than the default) FD_SETSIZE
+      value for building Pth. Additionally Pth makes sure that the
+      application using Pth does not use an even larger size.
+      [Nick Hudson <skrll@netbsd.org>, Ralf S. Engelschall]
+
    *) Added thread attribute PTH_ATTR_DISPATCHES which (in bounded
       attribute objects) is incremented every time the context
       is switched to the associated thread. This can be used for


ossp-pkg/pth/aclocal.m4 1.98 -> 1.99

--- aclocal.m4   2002/11/03 12:21:00     1.98
+++ aclocal.m4   2002/11/03 16:31:34     1.99
@@ -1168,6 +1168,66 @@
 ])
 
 dnl ##
+dnl ##  Check for FD_SETSIZE
+dnl ##
+dnl ##  configure.in:
+dnl ##    AC_CHECK_FDSETSIZE(<varname>)
+
+AC_DEFUN(AC_CHECK_FDSETSIZE,[dnl
+dnl #   1. determine default value
+AC_MSG_CHECKING(for default value of FD_SETSIZE)
+cross_compiling=no
+AC_TRY_RUN(
+changequote(<<, >>)dnl
+<<
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+int main(int argc, char *argv[])
+{
+    FILE *fp;
+    int ac_fdsetsize;
+#if defined(FD_SETSIZE)
+    ac_fdsetsize = FD_SETSIZE;
+#else
+    ac_fdsetsize = (sizeof(fd_set)*8);
+#endif
+    if ((fp = fopen("conftestval", "w")) == NULL)
+        exit(1);
+    fprintf(fp, "%d\n", ac_fdsetsize);
+    fclose(fp);
+    exit(0);
+}
+>>
+changequote([, ])dnl
+,
+ac_fdsetsize=`cat conftestval`,
+ac_fdsetsize=1024,
+ac_fdsetsize=1024
+)
+AC_MSG_RESULT([$ac_fdsetsize])
+$1="$ac_fdsetsize"
+AC_SUBST($1)
+
+dnl #   2. allow user to force a particular value
+AC_ARG_WITH(fdsetsize,dnl
+[  --with-fdsetsize=NUM    set FD_SETSIZE while building GNU Pth],[
+case $withval in
+    [[1-9]][[0-9]]|[[1-9]][[0-9]][[0-9]]|[[1-9]][[0-9]][[0-9]][[0-9]]) $1=$withval ;;
+    * ) AC_ERROR([invalid FD_SETSIZE specified -- allowed: 10-9999]) ;;
+esac
+dnl # we cannot use the usual
+dnl # AC_DEFINE_UNQUOTED(FD_SETSIZE, $$1, [Define to the maximum size of fd_set])
+dnl # here, because FD_SETSIZE has to be defined already before any other
+dnl # system headers are included. Hence we have to use CPPFLAGS.
+CPPFLAGS="$CPPFLAGS -DFD_SETSIZE=$$1"
+AC_MSG_CHECKING([for overridden FD_SETSIZE value])
+AC_MSG_RESULT([$$1])
+])
+
+])
+
+dnl ##
 dnl ##  Check for an external/extension library.
 dnl ##  - is aware of <libname>-config style scripts
 dnl ##  - searches under standard paths include, lib, etc.


ossp-pkg/pth/configure.ac 1.7 -> 1.8

--- configure.ac 2002/10/20 13:49:29     1.7
+++ configure.ac 2002/11/03 16:31:34     1.8
@@ -157,6 +157,9 @@
 dnl #  check for the number of signals
 AC_CHECK_NSIG(PTH_NSIG)
 
+dnl #  check for size of fd_set (FDSETSIZE)
+AC_CHECK_FDSETSIZE(PTH_FDSETSIZE)
+
 dnl # check whether poll(2)'s input stuff has to be faked
 AC_CHECK_FUNCS(poll)
 AC_CHECK_DEFINE(POLLIN, poll.h)


ossp-pkg/pth/pth.h.in 1.136 -> 1.137

--- pth.h.in     2002/11/03 11:15:04     1.136
+++ pth.h.in     2002/11/03 16:31:34     1.137
@@ -87,6 +87,13 @@
 #define END_DECLARATION   /*nop*/
 #endif
 
+    /* check if the user requests a bigger FD_SETSIZE than we can handle */
+#if defined(FD_SETSIZE)
+#if FD_SETSIZE > @PTH_FDSETSIZE@
+#error "FD_SETSIZE is larger than what GNU Pth can handle."
+#endif
+#endif
+
 BEGIN_DECLARATION
 
     /* some global constants */


ossp-pkg/pth/pthread.h.in 1.64 -> 1.65

--- pthread.h.in 2002/10/15 18:23:37     1.64
+++ pthread.h.in 2002/11/03 16:31:34     1.65
@@ -63,6 +63,15 @@
 #endif
 
 /*
+ * Check if the user requests a bigger FD_SETSIZE than we can handle
+ */
+#if defined(FD_SETSIZE)
+#if FD_SETSIZE > @PTH_FDSETSIZE@
+#error "FD_SETSIZE is larger than what GNU Pth can handle."
+#endif
+#endif
+
+/*
  * Protect namespace, because possibly existing vendor Pthread stuff
  * would certainly conflict with our defintions of pthread*_t.
  */

CVSTrac 2.0.1