Go to main content

man pages section 9: DDI and DKI Kernel Functions

Exit Print View

Updated: Thursday, June 13, 2019

kstat2_data_size (9F)


kstat2_data_size - calculate the total size required for a v2 kstat's data


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

size_t kstat2_data_size(kstat2_named_t *knp, uint_t ndata);

Interface Level

Solaris DDI specific (Solaris DDI)



Pointer to the first element in an array of kstat values (kvals).


Number of kvals in the array.


kstat2_data_size() function calculates the total amount of space in bytes, that is required to hold all of the kvals, their null terminated names, and any string or array values. Typically this might be called from a custom kstat_update() function and its return value is used to set the ks2_data_size field in the kstat2(9S) data-structure.

Return Values

The kstat2_data_size() function returns the amount of storage, in bytes, required to hold all of the kvals, their names and any variable values such as strings or arrays.


The kstat2_data_size() function can be called from any context.

See Also

kstat2_create(9F), kstat2_install(9F), kstat2(9S)