mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Add the resource limiting code back to Apache 2.0. This only works on
Unix because I can't find any other platforms with rlimit. If there are other platforms that need this code, then some of the code needs to move. This has just barely been tested, so it could probably use some good testing. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85449 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -69,6 +69,8 @@
|
||||
* they fail.
|
||||
*/
|
||||
|
||||
#define CORE_PRIVATE
|
||||
|
||||
#include "ap_config.h"
|
||||
#include "httpd.h"
|
||||
#include "http_config.h"
|
||||
@@ -305,6 +307,12 @@ static ap_status_t run_cgi_child(BUFF **script_out, BUFF **script_in, BUFF **scr
|
||||
ap_status_t rc = APR_SUCCESS;
|
||||
ap_file_t *file = NULL;
|
||||
ap_iol *iol;
|
||||
#if defined(RLIMIT_CPU) || defined(RLIMIT_NPROC) || \
|
||||
defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined (RLIMIT_AS)
|
||||
core_dir_config *conf;
|
||||
conf = (core_dir_config *) ap_get_module_config(r->per_dir_config, &core_module);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DEBUG_CGI
|
||||
#ifdef OS2
|
||||
@@ -341,6 +349,15 @@ static ap_status_t run_cgi_child(BUFF **script_out, BUFF **script_in, BUFF **scr
|
||||
APR_CHILD_BLOCK)) != APR_SUCCESS) ||
|
||||
((rc = ap_setprocattr_dir(procattr,
|
||||
ap_make_dirstr_parent(r->pool, r->filename))) != APR_SUCCESS) ||
|
||||
#ifdef RLIMIT_CPU
|
||||
((rc = ap_setprocattr_limit(procattr, APR_LIMIT_CPU, conf->limit_cpu)) != APR_SUCCESS) ||
|
||||
#endif
|
||||
#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS)
|
||||
((rc = ap_setprocattr_limit(procattr, APR_LIMIT_MEM, conf->limit_mem)) != APR_SUCCESS) ||
|
||||
#endif
|
||||
#ifdef RLIMIT_NPROC
|
||||
((rc = ap_setprocattr_limit(procattr, APR_LIMIT_NPROC, conf->limit_nproc)) != APR_SUCCESS) ||
|
||||
#endif
|
||||
((rc = ap_setprocattr_cmdtype(procattr, APR_PROGRAM)) != APR_SUCCESS)) {
|
||||
/* Something bad happened, tell the world. */
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r,
|
||||
|
Reference in New Issue
Block a user