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_property_values(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_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)
- simplified property read interface to Service Configuration Facility
cc [ flag… ] file… -lscf [ library… ] #include <libscf.h> scf_simple_prop_t *scf_simple_prop_get(scf_handle_t *handle, const char *instance, const char *pgname, const char *propname);
void scf_simple_prop_free(scf_simple_prop_t *prop);
scf_simple_app_props_t *scf_simple_app_props_get(scf_handle_t *handle, const char *instance);
void scf_simple_app_props_free(scf_simple_app_props_t *propblock);
const scf_simple_prop_t *scf_simple_app_props_next (const scf_simple_app_props_t *propblock,scf_simple_prop_t *last);
const scf_simple_prop_t *scf_simple_app_props_search (const scf_simple_app_props_t *propblock, const char *pgname, const char *propname);
ssize_t scf_simple_prop_numvalues(const scf_simple_prop_t *prop);
scf_type_t scf_simple_prop_type(const scf_simple_prop_t *prop);
const char *scf_simple_prop_name(const scf_simple_prop_t *prop);
const char *scf_simple_prop_pgname(const scf_simple_prop_t *prop);
uint8_t *scf_simple_prop_next_boolean(const scf_simple_prop_t *prop);
uint64_t *scf_simple_prop_next_count(const scf_simple_prop_t *prop);
int64_t *scf_simple_prop_next_integer(const scf_simple_prop_t *prop);
int64_t *scf_simple_prop_next_time(const scf_simple_prop_t *prop, int32_t *nsec);
char *scf_simple_prop_next_astring(const scf_simple_prop_t *prop);
char *scf_simple_prop_next_ustring(const scf_simple_prop_t *prop);
void *scf_simple_prop_next_opaque(const scf_simple_prop_t *prop, size_t *length);
void *scf_simple_prop_next_reset(const scf_simple_prop_t *prop);
The simplified read interface to the Service Configuration Facility deals with properties and blocks of properties.
The scf_simple_prop_get() function pulls a single property. The scf_simple_prop_*() functions operate on the resulting scf_simple_prop_t.
The application might need to get many properties or iterate through all properties. The scf_simple_app_props_get() function gets all properties from the service instance that are in property groups of type 'application'. Individual properties are pulled from the block using the scf_simple_app_props_next() function for iteration or scf_simple_app_props_search() to search. The pointer to the scf_simple_prop_t returned from iteration or searching can be acted upon using the scf_simple_prop_*() functions. Each scf_*_get() function has an accompanying scf_*_free function. The application does not free the pointer to the scf_simple_prop_t returned from the scf_simple_app_props_next() and scf_simple_app_props_search() calls. A free call is only used with a corresponding get call.
The scf_simple_prop_*() functions return references to the read-only in-memory copy of the property information. Any changes to this information results in unstable behavior and inaccurate results. The simplified read interface provides read access only, with no provisions to modify data in the service configuration facility repository.
The scf_simple_prop_get() function takes as arguments a bound handle, a service instance FMRI, and the property group and property name of a property. If handle is NULL, the library uses a temporary handle created for the purpose. If instance is NULL the library automatically finds the FMRI of the calling process. If pgname is NULL, the library uses the default application property group. The caller is responsible for freeing the returned property with scf_simple_prop_free().
The scf_simple_prop_free() function frees the scf_simple_prop_t allocated by scf_simple_prop_get().
The scf_simple_app_props_get() function takes a bound handle and a service instance FMRI and pulls all the application properties into an scf_simple_app_props_t. If handle is NULL, the library uses a temporary handle created for the purpose. If instance is NULL, the library looks up the instance FMRI of the process calling the function. The caller is responsible for freeing the scf_simple_app_props_t with scf_simple_app_props_free().
The scf_simple_app_props_free() function frees the scf_simple_app_props_t allocated by scf_simple_app_props_get().
The scf_simple_app_props_next() function iterates over each property in an scf_simple_app_props_t. It takes an scf_simple_app_props_t pointer and the last property returned from the previous call and returns the next property in the scf_simple_app_props_t. Because the property is a reference into the scf_simple_app_props_t, its lifetime extends only until that structure is freed.
The scf_simple_app_props_search() function queries for an exact match on a property in a property group. It takes an apps prop object, a property group name, and a property name, and returns a property pointer. Because the property is a reference into the scf_simple_app_props_t, its lifetime extends only until that structure is freed. If the property group name, pgname, is NULL, “application” is used.
The scf_simple_prop_numvalues() function takes a pointer to a property and returns the number of values in that property.
The scf_simple_prop_type() function takes a pointer to a property and returns the type of the property in an scf_type_t.
The scf_simple_prop_name() function takes a pointer to a property and returns a pointer to the property name string.
The scf_simple_prop_pgname() function takes a pointer to a property and returns a pointer to the property group name string. The scf_simple_prop_next_boolean(), scf_simple_prop_next_count(), scf_simple_prop_next_integer(), scf_simple_prop_next_astring(), and scf_simple_prop_next_ustring() functions take a pointer to a property and return the first value in the property. Subsequent calls iterate over all the values in the property. The property's internal iteration can be reset with scf_simple_prop_next_reset().
The scf_simple_prop_next_time() function takes a pointer to a property and the address of an allocated int32_t to hold the nanoseconds field, and returns the first value in the property. Subsequent calls iterate over the property values.
The scf_simple_prop_next_opaque() function takes a pointer to a property and the address of an allocated integer to hold the size of the opaque buffer. It returns the first value in the property. Subsequent calls iterate over the property values, as do the scf_simple_prop_next_*() functions. The scf_simple_prop_next_opaque() function writes the size of the opaque buffer into the allocated integer.
The scf_simple_prop_next_reset() function resets iteration on a property, so that a call to one of the scf_simple_prop_next_*() functions returns the first value in the property.
Upon successful completion, scf_simple_prop_get() returns a pointer to an allocated scf_simple_prop_t. Otherwise, it returns NULL.
Upon successful completion, scf_simple_app_props_get() returns a pointer to an allocated scf_simple_app_props_t. Otherwise, it returns NULL.
Upon successful completion, scf_simple_app_props_next() returns a pointer to an scf_simple_prop_t. Otherwise, it returns NULL.
Upon successful completion, scf_simple_app_props_search() returns a pointer to an scf_simple_prop_t. Otherwise, it returns NULL.
Upon successful completion, scf_simple_prop_numvalues() returns the number of values in a property. Otherwise, it returns -1.
Upon successful completion, scf_simple_prop_type() returns an scf_type_t. Otherwise, it returns -1.
Upon successful completion, scf_simple_prop_name() and scf_simple_prop_pgname() return character pointers. Otherwise, they return NULL.
Upon successful completion, scf_simple_prop_next_boolean(), scf_simple_prop_next_count(), scf_simple_prop_next_integer(), scf_simple_prop_next_time(), scf_simple_prop_next_astring(), scf_simple_prop_next_ustring(), and scf_simple_prop_next_opaque() return a pointer to the next value in the property. After all values have been returned, NULL is returned and SCF_ERROR_NONE is set. On failure, NULL is returned and the appropriate error value is set.
The scf_simple_prop_get() and scf_simple_app_props_get() functions will fail if:
The connection to the datastore is broken.
The instance FMRI is invalid or property name is NULL.
The memory allocation failed.
The connection handle is not bound.
The specified instance or property does not exist.
The caller is not authorized to read the property's value(s).
The scf_simple_app_props_next() function will fail if:
The value of the propblock argument is NULL.
The scf_simple_app_props_search() function will fail if:
The property was not found.
The value of the propblock or propname argument is NULL.
The scf_simple_prop_numvalues(), scf_simple_prop_type(), scf_simple_prop_name(), and scf_simple_prop_pgname() functions will fail if:
The property is NULL.
The scf_simple_prop_next_boolean(), scf_simple_prop_next_count(), scf_simple_prop_next_integer(), scf_simple_prop_next_time(), scf_simple_prop_next_astring(), scf_simple_prop_next_ustring(), and scf_simple_prop_next_opaque() functions will fail if:
The property is NULL.
The requested type does not match the property type.
Example 1 Simple Property Get
/* * In this example, we pull the property named "size" from the * default property group. We make sure that the property * isn't empty, and then copy it into the sizeval variable. */ scf_simple_prop_t *prop; ssize_t numvals; int64_t *sizeval; prop = scf_simple_prop_get( "svc://localhost/category/service/instance", NULL, "size"); numvals = scf_simple_prop_numvalues(prop); if(numvals > 0){ sizeval = scf_simple_prop_next_integer(prop); } scf_simple_prop_free(prop);
Example 2 Property Iteration
scf_simple_prop_t *prop; scf_simple_app_props_t *appprops; appprops = scf_simple_app_props_get( "svc://localhost/category/service/instance"); prop = scf_simple_app_props_next(appprops, NULL); while(prop != NULL) { /* * This iteration will go through every property in the * instance's application block. The user can use * the set of property functions to pull the values out * of prop, as seen in other examples. */ (...code acting on each property...) prop = scf_simple_app_props_next(appprops, prop); } scf_simple_app_props_free(appprops);
Example 3 Property Searching
/* * In this example, we pull the property block from the instance, * and then query it. Generally speaking, the simple get would * be used for an example like this, but for the purposes of * illustration, the non-simple approach is used. The property * is a list of integers that are pulled into an array. * Note how val is passed back into each call, as described above. */ scf_simple_app_props_t *appprops; scf_simple_prop_t *prop; int i; int64_t *intlist; ssize_t numvals; appprops = scf_simple_app_props_get( "svc://localhost/category/service/instance"); prop = scf_simple_app_props_search(appprops, "appname", "numlist"); if(prop != NULL){ numvals = scf_simple_prop_numvalues(prop); if(numvals > 0){ intlist = malloc(numvals * sizeof(int64_t)); val = scf_simple_prop_next_integer(prop); for(i=0, i < numvals, i++){ intlist[i] = *val; val = scf_simple_prop_next_integer(prop); } } } scf_simple_app_props_free(appprops);
See attributes(5) for descriptions of the following attributes:
|