Gentoo Archives: gentoo-user

From: Petr Uzel <petr.uzel@×××××××.cz>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] OT: get process name in c++
Date: Wed, 28 Jun 2006 13:59:09
Message-Id: 200606281551.42342.petr.uzel@centrum.cz
1 Dne støeda 28 èerven 2006 15:04 Iain Buchanan napsal(a):
2 > Hi again :)
3 >
4 > I have been googling for this one for a little while, and trying various
5 > options, but I can't seem to find it: How do I get the process from
6 > within a process in c or c++?
7 >
8 > I don't want to use argv[0], because the particular place is deep within
9 > classes, and there are too many (I'm doing some porting) to edit all of
10 > their constructors, for example, to pass argv[0].
11 >
12 > something like
13 >
14 > char *name = getpsname (pid);
15 >
16 Hi,
17 what about directly reading /proc/pid_of_the_process/stat (may be some other
18 file in this directory).
19
20 --
21 Petr Uzel
22 petr.uzel@×××××××.cz
23 Jabber : knotor@××××××××××.cz
24 ICQ : 101606095
25 Gentoo Linux
26
27 --
28 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] OT: get process name in c++ Petr Uzel <petr.uzel@×××××××.cz>