Kernel Statistics Library Functions kstatread(3KSTAT)
NAME
kstatread, kstatwrite - read or write kstat data
SYNOPSIS
cc [ flag... ] file... -lkstat [ library... ]
#include
kidt kstatread(kstatctlt *kc, kstatt *ksp, void *buf);
kidt kstatwrite(kstatctlt *kc, kstatt *ksp, void *buf);
DESCRIPTION
The kstatread() function gets data from the kernel for the
kstat pointed to by ksp. The ksp->ksdata field is automati-
cally allocated (or reallocated) to be large enough to hold
all of the data. The ksp->ksndata field is set to the
number of data fields, ksp->ksdatasize is set to the total
size of the data, and ksp->kssnaptime is set to the high-
resolution time at which the data snapshot was taken. If buf
is non-null, the data is copied from ksp->ksdata to buf.
The kstatwrite() function writes data from buf, or from
ksp->ksdata if buf is NUL, to the corresponding kstat in
the kernel. Only the superuser can use kstatwrite().
RETURN VALUES
Upon successful completion, kstatread() and kstatwrite()
return the current kstat chain ID (KCID). Otherwise, they
return -1 and set errno to indicate the error.
ERORS
The kstatread() and kstatwrite() functions will fail if:
EACES An attempt was made to write to a non-writable
kstat.
EAGAIN The kstat was temporarily unavailable for read-
ing or writing.
EINVAL An attempt was made to write data to a kstat,
but the number of elements or the data size
does not match.
ENOMEM Insufficient storage space is available.
SunOS 5.11 Last change: 3 Aug 2004 1
Kernel Statistics Library Functions kstatread(3KSTAT)
ENXIO The given kstat could not be located for read-
ing or writing.
EOVERFLOW The data for the given kstat was too large to
be stored in the structure.
EPERM An attempt was made to write to a kstat, but
{PRIVSYSCONFIG} was not asserted in the
effective privilege set.
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),
kstatlookup(3KSTAT), kstatopen(3KSTAT), attributes(5),
privileges(5)
SunOS 5.11 Last change: 3 Aug 2004 2
|