Re: patch for removing FD_FILESET check when using poll

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Wed, 06 Feb 2002 13:52:56 +0100

Unfortunately this is not safe as there is parts of Squid relying on
fd_set, and the size of fd_set is defined by FD_SETSIZE. Without the
check, these parts of the code will silently overwrite other parts of
memory.

If you are using Linux then Squid-2.5 and later automatically increases
the FD_SETSIZE if possible (depends on your glibc version).

Regards
Henrik

JEvans@Cyveillance.com wrote:
>
> I ran into a problem where even when compiling with --enable-poll, I found
> that squid was limiting itself to FD_FILESET worth of file descriptors as if
> it were still using select(). I found a reference to the solution to this
> problem in a post from Henrik Nordström that turned up in a google search.
> I patched my copy of squid as per his instructions and it solved our problem
> perfectly. I noticed that this patch has not made it's way into CVS yet, so
> here it is for your consideration... I've also included it as an attachment
> in case that's easier to deal with. Hope it helps.
>
> --- main.c.old Fri Jan 25 01:09:43 2002
> +++ main.c Thu Jan 24 22:15:33 2002
> @@ -575,8 +575,10 @@
> #endif
>
> debug_log = stderr;
> +#if !HAVE_POLL
> if (FD_SETSIZE < Squid_MaxFD)
> Squid_MaxFD = FD_SETSIZE;
> +#endif
>
> #if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)
> if ((WIN32_init_err = WIN32_Subsystem_Init()))
>
> -
> John
>
> ------------------------------------------------------------------------
> Name: squid-poll.patch
> squid-poll.patch Type: unspecified type (application/octet-stream)
> Encoding: quoted-printable
Received on Wed Feb 06 2002 - 05:59:56 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:47 MST