Sun Microsystems, Inc.
spacerspacer
spacer   www.sun.com docs.sun.com | | |  
spacer
black dot
   
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
    
 
Kernel VM Library Functionskvm_nextproc(3KVM)


NAME

 kvm_nextproc, kvm_getproc, 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_nextproc(kvm_t *kd);
 int kvm_setproc(kvm_t *kd);
 struct proc *kvm_getproc(kvm_t *kd, pid_t pid);

DESCRIPTION

 

kvm_nextproc

 

The kvm_nextproc() function may be used to sequentially read all of the system process structures from the kernel identified by kd (see kvm_open(3KVM)). 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 every process structure returned refers to an active process, nor is it certain that all processes will be reported.

kvm_setproc

 

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

kvm_getproc

 

The kvm_getproc() function locates the proc structure of the process specified by pid and returns a pointer to it. This function does not interact with the process table pointer manipulated by kvm_nextproc(); however, the restrictions regarding the validity of the data still apply.

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 pid. On failure, it returns NULL.

The kvm_setproc() function returns 0 on success -1 on failure.

ATTRIBUTES

 

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
MT-LevelUnsafe

SEE ALSO

 

kvm_getu(3KVM), kvm_open(3KVM), kvm_read(3KVM), attributes(5)


SunOS 5.9Go To TopLast Changed 22 Sep 1997

 
      
      
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.