Getting information about a process from inside a program.

How do you get information about a process? I know that
the contents of /proc/NNN, where NNN is the process ID, contains
some of this information, but where is the format of that
information documented? All I can find are references to
how to do it using the QNX4 migration library, which
clearly isn’t the right way to do it for new code.

I need the thread IDs for the process, their priorities,
and their states, as a minimum. What I want to do is find
the highest priority processes in RUN state when a watchdog
times out, and record who they are before I kill them and
shut down the “plant”.

John Nagle
Team Overbot

“John Nagle” <nagle@downside.com> wrote in message
news:bjjj0u$h7b$1@inn.qnx.com

How do you get information about a process? I know that
the contents of /proc/NNN, where NNN is the process ID, contains
some of this information, but where is the format of that
information documented? All I can find are references to
how to do it using the QNX4 migration library, which
clearly isn’t the right way to do it for new code.

I need the thread IDs for the process, their priorities,
and their states, as a minimum. What I want to do is find
the highest priority processes in RUN state when a watchdog
times out, and record who they are before I kill them and
shut down the “plant”.

Grab the source to pidin under CVS.

John Nagle
Team Overbot

John Nagle <nagle@downside.com> wrote:

How do you get information about a process? I know that
the contents of /proc/NNN, where NNN is the process ID, contains
some of this information, but where is the format of that
information documented? All I can find are references to

In my upcoming book :slight_smile:

how to do it using the QNX4 migration library, which
clearly isn’t the right way to do it for new code.

I need the thread IDs for the process, their priorities,
and their states, as a minimum. What I want to do is find
the highest priority processes in RUN state when a watchdog
times out, and record who they are before I kill them and
shut down the “plant”.

Take a look at the source for “pidin”… I believe it’s in
the CVS archive.

Cheers,
-RK

\

[If replying via email, you’ll need to click on the URL that’s emailed to you
afterwards to forward the email to me – spam filters and all that]
Robert Krten, PDP minicomputer collector http://www.parse.com/~pdp8/

Mario Charest postmaster@127.0.0.1 wrote:

“John Nagle” <> nagle@downside.com> > wrote in message
news:bjjj0u$h7b$> 1@inn.qnx.com> …
How do you get information about a process? I know that
the contents of /proc/NNN, where NNN is the process ID, contains
some of this information, but where is the format of that
information documented? All I can find are references to
how to do it using the QNX4 migration library, which
clearly isn’t the right way to do it for new code.

I need the thread IDs for the process, their priorities,
and their states, as a minimum. What I want to do is find
the highest priority processes in RUN state when a watchdog
times out, and record who they are before I kill them and
shut down the “plant”.

Grab the source to pidin under CVS.

www.cvs.com – the source is actually to 6.1 pidin, and is
somewhat opaque (understatement of the year), but should
still be correct.

Or, maybe one of the 3rd party utilities (spin?) has source
that might be a bit more clear.

-David

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

Robert Krten wrote:

John Nagle <> nagle@downside.com> > wrote:

How do you get information about a process? I know that
the contents of /proc/NNN, where NNN is the process ID, contains
some of this information, but where is the format of that
information documented? All I can find are references to


In my upcoming book > :slight_smile:

The book is actually going to document stuff like this (the title wouldn’t imply that) ?

If so you’ve sold one. This is a great marketing feature for your book, since seasoned developers don’t really need the “cookbook”
portion so much (although I’m sure there’s value there also), but documenting things like this make it more saleable to this category
of QNX developers.

Rennie Allen <rallen@csical.com> wrote:

Robert Krten wrote:
John Nagle <> nagle@downside.com> > wrote:

How do you get information about a process? I know that
the contents of /proc/NNN, where NNN is the process ID, contains
some of this information, but where is the format of that
information documented? All I can find are references to


In my upcoming book > :slight_smile:

The book is actually going to document stuff like this (the title wouldn’t imply that) ?

Yup. See http://www.parse.com/products/books/book_v2/index.html for the table of
contents. It’s an appendix :slight_smile:

If so you’ve sold one. This is a great marketing feature for your book, since seasoned developers don’t really need the “cookbook”
portion so much (although I’m sure there’s value there also), but documenting things like this make it more saleable to this category
of QNX developers.

Great! It should be out Oct/Nov 2003; the review draft should be printed this
week and sent out to reviewers, hopefully the review process will be finished
early October, with it going to press late October…

It’ll most likely include a CD-ROM with the example source…

Cheers,
-RK

\

[If replying via email, you’ll need to click on the URL that’s emailed to you
afterwards to forward the email to me – spam filters and all that]
Robert Krten, PDP minicomputer collector http://www.parse.com/~pdp8/

Oh wow, this is really l33t. Only real haXXors can
know about this stuff. I can hardly wait until the new
book of cheat codes comes out.

(Seriously, please put this stuff in the help
system. I don’t think there’s even anything in the
help system that mentions “/proc”. I appreciate that
people answer these questions, but this sort of thing
really should be findable in the documentation.)

John Nagle
Team Overbot

Mario Charest wrote:

“John Nagle” <> nagle@downside.com> > wrote in message
news:bjjj0u$h7b$> 1@inn.qnx.com> …

How do you get information about a process?


Grab the source to pidin under CVS.

John Nagle <nagle@overbot.com> wrote:

Oh wow, this is really l33t. Only real haXXors can
know about this stuff. I can hardly wait until the new
book of cheat codes comes out.

I really misses qnx_psinfo().

-David

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