httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@locus.apache.org
Subject cvs commit: apache-2.0/src/modules/mpm/perchild perchild.c
Date Fri, 28 Jul 2000 19:34:41 GMT
rbb         00/07/28 12:34:40

  Modified:    src/modules/mpm/perchild perchild.c
  Log:
  Cleanup the perchild MPM.  What I am doing so far in this MPM does not
  require hashes.  This makes it much easier to now associate the child
  process with a virtual host.
  
  Revision  Changes    Path
  1.3       +12 -31    apache-2.0/src/modules/mpm/perchild/perchild.c
  
  Index: perchild.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/perchild/perchild.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- perchild.c	2000/07/28 17:45:13	1.2
  +++ perchild.c	2000/07/28 19:34:39	1.3
  @@ -59,7 +59,6 @@
   #define CORE_PRIVATE 
    
   #include "ap_config.h"
  -#include "apr_hash.h"
   #include "apr_strings.h"
   #include "apr_portable.h"
   #include "apr_file_io.h"
  @@ -95,13 +94,6 @@
   
   typedef struct child_info_t child_info_t;
   
  -struct child_info_t {
  -    uid_t uid;
  -    gid_t gid;
  -};
  -static int curr_child_num = 0;  /* how many children have been setup so
  -                                   far */
  -
   /*
    * Actual definitions of config globals
    */
  @@ -118,9 +110,12 @@
   static int requests_this_child;
   static int num_listenfds = 0;
   static ap_socket_t **listenfds;
  -
  -static ap_hash_t *child_hash;
   
  +struct child_info_t {
  +    uid_t uid;
  +    gid_t gid;
  +};
  +static child_info_t child_info_table[HARD_SERVER_LIMIT];
   struct ap_ctable ap_child_table[HARD_SERVER_LIMIT];
   
   /*
  @@ -716,11 +711,8 @@
   
   static int perchild_setup_child(int childnum)
   {
  -    child_info_t *ug;
  -    char child_num_str[5];
  +    child_info_t *ug = &child_info_table[childnum];
   
  -    ap_snprintf(child_num_str, 5, "%d", childnum); 
  -    ug = ap_hash_get(child_hash, child_num_str, 1); 
       if (!ug) {
           return unixd_setup_child();
       }
  @@ -1244,7 +1236,6 @@
       lock_fname = DEFAULT_LOCKFILE;
       max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
       ap_perchild_set_maintain_connection_status(1);
  -    child_hash = ap_make_hash(p);
   
       ap_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
   }
  @@ -1448,18 +1439,12 @@
       return NULL;
   }
   
  -static ap_status_t reset_child_process(void *data)
  +static const char *set_childprocess(cmd_parms *cmd, void *dummy, const char *p,
  +                                    const char *u, const char *g) 
   {
  -    curr_child_num = 0;
  -    return APR_SUCCESS;	
  -}
  +    int curr_child_num = atoi(p);
  +    child_info_t *ug = &child_info_table[curr_child_num];
   
  -static const char *set_childprocess(cmd_parms *cmd, void *dummy, const char *u,
  -                                    const char *g) 
  -{
  -    child_info_t *ug = ap_palloc(cmd->pool, sizeof(*ug));
  -    char child_num_str[5];
  -
       if (curr_child_num > num_daemons) {
           return "Trying to use more child ID's than NumServers.  Increase "
                  "NumServers in your config file.";
  @@ -1467,10 +1452,6 @@
      
       ug->uid = atoi(u);
       ug->gid = atoi(g); 
  -    ap_snprintf(child_num_str, 5, "%d", curr_child_num++); 
  -    ap_hash_set(child_hash, ap_pstrdup(cmd->pool, child_num_str), 1, ug); 
  -
  -    ap_register_cleanup(cmd->pool, &curr_child_num, reset_child_process, ap_null_cleanup);
   
       return NULL;
   }
  @@ -1529,8 +1510,8 @@
                "Whether or not to maintain status information on current connections"),
   AP_INIT_TAKE1("CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF,
                 "The location of the directory Apache changes to before dumping core"),
  -AP_INIT_TAKE2("ChildProcess", set_childprocess, NULL, RSRC_CONF,
  -              "The User and Group this child Process should run as."),
  +AP_INIT_TAKE3("ChildProcess", set_childprocess, NULL, RSRC_CONF,
  +              "Specify a User and Group for a specific child process."),
   { NULL }
   };
   
  
  
  

Mime
View raw message