Skip Navigation Links | |
Exit Print View | |
![]() |
man pages section 3: Extended Library Functions Oracle Solaris 10 1/13 Information Library |
Extended Library Functions - Part 1
Extended Library Functions - Part 2
Extended Library Functions - Part 3
Extended Library Functions - Part 4
Extended Library Functions - Part 5
ptree_add_row_to_table(3PICLTREE)
ptree_create_and_add_node(3PICLTREE)
ptree_create_and_add_prop(3PICLTREE)
ptree_get_first_prop(3PICLTREE)
ptree_get_frutree_parent(3PICLTREE)
ptree_get_next_by_col(3PICLTREE)
ptree_get_next_by_row(3PICLTREE)
ptree_get_next_prop(3PICLTREE)
ptree_get_node_by_path(3PICLTREE)
ptree_get_prop_by_name(3PICLTREE)
ptree_get_propinfo_by_name(3PICLTREE)
ptree_get_propval_by_name(3PICLTREE)
ptree_init_propinfo(3PICLTREE)
ptree_register_handler(3PICLTREE)
ptree_unregister_handler(3PICLTREE)
ptree_update_propval(3PICLTREE)
ptree_update_propval_by_name(3PICLTREE)
ptree_walk_tree_by_class(3PICLTREE)
rsm_create_localmemory_handle(3RSM)
rsm_free_interconnect_topology(3RSM)
rsm_free_localmemory_handle(3RSM)
rsm_get_interconnect_topology(3RSM)
rsm_intr_signal_wait_pollfd(3RSM)
rsm_memseg_export_create(3RSM)
rsm_memseg_export_destroy(3RSM)
rsm_memseg_export_publish(3RSM)
rsm_memseg_export_rebind(3RSM)
rsm_memseg_export_republish(3RSM)
rsm_memseg_export_unpublish(3RSM)
rsm_memseg_import_close_barrier(3RSM)
rsm_memseg_import_connect(3RSM)
rsm_memseg_import_destroy_barrier(3RSM)
rsm_memseg_import_disconnect(3RSM)
rsm_memseg_import_get_mode(3RSM)
rsm_memseg_import_init_barrier(3RSM)
rsm_memseg_import_open_barrier(3RSM)
rsm_memseg_import_order_barrier(3RSM)
rsm_memseg_import_set_mode(3RSM)
rsm_memseg_release_pollfd(3RSM)
SCF_Card_exchangeAPDU(3SMARTCARD)
SCF_Card_waitForCardRemoved(3SMARTCARD)
scf_entry_destroy_children(3SCF)
scf_instance_get_pg_composed(3SCF)
scf_instance_get_snapshot(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_property_values(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_service_add_instance(3SCF)
scf_service_get_instance(3SCF)
SCF_Session_freeInfo(3SMARTCARD)
SCF_Session_getInfo(3SMARTCARD)
SCF_Session_getSession(3SMARTCARD)
SCF_Session_getTerminal(3SMARTCARD)
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_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_Terminal_addEventListener(3SMARTCARD)
SCF_Terminal_close(3SMARTCARD)
SCF_Terminal_freeInfo(3SMARTCARD)
SCF_Terminal_getCard(3SMARTCARD)
SCF_Terminal_getInfo(3SMARTCARD)
SCF_Terminal_removeEventListener(3SMARTCARD)
SCF_Terminal_updateEventListener(3SMARTCARD)
SCF_Terminal_waitForCardAbsent(3SMARTCARD)
SCF_Terminal_waitForCardPresent(3SMARTCARD)
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)
- 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.
Thescf_simple_app_props_search() function queries for an exact match on a property in a property group. It takes a service instance FMRI, 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.
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() function will fail if:
The specified instance or property does not exist.
The instance FMRI is invalid or property name is NULL.
The memory allocation failed.
The connection handle is not bound.
The connection to the datastore is broken.
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:
|