cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-15 Thread dougm

dougm   00/04/15 18:41:22

  Modified:.Makefile.PL
   lib/ModPerl Code.pm
  Log:
  dont need single file option now that sources are sorted on mtime
  
  Revision  ChangesPath
  1.8   +4 -11 modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Makefile.PL   2000/04/16 00:50:04 1.7
  +++ Makefile.PL   2000/04/16 01:41:21 1.8
  @@ -21,7 +21,7 @@
   use Getopt::Std;
   my %opts;
   getopts('Ecm:', \%opts);
  -configure()if $opts{c};
  +configure()  if $opts{c};
   make(\%opts) if $opts{m};
   }
   
  @@ -55,9 +55,7 @@
   
   sub make {
   my $opts = shift;
  -my $target = $opts->{m};
  -return clean() if $target eq 'c';
  -my $single_file = $target =~ /\.c$/ ? $target : "";
  +return clean() if $opts->{m} eq 'c';
   
   my $ccopts = ExtUtils::Embed::ccopts();
   my @inc = $build->inc;
  @@ -68,16 +66,11 @@
   my $flags = "-g -Wall";
   $flags .= " -E" if $opts->{E};
   
  -my @c_files = $single_file ? $single_file : $code->c_files;
  -
  -for (sort { (stat $b)[9] <=> (stat $a)[9] } @c_files) {
  +for (sort { (stat $b)[9] <=> (stat $a)[9] } @{ $code->c_files }) {
   echo_cmd "$cc $flags $ccopts @inc -c $_";
  -return if $single_file;
   }
  -
  -my @objs = $code->o_files;
   
  -echo_cmd "$ar crv libmodperl.a @objs";
  +echo_cmd "$ar crv libmodperl.a @{ $code->o_files }";
   
   chdir $build->cwd;
   }
  
  
  
  1.8   +2 -2  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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Code.pm   2000/04/15 23:00:45 1.7
  +++ Code.pm   2000/04/16 01:41:22 1.8
  @@ -275,8 +275,8 @@
   my @c_src_names = qw(interp log config);
   my @g_c_names = map { "modperl_$_" } qw(hooks directives);
   my @c_names   = ('mod_perl', (map "modperl_$_", @c_src_names), @g_c_names);
  -sub c_files { map { "$_.c" } @c_names }
  -sub o_files { map { "$_.o" } @c_names }
  +sub c_files { [map { "$_.c" } @c_names] }
  +sub o_files { [map { "$_.o" } @c_names] }
   
   my @g_h_names = map { "modperl_$_" } qw(hooks directives flags trace);
   
  
  
  



cvs commit: modperl-2.0/src/modules/perl mod_perl.c modperl_config.c modperl_config.h modperl_interp.c modperl_interp.h modperl_types.h

2000-04-15 Thread dougm

dougm   00/04/15 18:33:57

  Modified:src/modules/perl mod_perl.c modperl_config.c
modperl_config.h modperl_interp.c modperl_interp.h
modperl_types.h
  Log:
  interpreter pool is only useful #ifdef USE_ITHREADS
  
  Revision  ChangesPath
  1.6   +3 -6  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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- mod_perl.c2000/04/16 00:35:32 1.5
  +++ mod_perl.c2000/04/16 01:33:56 1.6
  @@ -23,7 +23,7 @@
   
   perl_run(perl);
   
  -modperl_interp_pool_init(s, p, perl);
  +modperl_interp_init(s, p, perl);
   }
   
   void modperl_init(server_rec *s, ap_pool_t *p)
  @@ -46,17 +46,13 @@
   {
   /* XXX: should be pre_config hook or 1.xx logic */
   ap_hook_open_logs(modperl_hook_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[] = {  
   #ifdef MP_TRACE
   MP_SRV_CMD_TAKE1("PerlTrace", trace, "Trace level"),
   #endif
  +#ifdef USE_ITHREADS
   MP_SRV_CMD_TAKE1("PerlInterpStart", interp_start,
"Number of Perl interpreters to start"),
   MP_SRV_CMD_TAKE1("PerlInterpMax", interp_max,
  @@ -65,6 +61,7 @@
"Max number of spare Perl interpreters"),
   MP_SRV_CMD_TAKE1("PerlInterpMinSpare", interp_min_spare,
"Min number of spare Perl interpreters"),
  +#endif
   { NULL }, 
   }; 
   
  
  
  
  1.4   +11 -2 modperl-2.0/src/modules/perl/modperl_config.c
  
  Index: modperl_config.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- modperl_config.c  2000/04/16 00:53:33 1.3
  +++ modperl_config.c  2000/04/16 01:33:56 1.4
  @@ -19,6 +19,8 @@
   void *modperl_create_srv_config(ap_pool_t *p, server_rec *s)
   {
   modperl_srv_config_t *scfg = modperl_srv_config_new(p);
  +
  +#ifdef USE_ITHREADS
   scfg->interp_pool_cfg = 
   (modperl_interp_pool_config_t *)
   ap_pcalloc(p, sizeof(*scfg->interp_pool_cfg));
  @@ -29,6 +31,8 @@
   scfg->interp_pool_cfg->min_spare = 3;
   scfg->interp_pool_cfg->max = 5;
   
  +#endif /* USE_ITHREADS */
  +
   return scfg;
   }
   
  @@ -37,14 +41,16 @@
   
   void *modperl_merge_srv_config(ap_pool_t *p, void *basev, void *addv)
   {
  +#if 0
   modperl_srv_config_t
   *base = (modperl_srv_config_t *)basev,
   *add  = (modperl_srv_config_t *)addv,
   *mrg  = modperl_srv_config_new(p);
   
  -merge_item(mip);
  -
   return mrg;
  +#else
  +return basev;
  +#endif
   }
   
   #define MP_CONFIG_BOOTSTRAP(parms) \
  @@ -56,6 +62,7 @@
   return NULL;
   }
   
  +#ifdef USE_ITHREADS
   
   #define MP_IMP_INTERP_POOL_CFG(item) \
   const char *modperl_cmd_interp_##item(cmd_parms *parms, \
  @@ -74,3 +81,5 @@
   MP_IMP_INTERP_POOL_CFG(max);
   MP_IMP_INTERP_POOL_CFG(max_spare);
   MP_IMP_INTERP_POOL_CFG(min_spare);
  +
  +#endif /* USE_ITHREADS */
  
  
  
  1.5   +2 -0  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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- modperl_config.h  2000/04/16 00:35:32 1.4
  +++ modperl_config.h  2000/04/16 01:33:56 1.5
  @@ -18,10 +18,12 @@
  void *dummy, char *arg)
   MP_DECLARE_SRV_CMD(trace);
   
  +#ifdef USE_ITHREADS
   MP_DECLARE_SRV_CMD(interp_start);
   MP_DECLARE_SRV_CMD(interp_max);
   MP_DECLARE_SRV_CMD(interp_max_spare);
   MP_DECLARE_SRV_CMD(interp_min_spare);
  +#endif
   
   #define MP_SRV_CMD_TAKE1(name, item, desc) \
   { name, modperl_cmd_##item, NULL, \
  
  
  
  1.6   +26 -4 modperl-2.0/src/modules/perl/modperl_interp.c
  
  Index: modperl_interp.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- modperl_interp.c  2000/04/16 00:35:32 1.5
  +++ modperl_interp.c  2000/04/16 01:33:56 1.6
  @@ -5,6 +5,8 @@
* but it will do for proof-of-concept
*/
   
  +#ifdef USE_ITHREADS
  +
   modperl_interp_t *modperl_interp_new(ap_pool_t *p,
modperl_interp_pool_t *mip,

cvs commit: modperl-2.0/src/modules/perl modperl_config.c

2000-04-15 Thread dougm

dougm   00/04/15 17:53:33

  Modified:src/modules/perl modperl_config.c
  Log:
  PerlInterp* commands can only be at the top-level
  
  Revision  ChangesPath
  1.3   +2 -0  modperl-2.0/src/modules/perl/modperl_config.c
  
  Index: modperl_config.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- modperl_config.c  2000/04/16 00:35:32 1.2
  +++ modperl_config.c  2000/04/16 00:53:33 1.3
  @@ -63,6 +63,8 @@
   { \
   MP_dSCFG(parms->server); \
   int item = atoi(arg); \
  +const char *err = ap_check_cmd_context(parms, GLOBAL_ONLY); \
  +if (err) return err; \
   scfg->interp_pool_cfg->##item = item; \
   MP_TRACE_d(MP_FUNC, "%s %d\n", parms->cmd->name, item); \
   return NULL; \
  
  
  



cvs commit: modperl-2.0 Makefile.PL

2000-04-15 Thread dougm

dougm   00/04/15 17:50:05

  Modified:.Makefile.PL
  Log:
  compile most recently modifified files first
  
  Revision  ChangesPath
  1.7   +3 -1  modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Makefile.PL   2000/04/16 00:28:39 1.6
  +++ Makefile.PL   2000/04/16 00:50:04 1.7
  @@ -68,7 +68,9 @@
   my $flags = "-g -Wall";
   $flags .= " -E" if $opts->{E};
   
  -for ($single_file ? $single_file : $code->c_files) {
  +my @c_files = $single_file ? $single_file : $code->c_files;
  +
  +for (sort { (stat $b)[9] <=> (stat $a)[9] } @c_files) {
   echo_cmd "$cc $flags $ccopts @inc -c $_";
   return if $single_file;
   }
  
  
  



cvs commit: modperl-2.0/src/modules/perl mod_perl.c mod_perl.h modperl_config.c modperl_config.h modperl_interp.c modperl_types.h

2000-04-15 Thread dougm

dougm   00/04/15 17:35:32

  Modified:src/modules/perl mod_perl.c mod_perl.h modperl_config.c
modperl_config.h modperl_interp.c modperl_types.h
  Log:
  add PerlInterp* and PerlTrace config directives
  
  Revision  ChangesPath
  1.5   +20 -5 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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- mod_perl.c2000/04/15 23:00:46 1.4
  +++ mod_perl.c2000/04/16 00:35:32 1.5
  @@ -26,13 +26,17 @@
   modperl_interp_pool_init(s, p, perl);
   }
   
  -void modperl_init(ap_pool_t *pconf, ap_pool_t *plog, 
  -  ap_pool_t *ptemp, server_rec *s)
  +void modperl_init(server_rec *s, ap_pool_t *p)
   {
  -modperl_trace_level_set("all"); /* XXX: all for now */
  -modperl_startup(s, pconf);
  +modperl_startup(s, p);
   }
   
  +void modperl_hook_init(ap_pool_t *pconf, ap_pool_t *plog, 
  +   ap_pool_t *ptemp, server_rec *s)
  +{
  +modperl_init(s, pconf);
  +}
  +
   void modperl_pre_config_handler(ap_pool_t *p, ap_pool_t *plog,
   ap_pool_t *ptemp)
   {
  @@ -41,7 +45,7 @@
   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);
  +ap_hook_open_logs(modperl_hook_init, NULL, NULL, HOOK_MIDDLE);
   
   /* XXX: should only bother selecting an interpreter
* if one is needed for the request
  @@ -50,6 +54,17 @@
   }
   
   static command_rec modperl_cmds[] = {  
  +#ifdef MP_TRACE
  +MP_SRV_CMD_TAKE1("PerlTrace", trace, "Trace level"),
  +#endif
  +MP_SRV_CMD_TAKE1("PerlInterpStart", interp_start,
  + "Number of Perl interpreters to start"),
  +MP_SRV_CMD_TAKE1("PerlInterpMax", interp_max,
  + "Max number of running Perl interpreters"),
  +MP_SRV_CMD_TAKE1("PerlInterpMaxSpare", interp_max_spare,
  + "Max number of spare Perl interpreters"),
  +MP_SRV_CMD_TAKE1("PerlInterpMinSpare", interp_min_spare,
  + "Min number of spare Perl interpreters"),
   { NULL }, 
   }; 
   
  
  
  
  1.5   +2 -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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- mod_perl.h2000/04/15 23:00:46 1.4
  +++ mod_perl.h2000/04/16 00:35:32 1.5
  @@ -32,4 +32,6 @@
   
   #include "modperl_directives.h"
   
  +void modperl_init(server_rec *s, ap_pool_t *p);
  +
   #endif /*  MOD_PERL_H */
  
  
  
  1.2   +39 -1 modperl-2.0/src/modules/perl/modperl_config.c
  
  Index: modperl_config.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- modperl_config.c  2000/04/15 23:00:47 1.1
  +++ modperl_config.c  2000/04/16 00:35:32 1.2
  @@ -19,10 +19,22 @@
   void *modperl_create_srv_config(ap_pool_t *p, server_rec *s)
   {
   modperl_srv_config_t *scfg = modperl_srv_config_new(p);
  +scfg->interp_pool_cfg = 
  +(modperl_interp_pool_config_t *)
  +ap_pcalloc(p, sizeof(*scfg->interp_pool_cfg));
   
  +/* XXX: determine reasonable defaults */
  +scfg->interp_pool_cfg->start = 3;
  +scfg->interp_pool_cfg->max_spare = 3;
  +scfg->interp_pool_cfg->min_spare = 3;
  +scfg->interp_pool_cfg->max = 5;
  +
   return scfg;
   }
   
  +#define merge_item(item) \
  +mrg->item = add->item ? add->item : base->item
  +
   void *modperl_merge_srv_config(ap_pool_t *p, void *basev, void *addv)
   {
   modperl_srv_config_t
  @@ -30,7 +42,33 @@
   *add  = (modperl_srv_config_t *)addv,
   *mrg  = modperl_srv_config_new(p);
   
  -mrg->mip = add->mip ? add->mip : base->mip;
  +merge_item(mip);
   
   return mrg;
   }
  +
  +#define MP_CONFIG_BOOTSTRAP(parms) \
  +if (!scfg->mip) modperl_init(parms->server, parms->pool)
  +
  +MP_DECLARE_SRV_CMD(trace)
  +{
  +modperl_trace_level_set(arg);
  +return NULL;
  +}
  +
  +
  +#define MP_IMP_INTERP_POOL_CFG(item) \
  +const char *modperl_cmd_interp_##item(cmd_parms *parms, \
  +  void *dummy, char *arg) \
  +{ \
  +MP_dSCFG(parms->server); \
  +int item = atoi(arg); \
  +scfg->interp_pool_cfg->##item = item; \
  +MP_TRACE_d(MP_FUNC, "%s %d\n", parms->cmd->name, item); \
  +return NULL; \
  +}
  +
  +MP_IMP_INTERP_POOL_CFG(start);
  +MP_IMP_INTERP_POOL_CFG(max);
  +MP_IMP_INTERP_

cvs commit: modperl-2.0 Makefile.PL

2000-04-15 Thread dougm

dougm   00/04/15 17:28:39

  Modified:.Makefile.PL
  Log:
  -E option to use cpp
  
  Revision  ChangesPath
  1.6   +8 -4  modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Makefile.PL   2000/04/15 19:04:20 1.5
  +++ Makefile.PL   2000/04/16 00:28:39 1.6
  @@ -20,9 +20,9 @@
   {
   use Getopt::Std;
   my %opts;
  -getopts('cm:', \%opts);
  +getopts('Ecm:', \%opts);
   configure()if $opts{c};
  -make($opts{m}) if $opts{m};
  +make(\%opts) if $opts{m};
   }
   
   sub configure {
  @@ -54,7 +54,8 @@
   }
   
   sub make {
  -my $target = shift;
  +my $opts = shift;
  +my $target = $opts->{m};
   return clean() if $target eq 'c';
   my $single_file = $target =~ /\.c$/ ? $target : "";
   
  @@ -64,8 +65,11 @@
   
   chdir $code->path;
   
  +my $flags = "-g -Wall";
  +$flags .= " -E" if $opts->{E};
  +
   for ($single_file ? $single_file : $code->c_files) {
  -echo_cmd "$cc -g -Wall $ccopts @inc -c $_";
  +echo_cmd "$cc $flags $ccopts @inc -c $_";
   return if $single_file;
   }
   
  
  
  



cvs commit: modperl-2.0/src/modules/perl modperl_config.c mod_perl.c mod_perl.h modperl_config.h

2000-04-15 Thread dougm

dougm   00/04/15 16:00:47

  Modified:lib/ModPerl Code.pm
   src/modules/perl mod_perl.c mod_perl.h modperl_config.h
  Added:   src/modules/perl modperl_config.c
  Log:
  put modperl_config.c in place
  
  Revision  ChangesPath
  1.7   +1 -1  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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Code.pm   2000/04/15 17:51:44 1.6
  +++ Code.pm   2000/04/15 23:00:45 1.7
  @@ -272,7 +272,7 @@
  generate_trace  => {h => 'modperl_trace.h'},
   );
   
  -my @c_src_names = qw(interp log);
  +my @c_src_names = qw(interp log config);
   my @g_c_names = map { "modperl_$_" } qw(hooks directives);
   my @c_names   = ('mod_perl', (map "modperl_$_", @c_src_names), @g_c_names);
   sub c_files { map { "$_.c" } @c_names }
  
  
  
  1.4   +0 -35 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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- mod_perl.c2000/04/15 01:38:45 1.3
  +++ mod_perl.c2000/04/15 23:00:46 1.4
  @@ -38,41 +38,6 @@
   {
   }
   
  -void *modperl_create_dir_config(ap_pool_t *p, char *dir)
  -{
  -return NULL;
  -}
  -
  -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 */
  
  
  
  1.4   +1 -1  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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- mod_perl.h2000/04/15 01:38:45 1.3
  +++ mod_perl.h2000/04/15 23:00:46 1.4
  @@ -19,7 +19,7 @@
   
   #include "apr_lock.h"
   
  -module MODULE_VAR_EXPORT perl_module;
  +extern module MODULE_VAR_EXPORT perl_module;
   
   #include "modperl_flags.h"
   #include "modperl_hooks.h"
  
  
  
  1.3   +10 -0 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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- modperl_config.h  2000/04/14 23:52:54 1.2
  +++ modperl_config.h  2000/04/15 23:00:47 1.3
  @@ -1,6 +1,16 @@
   #ifndef MODPERL_CONFIG_H
   #define MODPERL_CONFIG_H
   
  +void *modperl_create_dir_config(ap_pool_t *p, char *dir);
  +
  +void *modperl_merge_dir_config(ap_pool_t *p, void *base, void *add);
  +
  +modperl_srv_config_t *modperl_srv_config_new(ap_pool_t *p);
  +
  +void *modperl_create_srv_config(ap_pool_t *p, server_rec *s);
  +
  +void *modperl_merge_srv_config(ap_pool_t *p, void *basev, void *addv);
  +
   char *modperl_cmd_push_handlers(MpAV *handlers, char *name, ap_pool_t *p);
   
   #define MP_dRCFG \
  
  
  
  1.1  modperl-2.0/src/modules/perl/modperl_config.c
  
  Index: modperl_config.c
  ===
  #include "mod_perl.h"
  
  void *modperl_create_dir_config(ap_pool_t *p, char *dir)
  {
  return NULL;
  }
  
  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;
  
  retur

cvs commit: modperl-2.0/src/modules/perl modperl_interp.c modperl_interp.h modperl_types.h

2000-04-15 Thread dougm

dougm   00/04/15 15:43:11

  Modified:src/modules/perl modperl_interp.c modperl_interp.h
modperl_types.h
  Log:
  interpreter pool throttling
  
  Revision  ChangesPath
  1.4   +134 -49   modperl-2.0/src/modules/perl/modperl_interp.c
  
  Index: modperl_interp.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- modperl_interp.c  2000/04/15 17:51:44 1.3
  +++ modperl_interp.c  2000/04/15 22:43:10 1.4
  @@ -6,15 +6,21 @@
*/
   
   modperl_interp_t *modperl_interp_new(ap_pool_t *p,
  - modperl_interp_t *parent)
  + modperl_interp_pool_t *mip,
  + PerlInterpreter *perl)
   {
   modperl_interp_t *interp = 
   (modperl_interp_t *)ap_pcalloc(p, sizeof(*interp));
   
  -if (parent) {
  -interp->mip_lock = parent->mip_lock;
  +if (mip) {
  +interp->mip = mip;
   }
   
  +if (perl) {
  +interp->perl = perl_clone(perl, TRUE);
  +MpInterpCLONED_On(interp);
  +}
  +
   MP_TRACE_i(MP_FUNC, "0x%lx\n", (unsigned long)interp);
   
   return interp;
  @@ -31,7 +37,6 @@
   MP_TRACE_i(MP_FUNC, "*error - still in use!*\n");
   }
   
  -
   PL_perl_destruct_level = 2;
   perl_destruct(interp->perl);
   perl_free(interp->perl);
  @@ -58,8 +63,23 @@
   MP_TRACE_i(MP_FUNC, "no pool, returning parent\n");
   return mip->parent;
   }
  +
  +MUTEX_LOCK(&mip->mip_lock);
   
  -ap_lock(mip->mip_lock);
  +if (mip->size == mip->in_use) {
  +if (mip->size < mip->max) {
  +interp = modperl_interp_new(mip->ap_pool, mip, 
  +mip->parent->perl);
  +MUTEX_UNLOCK(&mip->mip_lock);
  +modperl_interp_pool_add(mip, interp);
  +MP_TRACE_i(MP_FUNC, "cloned new interp\n");
  +return interp;
  +}
  +while (mip->size == mip->in_use) {
  +MP_TRACE_i(MP_FUNC, "waiting for available interpreter\n");
  +COND_WAIT(&mip->available, &mip->mip_lock);
  +}
  +}
   
   head = mip->head;
   
  @@ -77,6 +97,7 @@
   #endif
   MpInterpIN_USE_On(interp);
   MpInterpPUTBACK_On(interp);
  +mip->in_use++;
   break;
   }
   else {
  @@ -86,28 +107,19 @@
   }
   }
   
  -ap_unlock(mip->mip_lock);
  +MUTEX_UNLOCK(&mip->mip_lock);
   
  -if (!interp) {
  -/*
  - * XXX: options
  - * -block until one is available
  - * -clone a new Perl
  - * - ...
  - */
  -}
  -
   return interp;
   }
   
   ap_status_t modperl_interp_pool_destroy(void *data)
   {
   modperl_interp_pool_t *mip = (modperl_interp_pool_t *)data;
  +modperl_interp_t *interp;
   
  -while (mip->head) {
  -modperl_interp_destroy(mip->head);
  -mip->head->perl = NULL;
  -mip->head = mip->head->next;
  +while ((interp = mip->head)) {
  +modperl_interp_pool_remove(mip, interp);
  +modperl_interp_destroy(interp);
   }
   
   MP_TRACE_i(MP_FUNC, "parent == 0x%lx\n",
  @@ -115,54 +127,112 @@
   
   modperl_interp_destroy(mip->parent);
   mip->parent->perl = NULL;
  +
  +MUTEX_DESTROY(&mip->mip_lock);
   
  -ap_destroy_lock(mip->mip_lock);
  +COND_DESTROY(&mip->available);
   
   return APR_SUCCESS;
   }
   
  +void modperl_interp_pool_add(modperl_interp_pool_t *mip,
  + modperl_interp_t *interp)
  +{
  +MUTEX_LOCK(&mip->mip_lock);
  +
  +if (mip->size == 0) {
  +mip->head = mip->tail = interp;
  +}
  +else {
  +mip->tail->next = interp;
  +mip->tail = interp;
  +}
  +
  +mip->size++;
  +MP_TRACE_i(MP_FUNC, "added 0x%lx (size=%d)\n",
  +   (unsigned long)interp, mip->size);
  +
  +MUTEX_UNLOCK(&mip->mip_lock);
  +}
  +
  +void modperl_interp_pool_remove(modperl_interp_pool_t *mip,
  +modperl_interp_t *interp)
  +{
  +MUTEX_LOCK(&mip->mip_lock);
  +
  +if (mip->head == interp) {
  +mip->head = interp->next;
  +interp->next = NULL;
  +MP_TRACE_i(MP_FUNC, "shifting head from 0x%lx to 0x%lx\n",
  +   (unsigned long)interp, (unsigned long)mip->head);
  +}
  +else if (mip->tail == interp) {
  +modperl_interp_t *tmp = mip->head;
  +/* XXX: implement a prev pointer */
  +while (tmp->next && tmp->next->next) {
  +tmp = tmp->next;
  +}
  +
  +tmp->next = NULL;
  +mip->tail = tmp;
  +MP_TRACE_i(MP_FUNC, "popping tail 0x%lx, now 0x%lx\n",
  +

Re: cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-15 Thread brian moseley

On Sat, 15 Apr 2000, Doug MacEachern wrote:

> that is sad.  consider PerlFreshRestart and graceful
> restart. it doesn't take much effort to type '' instead
> of "".  it might not make that much of a difference in
> parse time, but it doesn't hurt either. can we please
> drop this topic, there's plenty more important things to
> worry about.

if you don't watch it i'm going to start questioning where
you put your curly braces.





cvs commit: modperl-2.0 Makefile.PL

2000-04-15 Thread dougm

dougm   00/04/15 12:04:20

  Modified:.Makefile.PL
  Log:
  option to compile a single file ala -mmodperl_foo.c
  
  Revision  ChangesPath
  1.5   +3 -1  modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Makefile.PL   2000/04/15 17:38:44 1.4
  +++ Makefile.PL   2000/04/15 19:04:20 1.5
  @@ -56,6 +56,7 @@
   sub make {
   my $target = shift;
   return clean() if $target eq 'c';
  +my $single_file = $target =~ /\.c$/ ? $target : "";
   
   my $ccopts = ExtUtils::Embed::ccopts();
   my @inc = $build->inc;
  @@ -63,8 +64,9 @@
   
   chdir $code->path;
   
  -for ($code->c_files) {
  +for ($single_file ? $single_file : $code->c_files) {
   echo_cmd "$cc -g -Wall $ccopts @inc -c $_";
  +return if $single_file;
   }
   
   my @objs = $code->o_files;
  
  
  



Re: cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-15 Thread Stas Bekman

> > The only question I still want to ask you is why do we care about the
> > parse time, when mod_perl is a preloaded and precompiled. 
> 
> again, this is not the only reason.  however, i do think it's important to
> speed up parse time if possible.  
> consider t/TEST
> print "still waiting for server to warm up...";
> }
> for (1..4) {
> sleep $_;
> if (simple_fetch "/test.html") {
> print "ok\n";
> }
> else {
> print "...";
> }
> }
> 
> that is sad.  consider PerlFreshRestart and graceful restart.
> it doesn't take much effort to type '' instead of "".  it might not make
> that much of a difference in parse time, but it doesn't hurt either.
> can we please drop this topic, there's plenty more important things to
> worry about.




__
Stas Bekman | JAm_pH--Just Another mod_perl Hacker
http://stason.org/  | mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]  | http://perl.orghttp://stason.org/TULARC/
http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
--




cvs commit: modperl-2.0/src/modules/perl modperl_interp.c modperl_interp.h

2000-04-15 Thread dougm

dougm   00/04/15 10:51:45

  Modified:lib/ModPerl Code.pm
   src/modules/perl modperl_interp.c modperl_interp.h
  Log:
  move interpreter teardown into modperl_interp_destroy
  provide modperl_interp_cleanup to assist with throttling
  
  Revision  ChangesPath
  1.6   +4 -2  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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Code.pm   2000/04/15 01:43:17 1.5
  +++ Code.pm   2000/04/15 17:51:44 1.6
  @@ -69,7 +69,8 @@
   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)],
  +Interp => [qw(NONE IN_USE PUTBACK CLONED)],
  +Handler => [qw(NONE METHOD)],
   );
   
   sub new {
  @@ -271,8 +272,9 @@
  generate_trace  => {h => 'modperl_trace.h'},
   );
   
  +my @c_src_names = qw(interp log);
   my @g_c_names = map { "modperl_$_" } qw(hooks directives);
  -my @c_names   = (qw(mod_perl modperl_interp modperl_log), @g_c_names);
  +my @c_names   = ('mod_perl', (map "modperl_$_", @c_src_names), @g_c_names);
   sub c_files { map { "$_.c" } @c_names }
   sub o_files { map { "$_.o" } @c_names }
   
  
  
  
  1.3   +26 -14modperl-2.0/src/modules/perl/modperl_interp.c
  
  Index: modperl_interp.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- modperl_interp.c  2000/04/15 01:38:45 1.2
  +++ modperl_interp.c  2000/04/15 17:51:44 1.3
  @@ -20,6 +20,29 @@
   return interp;
   }
   
  +void modperl_interp_destroy(modperl_interp_t *interp)
  +{
  +dTHXa(interp->perl);
  +
  +MP_TRACE_i(MP_FUNC, "interp == 0x%lx\n",
  +   (unsigned long)interp);
  +
  +if (MpInterpIN_USE(interp)) {
  +MP_TRACE_i(MP_FUNC, "*error - still in use!*\n");
  +}
  +
  +
  +PL_perl_destruct_level = 2;
  +perl_destruct(interp->perl);
  +perl_free(interp->perl);
  +}
  +
  +ap_status_t modperl_interp_cleanup(void *data)
  +{
  +modperl_interp_destroy((modperl_interp_t *)data);
  +return APR_SUCCESS;
  +}
  +
   modperl_interp_t *modperl_interp_get(server_rec *s)
   {
   MP_dSCFG(s);
  @@ -82,18 +105,7 @@
   modperl_interp_pool_t *mip = (modperl_interp_pool_t *)data;
   
   while (mip->head) {
  -dTHXa(mip->head->perl);
  -
  -MP_TRACE_i(MP_FUNC, "head == 0x%lx\n",
  -   (unsigned long)mip->head);
  -if (MpInterpIN_USE(mip->head)) {
  -MP_TRACE_i(MP_FUNC, "*error - still in use!*\n");
  -}
  -
  -PL_perl_destruct_level = 2;
  -perl_destruct(mip->head->perl);
  -perl_free(mip->head->perl);
  -
  +modperl_interp_destroy(mip->head);
   mip->head->perl = NULL;
   mip->head = mip->head->next;
   }
  @@ -101,8 +113,7 @@
   MP_TRACE_i(MP_FUNC, "parent == 0x%lx\n",
  (unsigned long)mip->parent);
   
  -perl_destruct(mip->parent->perl);
  -perl_free(mip->parent->perl);
  +modperl_interp_destroy(mip->parent);
   mip->parent->perl = NULL;
   
   ap_destroy_lock(mip->mip_lock);
  @@ -136,6 +147,7 @@
   for (i=0; istart; i++) {
   modperl_interp_t *interp = modperl_interp_new(p, mip->parent);
   interp->perl = perl_clone(perl, TRUE);
  +MpInterpCLONED_On(interp);
   
   if (cur_interp) {
   cur_interp->next = interp;
  
  
  
  1.2   +4 -0  modperl-2.0/src/modules/perl/modperl_interp.h
  
  Index: modperl_interp.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- modperl_interp.h  2000/04/14 23:51:58 1.1
  +++ modperl_interp.h  2000/04/15 17:51:44 1.2
  @@ -4,6 +4,10 @@
   modperl_interp_t *modperl_interp_new(ap_pool_t *p,
modperl_interp_t *parent);
   
  +void modperl_interp_destroy(modperl_interp_t *interp);
  +
  +ap_status_t modperl_interp_cleanup(void *data);
  +
   modperl_interp_t *modperl_interp_get(server_rec *s);
   
   void modperl_interp_pool_init(server_rec *s, ap_pool_t *p,
  
  
  



Re: cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-15 Thread Doug MacEachern

> The only question I still want to ask you is why do we care about the
> parse time, when mod_perl is a preloaded and precompiled. 

again, this is not the only reason.  however, i do think it's important to
speed up parse time if possible.  
consider t/TEST
print "still waiting for server to warm up...";
}
for (1..4) {
sleep $_;
if (simple_fetch "/test.html") {
print "ok\n";
}
else {
print "...";
}
}

that is sad.  consider PerlFreshRestart and graceful restart.
it doesn't take much effort to type '' instead of "".  it might not make
that much of a difference in parse time, but it doesn't hurt either.
can we please drop this topic, there's plenty more important things to
worry about.




cvs commit: modperl-2.0/lib/Apache Build.pm

2000-04-15 Thread dougm

dougm   00/04/15 10:38:45

  Modified:.Makefile.PL
   lib/Apache Build.pm
  Log:
  fix libgdbm check logic
  move some re-usable things to Apache::Build
  
  Revision  ChangesPath
  1.4   +3 -35 modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Makefile.PL   2000/04/14 23:52:52 1.3
  +++ Makefile.PL   2000/04/15 17:38:44 1.4
  @@ -110,24 +110,6 @@
   close $fh;
   }
   
  -sub phat_warn {
  -my($msg, $abort) = @_;
  -my $level = $abort ? 'ERROR' : 'WARNING';
  -warn find_dlfile('gdbm');
  -
  -my $maybe = $build->find_dlfile_maybe('gdbm');
  -my $suggest = @$maybe ? 
  -  "You could just symlink it to $maybe->[0]" :
  -'You might need to install Perl from source';
  -phat_warn(perl_config('usemymalloc') eq 'y';
  @@ -173,7 +141,7 @@
   my $bincompat = $build->perl_config('bincompat5005');
   
   if ($bincompat) {
  - phat_warn(perl_config('libs') =~ /$name/;
  +
  +return if $self->find_dlfile($name);
  +
  +my $maybe = $self->find_dlfile_maybe($name);
  +my $suggest = @$maybe ? 
  +  "You could just symlink it to $maybe->[0]" :
  +'You might need to install Perl from source';
  +$self->phat_warn(

Re: cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-15 Thread Stas Bekman

On Fri, 14 Apr 2000, Doug MacEachern wrote:

> > > Orwant and friends in "Algorithms with Perl" page 28 claims the first form
> > > is slower.
> 
> faster to *parse*, not faster to *run*.  stas, your benchmarks don't test
> parse time.

The only question I still want to ask you is why do we care about the
parse time, when mod_perl is a preloaded and precompiled. If nothing
should be parsed at the *run time*, why it's important to work on the
*parse time*. I understand that it will make a server start and restart
faster.  Anything else that I've missed? 

Thanks a lot!

__
Stas Bekman | JAm_pH--Just Another mod_perl Hacker
http://stason.org/  | mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]  | http://perl.orghttp://stason.org/TULARC/
http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
--