


KVM_NEXTPROC(3K)   KERNEL VM LIBRARY FUNCTIONS   KVM_NEXTPROC(3K)



NAME
     kvm_getproc, kvm_nextproc, kvm_setproc - read system process
     structures

SYNOPSIS
     #include <kvm.h>
     #include <sys/param.h>
     #include <sys/time.h>
     #include <sys/proc.h>

     struct proc *kvm_getproc(kd, pid)
     kvm_t *kd;
     int pid;

     struct proc *kvm_nextproc(kd)
     kvm_t *kd;

     int kvm_setproc(kd)
     kvm_t *kd;

DESCRIPTION
     kvm_nextproc() may be used to sequentially read all  of  the
     system  process  structures from the kernel identified by _k_d
     (see kvm_open(3K)).  Each call to kvm_nextproc()  returns  a
     pointer  to  the  static memory area that contains a copy of
     the next valid process table entry.  There is  no  guarantee
     that   the   data   will   remain   valid  across  calls  to
     kvm_nextproc(), kvm_setproc(), or kvm_getproc().  Therefore,
     if  the process structure must be saved, it should be copied
     to non-volatile storage.

     For performance reasons, many implementations will  cache  a
     set of system process structures.  Since the system state is
     liable to change between calls to kvm_nextproc(), and  since
     the  cache  may  contain  obsolete  information, there is no
     guarantee that _e_v_e_r_y process structure returned refers to an
     active process, nor is it certain that _a_l_l processes will be
     reported.

     kvm_setproc()   rewinds   the   process    list,    enabling
     kvm_nextproc()  to  rescan  from the beginning of the system
     process table.  kvm_setproc() will always flush the  process
     structure cache, allowing an application to re-scan the pro-
     cess table of a running system.

     kvm_getproc() locates the  proc  structure  of  the  process
     specified by _p_i_d and returns a pointer to it.  kvm_getproc()
     does not interact with the process table pointer manipulated
     by  kvm_nextproc,  however,  the  restrictions regarding the
     validity of the data still apply.





Sun Release 4.1   Last change: 21 January 1990                  1






KVM_NEXTPROC(3K)   KERNEL VM LIBRARY FUNCTIONS   KVM_NEXTPROC(3K)



RETURN VALUES
     On success, kvm_nextproc() returns a pointer to  a  copy  of
     the  next valid process table entry.  On failure, it returns
     NULL.

     On success, kvm_getproc() returns  a  pointer  to  the  proc
     structure  of  the process specified by _p_i_d.  On failure, it
     returns NULL.

     kvm_setproc() returns:

     0    on success.

     -1   on failure.

SEE ALSO
     kvm_getu(3K), kvm_open(3K), kvm_read(3K)






































Sun Release 4.1   Last change: 21 January 1990                  2



