httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cove...@apache.org
Subject svn commit: r1172019 - in /httpd/httpd/trunk: CHANGES modules/generators/mod_cgi.c modules/generators/mod_cgid.c
Date Sat, 17 Sep 2011 17:01:15 GMT
Author: covener
Date: Sat Sep 17 17:01:15 2011
New Revision: 1172019

URL: http://svn.apache.org/viewvc?rev=1172019&view=rev
Log:
PR51371: cross-compile issues with cgi and apr_procattr_limit_*.


Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/generators/mod_cgi.c
    httpd/httpd/trunk/modules/generators/mod_cgid.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1172019&r1=1172018&r2=1172019&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Sep 17 17:01:15 2011
@@ -12,6 +12,9 @@ Changes with Apache 2.3.15
      PR 51714. [Stefan Fritsch, Jim Jagielski, Ruediger Pluem, Eric Covener,
      <lowprio20 gmail.com>]
 
+  *) Fix cross-compilation of mod_cgi/mod_cgid when APR_HAVE_STRUCT_RLIMIT is 
+     false but RLIMIT_* are defined.  PR51371. [Eric Covener]
+
   *) core: Correctly obey ServerName / ServerAlias if the Host header from the
      request matches the VirtualHost address.
      PR 51709. [Micha Lenk <micha lenk.info>]

Modified: httpd/httpd/trunk/modules/generators/mod_cgi.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_cgi.c?rev=1172019&r1=1172018&r2=1172019&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/generators/mod_cgi.c (original)
+++ httpd/httpd/trunk/modules/generators/mod_cgi.c Sat Sep 17 17:01:15 2011
@@ -53,6 +53,12 @@
 #include "mod_core.h"
 #include "mod_cgi.h"
 
+#if APR_HAVE_STRUCT_RLIMIT 
+#if defined (RLIMIT_CPU) || defined (RLIMIT_NPROC) || defined (RLIMIT_DATA) || defined(RLIMIT_VMEM)
|| defined(RLIMIT_AS)
+#define AP_CGI_USE_RLIMIT
+#endif
+#endif
+
 module AP_MODULE_DECLARE_DATA cgi_module;
 
 static APR_OPTIONAL_FN_TYPE(ap_register_include_handler) *cgi_pfn_reg_with_ssi;
