Go to main content

man pages section 9: DDI and DKI Kernel Functions

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

kstat2_nv_init (9F)

Name

kstat2_nv_init - initialize a kstat2 name-value pair

Synopsis

#include <sys/types.h>
#include <sys/kstat2.h>

void kstat2_nv_init(kstat2_named_t *knp,
             const char *name, uchar_t type, uint16_t flags)

Interface Level

Solaris DDI specific (Solaris DDI)

Parameters

knp

Pointer to storage for a kstat2 name-value pair.

name

Null-terminated character string which is the name of an nv pair. Must not be NULL or an empty string.

type

Type of the data in the nv pair (see DESCRIPTION)

flags

Initial flags to be set on the name-value pair.

Description

kstat2_nv_init() function is used to initialize a single kstats v2 name-value pair structure.

The kstat2_named(9S) structure is initialized from the values passed in as parameters and the value field appropriate to the type is cleared.

name

Should point to a static null-terminated string which cannot be NULL or zero length. The length of a name is limited to 2^16-1 characters. In practice, the more concise the name, the better.

type

It defines one of the values from the enumerated type:

typedef struct kstat2_nv_type {
    KSTAT2_NVVT_INT     /* 64-bit unsigned integer */
    KSTAT2_NVVT_INTS    /* Array of 64-bit unsigned
                                   integers */
    KSTAT2_NVVT_STR     /* Null-terminated C string */
    KSTAT2_NVVT_STRS    /* Array of null-terminated C
                                   strings */
} kstat2_nv_type_t;
flag

It defines one of the values from the enumerated type:

typedef enum kstat2_nv_flag {
    KSTAT2_NVF_NONE         /* No flags present */
    KSTAT2_NVF_INVAL        /* Value is invalid */
} kstat2_nv_flag_t;

typically this will be KSTAT2_NVF_NONE as KSTAT2_NVF_INVAL is used to indicate that the value in the nv pair is invalid. If KSTAT2_NVF_INVAL is used, then it should be cleared once a valid value is set in the nv pair so that clients know that the data is valid.

Return Values

None

Context

The kstat2_nv_init() function can be called from user or kernel context.

See Also

kstat2_create(9F), kstat2_create_with_template(9F), kstat2_nv_setints(9F), kstat2_nv_setstr(9F), kstat2_nv_setstrs(9F), kstat2(9S), kstat2_named(9S)