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 20*ab618543SJohn Levon.Sh LIBRARY 2143051d27SRobert Mustacchi.Lb libproc 22*ab618543SJohn Levon.Sh SYNOPSIS 2343051d27SRobert Mustacchi.In libproc.h 2443051d27SRobert Mustacchi.Ft int 2543051d27SRobert Mustacchi.Fo Penv_iter 2643051d27SRobert Mustacchi.Fa "struct ps_prochandle *P" 2743051d27SRobert Mustacchi.Fa "proc_env_f *func" 2843051d27SRobert Mustacchi.Fa "void *data" 2943051d27SRobert Mustacchi.Fc 3043051d27SRobert Mustacchi.Sh DESCRIPTION 3143051d27SRobert MustacchiThe 3243051d27SRobert Mustacchi.Fn Penv_iter 3343051d27SRobert Mustacchifunction iterates over the environment of the process represented by 3443051d27SRobert Mustacchi.Fa P . 3543051d27SRobert MustacchiFor each environment variable, 3643051d27SRobert Mustacchi.Fa func 3743051d27SRobert Mustacchiis passed the caller argument 3843051d27SRobert Mustacchi.Fa data 3972d3dbb9SYuri Pankovalong with the address of the environment variable and the key-value pair. 4072d3dbb9SYuri PankovFor the full signature of the 4143051d27SRobert Mustacchi.Ft proc_env_f 4243051d27SRobert Mustacchicallback, see 4343051d27SRobert Mustacchi.Xr libproc 3LIB . 4443051d27SRobert Mustacchi.Pp 4572d3dbb9SYuri PankovThe callback's return value controls whether or not iteration proceeds. 4672d3dbb9SYuri PankovIf 4743051d27SRobert Mustacchi.Fa func 4872d3dbb9SYuri Pankovreturns zero, then iteration continues. 4972d3dbb9SYuri PankovOtherwise, iteration is terminated and the value is returned. 5072d3dbb9SYuri PankovIt is recommended that callback functions do not return 5143051d27SRobert Mustacchi.Sy -1 5243051d27SRobert Mustacchiso as to distinguish between the failure of the 5343051d27SRobert Mustacchi.Fn Penv_iter 5443051d27SRobert Mustacchifunction and the callback function. 5543051d27SRobert Mustacchi.Sh RETURN VALUES 5643051d27SRobert MustacchiUpon successful completion, the 5743051d27SRobert Mustacchi.Fn Penv_iter 5843051d27SRobert Mustacchifunction returns 5943051d27SRobert Mustacchi.Sy 0 . 6043051d27SRobert MustacchiOtherwise, if there was an internal error, for example due to a 6143051d27SRobert Mustacchicorrupted environment, then 6243051d27SRobert Mustacchi.Sy -1 6372d3dbb9SYuri Pankovis returned. 6472d3dbb9SYuri PankovOtherwise, if the callback function 6543051d27SRobert Mustacchi.Fa func 6643051d27SRobert Mustacchireturns non-zero, then its return value will be returned instead. 6743051d27SRobert Mustacchi.Sh INTERFACE STABILITY 6843051d27SRobert Mustacchi.Sy Uncommitted 6943051d27SRobert Mustacchi.Sh MT-LEVEL 7043051d27SRobert MustacchiSee 7143051d27SRobert Mustacchi.Sy LOCKING 7243051d27SRobert Mustacchiin 7343051d27SRobert Mustacchi.Xr libproc 3LIB . 7443051d27SRobert Mustacchi.Sh SEE ALSO 7543051d27SRobert Mustacchi.Xr libproc 3LIB 76