perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@locus.apache.org
Subject cvs commit: modperl-2.0/src/modules/perl mod_perl.c mod_perl.h modperl_callback.h modperl_config.h modperl_types.h
Date Fri, 14 Apr 2000 23:52:56 GMT
dougm       00/04/14 16:52:56

  Modified:    .        Makefile.PL
               lib/ModPerl Code.pm
               src/modules/perl mod_perl.c mod_perl.h modperl_callback.h
                        modperl_config.h modperl_types.h
  Log:
  change from ap_context_t to ap_pool_t
  integrate/test interpreter pool
  
  Revision  Changes    Path
  1.3       +1 -1      modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Makefile.PL	2000/04/14 04:09:25	1.2
  +++ Makefile.PL	2000/04/14 23:52:52	1.3
  @@ -64,7 +64,7 @@
       chdir $code->path;
   
       for ($code->c_files) {
  -        echo_cmd "$cc -Wall $ccopts @inc -c $_";
  +        echo_cmd "$cc -g -Wall $ccopts @inc -c $_";
       }
   
       my @objs = $code->o_files;
  
  
  
  1.3       +7 -6      modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Code.pm	2000/04/14 04:09:26	1.2
  +++ Code.pm	2000/04/14 23:52:53	1.3
  @@ -20,14 +20,14 @@
   my %hook_proto = (
       Process    => {
           ret  => 'void',
  -        args => [{type => 'ap_context_t', name => 'p'},
  +        args => [{type => 'ap_pool_t', name => 'p'},
                    {type => 'server_rec', name => 's'}],
       },
       Files      => {
           ret  => 'void',
  -        args => [{type => 'ap_context_t', name => 'pconf'},
  -                 {type => 'ap_context_t', name => 'plog'},
  -                 {type => 'ap_context_t', name => 'ptemp'},
  +        args => [{type => 'ap_pool_t', name => 'pconf'},
  +                 {type => 'ap_pool_t', name => 'plog'},
  +                 {type => 'ap_pool_t', name => 'ptemp'},
                    {type => 'server_rec', name => 's'}],
       },
       PerSrv     => {
  @@ -69,6 +69,7 @@
   my %flags = (
       Srv => [qw(NONE PERL_TAINT_CHECK PERL_WARN FRESH_RESTART)],
       Dir => [qw(NONE INCPUSH SENDHDR SENTHDR ENV CLEANUP RCLEANUP)],
  +    Interp => [qw(NONE IN_USE PUTBACK)],
   );
   
   sub new {
  @@ -91,7 +92,7 @@
           my $i = 0;
           my $n = @$handlers;
   
  -        print $h_fh "\n", '#define ',
  +        print $h_fh "\n#define ",
             canon_define($class, 'num_handlers'), " $n\n\n";
   
           for my $name (@$handlers) {
  @@ -235,7 +236,7 @@
   );
   
   my @g_c_names = map { "modperl_$_" } qw(hooks directives);
  -my @c_names   = (qw(mod_perl), @g_c_names);
  +my @c_names   = (qw(mod_perl modperl_interp), @g_c_names);
   sub c_files { map { "$_.c" } @c_names }
   sub o_files { map { "$_.o" } @c_names }
   
  
  
  
  1.2       +62 -8     modperl-2.0/src/modules/perl/mod_perl.c
  
  Index: mod_perl.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mod_perl.c	2000/04/13 07:03:37	1.1
  +++ mod_perl.c	2000/04/14 23:52:54	1.2
  @@ -1,32 +1,86 @@
   #include "mod_perl.h"
   
  -void modperl_pre_config_handler(ap_context_t *p, ap_context_t *plog,
  -                                ap_context_t *ptemp)
  +void modperl_startup(server_rec *s, ap_pool_t *p)
   {
  +    PerlInterpreter *perl;
  +    int status;
  +    char *argv[] = { "httpd", "/dev/null" };
  +    int argc = 2;
  +
  +    if (!(perl = perl_alloc())) {
  +        perror("perl_alloc");
  +        exit(1);
  +    }
  +
  +    perl_construct(perl);
  +    
  +    status = perl_parse(perl, NULL, argc, argv, NULL);
  +
  +    if (status) {
  +        perror("perl_parse");
  +        exit(1);
  +    }
  +
  +    perl_run(perl);
  +
  +    modperl_interp_pool_init(s, p, perl);
   }
   
  -void *modperl_create_dir_config(ap_context_t *p, char *dir)
  +void modperl_init(ap_pool_t *pconf, ap_pool_t *plog, 
  +                  ap_pool_t *ptemp, server_rec *s)
   {
  -    return NULL;
  +    modperl_startup(s, pconf);
   }
   
  -void *modperl_merge_dir_config(ap_context_t *p, void *base, void *add)
  +void modperl_pre_config_handler(ap_pool_t *p, ap_pool_t *plog,
  +                                ap_pool_t *ptemp)
   {
  -    return NULL;
   }
   
  -void *modperl_create_srv_config(ap_context_t *p, server_rec *s)
  +void *modperl_create_dir_config(ap_pool_t *p, char *dir)
   {
       return NULL;
   }
   
  -void *modperl_merge_srv_config(ap_context_t *p, void *base, void *add)
  +void *modperl_merge_dir_config(ap_pool_t *p, void *base, void *add)
   {
       return NULL;
   }
   
  +modperl_srv_config_t *modperl_srv_config_new(ap_pool_t *p)
  +{
  +    return (modperl_srv_config_t *)
  +        ap_pcalloc(p, sizeof(modperl_srv_config_t));
  +}
  +
  +void *modperl_create_srv_config(ap_pool_t *p, server_rec *s)
  +{
  +    modperl_srv_config_t *scfg = modperl_srv_config_new(p);
  +
  +    return scfg;
  +}
  +
  +void *modperl_merge_srv_config(ap_pool_t *p, void *basev, void *addv)
  +{
  +    modperl_srv_config_t
  +        *base = (modperl_srv_config_t *)basev,
  +        *add  = (modperl_srv_config_t *)addv,
  +        *mrg  = modperl_srv_config_new(p);
  +
  +    mrg->mip = add->mip ? add->mip : base->mip;
  +
  +    return mrg;
  +}
  +
   void modperl_register_hooks(void)
   {
  +    /* XXX: should be pre_config hook or 1.xx logic */
  +    ap_hook_open_logs(modperl_init, NULL, NULL, HOOK_MIDDLE);
  +
  +    /* XXX: should only bother selecting an interpreter
  +     * if one is needed for the request
  +     */
  +    ap_hook_post_read_request(modperl_interp_select, NULL, NULL, HOOK_FIRST);
   }
   
   static command_rec modperl_cmds[] = {  
  
  
  
  1.2       +10 -0     modperl-2.0/src/modules/perl/mod_perl.h
  
  Index: mod_perl.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mod_perl.h	2000/04/13 07:03:37	1.1
  +++ mod_perl.h	2000/04/14 23:52:54	1.2
  @@ -1,3 +1,8 @@
  +#ifndef MOD_PERL_H
  +#define MOD_PERL_H
  +
  +#define PERL_NO_GET_CONTEXT
  +
   #include "EXTERN.h"
   #include "perl.h"
   #include "XSUB.h"
  @@ -10,6 +15,9 @@
   #include "httpd.h"
   #include "http_config.h"
   #include "http_log.h"
  +#include "http_protocol.h"
  +
  +#include "apr_lock.h"
   
   module MODULE_VAR_EXPORT perl_module;
   
  @@ -19,6 +27,8 @@
   #include "modperl_types.h"
   #include "modperl_config.h"
   #include "modperl_callback.h"
  +#include "modperl_interp.h"
   
   #include "modperl_directives.h"
   
  +#endif /*  MOD_PERL_H */
  
  
  
  1.2       +8 -3      modperl-2.0/src/modules/perl/modperl_callback.h
  
  Index: modperl_callback.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- modperl_callback.h	2000/04/13 07:03:37	1.1
  +++ modperl_callback.h	2000/04/14 23:52:54	1.2
  @@ -1,11 +1,16 @@
  -void modperl_process_callback(int idx, ap_context_t *p, server_rec *s);
  +#ifndef MODPERL_CALLBACK_H
  +#define MODPERL_CALLBACK_H
   
  +void modperl_process_callback(int idx, ap_pool_t *p, server_rec *s);
  +
   void modperl_files_callback(int idx,
  -                            ap_context_t *pconf, ap_context_t *plog,
  -                            ap_context_t *ptemp, server_rec *s);
  +                            ap_pool_t *pconf, ap_pool_t *plog,
  +                            ap_pool_t *ptemp, server_rec *s);
   
   int modperl_per_dir_callback(int idx, request_rec *r);
   
   int modperl_per_srv_callback(int idx, request_rec *r);
   
   int modperl_connection_callback(int idx, conn_rec *c);
  +
  +#endif /* MODPERL_CALLBACK_H */
  
  
  
  1.2       +6 -1      modperl-2.0/src/modules/perl/modperl_config.h
  
  Index: modperl_config.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- modperl_config.h	2000/04/13 07:03:37	1.1
  +++ modperl_config.h	2000/04/14 23:52:54	1.2
  @@ -1,5 +1,8 @@
  -char *modperl_cmd_push_handlers(MpAV *handlers, char *name, ap_context_t *ctx);
  +#ifndef MODPERL_CONFIG_H
  +#define MODPERL_CONFIG_H
   
  +char *modperl_cmd_push_handlers(MpAV *handlers, char *name, ap_pool_t *p);
  +
   #define MP_dRCFG \
      modperl_request_config_t *rcfg = \
         (modperl_request_config_t *) \
  @@ -14,3 +17,5 @@
      modperl_srv_config_t *scfg = \
         (modperl_srv_config_t *) \
             ap_get_module_config(s->module_config, &perl_module)
  +
  +#endif /* MODPERL_CONFIG_H */
  
  
  
  1.2       +24 -4     modperl-2.0/src/modules/perl/modperl_types.h
  
  Index: modperl_types.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_types.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- modperl_types.h	2000/04/13 07:03:37	1.1
  +++ modperl_types.h	2000/04/14 23:52:55	1.2
  @@ -1,3 +1,6 @@
  +#ifndef MODPERL_TYPES_H
  +#define MODPERL_TYPES_H
  +
   /* aliases */
   
   typedef ap_array_header_t MpAV;
  @@ -16,15 +19,30 @@
   typedef command_rec *  Apache__Command;
   
   typedef ap_table_t   * Apache__table;
  -typedef ap_context_t * Apache__Context;
  +typedef ap_pool_t    * Apache__Pool;
   
   /* mod_perl structures */
   
  -typedef struct {
  +typedef struct modperl_interp_t modperl_interp_t;
  +
  +struct modperl_interp_t {
  +    ap_lock_t *mip_lock;
       PerlInterpreter *perl;
  -} modperl_runtime_t;
  +    modperl_interp_t *next;
  +    int flags;
  +};
   
   typedef struct {
  +    ap_lock_t *mip_lock;
  +    int start; /* number of Perl intepreters to start (clone) */
  +    int min_spare; /* minimum number of spare Perl interpreters */
  +    int max_spare; /* maximum number of spare Perl interpreters */
  +    int size; /* current number of Perl interpreters */
  +    modperl_interp_t *parent; /* from which to perl_clone() */
  +    modperl_interp_t *head;
  +} modperl_interp_pool_t;
  +
  +typedef struct {
       MpAV *handlers[MP_PROCESS_NUM_HANDLERS];
   } modperl_process_config_t;
   
  @@ -43,7 +61,7 @@
       MpAV *handlers[MP_PER_SRV_NUM_HANDLERS];
       modperl_process_config_t *process_cfg;
       modperl_connection_config_t *connection_cfg;
  -    modperl_runtime_t *runtime;
  +    modperl_interp_pool_t *mip;
       int flags;
   } modperl_srv_config_t;
   
  @@ -66,3 +84,5 @@
       char *name;
       int flags;
   } modperl_handler_t;
  +
  +#endif /* MODPERL_TYPES_H */
  
  
  

Mime
View raw message