| KSTAT_KV_INIT(9) | Kernel Developer's Manual | KSTAT_KV_INIT(9) |
kstat_kv_init,
kstat_kv_unit_init,
KSTAT_KV_INITIALIZER,
KSTAT_KV_UNIT_INITIALIZER —
kernel statistic key/value data API
#include
<sys/kstat.h>
void
kstat_kv_init(struct kstat_kv
*kv, const char *key, enum
kstat_kv_type type);
void
kstat_kv_unit_init(struct kstat_kv
*kv, const char *key, enum
kstat_kv_type type, enum kstat_kv_unit
unit);
KSTAT_KV_INITIALIZER(const
char *name, enum kstat_kv_type type);
KSTAT_KV_UNIT_INITIALIZER(const
char *name, enum kstat_kv_type type,
enum kstat_kv_unit unit);
The kstat key/value data API supports the creation and maintenance of kstat_kv structures that can be exported to userland using the kstat API.
A kstat key/value data payload for a kstat
structure (created using
kstat_create(9) with
KSTAT_T_KV as the type
argument) is a series of kstat_kv structures in
memory. kstat_kv values are typed, and the memory used to store values of
different types is either inline as part of the structure, or is extra bytes
following a structure of a specified length.
kstat_kv_init()
initialises kv with a name specified as
key. The type of the value is specified as
type.
kstat_kv_unit_init()
initialises kv with a name specified as
key. The integer or counter type of the value is
specified as type, and specifies the units for the
values in unit.
A kstat_kv
structure can be initialised at compile time with the
KSTAT_KV_INITIALIZER()
macro. The kstat_kv structure will be declared with
the name key with the type of the values as
type.
A kstat_kv
structure can be initialised at compile time with the
KSTAT_KV_UNIT_INITIALIZER()
macro. The kstat_kv structure will be declared with
the name key with the integer or counter type of the
values as type, and specifies the units for the values
in unit.
These functions first appeared in OpenBSD 6.8.
David Gwynne <dlg@openbsd.org>
| August 10, 2020 | openbsd |