]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Backport the use of apr_procattr_addrspace_set() to specify whether the new process...
authorBradley Nicholes <bnicholes@apache.org>
Wed, 21 Sep 2005 22:17:55 +0000 (22:17 +0000)
committerBradley Nicholes <bnicholes@apache.org>
Wed, 21 Sep 2005 22:17:55 +0000 (22:17 +0000)
Reviewed By: jjclar, bnicholes, trawick

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.0.x@290850 13f79535-47bb-0310-9956-ffa450edef68

STATUS
modules/arch/netware/mod_netware.c
modules/generators/mod_cgi.c
modules/generators/mod_cgi.h

diff --git a/STATUS b/STATUS
index c96b3cd8b94747b208376d49159dbb43c30132d1..cf88c562a453a59f2838b620fde5e9699d112cf0 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -108,27 +108,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-    *) mod_cgi: Added API call and overload of detached field in
-       cgi_exec_info_t structure to support loading in current or new address
-       space for CGIs.  The patch change how NetWare use cmdtype for
-       processes. It was made necessary by changes done to log.c r1.145.
-       The HTTP and the APR patches are available at:
-       <http://www.apache.org/~clar/detach-addrspace_HTTP_2_0.patch>
-       <http://www.apache.org/~clar/detach-addrspace_APR_0_9.patch>
-       +1: jjclar, bnicholes, trawick
-       jerenkrantz: I'm confused as to the status of this backport.
-       trawick: Somebody commits the APR 0.9 patch, then:
-         do we have to wait for later APR 0.x release before putting
-         calls to apr_procattr_addrspace_set() into httpd-2.0.x, or
-         do we go ahead and introduce the prerequisite?
-       clar replies: I am ready to commit the apr 0.9.x patch, but then will 
-         need the changes in the httpd-2.0.x to be done in order for NetWare 
-         to work as expected when calling apr_proc_create. Should I do both, 
-         APR and Http, at the same time?
-       wrowe: commit to APR.  Use an APR version test *in httpd* to determine 
-         if the old or new behavior should be used in httpd.  In future versions
-         you could remove the test altogether.
-
     *) mod_actions: Regression from 1.3: the file referred to must exist.
        Solve this by introducing the "virtual" modifier to the Action
        directive. PR 28553.
index aa560f7931aba8bebbb9159762996cbfc107161a..2c4e2248bf26f89c45d8af4358fc02cf8940178a 100644 (file)
@@ -100,7 +100,6 @@ static apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv,
     char *ext = NULL;
     char *cmd_only, *ptr;
     const char *new_cmd;
-    const char *detached = NULL;
     netware_dir_config *d;
     apr_file_t *fh;
     const char *args = "";
@@ -143,6 +142,7 @@ static apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv,
 
     /* check if we have a registered command for the extension*/
     new_cmd = apr_table_get(d->file_type_handlers, ext);
+    e_info->detached = AP_PROC_DETACHED;
     if (new_cmd == NULL) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                   "Could not find a command associated with the %s extension", ext);
@@ -154,18 +154,12 @@ static apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv,
         *cmd = apr_pstrcat (p, new_cmd, " ", cmd_only, NULL);
 
         /* Run in its own address space if specified */
-        detached = apr_table_get(d->file_handler_mode, ext);
-        if (detached) {
-            e_info->cmd_type = APR_PROGRAM_ENV;
-        }
-        else {
-            e_info->cmd_type = APR_PROGRAM;
-        }
+        if(apr_table_get(d->file_handler_mode, ext))
+            e_info->detached |= AP_PROC_NEWADDRSPACE;
     }
 
     /* Tokenize the full command string into its arguments */
     apr_tokenize_to_argv(*cmd, (char***)argv, p);
-    e_info->detached = 1;
 
     /* The first argument should be the executible */
     *cmd = ap_server_root_relative(p, *argv[0]);
index 1ff33bb559ba8e6ef6aff4863b9861cedd309611..3a8ae8ef6b674a593cabc96426c3ea2958e894a6 100644 (file)
@@ -436,7 +436,9 @@ static apr_status_t run_cgi_child(apr_file_t **script_out,
                                         e_info->cmd_type)) != APR_SUCCESS) ||
 
         ((rc = apr_procattr_detach_set(procattr,
-                                        e_info->detached)) != APR_SUCCESS) ||
+                                        e_info->detached & AP_PROC_DETACHED)) != APR_SUCCESS) ||
+        ((rc = apr_procattr_addrspace_set(procattr,
+                                        (e_info->detached & AP_PROC_NEWADDRSPACE) ? 1 : 0)) != APR_SUCCESS) ||
         ((rc = apr_procattr_child_errfn_set(procattr, cgi_child_errfn)) != APR_SUCCESS)) {
         /* Something bad happened, tell the world. */
         ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r,
index 7221093a83698c2d8b833889c79dd1d90390db96..cf9d9ba9d711571f4931e32e95324f86bc55bee1 100644 (file)
@@ -19,6 +19,9 @@
 
 #include "mod_include.h"
 
+#define AP_PROC_DETACHED       1
+#define AP_PROC_NEWADDRSPACE   2
+
 typedef enum {RUN_AS_SSI, RUN_AS_CGI} prog_types;
 
 typedef struct {
@@ -27,7 +30,8 @@ typedef struct {
     apr_int32_t          err_pipe;
     int                  process_cgi;
     apr_cmdtype_e        cmd_type;
-    apr_int32_t          detached;
+    apr_int32_t          detached; /* used as a bitfield for detached_ & addrspace_set, */
+                                   /* when initializing apr_proc_attr structure */
     prog_types           prog_type;
     apr_bucket_brigade **bb;
     include_ctx_t       *ctx;