[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Process Id by Name.
On Mon, 23 Oct 2000, Alexander Indenbaum wrote:
> Hi!
>
> I'm writing c++ library which should find pid
> by process "name" - command line.
> This library should work on Linux Solaris and HP-UX.
> How do I do it?
>
> Alexander Indenbaum
> baum@actcom.co.il
>
A naive solution would be to parse the output of ps. I'm not sure if the
ps output and flags are portable across these three platforms, but it's
probably the most portable solution I can think of.
AFAIK, ps uses the proc filesystem to gather information, at least on
Linux. So you might be able to use that.
I suggest you take a look at the source of the procps utilities. That of
course is assuming they are not Linux specific.
Regards,
Shlomi Fish
>
> =================================================================
> To unsubscribe, send mail to linux-il-request@linux.org.il with
> the word "unsubscribe" in the message body, e.g., run the command
> echo unsubscribe | mail linux-il-request@linux.org.il
>
>
----------------------------------------------------------------------
Shlomi Fish shlomif@t2.technion.ac.il
Home Page: http://t2.technion.ac.il/~shlomif/
Home E-mail: shlomif@attglobal.net
The prefix "God Said" has the extraordinary logical property of
converting any statement that follows it into a true one.
=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il