Re: [squid-users] Re: FD_SETSIZE and max open filedescriptors

From: Chris McDonough <chrism@dont-contact.us>
Date: Thu, 03 Jan 2002 13:13:29 -0500

Miquel,

Many thanks, that caused the "right" behavior at least on my system!

- C

Miquel van Smoorenburg wrote:

> In article <3C348BD4.8070008@zope.com>,
> Chris McDonough <chrism@zope.com> wrote:
>
>>I'm using Squid 2.4-STABLE3 on Linux 2.4.X, and it appears that the only
>>way I can convince Squid to start with more than 1024 file descriptors
>>(even if bash's ulimit -n reports, for example, 30000 at compilation
>>time and runtime -- I'm dead certain that the OS and the shell limits
>>are set high enough) is to bruce-force set the number in main.c like so:
>>
>
> Set ulimit -n to 4096 or so, apply this patch, then run configure:
>
> Note that this is an UGLY HACK
>
> Oh yes you need glibc 2.2 or later
>
> --- squid-2.4.1.orig/src/squid.h Thu Feb 22 22:39:14 2001
> +++ squid-2.4.1/src/squid.h Thu Jun 28 15:20:47 2001
> @@ -45,10 +45,24 @@
> */
> #define CHANGE_FD_SETSIZE 1
>
> -/* Cannot increase FD_SETSIZE on Linux */
> +/*
> + * 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
> +# undef CHANGE_FD_SETSIZE
> +# define CHANGE_FD_SETSIZE 0
> +# include <features.h>
> +# if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
> +# if SQUID_MAXFD > DEFAULT_FD_SETSIZE
> +# include <bits/types.h>
> +# undef __FD_SETSIZE
> +# define __FD_SETSIZE SQUID_MAXFD
> +# endif
> +# endif
> #endif
>
> /*
>
>
> Mike.
>
>
Received on Thu Jan 03 2002 - 10:57:11 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:05:37 MST