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

FILE* to file descriptor problem on OS-X

Paul Marquess
February 26, 2003 01:55
FILE* to file descriptor problem on OS-X
Message ID:
I've had a failure of the Compress::Zlib test harness reported to me from
folk running OS-X version 10.2.3. The tests failing are the same in every

Here is a cut down thumbnail of the scenario that triggers the failure.

I have a Perl function that can take a file handle as parameter. This needs
to be passed to zlib, but the zlib API expects a file descriptor, so I pass
the fileno to the XSUB, thus:

    sub gzopen
        my $fh = shift ;

and then in XS-land

    xs_gzopen(int fd)
         gzdopen(fh) ;

Once in XSUB-land, any use of "fd" fails completely.

This feature has been working for years on all other platforms. Anyone know
if this is just a "feature" of OS-X, or is there a way to work around it?


Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About