httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: [PATCH] - Add a "detached" parameter to ap_cgi_build_command() for CGI...
Date Wed, 05 Jun 2002 17:41:42 GMT
Although win32 shares the same issue...  still...  ick...

Suppose it is time that we stuff the exec_info (renamed ap_exec_info_t) in 
place
of the apr_cmdtype_e, and allow the ap_cgi_build_command() integrator to modify
any of the flags/fields in that structure?

Bill

At 12:10 PM 6/5/2002, Brad Nicholes wrote:
>     This patch adds the "detached" parameter to the
>ap_cgi_build_command() optional function.  This allows the OS to specify
>whether the CGI binary should be spawned detached or not.  Specifically
>for NetWare this allows us to determine wheither a CGI NLM should be
>executed in the same address space as Apache or a new address space.
>
>Brad
>
>--- \tempapache\httpd-2.0\modules\generators\mod_cgi.h  Wed Apr 17
>08:18:42 2002
>+++ mod_cgi.h   Wed Jun 05 10:49:18 2002
>@@ -71,6 +71,7 @@
>   *                    as a CGI invocation, otherwise false
>   * @param type Set to APR_SHELLCMD or APR_PROGRAM on entry, may be
>   *             changed to invoke the program with alternate
>semantics.
>+ * @param detach Should the child start in detached state?  Default is
>no.
>   * @remark This callback may be registered by the os-specific module
>   * to correct the command and arguments for apr_proc_create
>invocation
>   * on a given os.  mod_cgi will call the function if registered.
>@@ -78,6 +79,7 @@
>  APR_DECLARE_OPTIONAL_FN(apr_status_t, ap_cgi_build_command,
>                          (const char **cmd, const char ***argv,
>                           request_rec *r, apr_pool_t *p,
>-                         int process_cgi, apr_cmdtype_e *type));
>+                         int process_cgi, apr_cmdtype_e *type,
>+                         apr_int32_t *detach));
>
>  #endif /* _MOD_CGI_H */
>
>--- \tempapache\httpd-2.0\modules\generators\mod_cgi.c  Thu May 30
>08:49:40 2002
>+++ mod_cgi.c   Wed Jun 05 10:50:04 2002
>@@ -110,6 +110,7 @@
>      apr_int32_t          out_pipe;
>      apr_int32_t          err_pipe;
>      apr_cmdtype_e        cmd_type;
>+    apr_int32_t          detached;
>      prog_types           prog_type;
>      apr_bucket_brigade **bb;
>      include_ctx_t       *ctx;
>@@ -471,7 +472,10 @@
>                                        conf->limit_nproc)) !=
>APR_SUCCESS) ||
>  #endif
>          ((rc = apr_procattr_cmdtype_set(procattr,
>-                                        e_info->cmd_type)) !=
>APR_SUCCESS)) {
>+                                        e_info->cmd_type)) !=
>APR_SUCCESS) ||
>+
>+        ((rc = apr_procattr_detach_set(procattr,
>+                                        e_info->detached)) !=
>APR_SUCCESS)) {
>          /* Something bad happened, tell the world. */
>          ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r,
>                        "couldn't set child process attributes: %s",
>r->filename);
>@@ -530,7 +534,8 @@
>
>  static apr_status_t default_build_command(const char **cmd, const char
>***argv,
>                                            request_rec *r, apr_pool_t
>*p,
>-                                          int process_cgi,
>apr_cmdtype_e * type)
>+                                          int process_cgi,
>apr_cmdtype_e * type,
>+                                          apr_int32_t *detach)
>  {
>      int numwords, x, idx;
>      char *w;
>@@ -665,6 +670,7 @@
>      ap_add_common_vars(r);
>
>      e_info.cmd_type  = APR_PROGRAM;
>+    e_info.detached  = 0;
>      e_info.in_pipe   = APR_CHILD_BLOCK;
>      e_info.out_pipe  = APR_CHILD_BLOCK;
>      e_info.err_pipe  = APR_CHILD_BLOCK;
>@@ -674,8 +680,8 @@
>      e_info.next      = NULL;
>
>      /* build the command line */
>-    if ((rv = cgi_build_command(&command, &argv, r, p, 1,
>&e_info.cmd_type))
>-            != APR_SUCCESS) {
>+    if ((rv = cgi_build_command(&command, &argv, r, p, 1,
>&e_info.cmd_type,
>+            &e_info.detached)) != APR_SUCCESS) {
>          ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
>                        "don't know how to spawn child process: %s",
>                        r->filename);
>@@ -940,6 +946,7 @@
>      apr_status_t rv;
>
>      e_info.cmd_type  = APR_SHELLCMD;
>+    e_info.detached  = 0;
>      e_info.in_pipe   = APR_NO_PIPE;
>      e_info.out_pipe  = APR_FULL_BLOCK;
>      e_info.err_pipe  = APR_NO_PIPE;
>@@ -949,7 +956,7 @@
>      e_info.next      = f->next;
>
>      if ((rv = cgi_build_command(&command, &argv, r, r->pool, 0,
>-                                &e_info.cmd_type)) != APR_SUCCESS) {
>+            &e_info.cmd_type, &e_info.detached)) != APR_SUCCESS) {
>          ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
>                        "don't know how to spawn cmd child process: %s",
>
>                        r->filename);
>
>
>
>Brad Nicholes
>Senior Software Engineer
>Novell, Inc., a leading provider of Net business solutions
>http://www.novell.com
>



Mime
View raw message