[comp.unix.programmer] Getting process status

pthonda@bgsuvax.UUCP (Killer B) (04/06/91)

Hi, I am trying to read the status of all the processes information in the system. 
I came to know that the file 'vmunix' contains a pointer to a location in file 
'kmem'.This location has another pointer to the starting of process structures in 
kmem, which would give me process information. Can anybody tell me how to get the 
pointer in the file 'vmunix' . Should I use nlist, if so , in what way.

Thanx in advance .

Pratap

jrc@brainiac.mn.org (Jeffrey Comstock) (04/12/91)

In article <7269@bgsuvax.UUCP> pthonda@bgsuvax.UUCP (Killer B) writes:
>
>
>Hi, I am trying to read the status of all the processes information in the system. 
>I came to know that the file 'vmunix' contains a pointer to a location in file 
>'kmem'.This location has another pointer to the starting of process structures in 
>kmem, which would give me process information. Can anybody tell me how to get the 
>pointer in the file 'vmunix' . Should I use nlist, if so , in what way.
>
>Thanx in advance .
>
>Pratap

Using SunOS, do a 'man -k kvm'.  There are some nice routines for dealing with
the kernel:

kvm_getproc, kvm_nextproc, kvm_setproc (3K) - read system process structures
kvm_read, kvm_write (3K)  copy data to or from a kernel image or running system


Jeff