Kernel Statistics Library Functions kstatlookup(3KSTAT)
NAME
kstatlookup, kstatdatalookup - find a kstat by name
SYNOPSIS
cc [ flag... ] file... -lkstat [ library...]
#include
kstatt *kstatlookup(kstatctlt *kc, char *ksmodule, int ksinstance,
char *ksname);
void *kstatdatalookup(kstatt *ksp, char *name);
DESCRIPTION
The kstatlookup() function traverses the kstat chain, kc-
>kcchain, searching for a kstat with the same ksmodule,
ksinstance, and ksname fields; this triplet uniquely iden-
tifies a kstat. If ksmodule is NUL, ksinstance is -1,
or ksname is NUL, those fields will be ignored in the
search. For example, kstatlookup(kc, NUL, -1, "foo")
will find the first kstat with name "foo".
The kstatdatalookup() function searches the kstat's data
section for the record with the specified name. This opera-
tion is valid only for those kstat types that have named
data records: KSTATYPENAMED and KSTATYPETIMER.
RETURN VALUES
The kstatlookup() function returns a pointer to the
requested kstat if it is found. Otherwise it returns NUL
and sets errno to indicate the error.
The kstatdatalookup() function returns a pointer to the
requested data record if it is found. Otherwise it returns
NUL and sets errno to indicate the error .
ERORS
The kstatlookup() and kstatdatalookup() functions will
fail if:
EINVAL An attempt was made to look up data for a kstat
that was not of type KSTATYPENAMED or
KSTATYPETIMER.
ENOENT The requested kstat could not be found.
SunOS 5.11 Last change: 3 Aug 2004 1
Kernel Statistics Library Functions kstatlookup(3KSTAT)
FILES
/dev/kstat kernel statistics driver
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Stable
MT-Level Unsafe
SEE ALSO
kstat(3KSTAT), kstatchainupdate(3KSTAT),
kstatopen(3KSTAT), kstatread(3KSTAT), attributes(5)
SunOS 5.11 Last change: 3 Aug 2004 2
|