1kstat_read(3KSTAT)    Kernel Statistics Library Functions   kstat_read(3KSTAT)
2
3
4

NAME

6       kstat_read, kstat_write - read or write kstat data
7

SYNOPSIS

9       cc [ flag... ] file... -lkstat [ library... ]
10       #include <kstat.h>
11
12       kid_t kstat_read(kstat_ctl_t *kc, kstat_t *ksp, void *buf);
13
14
15       kid_t kstat_write(kstat_ctl_t *kc, kstat_t *ksp, void *buf);
16
17

DESCRIPTION

19       The  kstat_read()  function  gets  data  from  the kernel for the kstat
20       pointed to by ksp. The ksp->ks_data field  is  automatically  allocated
21       (or  reallocated)  to  be  large  enough  to  hold all of the data. The
22       ksp->ks_ndata  field  is  set   to   the   number   of   data   fields,
23       ksp->ks_data_size   is   set  to  the  total  size  of  the  data,  and
24       ksp->ks_snaptime is set to the high-resolution time at which  the  data
25       snapshot  was  taken.  If  buf  is   non-null,  the data is copied from
26       ksp->ks_data to buf.
27
28
29       The kstat_write() function writes data from buf, or  from  ksp->ks_data
30       if  buf  is  NULL,  to the corresponding kstat in the kernel.  Only the
31       superuser can use kstat_write().
32

RETURN VALUES

34       Upon successful completion, kstat_read() and kstat_write()  return  the
35       current  kstat chain ID (KCID). Otherwise, they return −1 and set errno
36       to indicate the error.
37

ERRORS

39       The kstat_read() and kstat_write() functions will fail if:
40
41       EACCES       An attempt was made to write to a non-writable kstat.
42
43
44       EAGAIN       The kstat was temporarily unavailable for reading or writ‐
45                    ing.
46
47
48       EINVAL       An attempt was made to write data to a kstat, but the num‐
49                    ber of elements or the data size does not match.
50
51
52       ENOMEM       Insufficient storage space is available.
53
54
55       ENXIO        The given kstat could not be located for reading or  writ‐
56                    ing.
57
58
59       EOVERFLOW    The data for the given kstat was too large to be stored in
60                    the structure.
61
62
63       EPERM        An  attempt  was  made  to   write   to   a   kstat,   but
64                    {PRIV_SYS_CONFIG} was not asserted in the effective privi‐
65                    lege set.
66
67

FILES

69       /dev/kstat    kernel statistics driver
70
71

ATTRIBUTES

73       See attributes(5) for descriptions of the following attributes:
74
75
76
77
78       ┌─────────────────────────────┬─────────────────────────────┐
79       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
80       ├─────────────────────────────┼─────────────────────────────┤
81       │Interface Stability          │Stable                       │
82       ├─────────────────────────────┼─────────────────────────────┤
83       │MT-Level                     │Unsafe                       │
84       └─────────────────────────────┴─────────────────────────────┘
85

SEE ALSO

87       kstat(3KSTAT),    kstat_chain_update(3KSTAT),     kstat_lookup(3KSTAT),
88       kstat_open(3KSTAT), attributes(5), privileges(5)
89
90
91
92SunOS 5.11                        3 Aug 2004                kstat_read(3KSTAT)
Impressum