Skip to content

Commit

Permalink
Integrate:
Browse files Browse the repository at this point in the history
[ 29467]
Introduction of d_pseudofork

[ 29473]
d_pseudofork for configure.com

[ 29485]
Make use of $Config{d_pseudofork} in a couple of core tests

Can't really use it in ext/IO/t/*.t and lib/Test/Simple/t/fork.t
because they are dual-lived modules and must work with older perls
that don't have d_pseudofork
p4raw-link: @29485 on //depot/perl: 2b09c5a
p4raw-link: @29473 on //depot/perl: 734e0e8
p4raw-link: @29467 on //depot/perl: 233e16c

p4raw-id: //depot/maint-5.8/perl@30339
p4raw-integrated: from //depot/perl@30338 'edit in' handy.h (@29238..)
	'merge in' Porting/config.sh (@29289..) uconfig.sh (@29291..)
p4raw-integrated: from //depot/perl@29485 'merge in'
	ext/Socket/t/socketpair.t (@20269..) t/op/fork.t (@28215..)
p4raw-integrated: from //depot/perl@29473 'merge in' configure.com
	(@29380..)
p4raw-integrated: from //depot/perl@29467 'edit in' Configure
	(@29462..) 'merge in' Porting/Glossary (@29338..) config_h.SH
	(@29407..)
  • Loading branch information
nwc10 committed Feb 17, 2007
1 parent 16c06de commit f8c48e7
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 59 deletions.
98 changes: 51 additions & 47 deletions Configure
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
#
# Generated on Mon Nov 6 10:30:43 CET 2006 [metaconfig 3.0 PL70]
# Generated on Tue Dec 5 15:35:51 CET 2006 [metaconfig 3.0 PL70]
# (with additional metaconfig patches by perlbug@perl.org)

cat >c1$$ <<EOF
Expand Down Expand Up @@ -780,6 +780,7 @@ d_unsetenv=''
d_usleep=''
d_usleepproto=''
d_ustat=''
d_pseudofork=''
d_vfork=''
usevfork=''
d_voidsig=''
Expand Down Expand Up @@ -15440,6 +15441,54 @@ $rm -f reflect
set d_procselfexe
eval $setvar

: backward compatibility for d_hvfork
if test X$d_hvfork != X; then
d_vfork="$d_hvfork"
d_hvfork=''
fi
: see if there is a vfork
val=''
set vfork val
eval $inlibc

d_pseudofork=$undef

: Ok, but do we want to use it. vfork is reportedly unreliable in
: perl on Solaris 2.x, and probably elsewhere.
case "$val" in
$define)
echo " "
case "$usevfork" in
false) dflt='n';;
*) dflt='y';;
esac
cat <<'EOM'

Perl can only use a vfork() that doesn't suffer from strict
restrictions on calling functions or modifying global data in
the child. For example, glibc-2.1 contains such a vfork()
that is unsuitable. If your system provides a proper fork()
call, chances are that you do NOT want perl to use vfork().

EOM
rp="Do you still want to use vfork()?"
. ./myread
case "$ans" in
y|Y) ;;
*)
echo "Ok, we won't use vfork()."
val="$undef"
;;
esac
;;
esac
set d_vfork
eval $setvar
case "$d_vfork" in
$define) usevfork='true';;
*) usevfork='false';;
esac

: see whether the pthread_atfork exists
$cat >try.c <<EOP
#include <pthread.h>
Expand Down Expand Up @@ -17948,52 +17997,6 @@ eval $hasproto
set ustat d_ustat
eval $inlibc

: backward compatibility for d_hvfork
if test X$d_hvfork != X; then
d_vfork="$d_hvfork"
d_hvfork=''
fi
: see if there is a vfork
val=''
set vfork val
eval $inlibc

: Ok, but do we want to use it. vfork is reportedly unreliable in
: perl on Solaris 2.x, and probably elsewhere.
case "$val" in
$define)
echo " "
case "$usevfork" in
false) dflt='n';;
*) dflt='y';;
esac
cat <<'EOM'

Perl can only use a vfork() that doesn't suffer from strict
restrictions on calling functions or modifying global data in
the child. For example, glibc-2.1 contains such a vfork()
that is unsuitable. If your system provides a proper fork()
call, chances are that you do NOT want perl to use vfork().

EOM
rp="Do you still want to use vfork()?"
. ./myread
case "$ans" in
y|Y) ;;
*)
echo "Ok, we won't use vfork()."
val="$undef"
;;
esac
;;
esac
set d_vfork
eval $setvar
case "$d_vfork" in
$define) usevfork='true';;
*) usevfork='false';;
esac

