Penv_iter
—
iterate process environment
Process Control Library (libproc, -lproc)
#include
<libproc.h>
int
Penv_iter
(
struct
ps_prochandle *P,
proc_env_f *func,
void *data);
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.
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.
Uncommitted
See
LOCKING in
libproc(3LIB).
libproc(3LIB)