kstat2_hold_bykid, kstat2_rele - hold and release a lock on a v2 kstat
#include <sys/types.h> #include <sys/kstat2.h> kstat2_t *kstat2_hold_bykid(kid_t ks_kid); void kstat2_rele(kstat2_t *ksp);
Solaris DDI specific (Solaris DDI)
kstat2_hold_bykid() function
ID of a previously created kstat.
kstat2_rele() function
v2 kstat handle previously obtained one of the kstat2_hold*() calls.
Before the values in a kstat are modified, the kstat must be locked. These functions provide the operations to search for and lock a kstat and to release that lock once changes have been made.
kstat2_hold_bykid() locates a kstat using its unique ID, locks it and returns a pointer to the kstat to the caller.
kstat2_rele() releases the lock on the given kstat.
The kstat2_hold_bykid() function returns a pointer to the locked kstat or NULL if a kstat is not found.
These functions can be called from any context.
kstat2_create(9F), kstat2_install(9F), kstat2(9S)
It is recommended that locks be held for the absolute minimum time necessary to prevent kstat readers from blocking for a long time.