http://qs1969.pair.com?node_id=287385


in reply to Re: Threaded perl 5.8.0 for Solaris
in thread Threaded perl 5.8.0 for Solaris

Well, here's the XS routine that's causing the memory fault. Like I said, routine works fine for non-threaded perl.
double __call( sv_class, sv_path, sv_input ) SV * sv_class SV * sv_path SV * sv_input CODE: char *class = SvPV( sv_class, PL_na ); char *path = SvPV( sv_path, PL_na ); double input = SvNV( sv_input ); int fd; door_arg_t arg; double output; fd = open(path, O_RDWR); arg.data_ptr = (char *) &input; arg.data_size = sizeof(double); arg.desc_ptr = NULL; arg.desc_num = 0; arg.rbuf = (char *) &output; arg.rsize = sizeof(double); if ( door_call(fd, &arg) == 0 ) { RETVAL = output; } else { printf("ERRNO: %d\n",errno); RETVAL = -1; } OUTPUT: RETVAL

Replies are listed 'Best First'.
Re: Re: Re: Threaded perl 5.8.0 for Solaris
by liz (Monsignor) on Aug 28, 2003 at 14:47 UTC
    Please know that I have no experience with Solaris, or threaded applications using XS to speak of. That said, it seems you are leaking file descriptors, as you are doing:
    fd = open(path, O_RDWR);
    and you're not closing the file while the "int fd" does go out of scope. This is XS, not Perl! The file will not be automatically closed when its "handle" is destroyed. This may or may not be related to what you're seeing, though.

    Liz

      Thanks for the reminder, Liz. I put close(fd); after door_call(), but the error insists (on threaded perl, that is).