Gentoo Archives: gentoo-user

From: Iain Buchanan <iaindb@××××××××××××.au>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] OT: get process name in c++
Date: Thu, 29 Jun 2006 00:56:02
Message-Id: 1151542067.19231.0.camel@orpheus
In Reply to: Re: [gentoo-user] OT: get process name in c++ by Petr Uzel
1 On Wed, 2006-06-28 at 16:01 +0200, Petr Uzel wrote:
2 > Dne středa 28 červen 2006 15:51 Petr Uzel napsal(a):
3 > > Dne středa 28 červen 2006 15:04 Iain Buchanan napsal(a):
4 > > > Hi again :)
5 > > >
6 > > > I have been googling for this one for a little while, and trying various
7 > > > options, but I can't seem to find it: How do I get the process from
8 > > > within a process in c or c++?
9 > > >
10 > > > I don't want to use argv[0], because the particular place is deep within
11 > > > classes, and there are too many (I'm doing some porting) to edit all of
12 > > > their constructors, for example, to pass argv[0].
13
14 > file /proc/self/status is a link pointing to the
15 > directory /proc/pid_of_process. And by parsing status file in this directory
16 > you should get all the informations you want.
17
18 great idea, thanks!
19 --
20 Iain Buchanan <iaindb at netspace dot net dot au>
21
22 In every non-trivial program there is at least one bug.
23
24 --
25 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] OT: get process name in c++ Iain Buchanan <iaindb@××××××××××××.au>