]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Docs: display WARNING and ERROR when max_filedescriptors has failed.
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 29 May 2011 04:56:36 +0000 (22:56 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 29 May 2011 04:56:36 +0000 (22:56 -0600)
The big cases of missing OS dependencies and use of select() are mentioned
on configure parse where relevant. As well as from setMaxFD().

Failures to make the change are already logged, but now highlighted as
ERROR cases.

src/cache_cf.cc
src/tools.cc

index fcbc93c017b1c010f9a17b1d6eb2b9dc95c81281..56a643385335ffed480cb005bff14bb866709289 100644 (file)
@@ -501,6 +501,16 @@ configDoConfigure(void)
     if (Config.errHtmlText == NULL)
         Config.errHtmlText = xstrdup(null_string);
 
+#if !HAVE_SETRLIMIT || !defined(RLIMIT_NOFILE)
+    if (Config.max_filedescriptors > 0) {
+        debugs(0, DBG_IMPORTANT, "WARNING: max_filedescriptors disabled. Operating System setrlimit(RLIMIT_NOFILE) is missing.");
+    }
+#elif USE_SELECT || USE_SELECT_WIN32
+    if (Config.max_filedescriptors > FD_SETSIZE) {
+        debugs(0, DBG_IMPORTANT, "WARNING: max_filedescriptors limited to " << FD_SETSIZE << " by select() algorithm.");
+    }
+#endif
+
     storeConfigure();
 
     snprintf(ThisCache, sizeof(ThisCache), "%s (%s)",
index ad2c212b101393cc707342166506f86071032b9e..6feae60403a5711fa9a1d135efa924bfe2dc7123 100644 (file)
@@ -895,24 +895,25 @@ setMaxFD(void)
     } else if (Config.max_filedescriptors > 0) {
 #if USE_SELECT || USE_SELECT_WIN32
         /* select() breaks if this gets set too big */
-        if (Config.max_filedescriptors > FD_SETSIZE)
+        if (Config.max_filedescriptors > FD_SETSIZE) {
             rl.rlim_cur = FD_SETSIZE;
-        else
+            debugs(50, DBG_CRITICAL, "WARNING: 'max_filedescriptors " << Config.max_filedescriptors << "' does not work with select()");
+        } else
 #endif
             rl.rlim_cur = Config.max_filedescriptors;
         if (rl.rlim_cur > rl.rlim_max)
             rl.rlim_max = rl.rlim_cur;
         if (setrlimit(RLIMIT_NOFILE, &rl)) {
-            debugs(50, DBG_CRITICAL, "setrlimit: RLIMIT_NOFILE: " << xstrerror());
+            debugs(50, DBG_CRITICAL, "ERROR: setrlimit: RLIMIT_NOFILE: " << xstrerror());
             getrlimit(RLIMIT_NOFILE, &rl);
             rl.rlim_cur = rl.rlim_max;
             if (setrlimit(RLIMIT_NOFILE, &rl)) {
-                debugs(50, DBG_CRITICAL, "setrlimit: RLIMIT_NOFILE: " << xstrerror());
+                debugs(50, DBG_CRITICAL, "ERROR: setrlimit: RLIMIT_NOFILE: " << xstrerror());
             }
         }
     }
     if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
-        debugs(50, DBG_CRITICAL, "setrlimit: RLIMIT_NOFILE: " << xstrerror());
+        debugs(50, DBG_CRITICAL, "ERROR: getrlimit: RLIMIT_NOFILE: " << xstrerror());
     } else {
         Squid_MaxFD = rl.rlim_cur;
     }