Go to main content

man pages section 3: Remote Administration Daemon Module Interfaces

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

kstat-2 (3rad)

Name

kstat-2 - This API exposes v2 kernel statistics, or v2 kstats, to rad(8) clients.

Synopsis

#include <rad/client/2/kstat.h>
cc [ flag... ] file... -lkstat2_client [ library... ]

interface Kstat
const char * uri ; (ro)

rc_err_t kstat2_Kstat_getFlags(rc_instance_t *inst,
unsigned int *result,
kstat2_KstatError_t **error);

rc_err_t kstat2_Kstat_getMap(rc_instance_t *inst,
kstat2__rad_dict_string_Nv_t **result,
kstat2_KstatError_t **error);

rc_err_t kstat2_Kstat_getParent(rc_instance_t *inst,
rc_instance_t **result,
kstat2_KstatError_t **error);

rc_err_t kstat2_Kstat_getMapMetadata(rc_instance_t *inst,
kstat2_MapMeta_t **result,
kstat2_KstatError_t **error);

rc_err_t kstat2_Kstat_getNvMetadata(rc_instance_t *inst,
kstat2__rad_dict_string_NvMeta_t **result,
kstat2_KstatError_t **error);

typedef void (*kstat2_Kstat_kstatEvent_cb_f)(rc_instance_t *inst,
kstat2_KstatEvent_t *payload,
struct timespec ts,
void *arg);

rc_err_t kstat2_Kstat_subscribe_kstatEvent(rc_instance_t *inst,
kstat2_Kstat_kstatEvent_cb_f cb,
void *arg);

rc_err_t kstat2_Kstat_unsubscribe_kstatEvent(rc_instance_t *inst,
void **arg);

interface Control
rc_err_t kstat2_Control_update(rc_instance_t *inst,
kstat2_KstatError_t **error);

Enumerated Types
enum KstatErrorCode

typedef enum kstat2_KstatErrorCode {
K2KEC_KEC_NOT_FOUND = 0,
K2KEC_KEC_MOD_ERR = 1,
} kstat2_KstatErrorCode_t;

enum KstatEventType

typedef enum kstat2_KstatEventType {
K2KET_KET_DATA_ADD = 0,
K2KET_KET_DATA_REM = 1,
} kstat2_KstatEventType_t;

enum NvType

typedef enum kstat2_NvType {
K2NT_NVVT_STR = 0,
K2NT_NVVT_STRS = 1,
K2NT_NVVT_INT = 2,
K2NT_NVVT_INTS = 3,
K2NT_NVVT_KSTAT = 4,
} kstat2_NvType_t;

enum NvMetaType

typedef enum kstat2_NvMetaType {
K2NMT_NVMT_UNK = 0,
K2NMT_NVMT_ID = 1,
K2NMT_NVMT_CNT = 2,
K2NMT_NVMT_T_EPOCH = 3,
K2NMT_NVMT_T_REL = 4,
K2NMT_NVMT_T_ACC = 5,
K2NMT_NVMT_PCT = 6,
K2NMT_NVMT_ADDR = 7,
K2NMT_NVMT_TEMP_C = 8,
K2NMT_NVMT_RPM = 9,
K2NMT_NVMT_VOLT = 10,
K2NMT_NVMT_WATT = 11,
K2NMT_NVMT_CURR = 12,
K2NMT_NVMT_BYTES = 13,
K2NMT_NVMT_BITS = 14,
K2NMT_NVMT_STATE = 15,
K2NMT_NVMT_FREQ = 16,
} kstat2_NvMetaType_t;

enum MapMetaType

typedef enum kstat2_MapMetaType {
K2MMT_MMT_NONE = 0,
K2MMT_MMT_QUEUE = 1,
K2MMT_MMT_IO = 2,
K2MMT_MMT_INTR = 3,
K2MMT_MMT_TIMER = 4,
K2MMT_MMT_HIST = 5,
} kstat2_MapMetaType_t;

Structured Types
struct KstatError

typedef struct kstat2_KstatError kstat2_KstatError_t;

struct kstat2_KstatError {
kstat2_KstatErrorCode_t kke_errorCode;
char *kke_desc;
};


void kstat2_KstatError_free(kstat2_KstatError_t *in);

struct KstatEvent

typedef struct kstat2_KstatEvent kstat2_KstatEvent_t;

struct kstat2_KstatEvent {
kstat2_KstatEventType_t kke_type;
char *kke_uri;
};


