pid

what is the fn. I should use (in watcom C 10.6) to find the pid of
another process.

Cyndi <d_cynthia@rediffmail.com> wrote:

what is the fn. I should use (in watcom C 10.6) to find the pid of
another process.

Depends. The usual way of locating another process is with the
qnx_name_attach() & qnx_name_locate() pair. The process that is
to be located attaches a known name, then the other process locates
it. If both process are local, a pid will be returned. If they
are on different nodes, a global name will need to be attached, and
a vid (virtual circuit id, or vc) will be returned – but you can
use that just like a pid, by passing it to Send().

There are other ways of finding information about pids – qnx_psinfo(),
if given a non-existent pid, will return information (including the pid)
about the next higher pid in the process table. This can be used to
walk the process table, asking about all processes. (For instance,
ps, slay, and sin utilities use this feature to find/display information
about processes.)

If the process is created by your process, then fork() or spawn() will
generally return the pid of your child. If the process created your
process, then getppid() will return its pid.

-David

QNX Training Services
dagibbs@qnx.com