summaryrefslogtreecommitdiff
path: root/reentr.pl
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2005-05-10 07:44:13 -0500
committerAbhijit Menon-Sen <ams@wiw.org>2005-05-10 17:23:26 +0000
commit23e2b7a9cd174dbd4e526e1069d671e42c30d954 (patch)
tree3ab68d8e4a40a0a9c78abfd7a378bf29ca132255 /reentr.pl
parent66610fdd5da795f6de595e815ccc4d1c9f3f4505 (diff)
downloadperl-23e2b7a9cd174dbd4e526e1069d671e42c30d954.tar.gz
Re: [PATCH] reentr.h changes so threaded Perl's compile on OpenBSD 3.7
Message-Id: <20050510174413.GA19686@mccoy.peters.homeunix.org> p4raw-id: //depot/perl@24441
Diffstat (limited to 'reentr.pl')
-rw-r--r--reentr.pl22
1 files changed, 20 insertions, 2 deletions
diff --git a/reentr.pl b/reentr.pl
index 53a76e2d57..cd6998990c 100644
--- a/reentr.pl
+++ b/reentr.pl
@@ -41,7 +41,7 @@ print <<EOF;
/*
* 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 @@ print <<EOF;
# 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 @@ EOF
$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 @@ EOF
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;