2 .\" Copyright (c) 2007, 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_SERVICE_CREATE 3SCF "Aug 27, 2007"
8 scf_service_create, scf_service_handle, scf_service_destroy,
9 scf_service_get_parent, scf_service_get_name, scf_scope_get_service,
10 scf_scope_add_service, scf_service_delete \- create and manipulate service
11 handles and services in the Service Configuration Facility
15 cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lscf\fR [ \fIlibrary\fR\&.\|.\|. ]
18 \fBscf_service_t *\fR\fBscf_service_create\fR(\fBscf_handle_t *\fR\fIhandle\fR);
23 \fBscf_handle_t *\fR\fBscf_service_handle\fR(\fBscf_service_t *\fR\fIsvc\fR);
28 \fBvoid\fR \fBscf_service_destroy\fR(\fBscf_service_t *\fR\fIsvc\fR);
33 \fBint\fR \fBscf_service_get_parent\fR(\fBscf_service_t *\fR\fIsvc\fR, \fBscf_scope_t *\fR\fIsc\fR);
38 \fBssize_t\fR \fBscf_service_get_name\fR(\fBconst scf_service_t *\fR\fIsvc\fR, \fBchar *\fR\fIbuf\fR,
39 \fBsize_t\fR \fIsize\fR);
44 \fBint\fR \fBscf_scope_get_service\fR(\fBconst scf_scope_t *\fR\fIsc\fR, \fBconst char *\fR\fIname\fR,
45 \fBscf_service_t *\fR\fIsvc\fR);
50 \fBint\fR \fBscf_scope_add_service\fR(\fBconst scf_scope_t *\fR\fIsc\fR, \fBconst char *\fR\fIname\fR,
51 \fBscf_service_t *\fR\fIsvc\fR);
56 \fBint\fR \fBscf_service_delete\fR(\fBscf_service_t *\fR\fIsvc\fR);
62 Services form the middle layer of the Service Configuration Facility repository
63 tree. Services are children of a scope (see \fBscf_scope_create\fR(3SCF)) and
64 have three sets of children:
71 These hold configuration information shared by all of the instances of the
72 service. See \fBscf_pg_create\fR(3SCF), \fBscf_iter_service_pgs\fR(3SCF), and
73 \fBscf_iter_service_pgs_typed\fR(3SCF).
82 A particular instantiation of the service. See \fBscf_instance_create\fR(3SCF).
87 A service groups one or more related instances and provides a shared
88 configuration for them.
91 An \fBscf_service_t\fR is an opaque handle that can be set to a single service
92 at any given time. The \fBscf_service_create()\fR function allocates and
93 initializes a new \fBscf_service_t\fR bound to \fIhandle\fR. The
94 \fBscf_service_destroy()\fR function destroys and frees svc.
97 The \fBscf_service_handle()\fR function retrieves the handle to which \fIsvc\fR
101 The \fBscf_service_get_parent()\fR function sets \fIsc\fR to the scope that is
102 the parent of \fIsvc\fR.
105 The \fBscf_service_get_name()\fR function retrieves the name of the service to
106 which \fIsvc\fR is set.
109 The \fBscf_scope_get_service()\fR function sets \fIsvc\fR to the service
110 specified by \fIname\fR in the scope specified by \fIsc\fR.
113 The \fBscf_scope_add_service()\fR function sets \fIsvc\fR to a new service
114 specified by \fIname\fR in the scope specified by \fIsc\fR.
117 The \fBscf_service_delete()\fR function deletes the service to which \fIsvc\fR
118 is set, as well as all of its children.
122 Upon successful completion, \fBscf_service_create()\fR returns a new
123 \fBscf_service_t\fR. Otherwise, it returns \fINULL\fR.
126 Upon successful completion, \fBscf_service_handle()\fR returns the handle to
127 which svc is bound. Otherwise, it returns \fINULL\fR.
130 Upon successful completion, \fBscf_service_get_name()\fR returns the length of
131 the string written, not including the terminating null byte. Otherwise, it
135 Upon successful completion, \fBscf_service_get_parent()\fR,
136 \fBscf_scope_get_service()\fR, \fBscf_scope_add_service()\fR, and
137 \fBscf_service_delete()\fR return 0. Otherwise, it returns -1.
141 The \fBscf_service_create()\fR function will fail if:
145 \fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR
148 The value of the \fIhandle\fR argument is \fINULL\fR.
154 \fB\fBSCF_ERROR_NO_MEMORY\fR\fR
157 There is not enough memory to allocate an \fBscf_service_t\fR.
163 \fB\fBSCF_ERROR_NO_RESOURCES\fR\fR
166 The server does not have adequate resources for a new scope handle.
171 The \fBscf_service_handle()\fR function will fail if:
175 \fB\fBSCF_ERROR_HANDLE_DESTROYED\fR\fR
178 The handle associated with \fIsvc\fR has been destroyed.
183 The \fBscf_service_get_name()\fR, \fBscf_service_get_parent()\fR, and
184 \fBscf_service_delete()\fR functions will fail if:
188 \fB\fBSCF_ERROR_DELETED\fR\fR
192 The service has been deleted by someone else.
198 \fB\fBSCF_ERROR_NOT_SET\fR\fR
202 The service is not set.
208 \fB\fBSCF_ERROR_NOT_BOUND\fR\fR
212 The handle is not bound.
218 \fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR
222 The connection to the repository was lost.
227 The \fBscf_service_delete()\fR function will fail if:
231 \fB\fBSCF_ERROR_EXISTS\fR\fR
234 The service contains instances.
240 \fB\fBSCF_ERROR_NO_RESOURCES\fR\fR
243 The server does not have adequate resources for a new scope handle.
248 The \fBscf_scope_add_service()\fR function will fail if:
252 \fB\fBSCF_ERROR_EXISTS\fR\fR
255 A {service,instance,property group} named \fIname\fR already exists.
260 The \fBscf_scope_get_service()\fR function will fail if:
264 \fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR
267 The storage mechanism that the repository server (\fBsvc.configd\fR(1M))
268 chose for the operation denied access.
274 \fB\fBSCF_ERROR_INTERNAL\fR\fR
277 An internal error occurred.
282 The \fBscf_scope_add_service()\fR and \fBscf_scope_get_service()\fR functions
287 \fB\fBSCF_ERROR_CONNECTION_BROKEN\fR\fR
291 The connection to the repository was lost.
297 \fB\fBSCF_ERROR_DELETED\fR\fR
301 The parent entity has been deleted.
307 \fB\fBSCF_ERROR_HANDLE_MISMATCH\fR\fR
311 The scope and service are not derived from the same handle.
317 \fB\fBSCF_ERROR_INVALID_ARGUMENT\fR\fR
321 The value of the \fIname\fR argument is not a valid service name.
327 \fB\fBSCF_ERROR_NO_RESOURCES\fR\fR
331 The server does not have the resources to complete the request.
337 \fB\fBSCF_ERROR_NOT_BOUND\fR\fR
341 The handle is not bound.
347 \fB\fBSCF_ERROR_NOT_FOUND\fR\fR
351 The service specified by \fIname\fR was not found.
357 \fB\fBSCF_ERROR_NOT_SET\fR\fR
361 The scope is not set.
366 The \fBscf_scope_add_service()\fR and \fBscf_service_delete()\fR functions will
371 \fB\fBSCF_ERROR_PERMISSION_DENIED\fR\fR
375 The user does not have sufficient privileges to create or delete a service.
381 \fB\fBSCF_ERROR_BACKEND_READONLY\fR\fR
385 The repository backend is read-only.
391 \fB\fBSCF_ERROR_BACKEND_ACCESS\fR\fR
395 The repository backend refused the modification.
400 The \fBscf_error\fR(3SCF) function can be used to retrieve the error value.
404 See \fBattributes\fR(5) for descriptions of the following attributes:
412 ATTRIBUTE TYPE ATTRIBUTE VALUE
414 Interface Stability Committed
422 \fBlibscf\fR(3LIB), \fBscf_error\fR(3SCF), \fBscf_handle_decode_fmri\fR(3SCF),
423 \fBscf_iter_service_pgs\fR(3SCF), \fBscf_iter_service_pgs_typed\fR(3SCF),
424 \fBscf_instance_create\fR(3SCF), \fBscf_pg_create\fR(3SCF),
425 \fBscf_scope_create\fR(3SCF), \fBscf_service_to_fmri\fR(3SCF),
426 \fBattributes\fR(5), \fBsmf\fR(5)