xref: /illumos-gate/usr/src/man/man3proc/Penv_iter.3proc (revision 43051d2742bbe5911de73322064cb573b6aff975)
1*43051d27SRobert Mustacchi.\"
2*43051d27SRobert Mustacchi.\" This file and its contents are supplied under the terms of the
3*43051d27SRobert Mustacchi.\" Common Development and Distribution License ("CDDL"), version 1.0.
4*43051d27SRobert Mustacchi.\" You may only use this file in accordance with the terms of version
5*43051d27SRobert Mustacchi.\" 1.0 of the CDDL.
6*43051d27SRobert Mustacchi.\"
7*43051d27SRobert Mustacchi.\" A full copy of the text of the CDDL should have accompanied this
8*43051d27SRobert Mustacchi.\" source.  A copy of the CDDL is also available via the Internet at
9*43051d27SRobert Mustacchi.\" http://www.illumos.org/license/CDDL.
10*43051d27SRobert Mustacchi.\"
11*43051d27SRobert Mustacchi.\"
12*43051d27SRobert Mustacchi.\" Copyright 2015 Joyent, Inc.
13*43051d27SRobert Mustacchi.\"
14*43051d27SRobert Mustacchi.Dd May 11, 2016
15*43051d27SRobert Mustacchi.Dt PENV_ITER 3PROC
16*43051d27SRobert Mustacchi.Os
17*43051d27SRobert Mustacchi.Sh NAME
18*43051d27SRobert Mustacchi.Nm Penv_iter
19*43051d27SRobert Mustacchi.Nd iterate process environment
20*43051d27SRobert Mustacchi.Sh SYNOPSIS
21*43051d27SRobert Mustacchi.Lb libproc
22*43051d27SRobert Mustacchi.In libproc.h
23*43051d27SRobert Mustacchi.Ft int
24*43051d27SRobert Mustacchi.Fo Penv_iter
25*43051d27SRobert Mustacchi.Fa "struct ps_prochandle *P"
26*43051d27SRobert Mustacchi.Fa "proc_env_f *func"
27*43051d27SRobert Mustacchi.Fa "void *data"
28*43051d27SRobert Mustacchi.Fc
29*43051d27SRobert Mustacchi.Sh DESCRIPTION
30*43051d27SRobert MustacchiThe
31*43051d27SRobert Mustacchi.Fn Penv_iter
32*43051d27SRobert Mustacchifunction iterates over the environment of the process represented by
33*43051d27SRobert Mustacchi.Fa P .
34*43051d27SRobert MustacchiFor each environment variable,
35*43051d27SRobert Mustacchi.Fa func
36*43051d27SRobert Mustacchiis passed the caller argument
37*43051d27SRobert Mustacchi.Fa data
38*43051d27SRobert Mustacchialong with the address of the environment variable and the key-value
39*43051d27SRobert Mustacchipair. For the full signature of the
40*43051d27SRobert Mustacchi.Ft proc_env_f
41*43051d27SRobert Mustacchicallback, see
42*43051d27SRobert Mustacchi.Xr libproc 3LIB .
43*43051d27SRobert Mustacchi.Pp
44*43051d27SRobert MustacchiThe callback's return value controls whether or not iteration
45*43051d27SRobert Mustacchiproceeds. If
46*43051d27SRobert Mustacchi.Fa func
47*43051d27SRobert Mustacchireturns zero, then iteration continues. Otherwise, iteration is
48*43051d27SRobert Mustacchiterminated and the value if returned. It is recommend that callback
49*43051d27SRobert Mustacchifunctions do not return
50*43051d27SRobert Mustacchi.Sy -1
51*43051d27SRobert Mustacchiso as to distinguish between the failure of the
52*43051d27SRobert Mustacchi.Fn Penv_iter
53*43051d27SRobert Mustacchifunction and the callback function.
54*43051d27SRobert Mustacchi.Sh RETURN VALUES
55*43051d27SRobert MustacchiUpon successful completion, the
56*43051d27SRobert Mustacchi.Fn Penv_iter
57*43051d27SRobert Mustacchifunction returns
58*43051d27SRobert Mustacchi.Sy 0 .
59*43051d27SRobert MustacchiOtherwise, if there was an internal error, for example due to a
60*43051d27SRobert Mustacchicorrupted environment, then
61*43051d27SRobert Mustacchi.Sy -1
62*43051d27SRobert Mustacchiis returned. Otherwise, if the callback function
63*43051d27SRobert Mustacchi.Fa func
64*43051d27SRobert Mustacchireturns non-zero, then its return value will be returned instead.
65*43051d27SRobert Mustacchi.Sh INTERFACE STABILITY
66*43051d27SRobert Mustacchi.Sy Uncommitted
67*43051d27SRobert Mustacchi.Sh MT-LEVEL
68*43051d27SRobert MustacchiSee
69*43051d27SRobert Mustacchi.Sy LOCKING
70*43051d27SRobert Mustacchiin
71*43051d27SRobert Mustacchi.Xr libproc 3LIB .
72*43051d27SRobert Mustacchi.Sh SEE ALSO
73*43051d27SRobert Mustacchi.Xr libproc 3LIB
74