#29479 [Com]: changing current process name

From: Date: Tue, 22 Aug 2006 21:22:52 +0000
Subject: #29479 [Com]: changing current process name
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-101143@lists.php.net to get a copy of this message
 ID:               29479
 Comment by:       jdoak at google dot com
 Reported By:      black at scene-si dot org
 Status:           Suspended
 Bug Type:         Feature/Change Request
 Operating System: linux
 PHP Version:      6CVS
 New Comment:

Is there currently a way to do this in php 5?  It doesn't appear that
the pecl module listed below is actually around any longer:
http://cvs.sourceforge.net/viewcvs.py/wikipedia/extensions/pecl-proctitl
e/

and a search for it turned up nothing.  I'm just curious if this has
been implemented or is this possible now on linux systems?


Previous Comments:
------------------------------------------------------------------------

[2006-05-15 16:56:36] jerj at coplanar dot net

It appears someone has implemented this:

http://cvs.sourceforge.net/viewcvs.py/wikipedia/extensions/pecl-proctitle/

I'm going to try and compile it now.

------------------------------------------------------------------------

[2006-02-18 10:39:35] dan812 at hotmail dot com

This would be a very nice feature. Using perl you can change $0
variable. PHP do lack this functionality.

---From perlvar doc-----
$0 Contains the name of the program being executed.

On some (read: not all) operating systems assigning to $0 modifies the
argument area that the "ps" program sees.  On some platforms you may
have to use special "ps" options or a different "ps" to see the
changes.

Modifying the $0 is more useful as a way of indicating the current
program state than it is for hiding the program you're running. 
(Mnemonic: same as sh and ksh.)

Note that there are platform specific limitations on the the maximum
length of $0.  In the most extreme case it may be limited to the space
occupied by the original $0.

In some platforms there may be arbitrary amount of padding, for example
space characters, after the modified name as shown by "ps".  In some
platforms this padding may extend all the way to the original length of
the argument area, no matter what you do (this is the case for example
with Linux 2.2).

Note for BSD users: setting $0 does not completely remove "perl" from
the ps(1) output.  For example, setting $0 to "foobar" may result in
"perl: foobar (perl)" (whether both the "perl: " prefix and the "
(perl)" suffix are shown depends on your exact BSD variant and
version).  This is an operating system feature, Perl cannot help it.

In multithreaded scripts Perl coordinates the threads so that any
thread may modify its copy of the $0 and the change becomes visible to
ps(1) (assuming the operating system plays along).  Note that the the
view of $0 the other threads have will not change since they have their
own copies of it.
---------------------------

Regards.
Daniel
<a href="http://www.xcomprar.com/">venda</a>

------------------------------------------------------------------------

[2005-10-06 15:44:30] tony2001@php.net

Feel free to provide one.

------------------------------------------------------------------------

[2005-10-06 15:41:16] unclemonty at gmail dot com

Did the situation ever change with this? How about a work-around?

------------------------------------------------------------------------

[2004-08-01 13:25:48] wez@php.net

setproctitle() is only implemented on BSD; other systems that emulate
this use a non-portable dangerous hack that makes certain assumptions
about how the process will be run.

Suspending until this situation changes.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/29479

-- 
Edit this bug report at http://bugs.php.net/?id=29479&edit=1


Thread (12 messages)

« previous php.bugs (#101143) next »