develooper Front page | perl.perl5.porters | Postings from October 2012

Making PerlIOStdio_invalidate_fileno() less invasive on FreeBSD..

John Baldwin
October 11, 2012 00:45
Making PerlIOStdio_invalidate_fileno() less invasive on FreeBSD..
Message ID:
I am working on the stdio bits in FreeBSD's libc, and specifically on 
expanding the internal file descriptor field from a short to an int.  To limit 
the need for future compatiblity shims, I am attempting to make the _file 
member private to the implementation.  PerlIOStdio_invalidate_fileno() breaks 
that for me though since it reaches inside stdio and accesses an internal 
member (_file) directly.

I would like to insulate Perl from the internals of FILE going forward and 
wanted your input on how best to do that.  One option would be to change the 
FreeBSD code to just fail the invalidate function with 0 (as Solaris does) and 
rely on the calling code to dup() the file descriptor.  Another option might 
be for FreeBSD to add a new 'finvalidate()' or 'fclaimfd()' or some other 
function that basically sets _file to -1, but lives in libc itself rather than 
in Perl binaries.  I'm sure there are other options as well.  Do you folks 
have a preference?

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