void kstat2_KstatEvent_free(kstat2_KstatEvent_t *in);

struct Nv

typedef struct kstat2_Nv kstat2_Nv_t;

struct kstat2_Nv {
char *kn_name;
kstat2_NvType_t kn_type;
unsigned int kn_flags;
char *kn_string;
char **kn_strings;
int kn_strings_count;
unsigned long long *kn_integer;
unsigned long long *kn_integers;
int kn_integers_count;
rc_instance_t *kn_kstat;
};


void kstat2_Nv_free(kstat2_Nv_t *in);

struct NvMeta

typedef struct kstat2_NvMeta kstat2_NvMeta_t;

struct kstat2_NvMeta {
kstat2_NvMetaType_t knm_type;
unsigned int knm_flags;
unsigned long long knm_scale;
char *knm_desc;
};


void kstat2_NvMeta_free(kstat2_NvMeta_t *in);

struct MapMeta

typedef struct kstat2_MapMeta kstat2_MapMeta_t;

struct kstat2_MapMeta {
kstat2_MapMetaType_t kmm_type;
unsigned int kmm_flags;
char *kmm_desc;
};


void kstat2_MapMeta_free(kstat2_MapMeta_t *in);

Dictionaries
Dictionary { string : Nv }

typedef struct base_rad_dict kstat2__rad_dict_string_Nv_t;

Dictionary { string : NvMeta }

typedef struct base_rad_dict kstat2__rad_dict_string_NvMeta_t;

Description

KSTAT-2(3rad)               RAD Module Definitions               KSTAT-2(3rad)



NAME
       kstat - This API exposes v2 kernel statistics, or v2 kstats, to rad(8)
       clients.

