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

FILE* to file descriptor problem on OS-X

From:
Paul Marquess
Date:
February 26, 2003 01:55
Subject:
FILE* to file descriptor problem on OS-X
Message ID:
AIEAJICLCBDNAAOLLOKLIEMOGPAA.Paul.Marquess@btinternet.com
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
case.

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 ;
        xs_gzopen(fileno($fh));
    }

and then in XS-land

    xs_gzopen(int fd)
        CODE:
         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?

cheers
Paul

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About