stas 2004/06/02 14:35:58
Modified: src/modules/perl mod_perl.c modperl_filter.c modperl_io_apache.c modperl_util.h . Changes xs/Apache/RequestIO Apache__RequestIO.h xs/Apache/SubRequest Apache__SubRequest.h Log: complete the move to MP_RUN_CROAK which handles apr exceptions Revision Changes Path 1.214 +2 -1 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.213 retrieving revision 1.214 diff -u -u -r1.213 -r1.214 --- mod_perl.c 9 May 2004 22:43:57 -0000 1.213 +++ mod_perl.c 2 Jun 2004 21:35:58 -0000 1.214 @@ -592,7 +592,8 @@ */ { apr_file_t *dup; - MP_FAILURE_CROAK(apr_file_dup(&dup, s->error_log, pconf)); + MP_RUN_CROAK(apr_file_dup(&dup, s->error_log, pconf), + "mod_perl core post_config"); modperl_trace_logfile_set(dup); } #endif 1.93 +4 -2 modperl-2.0/src/modules/perl/modperl_filter.c Index: modperl_filter.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v retrieving revision 1.92 retrieving revision 1.93 diff -u -u -r1.92 -r1.93 --- modperl_filter.c 2 Jun 2004 18:49:21 -0000 1.92 +++ modperl_filter.c 2 Jun 2004 21:35:58 -0000 1.93 @@ -490,10 +490,12 @@ apr_brigade_destroy(filter->bb_in); filter->bb_in = NULL; } - MP_FAILURE_CROAK(modperl_input_filter_flush(filter)); + MP_RUN_CROAK(modperl_input_filter_flush(filter), + "Apache::Filter"); } else { - MP_FAILURE_CROAK(modperl_output_filter_flush(filter)); + MP_RUN_CROAK(modperl_output_filter_flush(filter), + "Apache::Filter"); } MP_INTERP_PUTBACK(interp); 1.21 +2 -1 modperl-2.0/src/modules/perl/modperl_io_apache.c Index: modperl_io_apache.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_io_apache.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -u -r1.20 -r1.21 --- modperl_io_apache.c 16 May 2004 09:19:40 -0000 1.20 +++ modperl_io_apache.c 2 Jun 2004 21:35:58 -0000 1.21 @@ -178,7 +178,8 @@ rcfg->wbucket->outbuf, rcfg->wbucket->outcnt)); - MP_FAILURE_CROAK(modperl_wbucket_flush(rcfg->wbucket, FALSE)); + MP_RUN_CROAK(modperl_wbucket_flush(rcfg->wbucket, FALSE), + ":Apache IO flush"); return 0; } 1.61 +0 -9 modperl-2.0/src/modules/perl/modperl_util.h Index: modperl_util.h =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v retrieving revision 1.60 retrieving revision 1.61 diff -u -u -r1.60 -r1.61 --- modperl_util.h 13 May 2004 01:33:52 -0000 1.60 +++ modperl_util.h 2 Jun 2004 21:35:58 -0000 1.61 @@ -65,15 +65,6 @@ #define MP_magical_tie(sv, mg_flags) \ SvFLAGS((SV*)sv) |= mg_flags - -/* XXX: this should be removed */ -#define MP_FAILURE_CROAK(rc_run) do { \ - apr_status_t rc = rc_run; \ - if (rc != APR_SUCCESS) { \ - Perl_croak(aTHX_ modperl_error_strerror(aTHX_ rc)); \ - } \ - } while (0) - /* check whether the response phase has been initialized already */ #define MP_CHECK_WBUCKET_INIT(func) \ if (!rcfg->wbucket) { \ 1.385 +6 -1 modperl-2.0/Changes Index: Changes =================================================================== RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.384 retrieving revision 1.385 diff -u -u -r1.384 -r1.385 --- Changes 2 Jun 2004 18:51:02 -0000 1.384 +++ Changes 2 Jun 2004 21:35:58 -0000 1.385 @@ -12,13 +12,18 @@ =item 1.99_15-dev +Apache::RequestIO: print(), printf(), puts(), write(), rflush() throw +an exception on failure [Stas] + +Apache::SubRequest: run() throw an exception on failure [Stas] + Apache::Filter: [Stas] - remove unneeded methods: remove_input_filter() and remove_output_filter(), fputs() - frec() accessor is made read-only - fflush(), get_brigade() and pass_brigade() now throw exceptions if called in the void context - - read, print() and puts() throw exception on failure + - read, print() and puts() throw an exception on failure Apache::FilterRec: [Stas] - remove the next() accessor since it's not used by Apache at the 1.47 +13 -9 modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h Index: Apache__RequestIO.h =================================================================== RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h,v retrieving revision 1.46 retrieving revision 1.47 diff -u -u -r1.46 -r1.47 --- Apache__RequestIO.h 2 Jun 2004 18:49:22 -0000 1.46 +++ Apache__RequestIO.h 2 Jun 2004 21:35:58 -0000 1.47 @@ -35,14 +35,15 @@ #define mpxs_Apache__RequestRec_UNTIE(r, refcnt) \ (r && refcnt) ? SVYES : SVNO /* noop */ -#define mpxs_output_flush(r, rcfg) \ +#define mpxs_output_flush(r, rcfg, name) \ /* if ($|) */ \ if (IoFLUSH(PL_defoutgv)) { \ MP_TRACE_o(MP_FUNC, "(flush) %d bytes [%s]", \ rcfg->wbucket->outcnt, \ apr_pstrmemdup(rcfg->wbucket->pool, rcfg->wbucket->outbuf, \ rcfg->wbucket->outcnt)); \ - MP_FAILURE_CROAK(modperl_wbucket_flush(rcfg->wbucket, TRUE)); \ + MP_RUN_CROAK(modperl_wbucket_flush(rcfg->wbucket, TRUE), \ + name); \ } static MP_INLINE apr_size_t mpxs_ap_rvputs(pTHX_ I32 items, @@ -92,7 +93,7 @@ mpxs_write_loop(modperl_wbucket_write, rcfg->wbucket, "Apache::RequestIO::print"); - mpxs_output_flush(r, rcfg); + mpxs_output_flush(r, rcfg, "Apache::RequestIO::print"); return bytes; } @@ -120,10 +121,11 @@ MP_TRACE_o(MP_FUNC, "%d bytes [%s]", bytes, SvPVX(sv)); - MP_FAILURE_CROAK(modperl_wbucket_write(aTHX_ rcfg->wbucket, - SvPVX(sv), &bytes)); + MP_RUN_CROAK(modperl_wbucket_write(aTHX_ rcfg->wbucket, + SvPVX(sv), &bytes), + "Apache::RequestIO::printf"); - mpxs_output_flush(r, rcfg); + mpxs_output_flush(r, rcfg, "Apache::RequestIO::printf"); return bytes; } @@ -152,8 +154,9 @@ } MP_CHECK_WBUCKET_INIT("$r->write"); - MP_FAILURE_CROAK(modperl_wbucket_write(aTHX_ rcfg->wbucket, - buf+offset, &wlen)); + MP_RUN_CROAK(modperl_wbucket_write(aTHX_ rcfg->wbucket, + buf+offset, &wlen), + "Apache::RequestIO::write"); return wlen; } @@ -175,7 +178,8 @@ rcfg->wbucket->outcnt, apr_pstrmemdup(rcfg->wbucket->pool, rcfg->wbucket->outbuf, rcfg->wbucket->outcnt)); - MP_FAILURE_CROAK(modperl_wbucket_flush(rcfg->wbucket, TRUE)); + MP_RUN_CROAK(modperl_wbucket_flush(rcfg->wbucket, TRUE), + "Apache::RequestIO::rflush"); return APR_SUCCESS; } 1.5 +2 -1 modperl-2.0/xs/Apache/SubRequest/Apache__SubRequest.h Index: Apache__SubRequest.h =================================================================== RCS file: /home/cvs/modperl-2.0/xs/Apache/SubRequest/Apache__SubRequest.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- Apache__SubRequest.h 4 Mar 2004 06:01:13 -0000 1.4 +++ Apache__SubRequest.h 2 Jun 2004 21:35:58 -0000 1.5 @@ -22,7 +22,8 @@ if (r->main) { modperl_config_req_t *rcfg = modperl_config_req_get(r->main); - MP_FAILURE_CROAK(modperl_wbucket_flush(rcfg->wbucket, FALSE)); + MP_RUN_CROAK(modperl_wbucket_flush(rcfg->wbucket, FALSE), + "Apache::SubRequest::run"); } return ap_run_sub_req(r);