Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Process name -> pid

169 views
Skip to first unread message

Mark Eliot

unread,
Nov 14, 1994, 4:56:53 PM11/14/94
to
In QNX 4.2, I'm looking for a way to get the pid of a process
by only knowing its name. Say I know that process "Foobar" is
running, how can I find its pid by only knowing "Foobar?"
Are there library/system calls to accomplish this? Maybe I'm
blind, but I can't find 'em.... How do utilities like "slay" do this?

Thanks in advance,
-Mark Eliot
Engineer
SRI Int'l

Trever Miller

unread,
Nov 15, 1994, 9:42:56 AM11/15/94
to
Mark Eliot (el...@sri.com) wrote:
> In QNX 4.2, I'm looking for a way to get the pid of a process
>by only knowing its name. Say I know that process "Foobar" is
>running, how can I find its pid by only knowing "Foobar?"
>Are there library/system calls to accomplish this? Maybe I'm
>blind, but I can't find 'em.... How do utilities like "slay" do this?

Look at qnx.psinfo() and the related structure in /usr/include/psinfo.h

--
b...@cyberdex.cuug.ab.ca | Cyberdex Systems | Just because you're not
mill...@cuug.ab.ca | c/o Trever Miller | paranoid doesn't mean
| Suite 557, 918 16Ave. N.W.| that they aren't out to
PGP mail accepted here | Calgary, Alberta T2M 0K3 | get you.

Emlyn Boyd Garvey

unread,
Nov 20, 1994, 11:58:58 PM11/20/94
to
el...@sri.com (Mark Eliot) writes:
r
r
r

> In QNX 4.2, I'm looking for a way to get the pid of a process
>by only knowing its name. Say I know that process "Foobar" is

>-Mark Eliot

The way to obtain the pid of an already running process is to perform
a qnx_name_locate() in the calling process (ie. process requiring pid)
This will find the pid assuming that a qnx_name_attach() was performed
on the first process.

Emlyn Garvey
em...@graph.moldflow.oz.au

David Ralphs

unread,
Nov 22, 1994, 10:57:44 PM11/22/94
to
Emlyn Boyd Garvey (gar...@numbat.cs.rmit.oz.au) wrote:

Most things dont attach
and it may return a vc to another node.

Try doing a qnx_psinfo()
and have a look in sys/psinfo.h
there is a name field in one of the structures.

Ok, you say, you need the pid to call qnx_psinfo()
well, so you have got to do call it for every pid
until you find it. If the pid does not exist
it will get the next valid one. This makes a search
easy(ier?)

Read the lib book entry.

DN
I aint done this, but another guy here has
and it does work.


0 new messages