143051d27SRobert Mustacchi.\" 243051d27SRobert Mustacchi.\" This file and its contents are supplied under the terms of the 343051d27SRobert Mustacchi.\" Common Development and Distribution License ("CDDL"), version 1.0. 443051d27SRobert Mustacchi.\" You may only use this file in accordance with the terms of version 543051d27SRobert Mustacchi.\" 1.0 of the CDDL. 643051d27SRobert Mustacchi.\" 743051d27SRobert Mustacchi.\" A full copy of the text of the CDDL should have accompanied this 843051d27SRobert Mustacchi.\" source. A copy of the CDDL is also available via the Internet at 943051d27SRobert Mustacchi.\" http://www.illumos.org/license/CDDL. 1043051d27SRobert Mustacchi.\" 1143051d27SRobert Mustacchi.\" 1243051d27SRobert Mustacchi.\" Copyright 2015 Joyent, Inc. 1343051d27SRobert Mustacchi.\" 14*48184658SMarcel Telka.Dd March 2, 2017 1543051d27SRobert Mustacchi.Dt PENV_ITER 3PROC 1643051d27SRobert Mustacchi.Os 1743051d27SRobert Mustacchi.Sh NAME 1843051d27SRobert Mustacchi.Nm Penv_iter 1943051d27SRobert Mustacchi.Nd iterate process environment 2043051d27SRobert Mustacchi.Sh SYNOPSIS 2143051d27SRobert Mustacchi.Lb libproc 2243051d27SRobert Mustacchi.In libproc.h 2343051d27SRobert Mustacchi.Ft int 2443051d27SRobert Mustacchi.Fo Penv_iter 2543051d27SRobert Mustacchi.Fa "struct ps_prochandle *P" 2643051d27SRobert Mustacchi.Fa "proc_env_f *func" 2743051d27SRobert Mustacchi.Fa "void *data" 2843051d27SRobert Mustacchi.Fc 2943051d27SRobert Mustacchi.Sh DESCRIPTION 3043051d27SRobert MustacchiThe 3143051d27SRobert Mustacchi.Fn Penv_iter 3243051d27SRobert Mustacchifunction iterates over the environment of the process represented by 3343051d27SRobert Mustacchi.Fa P . 3443051d27SRobert MustacchiFor each environment variable, 3543051d27SRobert Mustacchi.Fa func 3643051d27SRobert Mustacchiis passed the caller argument 3743051d27SRobert Mustacchi.Fa data 3843051d27SRobert Mustacchialong with the address of the environment variable and the key-value 3943051d27SRobert Mustacchipair. For the full signature of the 4043051d27SRobert Mustacchi.Ft proc_env_f 4143051d27SRobert Mustacchicallback, see 4243051d27SRobert Mustacchi.Xr libproc 3LIB . 4343051d27SRobert Mustacchi.Pp 4443051d27SRobert MustacchiThe callback's return value controls whether or not iteration 4543051d27SRobert Mustacchiproceeds. If 4643051d27SRobert Mustacchi.Fa func 4743051d27SRobert Mustacchireturns zero, then iteration continues. Otherwise, iteration is 48*48184658SMarcel Telkaterminated and the value is returned. It is recommended that callback 4943051d27SRobert Mustacchifunctions do not return 5043051d27SRobert Mustacchi.Sy -1 5143051d27SRobert Mustacchiso as to distinguish between the failure of the 5243051d27SRobert Mustacchi.Fn Penv_iter 5343051d27SRobert Mustacchifunction and the callback function. 5443051d27SRobert Mustacchi.Sh RETURN VALUES 5543051d27SRobert MustacchiUpon successful completion, the 5643051d27SRobert Mustacchi.Fn Penv_iter 5743051d27SRobert Mustacchifunction returns 5843051d27SRobert Mustacchi.Sy 0 . 5943051d27SRobert MustacchiOtherwise, if there was an internal error, for example due to a 6043051d27SRobert Mustacchicorrupted environment, then 6143051d27SRobert Mustacchi.Sy -1 6243051d27SRobert Mustacchiis returned. Otherwise, if the callback function 6343051d27SRobert Mustacchi.Fa func 6443051d27SRobert Mustacchireturns non-zero, then its return value will be returned instead. 6543051d27SRobert Mustacchi.Sh INTERFACE STABILITY 6643051d27SRobert Mustacchi.Sy Uncommitted 6743051d27SRobert Mustacchi.Sh MT-LEVEL 6843051d27SRobert MustacchiSee 6943051d27SRobert Mustacchi.Sy LOCKING 7043051d27SRobert Mustacchiin 7143051d27SRobert Mustacchi.Xr libproc 3LIB . 7243051d27SRobert Mustacchi.Sh SEE ALSO 7343051d27SRobert Mustacchi.Xr libproc 3LIB 74