kstat2_optional_set_state, kstat2_optional_list, kstat2_optional_list_free - list or enable/disable optional kstats
cc [ flag... ] file... -lkstat2 [ library...] #include <kstat2.h>
kstat2_status_t kstat2_optional_set_state(kstat2_handle_t handle, const char *id, kstat2_opt_estate_t state);
kstat2_status_t kstat2_optional_list(kstat2_handle_t handle, kstat2_opt_info_t *opt_array[], uint32_t *entries);
kstat2_status_t kstat2_optional_list_free( kstat2_opt_info_t *opt_array[], uint32_t entries);
The kstat2_optional_set_state() function enables or disables the optional kstats identified by the id parameter.
The kstat2_optional_list() function provides a list of registered optional kstats in opt_array. The memory for opt_array is allocated through the kstat2_optional_list() function, and is freed by a call to the kstat2_optional_list_free() function.
The kstat2_optional_list_free() function releases the memory associated with a list of optional kstats obtained in a call to the kstat2_optional_list() function. opt_array will contain NULL on return from this function.
Upon successful completion, the kstat2_optional_set_state(), kstat2_optional_list(), and kstat2_optional_list_free() functions will return KSTAT2_S_OK.
If the optional kstats identifier is not recognised, or the caller does not have the correct privilege to enable or disable kstats, an error is returned.
The kstat2_optional_set_state() function will fail if:
The caller does not have the privilege to enable or disable optional kstats, or the authorization to change their persistence settings
The optional kstat identifier does not exist
There is not enough memory to perform the requested operation
The kstat2_optional_list() function will fail if:
Handle, opt_array or entries are NULL
Not enough memory available to process the optional kstats list
The kstat2_optional_list_free() function will fail if:
opt_array is NULL
Kernel statistics driver
Header
See attributes(7) for descriptions of the following attributes:
|
kstat2(3KSTAT2), kstat2_open(3KSTAT2), kstat2_close(3KSTAT2), libkstat2(3LIB), kstat2adm(8)
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.