stas 2003/10/14 17:42:34
Modified: src/modules/perl modperl_io_apache.c Log: implement PerlIOApache_getarg (Getarg PerlIO callback), which now allows PerlIOApache filehandles to be dupped Revision Changes Path 1.6 +18 -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.5 retrieving revision 1.6 diff -u -u -r1.5 -r1.6 --- modperl_io_apache.c 15 Oct 2003 00:40:56 -0000 1.5 +++ modperl_io_apache.c 15 Oct 2003 00:42:34 -0000 1.6 @@ -58,6 +58,23 @@ return code; } +static SV * +PerlIOApache_getarg(pTHX_ PerlIO *f, CLONE_PARAMS *param, int flags) +{ + PerlIOApache *st = PerlIOSelf(f, PerlIOApache); + SV *sv = newSV(0); + + if (!st->r) { + Perl_croak(aTHX_ "an attempt to getarg from a stale io handle"); + } + + sv_setref_pv(sv, "Apache::RequestRec", (void*)(st->r)); + + MP_TRACE_o(MP_FUNC, "retrieved request_rec obj: 0x%lx", st->r); + + return sv; +} + static IV PerlIOApache_fileno(pTHX_ PerlIO *f) { @@ -204,7 +221,7 @@ PerlIOApache_popped, PerlIOApache_open, PerlIOBase_binmode, - NULL, /* no getarg needed */ + PerlIOApache_getarg, PerlIOApache_fileno, PerlIOBase_dup, PerlIOApache_read,