2 .\" Copyright (c) 2006, Sun Microsystems, Inc., All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH KSTAT_NAMED_INIT 9F "Feb 29, 2008"
8 kstat_named_init, kstat_named_setstr \- initialize a named kstat
12 #include <sys/types.h>
13 #include <sys/kstat.h>
17 \fBvoid\fR \fBkstat_named_init\fR(\fBkstat_named_t *\fR\fIknp\fR, \fBconst char *\fR\fIname\fR,
18 \fBuchar_t\fR \fIdata_type\fR);
23 \fBvoid\fR \fBkstat_named_setstr\fR(\fBkstat_named_t *\fR\fIknp\fR, \fBconst char *\fR\fIstr\fR);
28 Solaris DDI specific (Solaris DDI)
35 Pointer to a \fBkstat_named\fR(9S) structure.
44 The name of the statistic.
53 The type of value. This indicates which field of the \fBkstat_named\fR(9S)
54 structure should be used. Valid values are:
58 \fB\fBKSTAT_DATA_CHAR\fR\fR
61 The "\fBchar\fR" field.
67 \fB\fBKSTAT_DATA_LONG\fR\fR
70 The "\fBlong\fR" field.
76 \fB\fBKSTAT_DATA_ULONG\fR\fR
79 The "\fBunsigned long\fR" field.
85 \fB\fBKSTAT_DATA_LONGLONG\fR\fR
88 Obsolete. Use \fBKSTAT_DATA_INT64\fR.
94 \fB\fBKSTAT_DATA_ULONGLONG\fR\fR
97 Obsolete. Use \fBKSTAT_DATA_UINT64\fR.
103 \fB\fBKSTAT_DATA_STRING\fR\fR
106 Arbitrary length "\fBlong string\fR" field.
117 Pointer to a \fBNULL\fR-terminated string.
122 \fBkstat_named_init()\fR associates a name and a type with a
123 \fBkstat_named\fR(9S) structure.
126 \fBkstat_named_setstr()\fR associates \fIstr\fR with the named kstat \fBknp\fR.
127 It is an error for \fBknp\fR to be of type other than \fBKSTAT_DATA_STRING\fR.
128 The string argument must remain valid even after the function that is calling
129 \fBkstat_named_setstr()\fR is returned. If \fBKSTAT_DATA_STRING\fR is used in a
130 persistent kstat the string argument must remain valid even after the module
131 that created the kstat is unloaded. This is the only supported method of changing
132 the value of long strings.
138 \fBkstat_named_init()\fR and \fBkstat_named_setstr()\fR can be called from user
142 \fBkstat_create\fR(9F), \fBkstat_install\fR(9F), \fBkstat\fR(9S),
143 \fBkstat_named\fR(9S)
146 \fIWriting Device Drivers\fR