top(1) process name

Anton Berezin tobez at tobez.org
Tue Sep 18 07:48:31 PDT 2007


On Tue, Sep 18, 2007 at 05:07:17PM +0500, rihad wrote:

> This is probably a FAQ. Is there any way to set the process name of a 
> running Perl program displayed in top(1)?
> 
> $0 = 'candy';
> 
> doesn't seem to affect it in any way (although it does change what ps 
> displays).

I do not believe it is possible in modern FreeBSDs.  The top(1) utility uses
kvm_getprocs(3), which guarantees that the ki_comm field will represent an
unaltered original command name, so no amount of tinkering with
setproctitle(3) or the contents of argv array will change that.

Accidentally, ps -c does the same.

If there is a way to do it, I will be happy to learn about it myself.

\Anton.
-- 
We're going for 'working' here. 'clean' is for people with skills...
-- Flemming Jacobsen


More information about the freebsd-perl mailing list