kstat2_map_uri, kstat2_uri_encode, kstat2_uri_decode - retrieve and manipulate kstat2 URIs
cc [ flag... ] file... -lkstat2 [ library...] #include <kstat2.h>
kstat2_status_t kstat2_map_uri(kstat2_map_t map, char **uri);
kstat2_status_t kstat2_nv_uri(kstat2_map_t map, const char *nv_name, char **uri);
kstat2_status_t kstat2_uri_encode(const char *unenc, char **enc);
kstat2_status_t kstat2_uri_decode(const char *enc, char **unenc);
The kstat2_map_uri() function retrieves the URI for a kstat2 map. The URI will be returned in the uri parameter. When the URI is no longer required the caller is responsible for disposing it with free().
The kstat2_nv_uri() function retrieves the URI for a kstat2 map name/value entry. The URI will be returned in the uri parameter. When the URI is no longer required the caller is responsible for disposing it with free().
The kstat2_uri_encode() function URI-uncodes a string representing a component of a kstat2 URI. Any URI-unsafe characters are replaced by their encoded equivalents and the resulting string is returned in the enc parameter. When the encoded string is no longer required the caller is responsible for disposing it with free().
The kstat2_uri_decode() function URI-decodes a string representing a component of a kstat2 URI. Any encoded characters are replaced by their unencoded equivalents and the resulting string is returned in the unenc parameter. When the encoded string is no longer required the caller is responsible for disposing of it with free().
Upon successful completion, the above functions will return KSTAT2_S_OK. If there is an error performing the requested operation, an error code will be returned.
The above functions will fail if:
The map, uri, enc, or unenc parameters are invalid
Memory could not be allocated for the data
kernel statistics driver
header
See the kstat2(3KSTAT2) manpage.
See attributes(7) for descriptions of the following attributes:
|
kstat2(3KSTAT2), kstat2_close(3KSTAT2), kstat2_close(3KSTAT2), kstat2_map_get(3KSTAT2), kstat2_map_get_userdata(3KSTAT2), kstat2_map_meta(3KSTAT2), kstat2_map_parent(3KSTAT2), kstat2_map_put_integer(3KSTAT2), kstat2_map_put_integers(3KSTAT2), kstat2_map_put_string(3KSTAT2), kstat2_map_put_strings(3KSTAT2), kstat2_map_remove(3KSTAT2), kstat2_map_set_data_cb(3KSTAT2), kstat2_map_set_destroy_cb(3KSTAT2), kstat2_map_set_tree_cb(3KSTAT2), kstat2_map_set_userdata(3KSTAT2), kstat2_map_size(3KSTAT2), kstat2_map_to_array(3KSTAT2), kstat2_mapiter_end(3KSTAT2), kstat2_mapiter_hasnext(3KSTAT2), kstat2_mapiter_next(3KSTAT2), kstat2_mapiter_remove(3KSTAT2), kstat2_mapiter_start(3KSTAT2), kstat2_mapref_alloc(3KSTAT2), kstat2_mapref_deref(3KSTAT2), kstat2_mapref_free(3KSTAT2), kstat2_nv_meta(3KSTAT2), kstat2_open(3KSTAT2), kstat2_status_string(3KSTAT2), kstat2_update(3KSTAT2), libkstat2(3LIB)
The kstat2 functions are MT-Safe with the exception that only one thread may actively use a kstat2_handle_t, or any object obtained through it, at any one time. Synchronization is required if multiple threads intend to share a kstat2_handle_t or any object obtained through it. Synchronization is left to the application.