1 '\" te 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" 7 .SH NAME 8 kstat_named_init, kstat_named_setstr \- initialize a named kstat 9 .SH SYNOPSIS 10 .LP 11 .nf 12 #include <sys/types.h> 13 #include <sys/kstat.h> 14 15 16 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); 19 .fi 20 21 .LP 22 .nf 23 \fBvoid\fR \fBkstat_named_setstr\fR(\fBkstat_named_t *\fR\fIknp\fR, \fBconst char *\fR\fIstr\fR); 24 .fi 25 26 .SH INTERFACE LEVEL 27 .LP 28 Solaris DDI specific (Solaris DDI) 29 .SH PARAMETERS 30 .ne 2 31 .na 32 \fB\fIknp\fR\fR 33 .ad 34 .RS 13n 35 Pointer to a \fBkstat_named\fR(9S) structure. 36 .RE 37 38 .sp 39 .ne 2 40 .na 41 \fB\fIname\fR\fR 42 .ad 43 .RS 13n 44 The name of the statistic. 45 .RE 46 47 .sp 48 .ne 2 49 .na 50 \fB\fIdata_type\fR\fR 51 .ad 52 .RS 13n 53 The type of value. This indicates which field of the \fBkstat_named\fR(9S) 54 structure should be used. Valid values are: 55 .sp 56 .ne 2 57 .na 58 \fB\fBKSTAT_DATA_CHAR\fR\fR 59 .ad 60 .RS 24n 61 The "\fBchar\fR" field. 62 .RE 63 64 .sp 65 .ne 2 66 .na 67 \fB\fBKSTAT_DATA_LONG\fR\fR 68 .ad 69 .RS 24n 70 The "\fBlong\fR" field. 71 .RE 72 73 .sp 74 .ne 2 75 .na 76 \fB\fBKSTAT_DATA_ULONG\fR\fR 77 .ad 78 .RS 24n 79 The "\fBunsigned long\fR" field. 80 .RE 81 82 .sp 83 .ne 2 84 .na 85 \fB\fBKSTAT_DATA_LONGLONG\fR\fR 86 .ad 87 .RS 24n 88 Obsolete. Use \fBKSTAT_DATA_INT64\fR. 89 .RE 90 91 .sp 92 .ne 2 93 .na 94 \fB\fBKSTAT_DATA_ULONGLONG\fR\fR 95 .ad 96 .RS 24n 97 Obsolete. Use \fBKSTAT_DATA_UINT64\fR. 98 .RE 99 100 .sp 101 .ne 2 102 .na 103 \fB\fBKSTAT_DATA_STRING\fR\fR 104 .ad 105 .RS 24n 106 Arbitrary length "\fBlong string\fR" field. 107 .RE 108 109 .RE 110 111 .sp 112 .ne 2 113 .na 114 \fB\fIstr\fR\fR 115 .ad 116 .RS 13n 117 Pointer to a \fBNULL\fR-terminated string. 118 .RE 119 120 .SH DESCRIPTION 121 .LP 122 \fBkstat_named_init()\fR associates a name and a type with a 123 \fBkstat_named\fR(9S) structure. 124 .sp 125 .LP 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. 133 .SH RETURN VALUES 134 .LP 135 None. 136 .SH CONTEXT 137 .LP 138 \fBkstat_named_init()\fR and \fBkstat_named_setstr()\fR can be called from user 139 or kernel context. 140 .SH SEE ALSO 141 .LP 142 \fBkstat_create\fR(9F), \fBkstat_install\fR(9F), \fBkstat\fR(9S), 143 \fBkstat_named\fR(9S) 144 .sp 145 .LP 146 \fIWriting Device Drivers\fR