Skip Navigation Links | |
Exit Print View | |
man pages section 3: Extended Library Functions, Volume 4 Oracle Solaris 11.1 Information Library |
Extended Library Functions, Volume 4
gl_customize_completion(3TECLA)
scf_count_ranges_destroy(3SCF)
scf_decoration_get_bundle(3SCF)
scf_decoration_get_layer(3SCF)
scf_decoration_get_value(3SCF)
scf_decoration_layer_from_string(3SCF)
scf_decoration_layer_to_string(3SCF)
scf_entry_destroy_children(3SCF)
scf_instance_get_decoration(3SCF)
scf_instance_get_pg_composed(3SCF)
scf_instance_get_snapshot(3SCF)
scf_instance_is_complete(3SCF)
scf_iter_decoration_values(3SCF)
scf_iter_instance_decorations(3SCF)
scf_iter_instance_pgs_composed(3SCF)
scf_iter_instance_pgs_typed(3SCF)
scf_iter_instance_pgs_typed_composed(3SCF)
scf_iter_instance_snapshots(3SCF)
scf_iter_next_decoration(3SCF)
scf_iter_property_decorations(3SCF)
scf_iter_service_decorations(3SCF)
scf_iter_service_instances(3SCF)
scf_iter_service_pgs_typed(3SCF)
scf_iter_snaplevel_pgs_typed(3SCF)
scf_pg_get_parent_instance(3SCF)
scf_pg_get_parent_service(3SCF)
scf_pg_get_parent_snaplevel(3SCF)
scf_pg_get_underlying_pg(3SCF)
scf_property_get_decoration(3SCF)
scf_property_get_value_at_layer(3SCF)
scf_service_add_instance(3SCF)
scf_service_get_decoration(3SCF)
scf_service_get_instance(3SCF)
scf_simple_app_props_free(3SCF)
scf_simple_app_props_get(3SCF)
scf_simple_app_props_next(3SCF)
scf_simple_app_props_search(3SCF)
scf_simple_prop_next_astring(3SCF)
scf_simple_prop_next_boolean(3SCF)
scf_simple_prop_next_count(3SCF)
scf_simple_prop_next_integer(3SCF)
scf_simple_prop_next_opaque(3SCF)
scf_simple_prop_next_reset(3SCF)
scf_simple_prop_next_time(3SCF)
scf_simple_prop_next_ustring(3SCF)
scf_simple_prop_numvalues(3SCF)
scf_simple_walk_instances(3SCF)
scf_snaplevel_get_instance_name(3SCF)
scf_snaplevel_get_next_snaplevel(3SCF)
scf_snaplevel_get_parent(3SCF)
scf_snaplevel_get_scope_name(3SCF)
scf_snaplevel_get_service_name(3SCF)
scf_snapshot_get_base_snaplevel(3SCF)
scf_tmpl_error_prop_tmpl(3SCF)
scf_tmpl_error_source_fmri(3SCF)
scf_tmpl_prop_cardinality(3SCF)
scf_tmpl_prop_common_name(3SCF)
scf_tmpl_prop_description(3SCF)
scf_tmpl_prop_internal_seps(3SCF)
scf_tmpl_prop_visibility(3SCF)
scf_tmpl_value_common_name(3SCF)
scf_tmpl_value_count_range_choices(3SCF)
scf_tmpl_value_count_range_constraints(3SCF)
scf_tmpl_value_description(3SCF)
scf_tmpl_value_in_constraint(3SCF)
scf_tmpl_value_int_range_choices(3SCF)
scf_tmpl_value_int_range_constraints(3SCF)
scf_tmpl_value_name_choices(3SCF)
scf_tmpl_value_name_constraints(3SCF)
scf_tmpl_visibility_to_string(3SCF)
scf_transaction_destroy_children(3SCF)
scf_transaction_property_change(3SCF)
scf_transaction_property_change_type(3SCF)
scf_transaction_property_delete(3SCF)
scf_transaction_property_new(3SCF)
scf_transaction_reset_all(3SCF)
scf_value_get_as_string_typed(3SCF)
scf_value_set_from_string(3SCF)
stmfCheckHostGroupInUse(3STMF)
stmfCheckTargetGroupInUse(3STMF)
stmfFreeViewResourceList(3STMF)
stmfGetHostGroupMembers(3STMF)
stmfGetLogicalUnitProperties(3STMF)
stmfGetProviderDataProt(3STMF)
stmfGetTargetGroupMembers(3STMF)
stmfGetTargetProperties(3STMF)
stmfGetViewLuNumberList(3STMF)
stmfGetViewResourceList(3STMF)
stmfRemoveFromHostGroup(3STMF)
stmfRemoveFromTargetGroup(3STMF)
stmfSetProviderDataProt(3STMF)
sysevent_bind_handle(3SYSEVENT)
sysevent_get_attr_list(3SYSEVENT)
sysevent_get_class_name(3SYSEVENT)
sysevent_get_pub_name(3SYSEVENT)
sysevent_get_subclass_name(3SYSEVENT)
sysevent_get_vendor_name(3SYSEVENT)
sysevent_post_event(3SYSEVENT)
sysevent_subscribe_event(3SYSEVENT)
sysevent_unbind_handle(3SYSEVENT)
sysevent_unsubscribe_event(3SYSEVENT)
volmgt_feature_enabled(3VOLMGT)
XTSOLgetClientAttributes(3XTSOL)
XTSOLgetPropAttributes(3XTSOL)
XTSOLgetWorkstationOwner(3XTSOL)
XTSOLsetWorkstationOwner(3XTSOL)
zs_pset_zone_get_pset(3ZONESTAT)
zs_pset_zone_get_zone(3ZONESTAT)
zs_pset_zone_property(3ZONESTAT)
zs_pset_zone_used_cpus(3ZONESTAT)
zs_pset_zone_used_pct(3ZONESTAT)
zs_pset_zone_used_time(3ZONESTAT)
zs_resource_property(3ZONESTAT)
zs_resource_total_time(3ZONESTAT)
zs_resource_total_uint64(3ZONESTAT)
zs_resource_used_pct(3ZONESTAT)
zs_resource_used_time(3ZONESTAT)
zs_resource_used_uint64(3ZONESTAT)
zs_resource_used_zone_pct(3ZONESTAT)
zs_resource_used_zone_time(3ZONESTAT)
zs_resource_used_zone_uint64(3ZONESTAT)
zs_zone_limit_uint64(3ZONESTAT)
zs_zone_limit_used_pct(3ZONESTAT)
zs_zone_limit_used_time(3ZONESTAT)
- iterate through the Service Configuration Facility repository
cc [ flag… ] file… -lscf [ library… ] #include <libscf.h> scf_iter_t *scf_iter_create(scf_handle_t *handle);
scf_handle_t *scf_iter_handle(scf_iter_t *iter);
void scf_iter_destroy(scf_iter_t *iter);
void scf_iter_reset(scf_iter_t *iter);
int scf_iter_handle_scopes(scf_iter_t *iter, const scf_handle_t *h);
int scf_iter_scope_services(scf_iter_t *iter, const scf_scope_t *parent);
int scf_iter_service_instances(scf_iter_t *iter, const scf_service_t *parent);
int scf_iter_service_pgs(scf_iter_t *iter, const scf_service_t *parent);
int scf_iter_service_pgs_typed(scf_iter_t *iter, const scf_service_t *parent, const char *pgtype);
int scf_iter_instance_snapshots(scf_iter_t *iter, const scf_instance_t *parent);
int scf_iter_snaplevel_pgs(scf_iter_t *iter, const scf_snaplevel_t *parent);
int scf_iter_snaplevel_pgs_typed(scf_iter_t *iter, const scf_snaplevel_t *parent, const char *pgtype);
int scf_iter_instance_pgs(scf_iter_t *iter, scf_instance_t *parent);
int scf_iter_instance_pgs_typed(scf_iter_t *iter, scf_instance_t *parent, const char *pgtype);
int scf_iter_instance_pgs_composed(scf_iter_t *iter, const scf_instance_t *instance, const scf_snapshot_t *snapshot);
int scf_iter_instance_pgs_typed_composed(scf_iter_t *iter, const scf_instance_t *instance, const scf_snapshot_t *snapshot, const char *pgtype);
int scf_iter_pg_properties(scf_iter_t *iter, const scf_propertygroup_t *parent);
int scf_iter_property_values(scf_iter_t *iter, const scf_property_t *parent);
int scf_iter_next_scope(scf_iter_t *iter, scf_scope_t *out);
int scf_iter_next_service(scf_iter_t *iter, scf_service_t *out);
int scf_iter_next_instance(scf_iter_t *iter, scf_instance_t *out);
int scf_iter_next_snapshot(scf_iter_t *iter, scf_snapshot_t *out);
int scf_iter_next_pg(scf_iter_t *iter, scf_propertygroup_t *out);
int scf_iter_next_property(scf_iter_t *iter, scf_property_t *out);
int scf_iter_next_value(scf_iter_t *iter, scf_value_t *out);
The scf_iter_create() function creates a new iterator associated with handle. The scf_iter_destroy() function destroys an iteration.
The scf_iter_reset() function releases any resources involved with an active iteration and returns the iterator to its initial state.
The scf_iter_handle_scopes(), scf_iter_scope_services(), scf_iter_service_instances(), scf_iter_instance_snapshots(), scf_iter_service_pgs(), scf_iter_instance_pgs(), scf_iter_snaplevel_pgs(), scf_iter_pg_properties(), and scf_iter_property_values() functions set up a new iteration of all the children parent of a particular type. The scf_iter_property_values() function will iterate over values in the order in which they were specified with scf_entry_add_value(3SCF).
The scf_iter_service_pgs_typed(), scf_iter_instance_pgs_typed(), and scf_iter_snaplevel_pgs_typed() functions iterate over the child property groups of parent, but restrict them to a particular property group type.
The scf_iter_instance_pgs_composed() function sets up a new iteration of the composed view of instance's children at the time snapshot was taken. If snapshot is NULL, the current properties are used. The composed view of an instance's properties is the union of the properties of the instance and its ancestors. Properties of the instance take precedence over properties of the service with the same name, including property group name. Property groups retrieved with this iterator might not have instance as their parent and properties retrieved from such property groups might not have the indicated property group as their parent. If instance and its parent have property groups with the same name but different types, the properties in the property group of the parent are excluded. The scf_iter_instance_pgs_typed_composed() function behaves as scf_iter_instance_pgs_composed(), except the property groups of the type pgtype are returned.
The scf_iter_next_scope(), scf_iter_next_service(), scf_iter_next_instance(), scf_iter_next_snapshot(), scf_iter_next_pg(), scf_iter_next_property(), and scf_iter_next_value() functions retrieve the next element of the iteration.
Upon successful completion, scf_iter_create() returns a pointer to a new iterator. Otherwise, it returns NULL.
Upon successful completion, scf_iter_handle() returns the handle associated with iter. Otherwise it returns NULL.
Upon successful completion, scf_iter_handle_scopes(), scf_iter_scope_services(), scf_iter_service_instances(), scf_iter_instance_snapshots(), scf_iter_service_pgs(), scf_iter_instance_pgs(), scf_iter_snaplevel_pgs(), scf_iter_pg_properties(), scf_iter_property_values(), scf_iter_service_pgs_typed(), scf_iter_instance_pgs_composed(), scf_iter_instance_pgs_typed(), scf_iter_instance_pgs_typed_composed(), and scf_iter_snaplevel_pgs_typed() return 0. Otherwise, they return -1.
Upon successful completion, scf_iter_next_scope(), scf_iter_next_service(), scf_iter_next_instance(), scf_iter_next_snapshot(), scf_iter_next_pg(), scf_iter_next_property(), and scf_iter_next_value() return 1. If the iterator is complete, they return 0. Otherwise, they return -1.
The scf_iter_create() function will fail if:
The handle argument is NULL.
There is no memory available.
The server does not have adequate resources for a new iteration.
The scf_iter_handle() function will fail if:
The handle associated with iter has been destroyed.
The scf_iter_next_value() function will fail if:
The value could not be read due to access restrictions.
The scf_iter_handle_scopes(), scf_iter_scope_services(), scf_iter_service_instances(), scf_iter_instance_snapshots(), scf_iter_service_pgs(), scf_iter_instance_pgs(), scf_iter_instance_pgs_composed(), scf_iter_snaplevel_pgs(), scf_iter_pg_properties(), scf_iter_property_values(), scf_iter_service_pgs_typed(), scf_iter_instance_pgs_typed(), scf_iter_instance_pgs_typed_composed(), and scf_iter_snaplevel_pgs_typed() functions will fail if:
The parent has been deleted.
The parent is not set.
The handle is not bound.
The connection to the repository was lost.
The iter and parent arguments are not derived from the same handle.
The scf_iter_service_pgs_typed(), scf_iter_instance_pgs_typed(), scf_iter_instance_pgs_typed_composed(), and scf_iter_snaplevel_pgs_typed() functions will fail if:
The pgtype argument is not a valid property group type.
The scf_iter_next_service(), scf_iter_next_instance(), scf_iter_next_snapshot(), scf_iter_next_pg(), scf_iter_next_property(), and scf_iter_next_value() functions will fail if:
The parent the iterator is attached to has been deleted.
The scf_iter_next_scope(), scf_iter_next_service(), scf_iter_next_instance(), scf_iter_next_snapshot(), scf_iter_next_pg(),scf_iter_next_property(), and scf_iter_next_value() functions will fail if:
The iterator is not set.
The requested object type does not match the type the iterator is walking.
The handle is not bound.
The iter and parent arguments are not derived from the same handle.
The connection to the repository was lost.
The scf_iter_scope_services(), scf_iter_service_instances(), scf_iter_service_pgs(), scf_iter_instance_snapshots(), scf_iter_instance_pgs(), scf_iter_instance_pgs_composed(), scf_iter_snaplevel_pgs(), scf_iter_pg_properties(), scf_iter_property_values(), scf_iter_service_pgs_typed(), scf_iter_instance_pgs_typed(), scf_iter_instance_pgs_typed_composed(), scf_iter_snaplevel_pgs_typed(), scf_iter_next_service(), scf_iter_next_instance(), scf_iter_next_snapshot(), scf_iter_next_pg(), and scf_iter_next_property() functions will fail if:
The server does not have the resources to complete the request.
The scf_error(3SCF) function can be used to retrieve the error value.
Example 1 Iterate over all instances under a service.
scf_iter_t *iter = scf_iter_create(handle); if (iter == NULL || scf_iter_service_instances(iter, parent) == -1) { /* failure */ } while ((r = scf_iter_next_instance(iter, child)) > 0) { /* process child */ } if (r < 0) { /* failure */ } scf_iter_destroy(iter);
Example 2 Connect to the repository, walk all services and instances and print their FMRIs.
scf_handle_t *handle = scf_handle_create(SCF_VERSION); scf_scope_t *scope = scf_scope_create(handle); scf_service_t *svc = scf_service_create(handle); scf_instance_t *inst = scf_instance_create(handle); scf_iter_t *svc_iter = scf_iter_create(handle); scf_iter_t *inst_iter = scf_iter_create(handle); size_t sz = scf_limit(SCF_LIMIT_MAX_FMRI_LENGTH) + 1; char *fmri = malloc(sz + 1); int r; if (handle == NULL || scope == NULL || svc == NULL || inst == NULL || svc_iter == NULL || inst_iter == NULL || fmri == NULL) { /* failure */ } if (scf_handle_bind(handle) == -1 || scf_handle_get_scope(handle, SCF_SCOPE_LOCAL, scope) == -1 || scf_iter_scope_services(svc_iter, scope) == -1) { /* failure */ } while ((r = scf_iter_next_service(svc_iter, svc)) > 0) { if (scf_service_to_fmri(svc, fmri, sz) < 0) { /* failure */ } puts(fmri); if (scf_iter_service_instances(inst_iter, svc) < 0) { /* failure */ } while ((r = scf_iter_next_instance(inst_iter, inst)) > 0) { if (scf_instance_to_fmri(inst, fmri, sz) < 0) { /* failure */ } puts(fmri); } if (r < 0) break; } if (r < 0) { /* failure */ } scf_handle_destroy(handle); scf_scope_destroy(scope); scf_service_destroy(svc); scf_instance_destroy(inst); scf_iter_destroy(svc_iter); scf_iter_destroy(inst_iter);
See attributes(5) for descriptions of the following attributes:
|
libscf(3LIB), scf_entry_add_value(3SCF), scf_error(3SCF), scf_handle_create(3SCF), attributes(5)