Torsten Foertsch wrote:
On Friday 29 October 2004 22:13, Stas Bekman wrote:

Torsten Förtsch wrote:

On Friday 29 October 2004 20:17, Stas Bekman wrote:

perl allows to modify $0. Then top, ps & co would display the new
process title. Can the process title of a mod_perl modified apache be
set this way?

...

Take a look at this commit, which might be of some relevance:
http://marc.theaimsgroup.com/?l=apache-modperl-cvs&m=107672268012042&w=2

But I see, it is not supported.

Due to internal Apache corruptions, no.


I have just uploaded Sys::Proctitle that modifies the process title at C level. It works only on linux. I have tried it with 2.0.52+mp2-RC1.

To the internal Apache corruptions: my first attempt was simply to make a copy of __environ via malloc() and strdup(). With pure perl that worked but with apache/mod_perl it gave segfaults or double free messages from glibc depending on the require'ing or use'ing of the module. Some poking on putenv/getenv/setenv source code revealed big magic and led me to the following approach of copying the environment:

    clearenv();
    for( i=0; envp[i]; i++ ) {
      char *cp=strchr( envp[i], '=' );
      if( cp ) {
        *cp++='\0';
        setenv( envp[i], cp, 1 );
      }
    }

where is the copy? I don't see any data allocated.

clearenv() simply sets __environ=NULL. setenv() then builds a new environment.

I don't know anything about how mp2 and apache interact regarding the environment. But maybe it helps to let $0 be assigned to in mod_perl.

You don't want to know :)

As you can see from the email you've quoted the problem is really coming from Perl, not Apache.

--
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to