stas 2003/10/18 14:01:31
Modified: src/modules/perl mod_perl.c modperl_perl.c modperl_perl.h
. Changes
Log:
perl 5.8.1 w/ ithreads has a bug where it reports the wrong parent pid
(as if the process was never forked), provide a local workaround (+ new
test).
- revert my previous fix
- replace with Rafael's fix, which does it in the right place
Revision Changes Path
1.192 +0 -9 modperl-2.0/src/modules/perl/mod_perl.c
Index: mod_perl.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -u -r1.191 -r1.192
--- mod_perl.c 17 Oct 2003 17:17:06 -0000 1.191
+++ mod_perl.c 18 Oct 2003 21:01:30 -0000 1.192
@@ -695,15 +695,6 @@
{
modperl_perl_init_ids_server(s);
-#if PERL_REVISION == 5 && PERL_VERSION == 8 && PERL_SUBVERSION == 1 && \
- defined(THREADS_HAVE_PIDS)
- {
- MP_dSCFG(s);
- dTHXa(scfg->mip->parent->perl);
- PL_ppid = (IV)getppid();
- }
-#endif
-
apr_pool_cleanup_register(p, (void *)s, modperl_child_exit,
apr_pool_cleanup_null);
}
1.19 +15 -1 modperl-2.0/src/modules/perl/modperl_perl.c
Index: modperl_perl.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_perl.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -u -r1.18 -r1.19
--- modperl_perl.c 28 Aug 2002 03:16:20 -0000 1.18
+++ modperl_perl.c 18 Oct 2003 21:01:30 -0000 1.19
@@ -33,6 +33,9 @@
static void modperl_perl_ids_get(modperl_perl_ids_t *ids)
{
ids->pid = (I32)getpid();
+#ifdef MP_MAINTAIN_PPID
+ ids->ppid = (I32)getppid();
+#endif
#ifndef WIN32
ids->uid = getuid();
ids->euid = geteuid();
@@ -40,10 +43,18 @@
ids->gid = getegid();
MP_TRACE_g(MP_FUNC,
+ "pid=%d, "
+#ifdef MP_MAINTAIN_PPID
+ "ppid=%d, "
+#endif
"uid=%d, euid=%d, gid=%d, egid=%d\n",
+ (int)ids->pid,
+#ifdef MP_MAINTAIN_PPID
+ (int)ids->ppid,
+#endif
(int)ids->uid, (int)ids->euid,
(int)ids->gid, (int)ids->egid);
-#endif
+#endif /* #ifndef WIN32 */
}
static void modperl_perl_init_ids(pTHX_ modperl_perl_ids_t *ids)
@@ -55,6 +66,9 @@
PL_euid = ids->euid;
PL_gid = ids->gid;
PL_egid = ids->egid;
+#endif
+#ifdef MP_MAINTAIN_PPID
+ PL_ppid = ids->ppid;
#endif
}
1.11 +9 -0 modperl-2.0/src/modules/perl/modperl_perl.h
Index: modperl_perl.h
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_perl.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -u -r1.10 -r1.11
--- modperl_perl.h 28 Aug 2002 03:16:20 -0000 1.10
+++ modperl_perl.h 18 Oct 2003 21:01:30 -0000 1.11
@@ -1,10 +1,19 @@
#ifndef MODPERL_PERL_H
#define MODPERL_PERL_H
+#if PERL_REVISION == 5 && \
+ (PERL_VERSION == 8 && PERL_SUBVERSION >= 1 || PERL_VERSION >= 9) && \
+ THREADS_HAVE_PIDS
+#define MP_MAINTAIN_PPID
+#endif
+
typedef struct {
I32 pid;
Uid_t uid, euid;
Gid_t gid, egid;
+#ifdef MP_MAINTAIN_PPID
+ Uid_t ppid;
+#endif
} modperl_perl_ids_t;
void modperl_perl_core_global_init(pTHX);
1.240 +2 -2 modperl-2.0/Changes
Index: Changes
===================================================================
RCS file: /home/cvs/modperl-2.0/Changes,v
retrieving revision 1.239
retrieving revision 1.240
diff -u -u -r1.239 -r1.240
--- Changes 18 Oct 2003 20:58:27 -0000 1.239
+++ Changes 18 Oct 2003 21:01:30 -0000 1.240
@@ -13,8 +13,8 @@
=item 1.99_11-dev -
perl 5.8.1 w/ ithreads has a bug where it reports the wrong parent pid
-(as the process was never forked), provide a local workaround (+ new
-test). [Stas]
+(as if the process was never forked), provide a local workaround (+ new
+test). [Rafael Garcia-Suarez <[EMAIL PROTECTED]>]
overriden STD* streams now can be further overriden and will be
properly restored, which allows functions like $r->internal_redirect