httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean-Jacques Clar" <JJC...@novell.com>
Subject [PROPOSAL] cgi_exec_info_t: detached & addrspace fields combined
Date Thu, 24 Jun 2004 19:23:32 GMT
To replace the addrspace field that was added in the cgi_exec_info_t
struct in mod_cgi.h I will like to propose extending the use of the 
detached (apr_int32_t) field in cgi_exec_info_t and apr_procattr_t
structs. 
Currently that field is set to 0 by default and 1 if the process to be

created will be a detached one.
What I will like to do to is to add an address space option to set 
the second bit of that field in order to flag the new process to load 
or not in a new address space.
 
The detached field in cgi_exec_info_t is set to 0 for all platforms and
is used
only in mod_netware and mod_win32.
The changes will need to be back ported in order for NetWare to work
after 
log.c r r1.145 is back ported.
Follow a partial patch, I will certainly like to have suggestions:
Thank you,
 
Index: modules/arch/netware/mod_netware.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/arch/netware/mod_netware.c,v
retrieving revision 1.18
diff -u -r1.18 mod_netware.c
--- modules/arch/netware/mod_netware.c 14 Jun 2004 17:28:25 -0000 1.18
+++ modules/arch/netware/mod_netware.c 24 Jun 2004 19:07:12 -0000
@@ -153,12 +154,12 @@
 
         /* Run in its own address space if specified */
         if(apr_table_get(d->file_handler_mode, ext))
-            e_info->addrspace = 1;
+           e_info->detached |= APR_PROC_NEWADDRSPACE;
     }
 
     /* Tokenize the full command string into its arguments */
     apr_tokenize_to_argv(*cmd, (char***)argv, p);
-    e_info->detached = 1;
+    e_info->detached |= APR_PROC_DETACHED;
 
     /* The first argument should be the executible */
     *cmd = ap_server_root_relative(p, *argv[0]);
Index: modules/generators/mod_cgi.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgi.c,v
retrieving revision 1.164
diff -u -r1.164 mod_cgi.c
--- modules/generators/mod_cgi.c 14 Jun 2004 17:28:25 -0000 1.164
+++ modules/generators/mod_cgi.c 24 Jun 2004 16:57:13 -0000
@@ -432,8 +432,6 @@
 
         ((rc = apr_procattr_detach_set(procattr,
                                         e_info->detached)) !=
APR_SUCCESS) ||
-        ((rc = apr_procattr_addrspace_set(procattr,
-                                        e_info->addrspace)) !=
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,
@@ -790,7 +788,6 @@
     e_info.bb          = NULL;
     e_info.ctx         = NULL;
     e_info.next        = NULL;
-    e_info.addrspace   = 0;
 
     /* build the command line */
     if ((rv = cgi_build_command(&command, &argv, r, p, &e_info)) !=
APR_SUCCESS) {
@@ -1058,7 +1055,6 @@
     e_info.bb          = &bb;
     e_info.ctx         = ctx;
     e_info.next        = f->next;
-    e_info.addrspace   = 0;
 
     if ((rv = cgi_build_command(&command, &argv, r, r->pool,
                                 &e_info)) != APR_SUCCESS) {
Index: modules/generators/mod_cgi.h
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgi.h,v
retrieving revision 1.14
diff -u -r1.14 mod_cgi.h
--- modules/generators/mod_cgi.h 14 Jun 2004 17:28:25 -0000 1.14
+++ modules/generators/mod_cgi.h 24 Jun 2004 16:54:08 -0000
@@ -31,7 +31,6 @@
     apr_bucket_brigade **bb;
     include_ctx_t       *ctx;
     ap_filter_t         *next;
-    apr_int32_t          addrspace;
 } cgi_exec_info_t;
 
 /**
RCS file: /home/cvspublic/apr/include/apr_thread_proc.h,v
retrieving revision 1.110
diff -u -r1.110 apr_thread_proc.h
--- include/apr_thread_proc.h 15 Jun 2004 20:51:25 -0000 1.110
+++ include/apr_thread_proc.h 24 Jun 2004 19:06:59 -0000
@@ -64,6 +64,10 @@
     APR_PROC_SIGNAL_CORE = 4    /**< process exited and dumped a core
file */
 } apr_exit_why_e;
 
+#define APR_NOT_DETACHED_NEWADDRSPACE   0   
+#define APR_PROC_DETACHED               1
+#define APR_PROC_NEWADDRSPACE           2  /* load the process in new
address space */
+
 /** did we exit the process */
 #define APR_PROC_CHECK_EXIT(x)        (x & APR_PROC_EXIT)
 /** did we get a signal */
@@ -515,16 +519,6 @@
  */
 APR_DECLARE(apr_status_t) apr_procattr_error_check_set(apr_procattr_t
*attr,
                                                        apr_int32_t
chk);
-
-/**
- * Determine if the child should start in its own address space or
using the 
- * current one from its parent
- * @param attr The procattr we care about. 
- * @param addrspace Should the child start in its own address space? 
Default
- *                  is no on NetWare and yes on other platforms.
- */
-APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t
*attr,
-                                                       apr_int32_t
addrspace);
 
 #if APR_HAS_FORK
 /**
Index: include/arch/netware/apr_arch_threadproc.h
===================================================================
RCS file:
/home/cvspublic/apr/include/arch/netware/apr_arch_threadproc.h,v
retrieving revision 1.4
diff -u -r1.4 apr_arch_threadproc.h
--- include/arch/netware/apr_arch_threadproc.h 14 Jun 2004 17:26:19
-0000 1.4
+++ include/arch/netware/apr_arch_threadproc.h 24 Jun 2004 16:53:51
-0000
@@ -60,7 +60,6 @@
     char *currdir;
     apr_int32_t cmdtype;
     apr_int32_t detached;
-    apr_int32_t addrspace;
 };
 
 struct apr_thread_once_t {
Index: threadproc/netware/proc.c
===================================================================
RCS file: /home/cvspublic/apr/threadproc/netware/proc.c,v
retrieving revision 1.29
diff -u -r1.29 proc.c
--- threadproc/netware/proc.c 14 Jun 2004 17:26:19 -0000 1.29
+++ threadproc/netware/proc.c 24 Jun 2004 19:06:29 -0000
@@ -265,13 +265,6 @@
     return APR_SUCCESS;
 }
 
-APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t
*attr,
-                                                       apr_int32_t
addrspace)
-{
-    attr->addrspace = addrspace;
-    return APR_SUCCESS;
-}
-
 APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *newproc,
          const char *progname, 
          const char * const *args, 
@@ -293,9 +286,9 @@
     /* attr->detached and PROC_DETACHED do not mean the same thing. 
attr->detached means
      * start the NLM in a separate address space.  PROC_DETACHED means
don't wait for the
      * NLM to unload by calling wait() or waitpid(), just clean up */
-    addr_space = PROC_LOAD_SILENT | (attr->addrspace ? 0 :
PROC_CURRENT_SPACE);
-    addr_space |= (attr->detached ? PROC_DETACHED : 0);
-
+    addr_space = PROC_LOAD_SILENT | ((attr->detached &
APR_PROC_NEWADDRSPACE) ? 0 : PROC_CURRENT_SPACE);
+    addr_space |= ((attr->detached & APR_PROC_DETACHED) ?
PROC_DETACHED : 0);
+    
     if (attr->currdir) {
         char *fullpath = NULL;
         apr_status_t rv;


Mime
View raw message