: see if closedir exists
set closedir d_closedir
eval $inlibc
Expand Down Expand Up @@ -21622,6 +21625,7 @@ d_pipe='$d_pipe'
d_poll='$d_poll'
d_portable='$d_portable'
d_procselfexe='$d_procselfexe'
d_pseudofork='$d_pseudofork'
d_pthread_atfork='$d_pthread_atfork'
d_pthread_attr_setscope='$d_pthread_attr_setscope'
d_pthread_yield='$d_pthread_yield'
Expand Down
4 changes: 4 additions & 0 deletions Porting/Glossary
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,10 @@ d_procselfexe (d_procselfexe.U):
Defined if $procselfexe is symlink to the absolute
pathname of the executing program.

d_pseudofork (d_vfork.U):
This variable conditionally defines the HAS_PSEUDOFORK symbol,
which indicates that an emulation of the fork routine is available.

d_pthread_atfork (d_pthread_atfork.U):
This variable conditionally defines the HAS_PTHREAD_ATFORK symbol,
which indicates to the C program that the pthread_atfork()
Expand Down
1 change: 1 addition & 0 deletions Porting/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ d_pipe='define'
d_poll='define'
d_portable='define'
d_procselfexe='define'
d_pseudofork='undef'
d_pthread_atfork='undef'
d_pthread_attr_setscope='define'
d_pthread_yield='undef'
Expand Down
6 changes: 6 additions & 0 deletions config_h.SH
Original file line number Diff line number Diff line change
Expand Up @@ -3303,6 +3303,12 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
*/
#$d_vfork HAS_VFORK /**/
/* HAS_PSEUDOFORK:
* This symbol, if defined, indicates that an emulation of the
* fork routine is available.
*/
#$d_pseudofork HAS_PSEUDOFORK /**/
/* Signal_t:
* This symbol's value is either "void" or "int", corresponding to the
* appropriate return type of a signal handler. Thus, you can declare
Expand Down
1 change: 1 addition & 0 deletions configure.com
Original file line number Diff line number Diff line change
Expand Up @@ -5912,6 +5912,7 @@ $ WC "d_phostname='" + d_phostname + "'"
$ WC "d_pipe='define'"
$ WC "d_poll='" + d_poll + "'"
$ WC "d_procselfexe='undef'"
$ WC "d_pseudofork='undef'"
$ WC "d_pthread_atfork='undef'"
$ WC "d_pthread_attr_setscope='" + d_pthread_attr_setscope + "'"
$ WC "d_pthread_yield='" + d_pthread_yield + "'"
Expand Down
7 changes: 2 additions & 5 deletions ext/Socket/t/socketpair.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
require Config; import Config;
$can_fork = $Config{'d_fork'}
|| ($^O eq 'MSWin32' && $Config{useithreads}
&& $Config{ccflags} =~ /-DPERL_IMPLICIT_SYS\b/);

$can_fork = $Config{'d_fork'} || $Config{'d_pseudofork'};

if ($^O eq "hpux" or $Config{'extensions'} !~ /\bSocket\b/ &&
!(($^O eq 'VMS') && $Config{d_socket})) {
print "1..0\n";
exit 0;
}
}
}

{
Expand Down
2 changes: 1 addition & 1 deletion handy.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ typedef U64TYPE U64;
#endif

/* HMB H.Merijn Brand - a placeholder for preparing Configure patches */
#if defined(HAS_MALLOC_SIZE) && defined(LOCALTIME_R_NEEDS_TZSET)
#if defined(HAS_MALLOC_SIZE) && defined(LOCALTIME_R_NEEDS_TZSET) && defined(HAS_DIR_DD_FD) && defined(HAS_PSEUDOFORK)
/* Not (yet) used at top level, but mention them for metaconfig */
#endif

Expand Down
7 changes: 1 addition & 6 deletions t/op/fork.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
require Config; import Config;
unless ($Config{'d_fork'}
or (($^O eq 'MSWin32' || $^O eq 'NetWare') and $Config{useithreads}
and $Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/
# and !defined $Config{'useperlio'}
))
{
unless ($Config{'d_fork'} or $Config{'d_pseudofork'}) {
print "1..0 # Skip: no fork\n";
exit 0;
}
Expand Down
1 change: 1 addition & 0 deletions uconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ d_pipe='undef'
d_poll='undef'
d_portable='undef'
d_procselfexe='undef'
d_pseudofork='undef'
d_pthread_atfork='undef'
d_pthread_attr_setscope='undef'
d_pthread_yield='undef'
Expand Down

0 comments on commit f8c48e7

Please sign in to comment.