2 .\" Copyright (c) 2008, Sun Microsystems Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH SCF_TMPL_PG_CREATE 3SCF "Oct 28, 2008"
8 scf_tmpl_pg_create, scf_tmpl_pg_reset, scf_tmpl_pg_destroy,
9 scf_tmpl_get_by_pg_name, scf_tmpl_get_by_pg, scf_tmpl_iter_pgs \- template
10 property group functions
14 cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ]
17 \fBscf_pg_tmpl_t *\fR\fBscf_tmpl_pg_create\fR(\fBscf_handle_t *\fR\fIhandle\fR);
22 \fBvoid\fR \fBscf_tmpl_pg_reset\fR(\fBscf_pg_tmpl_t *\fR\fIpg_tmpl\fR);
27 \fBvoid\fR \fBscf_tmpl_pg_destroy\fR(\fBscf_pg_tmpl_t *\fR\fIpg_tmpl\fR);
32 \fBint\fR \fBscf_tmpl_get_by_pg_name\fR(\fBconst char *\fR\fIinstance_fmri\fR,
33 \fBconst char *\fR\fIsnapshot\fR, \fBconst char *\fR\fIpg_name\fR,
34 \fBconst char *\fR\fIpg_type\fR, \fBscf_pg_tmpl_t *\fR\fIpg_tmpl\fR, \fBint\fR \fIflags\fR);
39 \fBint\fR \fBscf_tmpl_get_by_pg\fR(\fBscf_propertygroup_t *\fR\fIpg\fR,
40 \fBscf_pg_tmpl_t *\fR\fIpg_tmpl\fR, \fBint\fR \fIflags\fR)
45 \fBint\fR \fBscf_tmpl_iter_pgs\fR(\fBscf_pg_tmpl_t *\fR\fIpg_tmpl\fR, \fBconst char *\fR\fIfmri\fR,
46 \fBconst char *\fR\fIsnapshot\fR, \fBconst char *\fR\fIpg_type\fR, \fBint\fR \fIflags\fR);
52 The template property group functions locate and give access to metadata about
53 SMF configuration for service instances. They are used to directly access
54 property group metadata and explore metadata for properties contained in those
58 A property group does not need to be currently defined in order to explore
59 metadata about it, as long as the metadata is defined. Thus, the property
60 group template functions operate on strings rather than
61 \fBscf_propertygroup_t\fR entities.
64 By default, when an instance FMRI is specified, \fBscf_tmpl_get_by_pg_name()\fR
65 and \fBscf_tmpl_iter_pgs()\fR lookup composed data from the running snapshot of
66 the instance. A different snapshot may be explicitly selected by specifying a
67 valid snapshot name rather than NULL for the snapshot argument. If a service
68 FMRI is specified, the current properties are used.
71 By default, these functions also explore template data defined by the service
72 or instance itself, the service's restarter, and global template data. See
73 \fBsmf_template\fR(5) for more information about this composition.
76 Once retrieved, the \fBscf_pg_tmpl_t\fR can be explored using the
77 \fBscf_tmpl_pg_name\fR(3SCF) and \fBscf_tmpl_prop_create\fR(3SCF) suite of
81 Before calling \fBscf_tmpl_get_by_pg()\fR, \fBscf_tmpl_get_by_pg_name()\fR, or
82 \fBscf_tmpl_iter_pgs()\fR, the \fBscf_pg_tmpl_t\fR must be allocated by
83 \fBscf_tmpl_pg_create()\fR. The \fBscf_pg_tmpl_t\fR can be reset to contain no
84 template information with \fBscf_tmpl_pg_reset()\fR, so that it can be used to
85 start an iteration from scratch. All associated memory can be freed with
86 \fBscf_tmpl_pg_destroy()\fR.
89 The \fBscf_tmpl_get_by_pg()\fR function locates the most specific matching
90 template for the property group supplied. The parent of that property group can
91 be either a service or an instance.
94 The \fBscf_tmpl_get_by_pg_name()\fR function locates the most specific matching
95 template for the property group as specified. As described above, when the
96 snapshot argument is \fINULL\fR the default running snapshot is used. If flags
97 includes \fBSCF_PG_TMPL_FLAG_CURRENT\fR, the snapshot argument is ignored and
98 the current configuration is used. If flags includes
99 \fBSCF_PG_TMPL_FLAG_EXACT\fR, only the exact FMRI is looked up. Either or both
100 of the \fIpg_name\fR and \fIpg_type\fR arguments may be specified as
101 \fINULL\fR. In this case, \fIpg_name\fR and/or \fIpg_type\fR is wildcarded and
102 matches any value. The most specific snapshot matching those arguments is
106 The \fBscf_tmpl_iter_pgs()\fR function iterates across all templates defined
107 for the specified FMRI, snapshot, and optional property group type. It also
108 takes an optional flags argument. If flags includes
109 \fBSCF_PG_TMPL_FLAG_CURRENT\fR, the snapshot argument is ignored and the
110 "running" snapshot is used. \fBSCF_PG_TMPL_FLAG_REQUIRED\fR searches only for
111 required property groups. \fBSCF_PG_TMPL_FLAG_EXACT\fR looks only at the exact
112 FMRI provided for templates, and not for templates defined on its restarter or
116 The iterator state for \fBscf_tmpl_iter_pgs()\fR is stored on the template data
117 structure. The data structure should be allocated with
118 \fBscf_tmpl_pg_create()\fR and to continue the iteration the previously
119 returned structure should be passed in as an argument.
123 The \fBscf_tmpl_pg_create()\fR function returns \fINULL\fR on failure and a
124 pointer to an allocated and populated \fBscf_pg_tmpl_t\fR on success. The
125 caller is responsible for freeing the memory with \fBscf_tmpl_pg_destroy()\fR.
128 The \fBscf_tmpl_get_by_pg()\fR and \fBscf_tmpl_get_by_pg_name()\fR functions
129 return 0 on success and -1 on failure.
132 The \fBscf_tmpl_iter_pgs()\fR function returns 1 on successful completion. If
133 the iteration is complete, it returns 0. It returns -1 on error.
137 The \fBscf_tmpl_get_by_pg()\fR, \fBscf_tmpl_get_by_pg_name()\fR, and
138 \fBscf_tmpl_iter_pgs()\fR functions will fail if:
142 \fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR
146 The storage mechanism that the repository server (\fBsvc.configd\fR(1M)) chose
147 for the operation denied access.
153 \fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR
157 The connection to the repository was lost.
163 \fB\fBSCF_ERROR_DELETED\fR\fR
167 The instance or its template property group has been deleted.
173 \fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR
177 The handle passed in has been destroyed.
183 \fB\fBSCF_ERROR_INTERNAL\fR\fR
187 An internal error occurred.
193 \fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR
197 The \fIhandle\fR argument, \fIfmri\fR argument, snapshot name, \fIpg_name\fR,
198 or \fIpg\fR is invalid.
204 \fB\fBSCF_ERROR_NO_MEMORY\fR\fR
208 There is not enough memory to populate the \fBscf_pg_tmpl_t\fR.
214 \fB\fBSCF_ERROR_NO_RESOURCES\fR\fR
218 The server does not have adequate resources to complete the request.
224 \fB\fBSCF_ERROR_NOT_BOUND\fR\fR
228 The handle is not currently bound.
234 \fB\fBSCF_ERROR_NOT_FOUND\fR\fR
238 The object matching FMRI does not exist in the repository, or the snapshot does
245 \fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR
249 The template could not be read due to access restrictions.
254 The \fBscf_tmpl_get_by_pg()\fR function will fail if:
258 \fB\fBSCF_ERROR_NOT_SET\fR\fR
261 The property group specified by \fIpg\fR is not set.
266 The \fBscf_tmpl_pg_create()\fR function will fail if:
270 \fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR
273 The handle argument is \fINULL\fR.
279 \fB\fBSCF_ERROR_NO_MEMORY\fR\fR
282 There is no memory available.
288 See \fBattributes\fR(5) for descriptions of the following attributes:
296 ATTRIBUTE TYPE ATTRIBUTE VALUE
298 Interface Stability Committed
306 \fBsvc.configd\fR(1M), \fBscf_tmpl_pg_name\fR(3SCF),
307 \fBscf_tmpl_prop_create\fR(3SCF), \fBattributes\fR(5), \fBsmf_template\fR(5)