From: hno <> Date: Wed, 17 May 2006 03:06:06 +0000 (+0000) Subject: Bug #1475: Squid does not need to be limited by FD_SETSIZE when using kqueue/epoll. X-Git-Tag: SQUID_3_0_PRE4~126 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b926988239757c35c09103ca5796e1967daebbbb;p=thirdparty%2Fsquid.git Bug #1475: Squid does not need to be limited by FD_SETSIZE when using kqueue/epoll. Technically poll doesn't need to be limited either, but is due to the delay pool hooks still using fd_set... Inspired by the patch by Gonzalo Arana --- diff --git a/src/main.cc b/src/main.cc index b9e240b686..bf357fa5c7 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.420 2006/05/08 23:38:33 robertc Exp $ + * $Id: main.cc,v 1.421 2006/05/16 21:06:06 hno Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -913,8 +913,12 @@ main(int argc, char **argv) Debug::parseOptions("ALL,1"); debug_log = stderr; - if (FD_SETSIZE < Squid_MaxFD) - Squid_MaxFD = FD_SETSIZE; +#if defined(SQUID_MAXFD_LIMIT) + + if (SQUID_MAXFD_LIMIT < Squid_MaxFD) + Squid_MaxFD = SQUID_MAXFD_LIMIT; + +#endif #ifdef _SQUID_WIN32_ diff --git a/src/squid.h b/src/squid.h index c910a2c7ad..0b2a268df6 100644 --- a/src/squid.h +++ b/src/squid.h @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.252 2006/05/10 21:04:24 hno Exp $ + * $Id: squid.h,v 1.253 2006/05/16 21:06:06 hno Exp $ * * AUTHOR: Duane Wessels * @@ -182,6 +182,23 @@ #endif /* HAVE_POLL_H */ #endif /* HAVE_POLL */ +/* + * Filedescriptor limits in the different select loops + */ +#if defined(USE_SELECT) +/* Limited by design */ +#define SQUID_MAXFD_LIMIT FD_SETSIZE +#elif defined(USE_POLL) +/* Limited due to delay pools */ +#define SQUID_MAXFD_LIMIT FD_SETSIZE +#elif defined(USE_KQUEUE) || defined(USE_EPOLL) +#define fd_set ERROR_FD_SET_USED +#else +#error Unknown select loop model! +#endif + +# + #if defined(HAVE_STDARG_H) #include #define HAVE_STDARGS /* let's hope that works everywhere (mj) */