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.\" 1448184658SMarcel 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 38*72d3dbb9SYuri Pankovalong with the address of the environment variable and the key-value pair. 39*72d3dbb9SYuri PankovFor the full signature of the 4043051d27SRobert Mustacchi.Ft proc_env_f 4143051d27SRobert Mustacchicallback, see 4243051d27SRobert Mustacchi.Xr libproc 3LIB . 4343051d27SRobert Mustacchi.Pp 44*72d3dbb9SYuri PankovThe callback's return value controls whether or not iteration proceeds. 45*72d3dbb9SYuri PankovIf 4643051d27SRobert Mustacchi.Fa func 47*72d3dbb9SYuri Pankovreturns zero, then iteration continues. 48*72d3dbb9SYuri PankovOtherwise, iteration is terminated and the value is returned. 49*72d3dbb9SYuri PankovIt is recommended that callback functions 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 62*72d3dbb9SYuri Pankovis returned. 63*72d3dbb9SYuri PankovOtherwise, if the callback function 6443051d27SRobert Mustacchi.Fa func 6543051d27SRobert Mustacchireturns non-zero, then its return value will be returned instead. 6643051d27SRobert Mustacchi.Sh INTERFACE STABILITY 6743051d27SRobert Mustacchi.Sy Uncommitted 6843051d27SRobert Mustacchi.Sh MT-LEVEL 6943051d27SRobert MustacchiSee 7043051d27SRobert Mustacchi.Sy LOCKING 7143051d27SRobert Mustacchiin 7243051d27SRobert Mustacchi.Xr libproc 3LIB . 7343051d27SRobert Mustacchi.Sh SEE ALSO 7443051d27SRobert Mustacchi.Xr libproc 3LIB 75