From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MUHAw-0004Zl-E5 for qemu-devel@nongnu.org; Fri, 24 Jul 2009 05:34:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MUHAr-0004Xk-Io for qemu-devel@nongnu.org; Fri, 24 Jul 2009 05:34:49 -0400 Received: from [199.232.76.173] (port=47535 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MUHAr-0004Xa-80 for qemu-devel@nongnu.org; Fri, 24 Jul 2009 05:34:45 -0400 Received: from mx2.redhat.com ([66.187.237.31]:43722) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MUHAq-0005js-Nk for qemu-devel@nongnu.org; Fri, 24 Jul 2009 05:34:45 -0400 Date: Fri, 24 Jul 2009 10:34:20 +0100 From: "Richard W.M. Jones" Subject: Re: [Qemu-devel] [PATCH] Allow setting qemu process name Message-ID: <20090724093420.GA13061@amd.home.annexia.org> References: <20090701093251.GA12447@basil.fritz.box> <20090723114715.GA826@fries.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090723114715.GA826@fries.net> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Todd T. Fries" Cc: Andi Kleen , qemu-devel@nongnu.org On Thu, Jul 23, 2009 at 06:47:16AM -0500, Todd T. Fries wrote: > | +#ifdef __linux__ > | + char name[16]; > | + if (!s) > | + return; > | + /* Could rewrite argv[0] too, but that's a bit more complicated. > | + This simple way is enough for `top'. */ > | + snprintf(name, sizeof name, "%s-%.10s", prefix, s); > | + prctl(PR_SET_NAME, name); > #elif defined(__OpenBSD__) > if (!s) > setproctitle("%s-%.10s", prefix, s); > | +#endif In case anyone is interested, setting process titles for all Un*x-like platforms is _really_ complex. This is how PostgreSQL does it: http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/misc/ps_status.c?rev=1.33.2.1;content-type=text%2Fplain Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v