Kernel VM Library Functions kvmnextproc(3KVM)
NAME
kvmnextproc, kvmgetproc, kvmsetproc - read system process
structures
SYNOPSIS
cc [ flag... ] file... -lkvm [ library...]
#include
#include
#include
#include
struct proc *kvmnextproc(kvmt *kd);
int kvmsetproc(kvmt *kd);
struct proc *kvmgetproc(kvmt *kd, pidt pid);
DESCRIPTION
The kvmnextproc() function reads sequentially all of the
system process structures from the kernel identified by kd
(see kvmopen(3KVM)). Each call to kvmnextproc() 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
kvmnextproc(), kvmsetproc(), or kvmgetproc(). If the pro-
cess 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 kvmnextproc(), 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.
The kvmsetproc() function rewinds the process list, ena-
bling kvmnextproc() 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.
The kvmgetproc() function locates the proc structure of the
process specified by pid and returns a pointer to it.
Although this function does not interact with the process
table pointer manipulated by kvmnextproc(), the
SunOS 5.11 Last change: 2 May 2002 1
Kernel VM Library Functions kvmnextproc(3KVM)
restrictions regarding the validity of the data still apply.
RETURN VALUES
On success, kvmnextproc() returns a pointer to a copy of
the next valid process table entry. On failure, it returns
NUL.
On success, kvmgetproc() returns a pointer to the proc
structure of the process specified by pid. On failure, it
returns NUL.
The kvmsetproc() function returns 0 on success and -1 on
failure.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Stable
MT-Level Unsafe
SEE ALSO
kvmgetu(3KVM), kvmopen(3KVM), kvmkread(3KVM), attri-
butes(5)
SunOS 5.11 Last change: 2 May 2002 2
|