cvs commit: modperl-2.0/src/modules/perl mod_perl.c modperl_interp.c modperl_util.c modperl_util.h
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
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; }
cvs commit: modperl-2.0/src/modules/perl mod_perl.c modperl_interp.c modperl_perl.c modperl_perl.h
dougm 01/11/01 15:50:32 Modified:src/modules/perl mod_perl.c modperl_interp.c modperl_perl.c modperl_perl.h Log: moving perl_destruct() and releated items into modperl_perl_destruct() wrapper Revision ChangesPath 1.93 +1 -3 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.92 retrieving revision 1.93 diff -u -r1.92 -r1.93 --- mod_perl.c2001/10/13 19:11:32 1.92 +++ mod_perl.c2001/11/01 23:50:32 1.93 @@ -9,12 +9,10 @@ handles = modperl_xs_dl_handles_get(aTHX_ cdata-pool); -PL_perl_destruct_level = 2; MP_TRACE_i(MP_FUNC, destroying interpreter=0x%lx\n, (unsigned long)perl); -perl_destruct(perl); -perl_free(perl); +modperl_perl_destruct(perl); if (handles) { modperl_xs_dl_handles_close(cdata-pool, handles); 1.37 +1 -12 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.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- modperl_interp.c 2001/10/21 22:10:11 1.36 +++ modperl_interp.c 2001/11/01 23:50:32 1.37 @@ -83,9 +83,6 @@ MP_TRACE_i(MP_FUNC, *error - still in use!*\n); } -PERL_SET_CONTEXT(interp-perl); -PL_perl_destruct_level = 2; - /* 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 @@ -93,16 +90,8 @@ */ (void)apr_pool_create(p, NULL); handles = modperl_xs_dl_handles_get(aTHX_ p); - -perl_destruct(interp-perl); -/* XXX: big bug in 5.6.1 fixed in 5.7.2+ - * XXX: see CLONEf_CLONE_HOST perl_clone() flag - * XXX: try to find a workaround for 5.6.1 - */ -#ifndef WIN32 -perl_free(interp-perl); -#endif +modperl_perl_destruct(interp-perl); if (handles) { modperl_xs_dl_handles_close(p, handles); 1.7 +19 -0 modperl-2.0/src/modules/perl/modperl_perl.c Index: modperl_perl.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_perl.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- modperl_perl.c2001/10/21 05:46:47 1.6 +++ modperl_perl.c2001/11/01 23:50:32 1.7 @@ -82,3 +82,22 @@ modperl_perl_init_ids(aTHX_ ids); #endif } + +void modperl_perl_destruct(PerlInterpreter *perl) +{ +dTHXa(perl); + +PERL_SET_CONTEXT(perl); + +PL_perl_destruct_level = 2; + +perl_destruct(perl); + +/* XXX: big bug in 5.6.1 fixed in 5.7.2+ + * XXX: see CLONEf_CLONE_HOST perl_clone() flag + * XXX: try to find a workaround for 5.6.1 + */ +#ifndef WIN32 +perl_free(perl); +#endif +} 1.7 +2 -0 modperl-2.0/src/modules/perl/modperl_perl.h Index: modperl_perl.h === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_perl.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- modperl_perl.h2001/10/21 05:46:47 1.6 +++ modperl_perl.h2001/11/01 23:50:32 1.7 @@ -11,4 +11,6 @@ void modperl_perl_init_ids_server(server_rec *s); +void modperl_perl_destruct(PerlInterpreter *perl); + #endif /* MODPERL_PERL_H */
cvs commit: modperl-2.0/src/modules/perl mod_perl.c modperl_interp.c
dougm 01/03/14 20:34:04 Modified:src/modules/perl mod_perl.c modperl_interp.c Log: need to PERL_SET_CONTEXT to parent perl in non-threaded mpms give a little more trace info about interpreters in virtual hosts Revision ChangesPath 1.36 +3 -2 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.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- mod_perl.c2001/03/15 02:17:35 1.35 +++ mod_perl.c2001/03/15 04:34:04 1.36 @@ -98,8 +98,9 @@ /* if alloc flags is On, virtual host gets its own parent perl */ if (MpSrvPARENT(scfg)) { perl = modperl_startup(s, p); -MP_TRACE_i(MP_FUNC, "modperl_startup() server=%s\n", - s-server_hostname); +MP_TRACE_i(MP_FUNC, + "created parent interpreter for VirtualHost %s\n", + modperl_server_desc(s, p)); } #ifdef USE_ITHREADS 1.24 +6 -2 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.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- modperl_interp.c 2001/03/15 02:17:35 1.23 +++ modperl_interp.c 2001/03/15 04:34:04 1.24 @@ -215,8 +215,12 @@ modperl_interp_lifetime_e lifetime; if (!scfg-threaded_mpm) { -MP_TRACE_i(MP_FUNC, "using parent 0x%lx for non-threaded mpm\n", - (unsigned long)scfg-mip-parent); +MP_TRACE_i(MP_FUNC, + "using parent 0x%lx for non-threaded mpm (%s:%d)\n", + (unsigned long)scfg-mip-parent, + s-server_hostname, s-port); +/* XXX: if no VirtualHosts w/ PerlOptions +Parent we can skip this */ +PERL_SET_CONTEXT(scfg-mip-parent-perl); return scfg-mip-parent; }