summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-05-02 17:10:19 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-05-02 17:10:19 +0000
commit0e0556fc348ff5f8beae704376481cf3219b0abd (patch)
tree3bbd76297d7dd9c75eb32166b89500a63a79d37d /pp_sys.c
parent4edc9001f2ec62106f8580f228ec1bc0aadfc27b (diff)
downloadperl-0e0556fc348ff5f8beae704376481cf3219b0abd.tar.gz
For perls where pids and ppids are cached, when the ppid of
the perl process becomes 1, refresh the ppid cache (this may indicate that the parent process has died.) p4raw-id: //depot/perl@24367
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/pp_sys.c b/pp_sys.c
index c127b64fdb..ec094a001c 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -4377,6 +4377,12 @@ PP(pp_getppid)
#ifdef HAS_GETPPID
dSP; dTARGET;
# ifdef THREADS_HAVE_PIDS
+ {
+ IV cur_ppid = getppid();
+ if (cur_ppid == 1)
+ /* maybe the parent process has died. Refresh ppid cache */
+ PL_ppid = cur_ppid;
+ }
XPUSHi( PL_ppid );
# else
XPUSHi( getppid() );