summaryrefslogtreecommitdiff
path: root/embed.h
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2001-07-20 18:38:48 +0000
committerGurusamy Sarathy <gsar@cpan.org>2001-07-20 18:38:48 +0000
commit52e18b1f277416a33dff2c066a83fdab0520a2d7 (patch)
tree0d35a4f042171ce3c05667667ca19d69d060a292 /embed.h
parent9046a8ae3aad1f7eda5affd38301ac2313201634 (diff)
downloadperl-52e18b1f277416a33dff2c066a83fdab0520a2d7.tar.gz
Make perl fork()-safe (in a slightly limited way) even on
platforms that don't have pthread_atfork() (extension of the fix in change#11151). Note that this will not help extensions that call fork() directly in C, or that link to libraries that call fork() directly. Such cases must be fixed to either call PerlProc_fork(), or call atfork_lock() in parent before the calling the function that forks and call atfork_unlock() in both parent and child immediately after the fork(). (There are no worries if C code calls exec() in the child immediately after a fork(). Only cases where the child calls perl's API functions (including New()) after the fork() are problematic.) This change also eliminates the use of vfork() from perl, since all such uses were violating the severe restrictions on modifying the state of the process between the vfork() and the exec(). This is a modified version of patches suggested by Abhijit Menon-Sen and Richard Soderberg. p4raw-link: @11151 on //depot/perl: 50dd6e574ff39b609595ddb16b2fe9f625a26f8c p4raw-id: //depot/perl@11423
Diffstat (limited to 'embed.h')
-rw-r--r--embed.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/embed.h b/embed.h
index f6176db259..9093f9bd0f 100644
--- a/embed.h
+++ b/embed.h
@@ -430,6 +430,9 @@
#define my_exit Perl_my_exit
#define my_failure_exit Perl_my_failure_exit
#define my_fflush_all Perl_my_fflush_all
+#define my_fork Perl_my_fork
+#define atfork_lock Perl_atfork_lock
+#define atfork_unlock Perl_atfork_unlock
#define my_lstat Perl_my_lstat
#if !defined(HAS_MEMCMP) || !defined(HAS_SANE_MEMCMP)
#define my_memcmp Perl_my_memcmp
@@ -1941,6 +1944,9 @@
#define my_exit(a) Perl_my_exit(aTHX_ a)
#define my_failure_exit() Perl_my_failure_exit(aTHX)
#define my_fflush_all() Perl_my_fflush_all(aTHX)
+#define my_fork Perl_my_fork
+#define atfork_lock Perl_atfork_lock
+#define atfork_unlock Perl_atfork_unlock
#define my_lstat() Perl_my_lstat(aTHX)
#if !defined(HAS_MEMCMP) || !defined(HAS_SANE_MEMCMP)
#define my_memcmp Perl_my_memcmp
@@ -3806,6 +3812,12 @@
#define my_failure_exit Perl_my_failure_exit
#define Perl_my_fflush_all CPerlObj::Perl_my_fflush_all
#define my_fflush_all Perl_my_fflush_all
+#define Perl_my_fork CPerlObj::Perl_my_fork
+#define my_fork Perl_my_fork
+#define Perl_atfork_lock CPerlObj::Perl_atfork_lock
+#define atfork_lock Perl_atfork_lock
+#define Perl_atfork_unlock CPerlObj::Perl_atfork_unlock
+#define atfork_unlock Perl_atfork_unlock
#define Perl_my_lstat CPerlObj::Perl_my_lstat
#define my_lstat Perl_my_lstat
#if !defined(HAS_MEMCMP) || !defined(HAS_SANE_MEMCMP)