[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Process Id by Name.
Hi
Nadav Har'El wrote:
> On Mon, Oct 23, 2000, Shlomi Fish wrote about "Re: Process Id by Name.":
> >..
> > 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.
>
> /proc and procps is quite Linux-specific, as far as I know. Solaris, for
> example, also has /proc/, but /proc/123456 has different files, and
> different directories. Other versions of Unix don't have a /proc filesystem
> at all, and their ps needs to read /dev/kmem (the Kernel memory) to do their
> job, which also means that 'ps' needs to be setuid root, and so you can't
> easily write a different ps program (not to mention you don't have the
> source ;)).
>
> Parsing the output of the ps command is more portable, but note that there
> are 2 major variants of ps in the Unix world: BSD ps and System V ps. Solaris
> has them both (/bin/ps and /usr/ucb/ps) and Linux's ps is a wierd combination
> of both (depending on the options you give it).
In addition to that, you should check the sources of top, which is ported
to many unices, and you'll see how to parse /dev/kmem and such.
Of course, don't use top from the procps utils - use the original
from <ftp://ftp.groupsys.com/pub/top>.
I once had to write something similar, and top's sources were very helpful.
>
> --
> Nadav Har'El | Monday, Oct 23 2000, 25 Tishri 5761
> nyh@math.technion.ac.il |-----------------------------------------
> Phone: +972-53-245868, ICQ 13349191 |In God we Trust -- all others must
> http://nadav.harel.org.il |submit an X.509 certificate.
>
> =================================================================
> 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
>
bye,
didi
=================================================================
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