1kstat_lookup(3KSTAT) Kernel Statistics Library Functions kstat_lookup(3KSTAT)
2
3
4
6 kstat_lookup, kstat_data_lookup - find a kstat by name
7
9 cc [ flag... ] file... -lkstat [ library...]
10 #include <kstat.h>
11
12 kstat_t *kstat_lookup(kstat_ctl_t *kc, char *ks_module, int ks_instance,
13 char *ks_name);
14
15
16 void *kstat_data_lookup(kstat_t *ksp, char *name);
17
18
20 The kstat_lookup() function traverses the kstat chain, kc->kc_chain,
21 searching for a kstat with the same ks_module, ks_instance, and ks_name
22 fields; this triplet uniquely identifies a kstat. If ks_module is
23 NULL, ks_instance is -1, or ks_name is NULL, those fields will be
24 ignored in the search. For example, kstat_lookup(kc, NULL, -1, "foo")
25 will find the first kstat with name "foo".
26
27
28 The kstat_data_lookup() function searches the kstat's data section for
29 the record with the specified name. This operation is valid only for
30 those kstat types that have named data records: KSTAT_TYPE_NAMED and
31 KSTAT_TYPE_TIMER.
32
34 The kstat_lookup() function returns a pointer to the requested kstat if
35 it is found. Otherwise it returns NULL and sets errno to indicate the
36 error.
37
38
39 The kstat_data_lookup() function returns a pointer to the requested
40 data record if it is found. Otherwise it returns NULL and sets errno to
41 indicate the error .
42
44 The kstat_lookup() and kstat_data_lookup() functions will fail if:
45
46 EINVAL An attempt was made to look up data for a kstat that was not
47 of type KSTAT_TYPE_NAMED or KSTAT_TYPE_TIMER.
48
49
50 ENOENT The requested kstat could not be found.
51
52
54 /dev/kstat kernel statistics driver
55
56
58 See attributes(5) for descriptions of the following attributes:
59
60
61
62
63 ┌─────────────────────────────┬─────────────────────────────┐
64 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
65 ├─────────────────────────────┼─────────────────────────────┤
66 │Interface Stability │Stable │
67 ├─────────────────────────────┼─────────────────────────────┤
68 │MT-Level │Unsafe │
69 └─────────────────────────────┴─────────────────────────────┘
70
72 kstat(3KSTAT), kstat_chain_update(3KSTAT), kstat_open(3KSTAT),
73 kstat_read(3KSTAT), attributes(5)
74
75
76
77SunOS 5.11 3 Aug 2004 kstat_lookup(3KSTAT)