Go to main content

man pages section 9: DDI and DKI Kernel Functions

Exit Print View

Updated: Thursday, June 13, 2019

kstat2_install (9F)


kstat2_install - add a fully initialized kstat to the system


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

void kstat2_install(kstat2_t *ksp);

Interface Level

Solaris DDI specific (Solaris DDI)



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


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



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


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 */

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)