Re: [gentoo-user] OT: get process name in c++

2006-07-09 Thread Iain Buchanan
On Fri, 2006-07-07 at 14:54 -0700, Richard Fish wrote: On 7/7/06, Uwe Thiem [EMAIL PROTECTED] 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

Re: [gentoo-user] OT: get process name in c++

2006-07-07 Thread Richard Fish
On 7/6/06, Iain Buchanan [EMAIL PROTECTED] wrote: but I don't have just one main.c, I have 20+ different apps, each with their own main.c, which I don't maintain, for which I'd have to issue Ah, ok, sorry, I missed that part. So, can I ask /why/ you need the process name in this class?

Re: [gentoo-user] OT: get process name in c++

2006-07-07 Thread Uwe Thiem
On 07 July 2006 18:14, Richard Fish wrote: On 7/6/06, Iain Buchanan [EMAIL PROTECTED] wrote: but I don't have just one main.c, I have 20+ different apps, each with their own main.c, which I don't maintain, for which I'd have to issue Ah, ok, sorry, I missed that part. So, can I ask /why/

Re: [gentoo-user] OT: get process name in c++

2006-07-07 Thread Richard Fish
On 7/7/06, Uwe Thiem [EMAIL PROTECTED] 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. -Richard

Re: [gentoo-user] OT: get process name in c++

2006-07-07 Thread Richard Fish
On 7/6/06, Iain Buchanan [EMAIL PROTECTED] wrote: Someone mentioned that /proc is deprecated for 2.6? is this correct? Is there a /sys alternative to /proc/self/status? Oh, I don't think /proc itself is deprecated. After all, ps, pstree, top and so on still use it. And it is not mentioned

Re: [gentoo-user] OT: get process name in c++

2006-07-06 Thread Iain Buchanan
On Thu, 2006-06-29 at 10:17 +0930, Iain Buchanan wrote: On Wed, 2006-06-28 at 16:01 +0200, Petr Uzel wrote: file /proc/self/status is a link pointing to the directory /proc/pid_of_process. And by parsing status file in this directory you should get all the informations you want.

Re: [gentoo-user] OT: get process name in c++

2006-07-06 Thread Richard Fish
On 7/6/06, Iain Buchanan [EMAIL PROTECTED] wrote: Someone mentioned that /proc is deprecated for 2.6? is this correct? Is there a /sys alternative to /proc/self/status? Again, I *highly* suggest doing the standard, cross-platform, and most-efficient thing, which is to just store off the

Re: [gentoo-user] OT: get process name in c++

2006-07-06 Thread Iain Buchanan
On Thu, 2006-07-06 at 19:55 -0700, Richard Fish wrote: On 7/6/06, Iain Buchanan [EMAIL PROTECTED] wrote: Someone mentioned that /proc is deprecated for 2.6? is this correct? Is there a /sys alternative to /proc/self/status? Again, I *highly* suggest doing the standard, cross-platform, and

Re: [gentoo-user] OT: get process name in c++

2006-07-06 Thread Richard Fish
On 7/6/06, Iain Buchanan [EMAIL PROTECTED] wrote: yes I would, except that I'm editing a class which is inherited by a multitude of programs, so the /proc way I only have to change one file, whereas the argv[0] way I have to change every source file... No, that's the point of a global.

Re: [gentoo-user] OT: get process name in c++

2006-07-06 Thread Iain Buchanan
On Thu, 2006-07-06 at 21:48 -0700, Richard Fish wrote: On 7/6/06, Iain Buchanan [EMAIL PROTECTED] wrote: yes I would, except that I'm editing a class which is inherited by a multitude of programs, so the /proc way I only have to change one file, whereas the argv[0] way I have to change

Re: [gentoo-user] OT: get process name in c++

2006-06-28 Thread Petr Uzel
Dne středa 28 červen 2006 15:04 Iain Buchanan napsal(a): Hi again :) I have been googling for this one for a little while, and trying various options, but I can't seem to find it: How do I get the process from within a process in c or c++? I don't want to use argv[0], because the

Re: [gentoo-user] OT: get process name in c++

2006-06-28 Thread Petr Uzel
Dne středa 28 červen 2006 15:51 Petr Uzel napsal(a): Dne středa 28 červen 2006 15:04 Iain Buchanan napsal(a): Hi again :) I have been googling for this one for a little while, and trying various options, but I can't seem to find it: How do I get the process from within a process in c

Re: [gentoo-user] OT: get process name in c++

2006-06-28 Thread Richard Fish
On 6/28/06, Iain Buchanan [EMAIL PROTECTED] wrote: I don't want to use argv[0], because the particular place is deep within classes, and there are too many (I'm doing some porting) to edit all of their constructors, for example, to pass argv[0]. The normal way of handling this is with a global

Re: [gentoo-user] OT: get process name in c++

2006-06-28 Thread Iain Buchanan
On Wed, 2006-06-28 at 16:01 +0200, Petr Uzel wrote: Dne středa 28 červen 2006 15:51 Petr Uzel napsal(a): Dne středa 28 červen 2006 15:04 Iain Buchanan napsal(a): Hi again :) I have been googling for this one for a little while, and trying various options, but I can't seem to find