SYNOPSIS
       #include <rad/client/2/kstat.h>
       cc [ flag... ] file... -lkstat2_client [ library... ]

   interface Kstat
       const char * uri ; (ro)

       rc_err_t kstat2_Kstat_getFlags(rc_instance_t *inst,
                                      unsigned int *result,
                                      kstat2_KstatError_t **error);

       rc_err_t kstat2_Kstat_getMap(rc_instance_t *inst,
                                    kstat2__rad_dict_string_Nv_t **result,
                                    kstat2_KstatError_t **error);

       rc_err_t kstat2_Kstat_getParent(rc_instance_t *inst,
                                       rc_instance_t **result,
                                       kstat2_KstatError_t **error);

       rc_err_t kstat2_Kstat_getMapMetadata(rc_instance_t *inst,
                                            kstat2_MapMeta_t **result,
                                            kstat2_KstatError_t **error);

       rc_err_t kstat2_Kstat_getNvMetadata(rc_instance_t *inst,
                                           kstat2__rad_dict_string_NvMeta_t **result,
                                           kstat2_KstatError_t **error);

       typedef void (*kstat2_Kstat_kstatEvent_cb_f)(rc_instance_t *inst,
                                                    kstat2_KstatEvent_t *payload,
                                                    struct timespec ts,
                                                    void *arg);

       rc_err_t kstat2_Kstat_subscribe_kstatEvent(rc_instance_t *inst,
                                                  kstat2_Kstat_kstatEvent_cb_f cb,
                                                  void *arg);

       rc_err_t kstat2_Kstat_unsubscribe_kstatEvent(rc_instance_t *inst,
                                                    void **arg);

   interface Control
       rc_err_t kstat2_Control_update(rc_instance_t *inst,
                                      kstat2_KstatError_t **error);

   Enumerated Types
       enum KstatErrorCode

           typedef enum kstat2_KstatErrorCode {
                K2KEC_KEC_NOT_FOUND = 0,
                K2KEC_KEC_MOD_ERR = 1,
           } kstat2_KstatErrorCode_t;

       enum KstatEventType

           typedef enum kstat2_KstatEventType {
                K2KET_KET_DATA_ADD = 0,
                K2KET_KET_DATA_REM = 1,
           } kstat2_KstatEventType_t;

       enum NvType

           typedef enum kstat2_NvType {
                K2NT_NVVT_STR = 0,
                K2NT_NVVT_STRS = 1,
                K2NT_NVVT_INT = 2,
                K2NT_NVVT_INTS = 3,
                K2NT_NVVT_KSTAT = 4,
           } kstat2_NvType_t;

       enum NvMetaType

           typedef enum kstat2_NvMetaType {
                K2NMT_NVMT_UNK = 0,
                K2NMT_NVMT_ID = 1,
                K2NMT_NVMT_CNT = 2,
                K2NMT_NVMT_T_EPOCH = 3,
                K2NMT_NVMT_T_REL = 4,
                K2NMT_NVMT_T_ACC = 5,
                K2NMT_NVMT_PCT = 6,
                K2NMT_NVMT_ADDR = 7,
                K2NMT_NVMT_TEMP_C = 8,
                K2NMT_NVMT_RPM = 9,
                K2NMT_NVMT_VOLT = 10,
                K2NMT_NVMT_WATT = 11,
                K2NMT_NVMT_CURR = 12,
                K2NMT_NVMT_BYTES = 13,
                K2NMT_NVMT_BITS = 14,
                K2NMT_NVMT_STATE = 15,
                K2NMT_NVMT_FREQ = 16,
           } kstat2_NvMetaType_t;

       enum MapMetaType

           typedef enum kstat2_MapMetaType {
                K2MMT_MMT_NONE = 0,
                K2MMT_MMT_QUEUE = 1,
                K2MMT_MMT_IO = 2,
                K2MMT_MMT_INTR = 3,
                K2MMT_MMT_TIMER = 4,
                K2MMT_MMT_HIST = 5,
           } kstat2_MapMetaType_t;

   Structured Types
       struct KstatError

           typedef struct kstat2_KstatError kstat2_KstatError_t;

           struct kstat2_KstatError {
                kstat2_KstatErrorCode_t kke_errorCode;
                char *kke_desc;
           };


           void kstat2_KstatError_free(kstat2_KstatError_t *in);

       struct KstatEvent

           typedef struct kstat2_KstatEvent kstat2_KstatEvent_t;

           struct kstat2_KstatEvent {
                kstat2_KstatEventType_t kke_type;
                char *kke_uri;
           };


           void kstat2_KstatEvent_free(kstat2_KstatEvent_t *in);

       struct Nv

           typedef struct kstat2_Nv kstat2_Nv_t;

           struct kstat2_Nv {
                char *kn_name;
                kstat2_NvType_t kn_type;
                unsigned int kn_flags;
                char *kn_string;
                char **kn_strings;
                int kn_strings_count;
                unsigned long long *kn_integer;
                unsigned long long *kn_integers;
                int kn_integers_count;
                rc_instance_t *kn_kstat;
           };


           void kstat2_Nv_free(kstat2_Nv_t *in);

       struct NvMeta

           typedef struct kstat2_NvMeta kstat2_NvMeta_t;

           struct kstat2_NvMeta {
                kstat2_NvMetaType_t knm_type;
                unsigned int knm_flags;
                unsigned long long knm_scale;
                char *knm_desc;
           };


           void kstat2_NvMeta_free(kstat2_NvMeta_t *in);

       struct MapMeta

           typedef struct kstat2_MapMeta kstat2_MapMeta_t;

           struct kstat2_MapMeta {
                kstat2_MapMetaType_t kmm_type;
                unsigned int kmm_flags;
                char *kmm_desc;
           };


           void kstat2_MapMeta_free(kstat2_MapMeta_t *in);

   Dictionaries
       Dictionary { string : Nv }

           typedef struct base_rad_dict kstat2__rad_dict_string_Nv_t;

       Dictionary { string : NvMeta }

           typedef struct base_rad_dict kstat2__rad_dict_string_NvMeta_t;

DESCRIPTION
       API com.oracle.solaris.rad.kstat [1]

       Two core interfaces are provided:

        1. Kstat - an object that represents a v2 kstat.

        2. Control - an administration object.

