PENV_ITER(3PROC) Process Control Library Functions PENV_ITER(3PROC)

Penv_iteriterate process environment

Process Control Library (libproc, -lproc)

#include <libproc.h>

int
Penv_iter(struct ps_prochandle *P, proc_env_f *func, void *data);

The () 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 () function and the callback function.

Upon successful completion, the Penv_iter() function returns . 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.

See in libproc(3LIB).

libproc(3LIB)

March 2, 2017 OmniOS