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"
8 net_kstat_create \- create and initialize a new kstat for a specific instance
13 #include <sys/types.h>
14 #include <sys/kstat.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);
25 Solaris DDI specific (Solaris DDI).
33 \fBIP\fR instance identifier.
42 The name of the provider's module (such as "\fBsd\fR", "\fBesp\fR", ...). The
43 "\fBcore\fR" kernel uses the name "unix".
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.
62 A pointer to a string that uniquely identifies this structure. Only
63 \fBKSTAT_STRLEN \(mi 1\fR characters are significant.
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.
83 The type of \fBkstat\fR to allocate. Valid types are:
87 \fB\fBKSTAT_TYPE_NAMED\fR\fR
91 Allows more than one data record per \fBkstat\fR.
97 \fB\fBKSTAT_TYPE_INTR\fR\fR
101 Interrupt; only one data record per \fBkstat\fR.
107 \fB\fBKSTAT_TYPE_IO\fR\fR
111 \fBI/O\fR; only one data record per \fBkstat\fR
122 The number of type-specific data records to allocate.
131 A bit-field of various flags for this \fBkstat\fR. \fIks_flag\fR is some
136 \fB\fBKSTAT_FLAG_VIRTUAL\fR\fR
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
149 \fB\fBKSTAT_FLAG_WRITABLE\fR\fR
153 Makes the \fBkstat\fR data section writable by root.
159 \fB\fBKSTAT_FLAG_PERSISTENT\fR\fR
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
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
183 If successful, \fBnet_kstat_create()\fR returns a pointer to the allocated
184 \fBkstat\fR. \fINULL\fR is returned upon failure.
188 The \fBnet_kstat_create()\fR function may be called from user or kernel
193 See \fBattributes\fR(5) for descriptions of the following attributes:
201 ATTRIBUTE TYPE ATTRIBUTE VALUE
203 Interface Stability Committed
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)