Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
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.
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.
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]
cc [ flag.\|.\|. ] file.\|.\|. -lscf [ library.\|.\|. ] #include <libscf.h> scf_service_t *scf_service_create(scf_handle_t *handle);
scf_handle_t *scf_service_handle(scf_service_t *svc);
void scf_service_destroy(scf_service_t *svc);
int scf_service_get_parent(scf_service_t *svc, scf_scope_t *sc);
ssize_t scf_service_get_name(const scf_service_t *svc, char *buf, size_t size);
int scf_scope_get_service(const scf_scope_t *sc, const char *name, scf_service_t *svc);
int scf_scope_add_service(const scf_scope_t *sc, const char *name, scf_service_t *svc);
int scf_service_delete(scf_service_t *svc);
Services form the middle layer of the Service Configuration Facility repository tree. Services are children of a scope (see scf_scope_create(3SCF)) and have three sets of children: Property groups
These hold configuration information shared by all of the instances of the service. See scf_pg_create(3SCF), scf_iter_service_pgs(3SCF), and scf_iter_service_pgs_typed(3SCF).
A particular instantiation of the service. See scf_instance_create(3SCF).
A service groups one or more related instances and provides a shared configuration for them.
An scf_service_t is an opaque handle that can be set to a single service at any given time. The scf_service_create() function allocates and initializes a new scf_service_t bound to handle. The scf_service_destroy() function destroys and frees svc.
The scf_service_handle() function retrieves the handle to which svc is bound.
The scf_service_get_parent() function sets sc to the scope that is the parent of svc.
The scf_service_get_name() function retrieves the name of the service to which svc is set.
The scf_scope_get_service() function sets svc to the service specified by name in the scope specified by sc.
The scf_scope_add_service() function sets svc to a new service specified by name in the scope specified by sc.
The scf_service_delete() function deletes the service to which svc is set, as well as all of its children.
Upon successful completion, scf_service_create() returns a new scf_service_t. Otherwise, it returns NULL.
Upon successful completion, scf_service_handle() returns the handle to which svc is bound. Otherwise, it returns NULL.
Upon successful completion, scf_service_get_name() returns the length of the string written, not including the terminating null byte. Otherwise, it returns -1.
Upon successful completion, scf_service_get_parent(), scf_scope_get_service(), scf_scope_add_service(), and scf_service_delete() return 0. Otherwise, it returns -1.
The scf_service_create() function will fail if: SCF_ERROR_INVALID_ARGUMENT
The value of the handle argument is NULL.
There is not enough memory to allocate an scf_service_t.
The server does not have adequate resources for a new scope handle.
The scf_service_handle() function will fail if: SCF_ERROR_HANDLE_DESTROYED
The handle associated with svc has been destroyed.
The scf_service_get_name(), scf_service_get_parent(), and scf_service_delete() functions will fail if: SCF_ERROR_DELETED
The service has been deleted by someone else.
The service is not set.
The handle is not bound.
The connection to the repository was lost.
The scf_service_delete() function will fail if: SCF_ERROR_EXISTS
The service contains instances.
The server does not have adequate resources for a new scope handle.
The scf_scope_add_service() function will fail if: SCF_ERROR_EXISTS
A {service,instance,property group} named name already exists.
The scf_scope_get_service() function will fail if: SCF_ERROR_BACKEND_ACCESS
The storage mechanism that the repository server (svc.configd(8)) chose for the operation denied access.
An internal error occurred.
The scf_scope_add_service() and scf_scope_get_service() functions will fail if: SCF_ERROR_CONNECTION_BROKEN
The connection to the repository was lost.
The parent entity has been deleted.
The scope and service are not derived from the same handle.
The value of the name argument is not a valid service name.
The server does not have the resources to complete the request.
The handle is not bound.
The service specified by name was not found.
The scope is not set.
The scf_scope_add_service() and scf_service_delete() functions will fail if: SCF_ERROR_PERMISSION_DENIED
The user does not have sufficient privileges to create or delete a service.
The repository backend is read-only.
The repository backend refused the modification.
The scf_error(3SCF) function can be used to retrieve the error value.
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE ATTRIBUTE VALUE |
Interface Stability Committed |
MT-Level Safe |
libscf (3LIB), scf_error (3SCF), scf_handle_decode_fmri (3SCF), scf_instance_create (3SCF), scf_iter_service_pgs (3SCF), scf_iter_service_pgs_typed (3SCF), scf_pg_create (3SCF), scf_scope_create (3SCF), scf_service_to_fmri (3SCF), attributes (7), smf (7)