On Mon, 14 Nov 2005, Kean Johnston wrote:

Ok then the check should be more complete and be compared to
both, becuase the current scheme foils things if you compile
with make CC='gcc -DFD_SETSIZE=12345' for example. I realize
that in theory, that should have been the args used to configure
so that that value is detected at autoconf time, but it does
no harm to check both values. Without this I got compiler
warnings that FD_SETSIZE is redfined.

Makes sense.

What should be done is that if FD_SETSIZE is defined at this point then it can't be overridden yet another time by Squid.

How does this sound to you?

Index: src/squid.h
===================================================================
RCS file: /cvsroot/squid/squid/src/squid.h,v
retrieving revision 1.216.2.8
diff -u -p -r1.216.2.8 squid.h
--- src/squid.h 26 Mar 2005 02:50:53 -0000      1.216.2.8
+++ src/squid.h 15 Nov 2005 10:09:37 -0000
@@ -46,13 +46,22 @@
 #define CHANGE_FD_SETSIZE 1

 /*
+ * If FD_SETSIZE is already defined by the user in the compiler options
+ * then we should not override the user provided value.
+ */
+#ifdef FD_SETSIZE
+#undef CHANGE_FD_SETSIZE
+#define CHANGE_FD_SETSIZE 0
+#endif
+
+/*
  * 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_)
+#if CHANGE_FD_SETSIZE && defined(_SQUID_LINUX_)
 #undef CHANGE_FD_SETSIZE
 #define CHANGE_FD_SETSIZE 0
 #include <features.h>

Regards
Henrik

Reply via email to