INTERFACES
   interface Kstat
       Provide kstat information for a particular kstat.

       The kstat interface represents a kernel statistic. To retrieve a
       specific instance, lookup based on the kstat URI.

       Kstat Properties
           const char * uri (read-only) -- the uri for this kstat

               rc_err_t kstat2_Kstat_get_uri(rc_instance_t *inst,
                                             char **result);

                   Get property value.

                   Arguments:

                   inst -- RAD instance

                   result -- Property value returned

       Kstat Methods
           rc_err_t kstat2_Kstat_getFlags(rc_instance_t *inst,
                                          unsigned int *result,
                                          kstat2_KstatError_t **error);

               Returns the bitwise kstat map flags.

               o   0x01 - Kstat has become dormant

               Arguments:

               inst -- RAD instance

               result

               error

           rc_err_t kstat2_Kstat_getMap(rc_instance_t *inst,
                                        kstat2__rad_dict_string_Nv_t **result,
                                        kstat2_KstatError_t **error);

               Get the map containing the current kstat values

               Returns the map containing the current kstat values this
               instance is associated with.

               Arguments:

               inst -- RAD instance

               result

               error

           rc_err_t kstat2_Kstat_getParent(rc_instance_t *inst,
                                           rc_instance_t **result,
                                           kstat2_KstatError_t **error);

               Get the parent kstat

               Arguments:

               inst -- RAD instance

               result

               error

           rc_err_t kstat2_Kstat_getMapMetadata(rc_instance_t *inst,
                                                kstat2_MapMeta_t **result,
                                                kstat2_KstatError_t **error);

               Get the metadata for the kstat map

               Arguments:

               inst -- RAD instance

               result

               error

           rc_err_t kstat2_Kstat_getNvMetadata(rc_instance_t *inst,
                                               kstat2__rad_dict_string_NvMeta_t **result,
                                               kstat2_KstatError_t **error);

               Returns available metadata for name/value pairs.

               Arguments:

               inst -- RAD instance

               result

               error

       Kstat Retrieve
           rc_err_t kstat2_Kstat__rad_get_name(adr_name_t **result,
                                               int n,
                                               ...);

               Obtain RAD name of a Kstat object.

               Arguments:

               result -- RAD name

               n -- Number of key-value pairs provided as variadic arguments

               ... -- Optional key-value pairs that compose the primary key

           rc_err_t kstat2_Kstat__rad_lookup(rc_conn_t *c,
                                             boolean_t strict,
                                             rc_instance_t **result,
                                             int n,
                                             ...);

               Lookup a Kstat instance.

               Construct a RAD name for the interface based on the provided
               key-value pairs and perform a lookup. If successful, instance
               reference is returned in the result.

               Arguments:

               c -- RAD connection handle

               strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning

               result -- RAD instance

               n -- Number of key-value pairs provided as variadic arguments

               ... -- Optional key-value pairs that compose the primary key

           rc_err_t kstat2_Kstat__rad_list(rc_conn_t *c,
                                           boolean_t strict,
                                           adr_pattern_scheme_t scheme,
                                           adr_name_t ***result,
                                           int *result_count,
                                           int n,
                                           ...);

               List RAD names of a available Kstat instances.

               Returns an array and array size of matching object names.

               Arguments:

               c -- RAD connection handle

               strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning

               scheme -- Apply glob (NS_GLOB) or regex (NS_REGEX) matching

               result -- Array of RAD names

               result_count -- Number of names in result array

               n -- Number of key-value pairs provided as variadic arguments

               ... -- Optional key-value pairs that compose the primary key

       Kstat Events
           kstatEvent

               An event is generated when a kstat is added or removed from the
               system. The event will contain the type of event that occurred
               and the URI of the kstat it occurred on. An event listener may
               be registered to any kstat interface and will receive all
               events that occur on itself and any subinstance below it in the
               tree.

               typedef void (*kstat2_Kstat_kstatEvent_cb_f)(rc_instance_t *inst,
                                                            kstat2_KstatEvent_t *payload,
                                                            struct timespec ts,
                                                            void *arg);

                   Function invoked when event "kstatEvent" occurs.

                   Arguments:

                   inst -- RAD instance that generated the event

                   payload -- Event payload

                   ts -- Time stamp

                   arg -- User data: custom parameter to invoke the function
                   with

               rc_err_t kstat2_Kstat_subscribe_kstatEvent(rc_instance_t *inst,
                                                          kstat2_Kstat_kstatEvent_cb_f cb,
                                                          void *arg);

                   Subscribe to event "kstatEvent".

                   Arguments:

                   inst -- RAD instance

                   cb -- Event callback function

                   arg -- User data: custom parameter to invoke the function
                   with

               rc_err_t kstat2_Kstat_unsubscribe_kstatEvent(rc_instance_t *inst,
                                                            void **arg);

                   Unsubscribe from event "kstatEvent".

                   Arguments:

                   inst -- RAD instance

                   arg -- User data returned

   interface Control
       Kstat administration interface.

       The Control interface provides an administrative API for the kstat v2
       infrastructure.

       Control Methods
           rc_err_t kstat2_Control_update(rc_instance_t *inst,
                                          kstat2_KstatError_t **error);

               Update the kstat chain

               Attempts to update the kstat chain. This will refresh kstat
               values, ready for when the next snapshot is taken.

               Arguments:

               inst -- RAD instance

               error

       Control Retrieve
           rc_err_t kstat2_Control__rad_get_name(adr_name_t **result,
                                                 int n,
                                                 ...);

               Obtain RAD name of a Control object.

               Arguments:

               result -- RAD name

               n -- Number of key-value pairs provided as variadic arguments

               ... -- Optional key-value pairs that compose the primary key

           rc_err_t kstat2_Control__rad_lookup(rc_conn_t *c,
                                               boolean_t strict,
                                               rc_instance_t **result,
                                               int n,
                                               ...);

               Lookup a Control instance.

               Construct a RAD name for the interface based on the provided
               key-value pairs and perform a lookup. If successful, instance
               reference is returned in the result.

               Arguments:

               c -- RAD connection handle

               strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning

               result -- RAD instance

               n -- Number of key-value pairs provided as variadic arguments

               ... -- Optional key-value pairs that compose the primary key

           rc_err_t kstat2_Control__rad_list(rc_conn_t *c,
                                             boolean_t strict,
                                             adr_pattern_scheme_t scheme,
                                             adr_name_t ***result,
                                             int *result_count,
                                             int n,
                                             ...);

               List RAD names of a available Control instances.

               Returns an array and array size of matching object names.

               Arguments:

               c -- RAD connection handle

               strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning

               scheme -- Apply glob (NS_GLOB) or regex (NS_REGEX) matching

               result -- Array of RAD names

               result_count -- Number of names in result array

               n -- Number of key-value pairs provided as variadic arguments

               ... -- Optional key-value pairs that compose the primary key

