PENV_ITER(3PROC) Process Control Library Functions PENV_ITER(3PROC)
NAME
Penv_iter - iterate process environment
LIBRARY
Process Control Library (libproc, -lproc)
SYNOPSIS
#include <libproc.h> int Penv_iter(
struct ps_prochandle *P,
proc_env_f *func,
void *data);
DESCRIPTION
The
Penv_iter() function iterates over the environment of the process
represented by
P. For each environment variable,
func is passed the
caller argument
data along with the address of the environment variable
and the key-value pair. For the full signature of the
proc_env_f callback, see
libproc(3LIB).
The callback's return value controls whether or not iteration proceeds.
If
func returns zero, then iteration continues. Otherwise, iteration
is terminated and the value is returned. It is recommended that
callback functions do not return
-1 so as to distinguish between the
failure of the
Penv_iter() function and the callback function.
RETURN VALUES
Upon successful completion, the
Penv_iter() function returns
0.
Otherwise, if there was an internal error, for example due to a
corrupted environment, then
-1 is returned. Otherwise, if the callback
function
func returns non-zero, then its return value will be returned
instead.
INTERFACE STABILITY
UncommittedMT-LEVEL See
LOCKING in
libproc(3LIB).
SEE ALSO
libproc(3LIB)illumos March 2, 2017 illumos