From owner-freebsd-perl@FreeBSD.ORG Tue Sep 18 13:25:16 2007 Return-Path: Delivered-To: freebsd-perl@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6152116A418 for ; Tue, 18 Sep 2007 13:25:16 +0000 (UTC) (envelope-from rihad@mail.ru) Received: from mx28.mail.ru (mx28.mail.ru [194.67.23.67]) by mx1.freebsd.org (Postfix) with ESMTP id 24A7813C478 for ; Tue, 18 Sep 2007 13:25:16 +0000 (UTC) (envelope-from rihad@mail.ru) Received: from mx3.mail.ru (mx3.mail.ru [194.67.23.149]) by mx28.mail.ru (mPOP.Fallback_MX) with ESMTP id 67FA170815F for ; Tue, 18 Sep 2007 16:07:44 +0400 (MSD) Received: from [217.25.21.185] (port=47671 helo=[217.25.21.185]) by mx3.mail.ru with esmtp id 1IXbrW-0009xo-00 for freebsd-perl@freebsd.org; Tue, 18 Sep 2007 16:07:30 +0400 Message-ID: <46EFBF75.2030009@mail.ru> Date: Tue, 18 Sep 2007 17:07:17 +0500 From: rihad User-Agent: Icedove 1.5.0.12 (X11/20070607) MIME-Version: 1.0 To: freebsd-perl@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: top(1) process name X-BeenThere: freebsd-perl@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: maintainer of a number of perl-related ports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Sep 2007 13:25:16 -0000 Hi all, 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). Thanks. From owner-freebsd-perl@FreeBSD.ORG Tue Sep 18 14:48:31 2007 Return-Path: Delivered-To: freebsd-perl@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9597216A477 for ; Tue, 18 Sep 2007 14:48:31 +0000 (UTC) (envelope-from tobez@tobez.org) Received: from heechee.tobez.org (heechee.tobez.org [194.255.56.42]) by mx1.freebsd.org (Postfix) with ESMTP id 5E34113C45E for ; Tue, 18 Sep 2007 14:48:31 +0000 (UTC) (envelope-from tobez@tobez.org) Received: by heechee.tobez.org (Postfix, from userid 1001) id 9FEC712543A; Tue, 18 Sep 2007 16:31:02 +0200 (CEST) Date: Tue, 18 Sep 2007 16:31:02 +0200 From: Anton Berezin To: rihad Message-ID: <20070918143102.GC55827@heechee.tobez.org> References: <46EFBF75.2030009@mail.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <46EFBF75.2030009@mail.ru> User-Agent: Mutt/1.4.2.3i X-Powered-By: FreeBSD http://www.freebsd.org/ Cc: freebsd-perl@freebsd.org Subject: Re: top(1) process name X-BeenThere: freebsd-perl@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: maintainer of a number of perl-related ports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Sep 2007 14:48:31 -0000 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 From owner-freebsd-perl@FreeBSD.ORG Wed Sep 19 07:27:46 2007 Return-Path: Delivered-To: freebsd-perl@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5239016A417 for ; Wed, 19 Sep 2007 07:27:46 +0000 (UTC) (envelope-from rihad@mail.ru) Received: from mx7.mail.ru (mx7.mail.ru [194.67.23.27]) by mx1.freebsd.org (Postfix) with ESMTP id EBCBC13C45E for ; Wed, 19 Sep 2007 07:27:45 +0000 (UTC) (envelope-from rihad@mail.ru) Received: from [217.25.21.185] (port=53446 helo=[217.25.21.185]) by mx7.mail.ru with esmtp id 1IXtyF-000JFj-00; Wed, 19 Sep 2007 11:27:43 +0400 Message-ID: <46F0CF4E.201@mail.ru> Date: Wed, 19 Sep 2007 12:27:10 +0500 From: rihad User-Agent: Icedove 1.5.0.12 (X11/20070607) MIME-Version: 1.0 To: Anton Berezin References: <46EFBF75.2030009@mail.ru> <20070918143102.GC55827@heechee.tobez.org> In-Reply-To: <20070918143102.GC55827@heechee.tobez.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-perl@freebsd.org Subject: Re: top(1) process name X-BeenThere: freebsd-perl@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: maintainer of a number of perl-related ports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Sep 2007 07:27:46 -0000 Anton Berezin wrote: > 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. > I hacked it by hardlinking the desired name to perl: # ln /root/candy /usr/local/bin/perl # cat /path/to/my/perl/script #!/root/candy ... Good enough for me.