develooper Front page | perl.perl5.porters | Postings from April 2003

revisting perlio callback tab requirements

Thread Next
Stas Bekman
April 29, 2003 02:36
revisting perlio callback tab requirements
Message ID:
For some reason, I thought that I could write a minimalistic layer 
implementation, adding only the minimal number of callbacks and keeping the 
rest NULLs. However perlio.c doesn't check whether the callback's entry is 
NULL or not. For example:

Perl_PerlIO_close(pTHX_ PerlIO *f)
     int code = -1;
     if (PerlIOValid(f)) {
	code = (*PerlIOBase(f)->tab->Close) (aTHX_ f);
	while (*f) {
	    PerlIO_pop(aTHX_ f);
     return code;

If my perlio tab has NULL for the Close callback, the program segfaults here:
	code = (*PerlIOBase(f)->tab->Close) (aTHX_ f);

I've "solved" this problem using the tab entry:

     PerlIOBase_noop_ok,         /* close */

But the problem with functions PerlIOBase_* is that they aren't exported in and so can't be used on AIX, winFU and several other platforms.

Should perliol.pod specify which tabs are required to have a callback, which 
can be filled with NULL and what options are available for noops (e.g. 
PerlIOBase_noop_ok and PerlIOBase_noop_fail, but they aren't exported!).

Please advise what's the right way to go about these.


Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker     mod_perl Guide --->

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About