ENUMERATED TYPES
       enum KstatErrorCode

           typedef enum kstat2_KstatErrorCode {
                K2KEC_KEC_NOT_FOUND = 0,
                K2KEC_KEC_MOD_ERR = 1,
           } kstat2_KstatErrorCode_t;

           K2KEC_KEC_NOT_FOUND (0) -- The requested kstat object no longer
           exists.

           K2KEC_KEC_MOD_ERR (1) -- An unexpected error has occurred with this
           RAD module.

       enum KstatEventType

           typedef enum kstat2_KstatEventType {
                K2KET_KET_DATA_ADD = 0,
                K2KET_KET_DATA_REM = 1,
           } kstat2_KstatEventType_t;

           K2KET_KET_DATA_ADD (0) -- Kstat data added

           K2KET_KET_DATA_REM (1) -- Kstat data removed

       enum NvType -- Type of kstat value.

           typedef enum kstat2_NvType {
                K2NT_NVVT_STR = 0,
                K2NT_NVVT_STRS = 1,
                K2NT_NVVT_INT = 2,
                K2NT_NVVT_INTS = 3,
                K2NT_NVVT_KSTAT = 4,
           } kstat2_NvType_t;

           K2NT_NVVT_STR (0) -- Null-terminated C string.

           K2NT_NVVT_STRS (1) -- Array of null-terminated C strings.

           K2NT_NVVT_INT (2) -- 64-bit unsigned integer.

           K2NT_NVVT_INTS (3) -- Array of 64-bit unsigned integers.

           K2NT_NVVT_KSTAT (4) -- Nested Kstat instance.

       enum NvMetaType

           typedef enum kstat2_NvMetaType {
                K2NMT_NVMT_UNK = 0,
                K2NMT_NVMT_ID = 1,
                K2NMT_NVMT_CNT = 2,
                K2NMT_NVMT_T_EPOCH = 3,
                K2NMT_NVMT_T_REL = 4,
                K2NMT_NVMT_T_ACC = 5,
                K2NMT_NVMT_PCT = 6,
                K2NMT_NVMT_ADDR = 7,
                K2NMT_NVMT_TEMP_C = 8,
                K2NMT_NVMT_RPM = 9,
                K2NMT_NVMT_VOLT = 10,
                K2NMT_NVMT_WATT = 11,
                K2NMT_NVMT_CURR = 12,
                K2NMT_NVMT_BYTES = 13,
                K2NMT_NVMT_BITS = 14,
                K2NMT_NVMT_STATE = 15,
                K2NMT_NVMT_FREQ = 16,
           } kstat2_NvMetaType_t;

           K2NMT_NVMT_UNK (0) -- Unknown type

           K2NMT_NVMT_ID (1) -- Identifier, e.g. CPU type, CPU chip ID

           K2NMT_NVMT_CNT (2) -- Count, e.g. network packets, disk blocks

           K2NMT_NVMT_T_EPOCH (3) -- Time since UNIX epoch

           K2NMT_NVMT_T_REL (4) -- Time relative to boot

           K2NMT_NVMT_T_ACC (5) -- Accumulated time since boot

           K2NMT_NVMT_PCT (6) -- Percentage, 0-100

           K2NMT_NVMT_ADDR (7) -- Memory address

           K2NMT_NVMT_TEMP_C (8) -- Temperature in centigrade

           K2NMT_NVMT_RPM (9) -- Revolutions per minute

           K2NMT_NVMT_VOLT (10) -- Voltage

           K2NMT_NVMT_WATT (11) -- Power consumption

           K2NMT_NVMT_CURR (12) -- Current

           K2NMT_NVMT_BYTES (13) -- Byte count

           K2NMT_NVMT_BITS (14) -- Bit count

           K2NMT_NVMT_STATE (15) -- State, e.g. CPU state

           K2NMT_NVMT_FREQ (16) -- Frequence (Hz)

       enum MapMetaType

           typedef enum kstat2_MapMetaType {
                K2MMT_MMT_NONE = 0,
                K2MMT_MMT_QUEUE = 1,
                K2MMT_MMT_IO = 2,
                K2MMT_MMT_INTR = 3,
                K2MMT_MMT_TIMER = 4,
                K2MMT_MMT_HIST = 5,
           } kstat2_MapMetaType_t;

           K2MMT_MMT_NONE (0) -- Map contains no specific data type

           K2MMT_MMT_QUEUE (1) -- Map contains queue data

           K2MMT_MMT_IO (2) -- Map contains IO data

           K2MMT_MMT_INTR (3) -- Map contains interrupt data

           K2MMT_MMT_TIMER (4) -- Map contains timer data

           K2MMT_MMT_HIST (5) -- Map contains histogram data

