Go to main content

man pages section 3: Extended Library Functions, Volume 2

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

kstat2_optional_list_free (3KSTAT2)

Name

kstat2_optional_set_state, kstat2_optional_list, kstat2_optional_list_free - list or enable/disable optional kstats

Synopsis

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);

Description

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.

Return Values

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.

Errors

The kstat2_optional_set_state() function will fail if:

KSTAT2_S_NO_PERM

The caller does not have the privilege to enable or disable optional kstats, or the authorization to change their persistence settings

KSTAT2_S_NOT_FOUND

The optional kstat identifier does not exist

KSTAT2_S_NO_MEM

There is not enough memory to perform the requested operation

The kstat2_optional_list() function will fail if:

KSTAT_S_INVAL_ARG

Handle, opt_array or entries are NULL

KSTAT2_S_NO_MEM

Not enough memory available to process the optional kstats list

The kstat2_optional_list_free() function will fail if:

KSTAT_S_INVAL_ARG

opt_array is NULL

Files

/dev/kstat

Kernel statistics driver

/usr/include/kstat2.h

Header

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
MT-Safe with exceptions

See Also

kstat2(3KSTAT2), kstat2_open(3KSTAT2), kstat2_close(3KSTAT2), libkstat2(3LIB), kstat2adm(8)

Notes

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.