Process

Hi,
Is there a way, from ones application, to determine if
a system process (eg. Dosfsys) is running and alive?

Thank you,
Shashank

Shashank <sbalijepalli@precitech.com> wrote:

Hi,
Is there a way, from ones application, to determine if
a system process (eg. Dosfsys) is running and alive?

You have several choices:

  1. if the process has attached a name (like Dosfsys - it has attached
    qnx/dosfsys name), you can find it by qnx_name_locate()

  2. if it hasn’t name by it is launched from your application
    and you know its pid, you can check it by qnx_getids()

  3. Otherwise see example for qnx_psinfo v Watcom C library
    → you can go through all processes, get their names and test.

Andy

Thank you,
Shashank

andy@microstep-mis.com wrote:

Shashank <> sbalijepalli@precitech.com> > wrote:
Hi,
Is there a way, from ones application, to determine if
a system process (eg. Dosfsys) is running and alive?

You have several choices:

  1. if the process has attached a name (like Dosfsys - it has attached
    qnx/dosfsys name), you can find it by qnx_name_locate()

  2. if it hasn’t name by it is launched from your application
    and you know its pid, you can check it by qnx_getids()

  3. Otherwise see example for qnx_psinfo v Watcom C library
    → you can go through all processes, get their names and test.

Or, you can do a kill (pid, 0) as well…

Cheers,
-RK


Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.

Shashank <sbalijepalli@precitech.com> wrote:

Hi,
Is there a way, from ones application, to determine if
a system process (eg. Dosfsys) is running and alive?

qnx_psinfo() can be used to walk the process table, and it will
give a short command string that can be examined.

Or, if you know that the process registers a name, you can do a
qnx_name_locate() on it. (Useful for Fsys, Net, and a few others.)

Or, if it registers a pathname, you can do an open/stat on the
pathname, to determine if it exists.

But, there isn’t really a generic way to do this efficiently – though
if you’ve found the pid using qnx_psinfo() once, you can just re-check
that pid each time, rather than walking the whole pid table to find
it.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Shashank,
Dosfsys registers the name qnx/dosfsys. Use the command ‘sin na’ to list
the names registered. The easiest method of determining that the Dosfsys
is to use the function qnx_name_attach(). This is ok where the
application and Dosfsys are operating on the same node. If they are on
different nodes - you should use qnx_vc_detach() to release the virtual
circuit created by qnx_name_locate(). If the virtual circuit is not
realeased subsequent calls to qnx_name_locate() will creat new virtual
circuits - eventually you run out of virtual circuits.

Padraig Furlong

Shashank wrote:

Hi,
Is there a way, from ones application, to determine if
a system process (eg. Dosfsys) is running and alive?

Thank you,
Shashank

if you’ve found the pid using qnx_psinfo() once, you can just re-check
that pid each time, rather than walking the whole pid table to find
it.

Can’t the pid be reused by another process?

Dmitri Ivanov wrote:

if you’ve found the pid using qnx_psinfo() once, you can just re-check
that pid each time, rather than walking the whole pid table to find
it.


Can’t the pid be reused by another process?

Possibly yes - but if it has the code_name will have changed

Padraig