Commit 1c0e2f29 authored by Bradley Nicholes's avatar Bradley Nicholes
Browse files

Backport the use of apr_procattr_addrspace_set() to specify whether the new...

Backport the use of apr_procattr_addrspace_set() to specify whether the new process should be started in the current address space or a new address space.  This should have no effect on most platforms other than NetWare.

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
parent a424d811
Loading
Loading
Loading
Loading
+0 −21
Changes for STATUS: 0 added lines, 21 removed lines.
Original line number Diff line number Diff line
@@ -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.
+3 −9
Changes for modules/arch/netware/mod_netware.c: 3 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -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]);
+3 −1
Changes for modules/generators/mod_cgi.c: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -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,
+5 −1
Changes for modules/generators/mod_cgi.h: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -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;