@@ -382,9 +388,7 @@ static apr_status_t run_cgi_child(apr_fi
     apr_proc_t *procnew;
     apr_status_t rc = APR_SUCCESS;
 
-#if defined(RLIMIT_CPU)  || defined(RLIMIT_NPROC) || \
-    defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined (RLIMIT_AS)
-
+#ifdef AP_CGI_USE_RLIMIT
     core_dir_config *conf = ap_get_core_module_config(r->per_dir_config);
 #endif
 
@@ -424,15 +428,15 @@ static apr_status_t run_cgi_child(apr_fi
         ((rc = apr_procattr_dir_set(procattr,
                         ap_make_dirstr_parent(r->pool,
                                               r->filename))) != APR_SUCCESS) ||
-#ifdef RLIMIT_CPU
+#if defined(RLIMIT_CPU) && defined(AP_CGI_USE_RLIMIT)
         ((rc = apr_procattr_limit_set(procattr, APR_LIMIT_CPU,
                                       conf->limit_cpu)) != APR_SUCCESS) ||
 #endif
-#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS)
+#if defined(AP_CGI_USE_RLIMIT) && (defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) ||
defined(RLIMIT_AS))
         ((rc = apr_procattr_limit_set(procattr, APR_LIMIT_MEM,
                                       conf->limit_mem)) != APR_SUCCESS) ||
 #endif
-#ifdef RLIMIT_NPROC
+#if RLIMIT_NPROC && defined(AP_CGI_USE_RLIMIT)
         ((rc = apr_procattr_limit_set(procattr, APR_LIMIT_NPROC,
                                       conf->limit_nproc)) != APR_SUCCESS) ||
 #endif

Modified: httpd/httpd/trunk/modules/generators/mod_cgid.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_cgid.c?rev=1172019&r1=1172018&r2=1172019&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/generators/mod_cgid.c (original)
+++ httpd/httpd/trunk/modules/generators/mod_cgid.c Sat Sep 17 17:01:15 2011
@@ -70,6 +70,11 @@
 #include <sys/stat.h>
 #include <sys/un.h> /* for sockaddr_un */
 
+#if APR_HAVE_STRUCT_RLIMIT 
+#if defined (RLIMIT_CPU) || defined (RLIMIT_NPROC) || defined (RLIMIT_DATA) || defined(RLIMIT_VMEM)
|| defined(RLIMIT_AS)
+#define AP_CGID_USE_RLIMIT
+#endif
+#endif
 
 module AP_MODULE_DECLARE_DATA cgid_module;
 
@@ -168,7 +173,7 @@ typedef struct {
     int bufbytes;
 } cgid_server_conf;
 
-#if defined (RLIMIT_CPU) || defined (RLIMIT_NPROC) || defined (RLIMIT_DATA) || defined(RLIMIT_VMEM)
|| defined(RLIMIT_AS) 
+#ifdef AP_CGID_USE_RLIMIT
 typedef struct { 
 #ifdef RLIMIT_CPU
     int    limit_cpu_set;
@@ -203,7 +208,7 @@ typedef struct {
     apr_size_t args_len;
     int loglevel; /* to stuff in server_rec */
 
-#if defined (RLIMIT_CPU) || defined (RLIMIT_NPROC) || defined (RLIMIT_DATA) || defined(RLIMIT_VMEM)
|| defined(RLIMIT_AS)
+#ifdef AP_CGID_USE_RLIMIT
     cgid_rlimit_t limits;
 #endif
 } cgid_req_t;
@@ -459,7 +464,7 @@ static apr_status_t get_req(int fd, requ
     }
     *env = environ;
 
-#if defined (RLIMIT_CPU) || defined (RLIMIT_NPROC) || defined (RLIMIT_DATA) || defined(RLIMIT_VMEM)
|| defined(RLIMIT_AS)
+#ifdef AP_CGID_USE_RLIMIT
     if ((stat = sock_read(fd, &(req->limits), sizeof(cgid_rlimit_t))) != APR_SUCCESS)
          return stat;
 #endif
@@ -524,7 +529,7 @@ static apr_status_t send_req(int fd, req
             return stat;
         }
     }
-#ifdef RLIMIT_CPU
+#if defined(RLIMIT_CPU) && defined(AP_CGID_USE_RLIMIT)
     if (core_conf->limit_cpu) {
         req.limits.limit_cpu = *(core_conf->limit_cpu);
         req.limits.limit_cpu_set = 1;
@@ -534,7 +539,7 @@ static apr_status_t send_req(int fd, req
     }
 #endif
 
-#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS)
+#if defined(AP_CGID_USE_RLIMIT) && (defined(RLIMIT_DATA) || defined(RLIMIT_VMEM)
|| defined(RLIMIT_AS))
     if (core_conf->limit_mem) {
         req.limits.limit_mem = *(core_conf->limit_mem);
         req.limits.limit_mem_set = 1;
@@ -545,7 +550,7 @@ static apr_status_t send_req(int fd, req
 
 #endif
 
-#ifdef RLIMIT_NPROC
+#if defined(RLIMIT_NPROC) && defined(AP_CGID_USE_RLIMIT)
     if (core_conf->limit_nproc) {
         req.limits.limit_nproc = *(core_conf->limit_nproc);
         req.limits.limit_nproc_set = 1;
@@ -555,7 +560,7 @@ static apr_status_t send_req(int fd, req
     }
 #endif
 
-#if defined (RLIMIT_CPU) || defined (RLIMIT_NPROC) || defined (RLIMIT_DATA) || defined(RLIMIT_VMEM)
|| defined(RLIMIT_AS)
+#ifdef AP_CGID_USE_RLIMIT
     if ( (stat = sock_write(fd, &(req.limits), sizeof(cgid_rlimit_t))) != APR_SUCCESS)
         return stat;
 #endif
@@ -761,6 +766,7 @@ static int cgid_server(void *data)
             ((rc = apr_procattr_dir_set(procattr,
                                   ap_make_dirstr_parent(r->pool, r->filename))) !=
APR_SUCCESS) ||
             ((rc = apr_procattr_cmdtype_set(procattr, cmd_type)) != APR_SUCCESS) ||
+#ifdef AP_CGID_USE_RLIMIT
 #ifdef RLIMIT_CPU
         (  (cgid_req.limits.limit_cpu_set) && ((rc = apr_procattr_limit_set(procattr,
APR_LIMIT_CPU,
                                       &cgid_req.limits.limit_cpu)) != APR_SUCCESS)) ||
@@ -773,6 +779,7 @@ static int cgid_server(void *data)
         ( (cgid_req.limits.limit_nproc_set) && ((rc = apr_procattr_limit_set(procattr,
APR_LIMIT_NPROC,
                                       &cgid_req.limits.limit_nproc)) != APR_SUCCESS))
||
 #endif
+#endif
 
             ((rc = apr_procattr_child_errfn_set(procattr, cgid_child_errfn)) != APR_SUCCESS))
{
             /* Something bad happened, tell the world.



Mime
View raw message