I am using HP-UX. There is no setproctitle on it as far as I know. Is there any other way of doing this on HP-UX.. Also I found a similar query which was reported some time back which was changing the command name dated Wed, 11 Feb 2004. This has been rectified though. But in my case the entire command name is being changed instead of just httpd.
Earlier reported case:
#ps -eaf | grep httpd
I normally get something like: root 3634 1 0 20:31 ? 00:00:00 /app/apache/bin/httpd -k start nobody 3635 3634 0 20:31 ? 00:00:00 /app/apache/bin/httpd -k start nobody 3636 3634 0 20:31 ? 00:00:00 /app/apache/bin/httpd -k start nobody 3637 3634 0 20:31 ? 00:00:00 /app/apache/bin/httpd -k start nobody 3638 3634 0 20:31 ? 00:00:00 /app/apache/bin/httpd -k start nobody 3639 3634 0 20:31 ? 00:00:00 /app/apache/bin/httpd -k start
putting a single line between <Perl > and </Perl> (even if the line is empty)
root 3738 1 2 20:34 ? 00:00:00 /app/apache/bin/-e -k start
nobody 3739 3738 0 20:34 ? 00:00:00 /app/apache/bin/-e -k start
nobody 3740 3738 0 20:34 ? 00:00:00 /app/apache/bin/-e -k start
nobody 3741 3738 0 20:34 ? 00:00:00 /app/apache/bin/-e -k start
nobody 3742 3738 0 20:34 ? 00:00:00 /app/apache/bin/-e -k start
nobody 3743 3738 0 20:34 ? 00:00:00 /app/apache/bin/-e -k start
nobody 3739 3738 0 20:34 ? 00:00:00 /app/apache/bin/-e -k start
nobody 3740 3738 0 20:34 ? 00:00:00 /app/apache/bin/-e -k start
nobody 3741 3738 0 20:34 ? 00:00:00 /app/apache/bin/-e -k start
nobody 3742 3738 0 20:34 ? 00:00:00 /app/apache/bin/-e -k start
nobody 3743 3738 0 20:34 ? 00:00:00 /app/apache/bin/-e -k start
In my case the output is something like this.
root 3738 1 2 20:34 ? 00:00:00 -e
nobody 3739 3738 0 20:34 ? 00:00:00 -e
nobody 3740 3738 0 20:34 ? 00:00:00 -e
nobody 3741 3738 0 20:34 ? 00:00:00 -e
nobody 3742 3738 0 20:34 ? 00:00:00 -e
nobody 3743 3738 0 20:34 ? 00:00:00 -e
nobody 3740 3738 0 20:34 ? 00:00:00 -e
nobody 3741 3738 0 20:34 ? 00:00:00 -e
nobody 3742 3738 0 20:34 ? 00:00:00 -e
nobody 3743 3738 0 20:34 ? 00:00:00 -e
The fix for the first reported problem was given in the modperl_config.c
modperl_config_srv_argv_push(apr_pstrmemdup(p, ap_server_argv0,
strlen(ap_server_argv0)));
Any idea why this is not working now.
On 9/14/05, Philippe M. Chiasson <[EMAIL PROTECTED]> wrote:
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