From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1FzjLJ-0005ao-3l for garchives@archives.gentoo.org; Mon, 10 Jul 2006 00:09:41 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.7/8.13.6) with SMTP id k6A07mxg009330; Mon, 10 Jul 2006 00:07:49 GMT Received: from mail.netspace.net.au (thunder.netspace.net.au [203.10.110.71]) by robin.gentoo.org (8.13.7/8.13.6) with ESMTP id k6A00qC9018935 for ; Mon, 10 Jul 2006 00:00:53 GMT Received: from orpheus (unknown [150.101.6.82]) by mail.netspace.net.au (Postfix) with ESMTP id 55B0D4BCD7 for ; Mon, 10 Jul 2006 10:00:49 +1000 (EST) Subject: Re: [gentoo-user] OT: get process name in c++ From: Iain Buchanan To: gentoo-user@lists.gentoo.org In-Reply-To: <7573e9640607071454l7309902enff8c38b775caca7d@mail.gmail.com> References: <1151499883.17966.13.camel@orpheus> <1152248749.31828.7.camel@orpheus> <7573e9640607071014v5bd571a0nd265fc30f58685a6@mail.gmail.com> <200607072153.35550.uwix@iway.na> <7573e9640607071454l7309902enff8c38b775caca7d@mail.gmail.com> Content-Type: text/plain Date: Mon, 10 Jul 2006 09:30:08 +0930 Message-Id: <1152489608.23269.7.camel@orpheus> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 X-Mailer: Evolution 2.6.2 Content-Transfer-Encoding: 7bit X-Archives-Salt: 8473abf0-ef5b-4e7b-a16a-4925f3ffea58 X-Archives-Hash: dc54c379ad6d60a5c9fc4b11211b1dcf On Fri, 2006-07-07 at 14:54 -0700, Richard Fish wrote: > On 7/7/06, Uwe Thiem wrote: > > How about: > > > > getenv( "_" ); > > Well, that is set by bash before it exec's anything, so that should > work, provided the program[s] are always exec'd by bash and not by > something else. It would be nicer if "_" was set by the kernel, or > even glibc. well, they are forked by start-stop-daemon in an init script at the moment, which is in turn run by /sbin/runscript, which is run by bash... as to why: Firstly there are various log message functions defined that print the name of the program calling the log function, the log message (and then do some other stuff depending on what type of message - critical, info, etc). Secondly, and more importantly, no task should have multiple copies of itself running, or "bad things" will happen (there's quite a bit of shared memory which would get corrupted). And some tasks require that a whole list of other tasks are not running. QNX used to have some functions to register a name with the system to stop this (qnx_name_locate, etc), but linux doesn't... that I can see... cya, -- Iain Buchanan Having the fewest wants, I am nearest to the gods. -- Socrates -- gentoo-user@gentoo.org mailing list