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

2002-06-20 Thread dougm

dougm   2002/06/20 17:44:24

  Modified:src/modules/perl mod_perl.c modperl_interp.c modperl_util.c
modperl_util.h
  Log:
  use our own modperl_sys_dlclose instead of apr_dso_unload which
  requires us to create our own pool.
  
  Revision  ChangesPath
  1.127 +3 -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.126
  retrieving revision 1.127
  diff -u -r1.126 -r1.127
  --- mod_perl.c16 Jun 2002 01:07:37 -  1.126
  +++ mod_perl.c21 Jun 2002 00:44:24 -  1.127
   -5,18 +5,16 
   {
   modperl_cleanup_data_t *cdata = (modperl_cleanup_data_t *)data;
   PerlInterpreter *perl = (PerlInterpreter *)cdata-data;
  -apr_array_header_t *handles;
  +void **handles;
   
  -handles = modperl_xs_dl_handles_get(aTHX_ cdata-pool);
  +handles = modperl_xs_dl_handles_get(aTHX);
   
   MP_TRACE_i(MP_FUNC, destroying interpreter=0x%lx\n,
  (unsigned long)perl);
   
   modperl_perl_destruct(perl);
   
  -if (handles) {
  -modperl_xs_dl_handles_close(cdata-pool, handles);
  -}
  +modperl_xs_dl_handles_close(handles);
   
   modperl_env_unload();
   
  
  
  
  1.47  +3 -14 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.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- modperl_interp.c  17 Jun 2002 20:00:44 -  1.46
  +++ modperl_interp.c  21 Jun 2002 00:44:24 -  1.47
   -80,8 +80,7 
   
   void modperl_interp_destroy(modperl_interp_t *interp)
   {
  -apr_pool_t *p = NULL;
  -apr_array_header_t *handles;
  +void **handles;
   dTHXa(interp-perl);
   
   PERL_SET_CONTEXT(interp-perl);
   -93,21 +92,11 
   MP_TRACE_i(MP_FUNC, *error - still in use!*\n);
   }
   
  -/* we cant use interp-mip-ap_pool without locking
  - * apr_pool_create() will mutex lock for us
  - * XXX: could roll something without using apr_pool_t
  - * to avoid locking
  - */
  -(void)apr_pool_create(p, NULL);
  -handles = modperl_xs_dl_handles_get(aTHX_ p);
  +handles = modperl_xs_dl_handles_get(aTHX);
   
   modperl_perl_destruct(interp-perl);
   
  -if (handles) {
  -modperl_xs_dl_handles_close(p, handles);
  -}
  -
  -apr_pool_destroy(p);
  +modperl_xs_dl_handles_close(handles);
   }
   
   apr_status_t modperl_interp_cleanup(void *data)
  
  
  
  1.47  +12 -13modperl-2.0/src/modules/perl/modperl_util.c
  
  Index: modperl_util.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.c,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- modperl_util.c19 Jun 2002 05:18:04 -  1.46
  +++ modperl_util.c21 Jun 2002 00:44:24 -  1.47
   -300,12 +300,12 
   }
   }
   
  -apr_array_header_t *modperl_xs_dl_handles_get(pTHX_ apr_pool_t *p)
  +void **modperl_xs_dl_handles_get(pTHX)
   {
   I32 i;
   AV *librefs = get_av(dl_librefs, FALSE);
   AV *modules = get_av(dl_modules, FALSE);
  -apr_array_header_t *handles;
  +void **handles;
   
   if (!librefs) {
MP_TRACE_g(MP_FUNC,
   -319,7 +319,7 
   return NULL;
   }
   
  -handles = apr_array_make(p, AvFILL(librefs)-1, sizeof(void *));
  +handles = (void **)malloc(sizeof(void *) * (AvFILL(librefs)+2));
   
   for (i=0; i=AvFILL(librefs); i++) {
void *handle;
   -337,17 +337,19 
MP_TRACE_g(MP_FUNC, %s dl handle == 0x%lx\n,
  SvPVX(module_sv), (unsigned long)handle);
if (handle) {
  - *(void **)apr_array_push(handles) = handle;
  + handles[i] = handle;
}
   }
   
   av_clear(modules);
   av_clear(librefs);
   
  +handles[i] = (void *)0;
  +
   return handles;
   }
   
  -void modperl_xs_dl_handles_close(apr_pool_t *p, apr_array_header_t *handles)
  +void modperl_xs_dl_handles_close(void **handles)
   {
   int i;
   
   -355,15 +357,12 
return;
   }
   
  -for (i=0; i  handles-nelts; i++) {
  -apr_dso_handle_t *dso = NULL;
  -void *handle = ((void **)handles-elts)[i];
  -
  -MP_TRACE_g(MP_FUNC, close 0x%lx\n, (unsigned long)handle);
  -
  -apr_os_dso_handle_put(dso, (apr_os_dso_handle_t )handle, p);
  -apr_dso_unload(dso);
  +for (i=0; handles[i]; i++) {
  +MP_TRACE_g(MP_FUNC, close 0x%lx\n, (unsigned long)handles[i]);
  +modperl_sys_dlclose(handles[i]);
   }
  +
  +free(handles);
   }
   
   modperl_cleanup_data_t 

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

2002-06-20 Thread dougm

dougm   2002/06/20 21:16:51

  Modified:src/modules/perl mod_perl.c modperl_interp.c
  Log:
  move modperl_pp_{set,unset}_all and modperl_init_{init,unload} to
  modperl_sys_{init,term} functions that only happen once per-parent
  process
  
  Revision  ChangesPath
  1.128 +16 -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.127
  retrieving revision 1.128
  diff -u -r1.127 -r1.128
  --- mod_perl.c21 Jun 2002 00:44:24 -  1.127
  +++ mod_perl.c21 Jun 2002 04:16:51 -  1.128
   -202,10 +202,6 
   return;
   }
   
  -modperl_perl_pp_set_all();
  -
  -modperl_env_init();
  -
   base_perl = modperl_startup(base_server, p);
   
   #ifdef USE_ITHREADS
   -330,6 +326,10 
   modperl_tls_create_request_rec(pconf);
   }
   
  +/*
  + * modperl_sys_{init,term} are things that happen
  + * once per-parent process, not per-interpreter
  + */
   static apr_status_t modperl_sys_init(void)
   {
   #if 0 /*XXX*/
   -345,11 +345,22 
   }
   #endif
   #endif
  +
  +/* modifies PL_ppaddr */
  +modperl_perl_pp_set_all();
  +
  +/* modifies PL_vtbl_env{elem} */
  +modperl_env_init();
  +
   return APR_SUCCESS;
   }
   
   static apr_status_t modperl_sys_term(void *data)
   {
  +modperl_env_unload();
  +
  +modperl_perl_pp_unset_all();
  +
   #if 0 /*XXX*/
   PERL_SYS_TERM();
   #endif
   -362,7 +373,7 
   apr_pool_create(server_pool, pconf);
   
   modperl_sys_init();
  -apr_pool_cleanup_register(server_pool, NULL,
  +apr_pool_cleanup_register(pconf, NULL,
 modperl_sys_term, apr_pool_cleanup_null);
   modperl_init_globals(s, pconf);
   modperl_init(s, pconf);
  
  
  
  1.50  +0 -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.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- modperl_interp.c  21 Jun 2002 03:46:46 -  1.49
  +++ modperl_interp.c  21 Jun 2002 04:16:51 -  1.50
   -152,10 +152,6 
   modperl_interp_destroy(mip-parent);
   }
   
  -modperl_env_unload();
  -
  -modperl_perl_pp_unset_all();
  -
   return APR_SUCCESS;
   }