On Wed, Sep 05, 2007, Dvir Volk wrote about "getting another process id from 
within a c/cpp program?":
> i want to get another process' pid(s) from withing a program by process
> name, without executing a ps or pidof command.
> Is there another way of doing this other than iterating over /proc and
> reading all the process names?

Probably not. There is no system call, or even C library function, to do
this sort of query.

So your most portable choice is indeed to run an external "ps" program.
The not-portable way (will work only on Linux) is to look in /proc. This
is what the ps program does on Linux, by the way.

-- 
Nadav Har'El                        |     Wednesday, Sep  5 2007, 22 Elul 5767
[EMAIL PROTECTED]             |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |Always go to other people's funerals,
http://nadav.harel.org.il           |otherwise they won't come to yours.

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to