You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by "Philip M. Gollucci" <pg...@p6m7g8.com> on 2005/05/10 20:08:35 UTC

[Fwd: Change 24441: Re: [PATCH] reentr.h changes so threaded Perl's compile on OpenBSD 3.7]


-------- Original Message --------
Subject: 	Change 24441: Re: [PATCH] reentr.h changes so threaded Perl's 
compile on OpenBSD 3.7
Date: 	Tue, 10 May 2005 10:59:47 -0700
From: 	Abhijit Menon-Sen <am...@wiw.org>
To: 	Anybody And Everybody <pe...@perl.org>



Change 24441 by ams@penne on 2005/05/10 17:23:26

	Subject: Re: [PATCH] reentr.h changes so threaded Perl's compile on OpenBSD 3.7
	From: Steve Peters <st...@fisharerojo.org>
	Date: Tue, 10 May 2005 12:44:13 -0500
	Message-Id: <20...@mccoy.peters.homeunix.org>

Affected files ...

... //depot/perl/MANIFEST#1248 edit
... //depot/perl/README.openbsd#1 add
... //depot/perl/reentr.pl#35 edit

Differences ...

==== //depot/perl/MANIFEST#1248 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST#1247~24426~	Mon May  9 04:11:35 2005
+++ perl/MANIFEST	Tue May 10 10:23:26 2005
@@ -2453,6 +2453,7 @@
 README.mint			Perl notes for MiNT
 README.mpeix			Perl notes for MPE/iX
 README.netware			Perl notes for NetWare
+README.openbsd			Perl notes for OpenBSD
 README.os2			Perl notes for OS/2
 README.os390			Perl notes for OS/390
 README.os400			Perl notes for OS/400

==== //depot/perl/README.openbsd#1 (text) ====
Index: perl/README.openbsd
--- /dev/null	Tue May  5 13:32:27 1998
+++ perl/README.openbsd	Tue May 10 10:23:26 2005
@@ -0,0 +1,30 @@
+If you read this file _as_is_, just ignore the funny characters you
+see.  It is written in the POD format (see pod/perlpod.pod) which is
+specifically designed to be readable as is.
+
+=head1 NAME
+
+README.openbsd - Perl version 5 on OpenBSD systems
+
+=head1 DESCRIPTION
+
+This document describes various features of OpenBSD that will affect how Perl
+version 5 (hereafter just Perl) is compiled and/or runs.
+
+=head2 OpenBSD core dumps from getprotobyname_r and getservbyname_r with ithreads
+
+When Perl is configured to use ithreads, it will use re-entrant library calls
+in preference to non-re-entrant versions.  There is an incompatability in
+OpenBSD's C<getprotobyname_r> and C<getservbyname_r> function in versions 3.7
+and later that will cause a SEGV when called without doing a C<bzero> on
+their return structs prior to calling these functions.  Current Perl's
+should handle this problem correctly.  Older threaded Perls (5.8.6 or earlier)
+will run into this problem.  If you want to run a threaded Perl on OpenBSD
+3.7 or higher, you will need to upgrade to at least Perl 5.8.7.
+
+=head1 AUTHOR
+
+Steve Peters <st...@fisharerojo.org>
+
+Please report any errors, updates, or suggestions to F<pe...@perl.org>.
+

==== //depot/perl/reentr.pl#35 (text) ====
Index: perl/reentr.pl
--- perl/reentr.pl#34~24271~	Thu Apr 21 08:38:30 2005
+++ perl/reentr.pl	Tue May 10 10:23:26 2005
@@ -41,7 +41,7 @@
 /*
  *    reentr.h
  *
- *    Copyright (C) 2002, 2003, by Larry Wall and others
+ *    Copyright (C) 2002, 2003, 2005 by Larry Wall and others
  *
  *    You may distribute under the terms of either the GNU General Public
  *    License or the Artistic License, as specified in the README file.
@@ -80,6 +80,17 @@
 #   define NETDB_R_OBSOLETE
 #endif
 
+/*
+ * As of OpenBSD 3.7, reentrant functions are now working, they just are
+ * incompatible with everyone else.  To make OpenBSD happy, we have to
+ * memzero out certain structures before calling the functions.
+ */
+#if defined(__OpenBSD__)
+#    define REENTR_MEMZERO(a,b) memzero(a,b),
+#else
+#    define REENTR_MEMZERO(a,b)
+#endif 
+
 #ifdef NETDB_R_OBSOLETE
 #   undef HAS_ENDHOSTENT_R
 #   undef HAS_ENDNETENT_R
@@ -679,6 +690,13 @@
 		$w = ", $w" if length $v;
 	    }
 	    my $call = "${func}_r($v$w)";