STRUCTURED TYPES
       struct KstatError

           typedef struct kstat2_KstatError kstat2_KstatError_t;

           struct kstat2_KstatError {
                kstat2_KstatErrorCode_t kke_errorCode;
                char *kke_desc;
           };


           void kstat2_KstatError_free(kstat2_KstatError_t *in);

           Fields:

           kke_errorCode -- Error code for the error that occurred.

           kke_desc -- Description of the error that occurred.

       struct KstatEvent

           typedef struct kstat2_KstatEvent kstat2_KstatEvent_t;

           struct kstat2_KstatEvent {
                kstat2_KstatEventType_t kke_type;
                char *kke_uri;
           };


           void kstat2_KstatEvent_free(kstat2_KstatEvent_t *in);

           Fields:

           kke_type -- The type of event that occurred

           kke_uri -- The URI of the kstat the event is for

       struct Nv -- A kstat name/value pair.

           typedef struct kstat2_Nv kstat2_Nv_t;

           struct kstat2_Nv {
                char *kn_name;
                kstat2_NvType_t kn_type;
                unsigned int kn_flags;
                char *kn_string;
                char **kn_strings;
                int kn_strings_count;
                unsigned long long *kn_integer;
                unsigned long long *kn_integers;
                int kn_integers_count;
                rc_instance_t *kn_kstat;
           };


           void kstat2_Nv_free(kstat2_Nv_t *in);

           Fields:

           kn_name -- The name of the value.

           kn_type -- The type of the name/value pair.

           kn_flags

               Bitwise nv_flags field.

               o   0x01 - Value is invalid

           kn_string -- The string value.

           kn_strings -- The array of string values.

           kn_strings_count

           kn_integer -- The integer value.

           kn_integers -- The array of integer values.

           kn_integers_count

           kn_kstat -- Reference to a nested Kstat instance

       struct NvMeta

           typedef struct kstat2_NvMeta kstat2_NvMeta_t;

           struct kstat2_NvMeta {
                kstat2_NvMetaType_t knm_type;
                unsigned int knm_flags;
                unsigned long long knm_scale;
                char *knm_desc;
           };


           void kstat2_NvMeta_free(kstat2_NvMeta_t *in);

           Fields:

           knm_type -- Metadata type

           knm_flags

               Bitwise nv_meta_flags field.

               o   0x01 - Scale is a divisor not a multiplier

               o   0x02 - Value is immutable

               o   0x04 - Value is stable across Solaris releases

           knm_scale -- Scale of the value

           knm_desc -- Descriptive string

       struct MapMeta -- Metadata for the kstat map

           typedef struct kstat2_MapMeta kstat2_MapMeta_t;

           struct kstat2_MapMeta {
                kstat2_MapMetaType_t kmm_type;
                unsigned int kmm_flags;
                char *kmm_desc;
           };


           void kstat2_MapMeta_free(kstat2_MapMeta_t *in);

           Fields:

           kmm_type -- Metadata type

           kmm_flags

               Bitwise map_meta_flags field.

               o   0x01 - Map is stable across solaris releases

               o   0x02 - Map has privileged read access

           kmm_desc -- Descriptive string

