Index: ossp-pkg/pth/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/pth/ChangeLog,v rcsdiff -q -kk '-r1.585' '-r1.586' -u '/v/ossp/cvs/ossp-pkg/pth/ChangeLog,v' 2>/dev/null --- 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 , 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 Index: ossp-pkg/pth/aclocal.m4 RCS File: /v/ossp/cvs/ossp-pkg/pth/aclocal.m4,v rcsdiff -q -kk '-r1.98' '-r1.99' -u '/v/ossp/cvs/ossp-pkg/pth/aclocal.m4,v' 2>/dev/null --- 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() + +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 +#include +#include +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 -config style scripts dnl ## - searches under standard paths include, lib, etc. Index: ossp-pkg/pth/configure.ac RCS File: /v/ossp/cvs/ossp-pkg/pth/configure.ac,v rcsdiff -q -kk '-r1.7' '-r1.8' -u '/v/ossp/cvs/ossp-pkg/pth/configure.ac,v' 2>/dev/null --- 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) Index: ossp-pkg/pth/pth.h.in RCS File: /v/ossp/cvs/ossp-pkg/pth/pth.h.in,v rcsdiff -q -kk '-r1.136' '-r1.137' -u '/v/ossp/cvs/ossp-pkg/pth/pth.h.in,v' 2>/dev/null --- 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 */ Index: ossp-pkg/pth/pthread.h.in RCS File: /v/ossp/cvs/ossp-pkg/pth/pthread.h.in,v rcsdiff -q -kk '-r1.64' '-r1.65' -u '/v/ossp/cvs/ossp-pkg/pth/pthread.h.in,v' 2>/dev/null --- 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. */