1kstat_open(3KSTAT) Kernel Statistics Library Functions kstat_open(3KSTAT)
2
3
4
6 kstat_open, kstat_close - initialize kernel statistics facility
7
9 cc[ flag... ] file... -lkstat [ library...]
10 #include <kstat.h>
11
12 kstat_ctl_t *kstat_open(void);
13
14
15 int kstat_close(kstat_ctl_t *kc);
16
17
19 The kstat_open() function initializes a kstat control structure that
20 provides access to the kernel statistics library. It returns a pointer
21 to this structure, which must be supplied as the kc argument in subse‐
22 quent libkstat function calls.
23
24
25 The kstat_close() function frees all resources that were associated
26 with kc. This is performed automatically on exit(2) and execve(2).
27
29 Upon successful completion, kstat_open() returns a pointer to a kstat
30 control structure. Otherwise, it returns NULL, no resources are allo‐
31 cated, and errno is set to indicate the error.
32
33
34 Upon successful completion, kstat_close() returns 0. Otherwise, −1 is
35 returned and errno is set to indicate the error.
36
38 The kstat_open() function will fail if:
39
40 ENOMEM Insufficient storage space is available.
41
42
43 EAGAIN The kstat was temporarily unavailable for reading or writ‐
44 ing.
45
46
47 ENXIO The given kstat could not be located for reading.
48
49
50 EOVERFLOW The data for the given kstat was too large to be stored in
51 the structure.
52
53
54
55 The kstat_open() function can also return the error values for open(2).
56
57
58 The kstat_close() function can also return the error values for
59 close(2).
60
62 /dev/kstat kernel statistics driver
63
64
66 See attributes(5) for descriptions of the following attributes:
67
68
69
70
71 ┌─────────────────────────────┬─────────────────────────────┐
72 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
73 ├─────────────────────────────┼─────────────────────────────┤
74 │Interface Stability │Stable │
75 ├─────────────────────────────┼─────────────────────────────┤
76 │MT-Level │Unsafe │
77 └─────────────────────────────┴─────────────────────────────┘
78
80 close(2), execve(2), open(2), exit(2), kstat(3KSTAT),
81 kstat_chain_update(3KSTAT), kstat_lookup(3KSTAT), kstat_read(3KSTAT),
82 attributes(5)
83
84
85
86SunOS 5.11 3 Aug 2004 kstat_open(3KSTAT)