Go to main content

man pages section 9: DDI and DKI Kernel Functions

Exit Print View

Updated: Thursday, June 13, 2019
 
 

kstat2_install (9F)

Name

kstat2_install - add a fully initialized kstat to the system

Synopsis

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

void kstat2_install(kstat2_t *ksp);

Interface Level

Solaris DDI specific (Solaris DDI)

Parameters

ksp

Pointer to a fully initialized kstat2(9S) structure.

Description

kstat2_install() function is used in conjunction with kstat2_create() function to allocate and initialize a kstat2 structure.

After a successful call to kstat2_create() function, the driver must perform any necessary initialization of the data section. The provider might also set the ks2_update, ks2_private, and ks2_lock fields if necessary. These fields should be set before kstat2_install() function is called.

Once the kstat is completely initialized, kstat2_install marks it as valid and you may start to access its data.

Return Values

None

Context

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

Examples

Example 1 Allocating and Initializing a kstat Structure

The method for allocating and initializing a kstat structure is generally as follows:

kstat2_t *ksp;
ksp = kstat2_create(pseg, npseg, zoneid,
    &data, ndata, flags, md);
if (ksp != NULL) {
     /* ... provider initialization, if necessary */
     kstat2_install(ksp);
}

See Also

kstat2_create(9F), kstat2_create_histogram(9F), kstat2_create_with_template(9F), kstat2_delete(9F), kstat2_lookup_template(9F), kstat2_nv_init(9F), kstat2(9S), kstat2_named(9S)