This patch increases the maximum number of open files
at httpd startup.  Before I commit, does anyone have a
scenario in which it won't be safe to do this?

Thanks,
--Brian

Index: os/unix/unixd.c
===================================================================
RCS file: /home/cvs/httpd-2.0/os/unix/unixd.c,v
retrieving revision 1.55
diff -u -r1.55 unixd.c
--- os/unix/unixd.c     27 Jun 2002 10:47:49 -0000      1.55
+++ os/unix/unixd.c     9 Jul 2002 04:38:37 -0000
@@ -229,10 +229,25 @@
 AP_DECLARE(void) unixd_pre_config(apr_pool_t *ptemp)
 {
     apr_finfo_t wrapper;
+#if APR_HAVE_STRUCT_RLIMIT && APR_HAVE_SETRLIMIT &&
defined(RLIMIT_NOFILE)
+    struct rlimit limit;
+#endif
 
     unixd_config.user_name = DEFAULT_USER;
     unixd_config.user_id = ap_uname2id(DEFAULT_USER);
     unixd_config.group_id = ap_gname2id(DEFAULT_GROUP);
+
+    /* Increase the file descriptor limit up to the hard maximum,
+     * in case we're running a threaded MPM or a lot of vhosts.
+     */
+#if APR_HAVE_STRUCT_RLIMIT && APR_HAVE_SETRLIMIT &&
defined(RLIMIT_NOFILE)
+    if (getrlimit(RLIMIT_NOFILE, &limit) == 0) {
+        if (limit.rlim_cur != limit.rlim_max) {
+            limit.rlim_cur = limit.rlim_max;
+            (void)setrlimit(RLIMIT_NOFILE, &limit);
+        }
+    }
+#endif
 
     /* Check for suexec */
     unixd_config.suexec_enabled = 0;


Reply via email to