Philip M. Gollucci wrote:
> Philippe M. Chiasson wrote:
> 
>> Still unable to reproduce this on my end.
> 
> This help any ?

Nope, but I've nailed the source of the problem.

Turns out that on some BSDs (like FreeBSD) changes to argv[0]
do not affect the output of ps and such. Each process instead
has a slot somewhere for what's being displayed in ps output,
and there is an API to alter it (setproctitle()).

So, Perl's $0 magic handling (in mg.c) does detect this correctly
and calls setproctitle() when necessary.

We need to do the same, otherwise saving/copying ap_server_argv0
doesn't help.

I've got a simple patch that fixed the problem I'd like you to test.

That's probably not quite the right place to stick setproctitle(),
so this patch needs cleaning up some, but should at least work for
now.

Index: src/modules/perl/modperl_config.c
===================================================================
--- src/modules/perl/modperl_config.c   (revision 280622)
+++ src/modules/perl/modperl_config.c   (working copy)
@@ -183,6 +183,15 @@
      * as a copying side-effect, changing $0 now doesn't affect the
      * way the process is seen from the outside.
      */
+
+#ifdef HAS_SETPROCTITLE
+#   if __FreeBSD_version > 410001
+            setproctitle("-%s", ap_server_argv0);
+#   else
+            setproctitle("%s", ap_server_argv0);
+#   endif
+#endif
+
     modperl_config_srv_argv_push(apr_pstrmemdup(p, ap_server_argv0,
                                                 strlen(ap_server_argv0)));

--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to