[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    kstat_chain_update(3K) manual page Table of Contents

Name

kstat_chain_update - update the kstat header chain

Synopsis

cc [ flag... ] file... -lkstat [ library... ]

#include <kstat.h>

kid_t *kstat_chain_update(kstat_ctl_t *kc);

Description

kstat_chain_update() brings the user’s kstat header chain in sync with the kernel’s. The kstat chain is a linked list of kstat headers (kstat_t’s), pointed to by kc->kc_chain, which is initialized by kstat_open(3K) . This chain constitutes a list of all kstats currently in the system. During normal operation, the kernel will occasionally create new kstats and delete old ones, as various device instances come and go. When this happens, the user’s copy of the kstat chain becomes out of date.

kstat_chain_update() detects this by comparing the kernel’s current kstat chain ID (KCID), which is incremented every time the kstat chain changes, to the user’s KCID, kc->kc_chain_id. If the KCID ’s match, kstat_chain_update() does nothing. Otherwise, it deletes any invalid kstat headers from the user’s kstat chain, and adds any new ones, and sets kc->kc_chain_id to the new KCID . All other kstat headers in the user’s kstat chain are unmodified.

Return Values

kstat_chain_update() returns the new KCID if the kstat chain has changed, 0 if it hasn’t, or -1 on failure.

Files

/dev/kstat
kernel statistics driver

See Also

kstat(3K) , kstat_close(3K) , kstat_data_lookup(3K) , kstat_lookup(3K) , kstat_open(3K) , kstat_read(3K) , kstat_write(3K)


Table of Contents