DICTIONARIES
   Dictionary { string : Nv }
       Dictionary with a key type of string and a value type of Nv.

       typedef struct base_rad_dict kstat2__rad_dict_string_Nv_t;

       rc_err_t kstat2__rad_dict_string_Nv_get(kstat2__rad_dict_string_Nv_t *dict,
                                               const char *key,
                                               kstat2_Nv_t **result);

           Get the value for given key.

           Arguments:

           dict -- Dictionary

           key -- Key value

           result -- Value returned

       rc_err_t kstat2__rad_dict_string_Nv_put(kstat2__rad_dict_string_Nv_t *dict,
                                               const char *key,
                                               kstat2_Nv_t *value,
                                               kstat2_Nv_t **result);

           Put a key-value pair into the dictionary.

           Returns a previous value stored with the same key if one exists.

           Arguments:

           dict -- Dictionary

           key -- Key value

           value -- Value written

           result -- Original value for the key

       rc_err_t kstat2__rad_dict_string_Nv_contains(kstat2__rad_dict_string_Nv_t *dict,
                                                    const char *key);

           Check whether a key exists in the dictionary.

           Returns RCE_OK when key exists, RCE_CLIENT_NOTFOUND otherwise.

           Arguments:

           dict -- Dictionary

           key -- Key value

       rc_err_t kstat2__rad_dict_string_Nv_remove(kstat2__rad_dict_string_Nv_t *dict,
                                                  const char *key,
                                                  kstat2_Nv_t **result);

           Remove key-value pair from the dictionary.

           Returns RCE_OK when key was sucessfully removed,
           RCE_CLIENT_NOTFOUND otherwise.

           Arguments:

           dict -- Dictionary

           key -- Key value

           result -- Original value for the key

       rc_err_t kstat2__rad_dict_string_Nv_keys(kstat2__rad_dict_string_Nv_t *dict,
                                                char ***result,
                                                int *count);

           Get list of keys from the dictionary.

           Memory associated with the result array should be freed by the
           user.

           Arguments:

           dict -- Dictionary

           result -- Array of dictionary keys

           count -- Number of items in result array

       rc_err_t kstat2__rad_dict_string_Nv_values(kstat2__rad_dict_string_Nv_t *dict,
                                                  kstat2_Nv_t ***result,
                                                  int *count);

           Get list of values from the dictionary.

           Memory associated with the result array should be freed by the
           user.

           Arguments:

           dict -- Dictionary

           result -- Array of dictionary values

           count -- Number of items in result array

       unsigned int kstat2__rad_dict_string_Nv_size(kstat2__rad_dict_string_Nv_t *dict);

           Get number of key-value pairs in the dictionary.

           Arguments:

           dict -- Dictionary

       kstat2__rad_dict_string_Nv_t * kstat2__rad_dict_string_Nv_create(const rc_instance_t *inst);

           Create a new, empty dictionary.

           Returns a pointer to the dictionary, or NULL on error.

           Arguments:

           inst -- RAD instance

       void kstat2__rad_dict_string_Nv_free(kstat2__rad_dict_string_Nv_t *dict);

           Destroy the dictionary and release the allocated memory.

           Arguments:

           dict -- Dictionary

       rc_err_t kstat2__rad_dict_string_Nv_map(kstat2__rad_dict_string_Nv_t *dict,
                                               rc_err_t(*func)(const char *, kstat2_Nv_t *, void *),
                                               void *arg);

           Invoke a function with each key-value pair in the dictionary.

           Arguments:

           dict -- Dictionary

           func -- Function to invoke

               The arguments are: key, value, user-data.

           arg -- User data: custom parameter to invoke the function with

   Dictionary { string : NvMeta }
       Dictionary with a key type of string and a value type of NvMeta.

       typedef struct base_rad_dict kstat2__rad_dict_string_NvMeta_t;

       rc_err_t kstat2__rad_dict_string_NvMeta_get(kstat2__rad_dict_string_NvMeta_t *dict,
                                                   const char *key,
                                                   kstat2_NvMeta_t **result);

           Get the value for given key.

           Arguments:

           dict -- Dictionary

           key -- Key value

           result -- Value returned

       rc_err_t kstat2__rad_dict_string_NvMeta_put(kstat2__rad_dict_string_NvMeta_t *dict,
                                                   const char *key,
                                                   kstat2_NvMeta_t *value,
                                                   kstat2_NvMeta_t **result);

           Put a key-value pair into the dictionary.

           Returns a previous value stored with the same key if one exists.

           Arguments:

           dict -- Dictionary

           key -- Key value

           value -- Value written

           result -- Original value for the key

       rc_err_t kstat2__rad_dict_string_NvMeta_contains(kstat2__rad_dict_string_NvMeta_t *dict,
                                                        const char *key);

           Check whether a key exists in the dictionary.

           Returns RCE_OK when key exists, RCE_CLIENT_NOTFOUND otherwise.

           Arguments:

           dict -- Dictionary

           key -- Key value

       rc_err_t kstat2__rad_dict_string_NvMeta_remove(kstat2__rad_dict_string_NvMeta_t *dict,
                                                      const char *key,
                                                      kstat2_NvMeta_t **result);

           Remove key-value pair from the dictionary.

           Returns RCE_OK when key was sucessfully removed,
           RCE_CLIENT_NOTFOUND otherwise.

           Arguments:

           dict -- Dictionary

           key -- Key value

           result -- Original value for the key

       rc_err_t kstat2__rad_dict_string_NvMeta_keys(kstat2__rad_dict_string_NvMeta_t *dict,
                                                    char ***result,
                                                    int *count);

           Get list of keys from the dictionary.

           Memory associated with the result array should be freed by the
           user.

           Arguments:

           dict -- Dictionary

           result -- Array of dictionary keys

           count -- Number of items in result array

       rc_err_t kstat2__rad_dict_string_NvMeta_values(kstat2__rad_dict_string_NvMeta_t *dict,
                                                      kstat2_NvMeta_t ***result,
                                                      int *count);

           Get list of values from the dictionary.

           Memory associated with the result array should be freed by the
           user.

           Arguments:

           dict -- Dictionary

           result -- Array of dictionary values

           count -- Number of items in result array

       unsigned int kstat2__rad_dict_string_NvMeta_size(kstat2__rad_dict_string_NvMeta_t *dict);

           Get number of key-value pairs in the dictionary.

           Arguments:

           dict -- Dictionary

       kstat2__rad_dict_string_NvMeta_t * kstat2__rad_dict_string_NvMeta_create(const rc_instance_t *inst);

           Create a new, empty dictionary.

           Returns a pointer to the dictionary, or NULL on error.

           Arguments:

           inst -- RAD instance

       void kstat2__rad_dict_string_NvMeta_free(kstat2__rad_dict_string_NvMeta_t *dict);

           Destroy the dictionary and release the allocated memory.

           Arguments:

           dict -- Dictionary

       rc_err_t kstat2__rad_dict_string_NvMeta_map(kstat2__rad_dict_string_NvMeta_t *dict,
                                                   rc_err_t(*func)(const char *, kstat2_NvMeta_t *, void *),
                                                   void *arg);

           Invoke a function with each key-value pair in the dictionary.

           Arguments:

           dict -- Dictionary

           func -- Function to invoke

               The arguments are: key, value, user-data.

           arg -- User data: custom parameter to invoke the function with

VERSION
       2.0

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

       +--------------------+----------------------------------------+
       |  ATTRIBUTE TYPE    |            ATTRIBUTE VALUE             |
       +--------------------+----------------------------------------+
       |Availability        | system/management/rad/module/rad-kstat |
       +--------------------+----------------------------------------+
       |Interface Stability | Private                                |
       +--------------------+----------------------------------------+

SEE ALSO
       rad(8)

NOTES
        1. Accessing Python documentation for this module:

           $ pydoc rad.bindings.com.oracle.solaris.rad.kstat_2





Solaris 11.4                      2017-02-01                     KSTAT-2(3rad)