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
|
1 .\" Copyright 2016 Garrett D'Amore
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 .Dd Jan 27, 2016
7 .Dt KSTAT_NAMED_INIT 9F
8 .Os
9 .Sh NAME
10 .Nm kstat_named_init
11 .Nm kstat_named_setstr
12 .Nd initialize a named kstat
13 .Sh SYNOPSIS
14 .Hf <sys/types.h>
15 .br
16 .Hf <sys/kstat.h>
17 .Lp
18 .Ft void
19 .Fo kstat_named_init
20 .Fa "kstat_named_t *knp"
21 .Fa "const char *name"
22 .Fa "uchar_t data_type"
23 .Fc
24 .Lp
25 .Ft void
26 .Fo kstat_named_setstr
27 .Fa "kstat_named_t *knp"
28 .Fa "const char *str"
29 .Fc
30 .Sh INTERFACE LEVEL
31 Solaris DDI specific (Solaris DDI)
32 .Sh PARAMETERS
33 .Bl -tag -width Ds
34 .It Fa knp
35 Pointer to a
36 .Xr kstat_named 9S
37 structure.
38 .It Fa name
39 The name of the statistic.
40 .It Fa data_type
41 The type of value. This indicates which field of the
42 .Xr kstat_named 9S
43 structure should be used. Valid values are:
44 .Bl -tag -width Ds
45 .It Sy KSTAT_DATA_CHAR
46 The "char" field.
47 .
48 .It Sy KSTAT_DATA_LONG
49 The "long" field.
50 .
51 .It Sy KSTAT_DATA_ULONG
52 The "unsigned long" field.
53 .
54 .It Sy KSTAT_DATA_LONGLONG
55 Obsolete. Use
56 .Sy KSTAT_DATA_INT64 .
57 .
58 .It Sy KSTAT_DATA_ULONGLONG
59 Obsolete. Use
60 .Sy KSTAT_DATA_UINT64 .
61 .
62 .It Sy KSTAT_DATA_STRING
63 Arbitrary length "long string" field.
64 .
65 .It Sy KSTAT_DATA_TIME
66 The high resolution time stamp field. Note that this should only be used
67 for absolute time stamps, such as returned by
68 .Xr gethrtime 9F ,
69 and not for relative durations. For relative durations,
70 .Sy KSTAT_DATA_UINT64
71 is preferred.
72 .El
73 .It Fa str
74 Pointer to a
75 .Sy NULL- Ns No terminated
76 string.
77 .El
78 .Sh DESCRIPTION
79 .Fn kstat_named_init
80 associates a name and a type with a
81 .Xr kstat_named 9S
82 structure.
83 .Lp
84 .Fn kstat_named_setstr
85 associates
86 .Fa str
87 with the named kstat
88 .Fa knp .
89 It is an error for
90 .Fa knp
91 to be of type other than
92 .Sy KSTAT_DATA_STRING .
93 The string argument must remain valid even after the function that is calling
94 .Fn kstat_named_setstr
95 is returned. If
96 .Sy KSTAT_DATA_STRING
97 is used in a
98 persistent kstat the string argument must remain valid even after the module
99 that created the kstat is unloaded.
100 This is the only supported method of changing the value of long strings.
101 .Sh CONTEXT
102 .Fn kstat_named_init
103 and
104 .Fn kstat_named_setstr
105 can be called from user or kernel context.
106 .Sh RETURN VALUES
107 None.
108 .Sh SEE ALSO
109 .Xr gethrtime 9F ,
110 .Xr kstat_create 9F ,
111 .Xr kstat_install 9F ,
112 .Xr kstat 9S ,
113 .Xr kstat_named 9S
114 .Rs
115 .%B Writing Device Drivers
116 .Re
|