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
--- /dev/null
+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 <steve@fisharerojo.org>
+
+Please report any errors, updates, or suggestions to F<perlbug@perl.org>.
+
/*
* 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.
# 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
$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
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;