Question about process list

Hi !
I have trouble to gather information about all process on my node.
I have root rights.
I need something like sin command but from my code.
All my attempts find this function in qnx_… were fault.

I would be very appreciate if you help me.

“õÓÔÉÎÏ× ðÁ×ÅÌ” <rotozoom@mail.ru> wrote in message
news:b3hk91$750$1@inn.qnx.com

Hi !
I have trouble to gather information about all process on my node.
I have root rights.
I need something like sin command but from my code.
All my attempts find this function in qnx_… were fault.

I would be very appreciate if you help me.

for a local node code is like this:

#include <sys/kernel.h>
#include <sys/psinfo.h>

struct _psinfo psinfo;
int id;

for (id = 1; (id = qnx_psinfo(PROC_PID, id, &psinfo, 0, NULL)) != -1; id++)
{
if (psinfo.flags & _PPF_MID) {
printf(“pid = %d\n”, psinfo.pid);
}
}

// wbr

Ian Zagorskih <ianzag@megasignal.com> wrote:

“õÓÔÉÎÏ× ðÁ×ÅÌ” <> rotozoom@mail.ru> > wrote in message
news:b3hk91$750$> 1@inn.qnx.com> …
Hi !
I have trouble to gather information about all process on my node.
I have root rights.
I need something like sin command but from my code.
All my attempts find this function in qnx_… were fault.

I would be very appreciate if you help me.


for a local node code is like this:

#include <sys/kernel.h
#include <sys/psinfo.h

struct _psinfo psinfo;
int id;

for (id = 1; (id = qnx_psinfo(PROC_PID, id, &psinfo, 0, NULL)) != -1; id++)
{
if (psinfo.flags & _PPF_MID) {
printf(“pid = %d\n”, psinfo.pid);
}
}

The reason this works, is that if qnx_psinfo() is given a pid for which
no process exists, it will, instead, return the pid, and information for,
the next higher valid pid in existence. This allows one to reasonably
quickly walk through all the processes.

The contents of the psinfo structure contains much of the information
that sin spits out.

-David

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