poll and FD_SETSIZE

From: Darren Steven <dsteven@dont-contact.us>
Date: Tue, 01 Jun 1999 12:22:33 +1000

Hello all,

I have been trying to build squid 2.2 (or 2.0) on a linux 2.2 box with
more than 1024 FD's (1024 is probably enough, but my testing has seen it
warn that it is running out). By doing the following:

ulimit -SHn 2048 (kernel /proc/sys/fs/file-max is 4096 by default)
./configure
(which sees 2048 fd's, and 1024 FD_SETSIZE)

when squid starts (it uses poll by default - I check that in main.c), it
says it is using 1024 FD's

This appears to happen because in include/squid.h, it says linux can't
change FD_SETSIZE, and the initialisation of the variable Squid_MaxFD
goes like this
    Squid_MaxFD = SQUID_MAXFD (2048 from config)
    if (FD_SETSIZE < Squid_MaxFD)
           Squid_MaxFD = FD_SETSIZE

I thought that the --enable-poll would free the need for FD_SETSIZE
limit, or is select still used somewhere ?.

so (under 2.0Patch2), I put a #ifdef HAVE_POLL wrapper around the if
statement to set the variable to SQUID_MAXFD if built with enable-poll,
and it mostly seemed to work when run in foreground with debug to
stdout, but when run in background, it kept closing the cache.log file
(FD 3) with a warning in syslog. I am about to try this on 2.2Stable3,
as the changelog indicates that poll is now OK on 2.2 kernels (RH),
where 2.0patch2 warned against it.

Any hints or pointers - I don't think I should have to mess with the
kernel definition of FD_SETSIZE

Thanks,

Darren Steven
Applications Specialist
Telstra
Received on Mon May 31 1999 - 20:06:47 MDT

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