Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man9f / net_kstat_create.9f
blob4dc32de1d5777d1153c2baaa0af188db9ef228cc
1 '\" te
2 .\" Copyright (C) 2008, 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 NET_KSTAT_CREATE 9F "May 1, 2008"
7 .SH NAME
8 net_kstat_create \- create and initialize a new kstat for a specific instance
9 of IP
10 .SH SYNOPSIS
11 .LP
12 .nf
13 #include <sys/types.h>
14 #include <sys/kstat.h>
15 #include <sys/neti.h>
17 \fBkstat_t\fR *\fBnet_kstat_create\fR(\fBnetid_t\fR \fInetid\fR, \fBchar\fR *\fImodule\fR,
18      \fBint\fR \fIinstance\fR, \fBchar\fR *\fIname\fR, \fBchar\fR *\fIclass\fR, \fBuchar_type\fR \fItype\fR,
19      \fBulong_t\fR \fIndata\fR, \fBuchar_t\fR \fIks_flag\fR);
20 .fi
22 .SH INTERFACE LEVEL
23 .sp
24 .LP
25 Solaris DDI specific (Solaris DDI).
26 .SH PARAMETERS
27 .sp
28 .ne 2
29 .na
30 \fB\fInetid\fR\fR
31 .ad
32 .RS 12n
33 \fBIP\fR instance identifier.
34 .RE
36 .sp
37 .ne 2
38 .na
39 \fB\fImodule\fR\fR
40 .ad
41 .RS 12n
42 The name of the provider's module (such as "\fBsd\fR", "\fBesp\fR", ...). The
43 "\fBcore\fR" kernel uses the name "unix".
44 .RE
46 .sp
47 .ne 2
48 .na
49 \fB\fIinstance\fR\fR
50 .ad
51 .RS 12n
52 The provider's instance number, as from \fBddi_get_instance\fR(9F). Modules
53 which do not have a meaningful instance number should use \fB0\fR.
54 .RE
56 .sp
57 .ne 2
58 .na
59 \fB\fIname\fR\fR
60 .ad
61 .RS 12n
62 A pointer to a string that uniquely identifies this structure. Only
63 \fBKSTAT_STRLEN \(mi 1\fR characters are significant.
64 .RE
66 .sp
67 .ne 2
68 .na
69 \fB\fIclass\fR\fR
70 .ad
71 .RS 12n
72 The general class that this kstat belongs to. The following classes are
73 currently in use: \fBdisk\fR, \fBtape\fR, \fBnet\fR, \fBcontroller\fR,
74 \fBvm\fR, \fBkvm\fR, \fBhat\fR, \fBstreams\fR, \fBkstat\fR, and \fBmisc\fR.
75 .RE
77 .sp
78 .ne 2
79 .na
80 \fB\fItype\fR\fR
81 .ad
82 .RS 12n
83 The type of \fBkstat\fR to allocate. Valid types are:
84 .sp
85 .ne 2
86 .na
87 \fB\fBKSTAT_TYPE_NAMED\fR\fR
88 .ad
89 .sp .6
90 .RS 4n
91 Allows more than one data record per \fBkstat\fR.
92 .RE
94 .sp
95 .ne 2
96 .na
97 \fB\fBKSTAT_TYPE_INTR\fR\fR
98 .ad
99 .sp .6
100 .RS 4n
101 Interrupt; only one data record per \fBkstat\fR.
105 .ne 2
107 \fB\fBKSTAT_TYPE_IO\fR\fR
109 .sp .6
110 .RS 4n
111 \fBI/O\fR; only one data record per \fBkstat\fR
117 .ne 2
119 \fB\fIndata\fR\fR
121 .RS 12n
122 The number of type-specific data records to allocate.
126 .ne 2
128 \fB\fIks_flag\fR\fR
130 .RS 12n
131 A bit-field of various flags for this \fBkstat\fR. \fIks_flag\fR is some
132 combination of:
134 .ne 2
136 \fB\fBKSTAT_FLAG_VIRTUAL\fR\fR
138 .sp .6
139 .RS 4n
140 Tells \fBkstat_create()\fR not to allocate memory for the \fBkstat\fR data
141 section; instead, the driver will set the \fBks_data\fR field to point to the
142 data it wishes to export. This provides a convenient way to export existing
143 data structures.
147 .ne 2
149 \fB\fBKSTAT_FLAG_WRITABLE\fR\fR
151 .sp .6
152 .RS 4n
153 Makes the \fBkstat\fR data section writable by root.
157 .ne 2
159 \fB\fBKSTAT_FLAG_PERSISTENT\fR\fR
161 .sp .6
162 .RS 4n
163 Indicates that this \fBkstat\fR is to be persistent over time. For persistent
164 \fBkstat\fRs, \fBkstat_delete\fR(9F) simply marks the \fBkstat\fR as dormant; a
165 subsequent \fBkstat_create()\fR reactivates the kstat. This feature is provided
166 so that statistics are not lost across driver close/open (such as raw disk
167 \fBI/O\fR on a disk with no mounted partitions.) Note: Persistent \fBkstat\fRs
168 cannot be virtual, since \fBks_data\fR points to garbage as soon as the driver
169 goes away.
174 .SH DESCRIPTION
177 The \fBnet_kstat_create()\fR function allocates and initializes a
178 \fBkstat\fR(9S) structure. See \fBkstat_create\fR(9F) for a complete discussion
179 of this function.
180 .SH RETURN VALUES
183 If successful, \fBnet_kstat_create()\fR returns a pointer to the allocated
184 \fBkstat\fR. \fINULL\fR is returned upon failure.
185 .SH CONTEXT
188 The \fBnet_kstat_create()\fR function may be called from user or kernel
189 context.
190 .SH ATTRIBUTES
193 See \fBattributes\fR(5) for descriptions of the following attributes:
198 box;
199 c | c
200 l | l .
201 ATTRIBUTE TYPE  ATTRIBUTE VALUE
203 Interface Stability     Committed
206 .SH SEE ALSO
209 \fBddi_get_instance\fR(9F), \fBkstat_create\fR(9F), \fBkstat_delete\fR(9F),
210 \fBnet_kstat_delete\fR(9F), \fBhook_t\fR(9S), \fBkstat_named\fR(9S)