From: robertc <> Date: Mon, 7 Oct 2002 19:55:37 +0000 (+0000) Subject: hopefully fix FD_SETSIZE issue on *BSD X-Git-Tag: SQUID_3_0_PRE1~696 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=88d8a2a;p=thirdparty%2Fsquid.git hopefully fix FD_SETSIZE issue on *BSD --- diff --git a/include/config.h b/include/config.h index 3757eea02c..d83964fa45 100644 --- a/include/config.h +++ b/include/config.h @@ -1,5 +1,5 @@ /* - * $Id: config.h,v 1.5 2002/10/06 02:05:22 robertc Exp $ + * $Id: config.h,v 1.6 2002/10/07 13:55:37 robertc Exp $ * * AUTHOR: Duane Wessels * @@ -122,6 +122,66 @@ */ #endif +/* FD_SETSIZE must be redefined before including sys/types.h */ + +/* + * On some systems, FD_SETSIZE is set to something lower than the + * actual number of files which can be opened. IRIX is one case, + * NetBSD is another. So here we increase FD_SETSIZE to our + * configure-discovered maximum *before* any system includes. + */ +#define CHANGE_FD_SETSIZE 1 + +/* + * Cannot increase FD_SETSIZE on Linux, but we can increase __FD_SETSIZE + * with glibc 2.2 (or later? remains to be seen). We do this by including + * bits/types.h which defines __FD_SETSIZE first, then we redefine + * __FD_SETSIZE. Ofcourse a user program may NEVER include bits/whatever.h + * directly, so this is a dirty hack! + */ +#if defined(_SQUID_LINUX_) +#undef CHANGE_FD_SETSIZE +#define CHANGE_FD_SETSIZE 0 +#include +#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) +#if SQUID_MAXFD > DEFAULT_FD_SETSIZE +#include +#undef __FD_SETSIZE +#define __FD_SETSIZE SQUID_MAXFD +#endif +#endif +#endif + +/* + * Cannot increase FD_SETSIZE on FreeBSD before 2.2.0, causes select(2) + * to return EINVAL. + * --Marian Durkovic + * --Peter Wemm + */ +#if defined(_SQUID_FREEBSD_) +#include +#if __FreeBSD_version < 220000 +#undef CHANGE_FD_SETSIZE +#define CHANGE_FD_SETSIZE 0 +#endif +#endif + +/* + * Trying to redefine CHANGE_FD_SETSIZE causes a slew of warnings + * on Mac OS X Server. + */ +#if defined(_SQUID_APPLE_) +#undef CHANGE_FD_SETSIZE +#define CHANGE_FD_SETSIZE 0 +#endif + +/* Increase FD_SETSIZE if SQUID_MAXFD is bigger */ +#if CHANGE_FD_SETSIZE && SQUID_MAXFD > DEFAULT_FD_SETSIZE +#define FD_SETSIZE SQUID_MAXFD +#endif + + + /* Typedefs for missing entries on a system */ #include "squid_types.h" diff --git a/src/squid.h b/src/squid.h index 3e9fff6890..92ea8f5a4b 100644 --- a/src/squid.h +++ b/src/squid.h @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.225 2002/10/07 13:44:51 hno Exp $ + * $Id: squid.h,v 1.226 2002/10/07 13:55:37 robertc Exp $ * * AUTHOR: Duane Wessels * @@ -37,62 +37,6 @@ #include "config.h" -/* - * On some systems, FD_SETSIZE is set to something lower than the - * actual number of files which can be opened. IRIX is one case, - * NetBSD is another. So here we increase FD_SETSIZE to our - * configure-discovered maximum *before* any system includes. - */ -#define CHANGE_FD_SETSIZE 1 - -/* - * Cannot increase FD_SETSIZE on Linux, but we can increase __FD_SETSIZE - * with glibc 2.2 (or later? remains to be seen). We do this by including - * bits/types.h which defines __FD_SETSIZE first, then we redefine - * __FD_SETSIZE. Ofcourse a user program may NEVER include bits/whatever.h - * directly, so this is a dirty hack! - */ -#if defined(_SQUID_LINUX_) -#undef CHANGE_FD_SETSIZE -#define CHANGE_FD_SETSIZE 0 -#include -#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) -#if SQUID_MAXFD > DEFAULT_FD_SETSIZE -#include -#undef __FD_SETSIZE -#define __FD_SETSIZE SQUID_MAXFD -#endif -#endif -#endif - -/* - * Cannot increase FD_SETSIZE on FreeBSD before 2.2.0, causes select(2) - * to return EINVAL. - * --Marian Durkovic - * --Peter Wemm - */ -#if defined(_SQUID_FREEBSD_) -#include -#if __FreeBSD_version < 220000 -#undef CHANGE_FD_SETSIZE -#define CHANGE_FD_SETSIZE 0 -#endif -#endif - -/* - * Trying to redefine CHANGE_FD_SETSIZE causes a slew of warnings - * on Mac OS X Server. - */ -#if defined(_SQUID_APPLE_) -#undef CHANGE_FD_SETSIZE -#define CHANGE_FD_SETSIZE 0 -#endif - -/* Increase FD_SETSIZE if SQUID_MAXFD is bigger */ -#if CHANGE_FD_SETSIZE && SQUID_MAXFD > DEFAULT_FD_SETSIZE -#define FD_SETSIZE SQUID_MAXFD -#endif - #if PURIFY #define assert(EX) ((void)0) #elif defined(NODEBUG)