+
+            # Must make OpenBSD happy
+            my $memzero = '';
+            if($p =~ /D$/ &&
+                ($genfunc eq 'protoent' || $genfunc eq 'servent')) {
+                $memzero = 'REENTR_MEMZERO(&PL_reentrant_buffer->_' . $genfunc . '_data, sizeof(PL_reentrant_buffer->_' . $genfunc . '_data))';
+            }
 	    push @wrap, <<EOF;
 #   if !defined($func) && ${FUNC}_R_PROTO == REENTRANT_PROTO_$p
 EOF
@@ -691,7 +709,7 @@
 		    my $rv = $v ? ", $v" : "";
 		    if ($r eq 'I') {
 			push @wrap, <<EOF;
-#       define $func($v) ((PL_reentrant_retint = $call)$test ? $true : (((PL_reentrant_retint == ERANGE) || (errno == ERANGE)) ? ($seent{$func} *) Perl_reentrant_retry("$func"$rv) : 0))
+#       define $func($v) ($memzero(PL_reentrant_retint = $call)$test ? $true : (((PL_reentrant_retint == ERANGE) || (errno == ERANGE)) ? ($seent{$func} *) Perl_reentrant_retry("$func"$rv) : 0))
 EOF
 		    } else {
 			push @wrap, <<EOF;
End of Patch.


-- 
END
-----------------------------------------------------------------------------
Philip M. Gollucci
Senior Developer - Liquidity Services Inc.
Phone:  202.558.6268 (Direct)
E-Mail: pgollucci@liquidation.com
Web:    http://www.liquidation.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [Fwd: Change 24441: Re: [PATCH] reentr.h changes so threaded Perl's compile on OpenBSD 3.7]

Posted by Stas Bekman <st...@stason.org>.
Philip M. Gollucci wrote:
> 
> 
> -------- Original Message --------
> Subject:     Change 24441: Re: [PATCH] reentr.h changes so threaded 
> Perl's compile on OpenBSD 3.7
> Date:     Tue, 10 May 2005 10:59:47 -0700
> From:     Abhijit Menon-Sen <am...@wiw.org>
> To:     Anybody And Everybody <pe...@perl.org>
> 
> 
> 
> Change 24441 by ams@penne on 2005/05/10 17:23:26
> 
>     Subject: Re: [PATCH] reentr.h changes so threaded Perl's compile on 
> OpenBSD 3.7

Philip, it'd have been more useful if you'd added a comment explaining the 
relevance of this forward to the modperl dev list :)

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [Fwd: Change 24441: Re: [PATCH] reentr.h changes so threaded Perl's compile on OpenBSD 3.7]

Posted by Stas Bekman <st...@stason.org>.
Philip M. Gollucci wrote:
> Yeah, it would have :)  I was in a rush.  Appologies.
> 
> Basically the important part is:
> 
>> OpenBSD core dumps from getprotobyname_r and getservbyname_r with 
>> >ithreads When Perl is configured to use ithreads, it will use 
>> >re-entrant library calls in preference to non-re-entrant versions.  
>> >There is an incompatability in OpenBSD's getprotobyname_r and 
>> >getservbyname_r function in versions 3.7 and later that will cause a 
>> >SEGV when called without doing a bzero on their return structs prior 
>> to >calling these functions.  Current Perl's should handle this 
>> problem >correctly.  Older threaded Perls (5.8.6 or earlier) will run 
>> into this >problem.  If you want to run a threaded Perl on OpenBSD 3.7 
>> or higher, >you will need to upgrade to at least Perl 5.8.7.
> 
> 
> The impact of this is not that we have working ihreaded mp2 on OpenBSD, 
> but if we did, it will require perl v 5.8.7 as a minimum.

May be it does work. All we know is that OpenBSD 2.9 doesn't work.

> Hope this is clearer.

Yup, thanks Philip

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [Fwd: Change 24441: Re: [PATCH] reentr.h changes so threaded Perl's compile on OpenBSD 3.7]

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Yeah, it would have :)  I was in a rush.  Appologies.

Basically the important part is:

>OpenBSD core dumps from getprotobyname_r and getservbyname_r with >ithreads When Perl is configured to use ithreads, it will use >re-entrant library calls in preference to non-re-entrant versions.  >There is an incompatability in OpenBSD's getprotobyname_r and >getservbyname_r function in versions 3.7 and later that will cause a >SEGV when called without doing a bzero on their return structs prior to >calling these functions.  Current Perl's should handle this problem >correctly.  Older threaded Perls (5.8.6 or earlier) will run into this >problem.  If you want to run a threaded Perl on OpenBSD 3.7 or higher, >you will need to upgrade to at least Perl 5.8.7.

The impact of this is not that we have working ihreaded mp2 on OpenBSD, but if we did, it will require perl v 5.8.7 as a minimum.


Hope this is clearer.

END
-----------------------------------------------------------------------------
Philip M. Gollucci
Senior Developer - Liquidity Services Inc.
Phone:  202.558.6268 (Direct)
E-Mail: pgollucci@liquidation.com
Web:    http://www.liquidation.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org