'\" te .\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved. .TH net_kstat_create 9F "1 May 2008" "SunOS 5.11" "Kernel Functions for Drivers" .SH NAME net_kstat_create \- create and initialize a new kstat for a specific instance of IP .SH SYNOPSIS .LP .nf #include #include #include \fBkstat_t\fR *\fBnet_kstat_create\fR(\fBnetid_t\fR \fInetid\fR, \fBchar\fR *\fImodule\fR, \fBint\fR \fIinstance\fR, \fBchar\fR *\fIname\fR, \fBchar\fR *\fIclass\fR, \fBuchar_type\fR \fItype\fR, \fBulong_t\fR \fIndata\fR, \fBuchar_t\fR \fIks_flag\fR); .fi .SH INTERFACE LEVEL .sp .LP Solaris DDI specific (Solaris DDI). .SH PARAMETERS .sp .ne 2 .mk .na \fB\fInetid\fR\fR .ad .RS 12n .rt \fBIP\fR instance identifier. .RE .sp .ne 2 .mk .na \fB\fImodule\fR\fR .ad .RS 12n .rt The name of the provider's module (such as "\fBsd\fR", "\fBesp\fR", ...). The "\fBcore\fR" kernel uses the name "unix". .RE .sp .ne 2 .mk .na \fB\fIinstance\fR\fR .ad .RS 12n .rt The provider's instance number, as from \fBddi_get_instance\fR(9F). Modules which do not have a meaningful instance number should use \fB0\fR. .RE .sp .ne 2 .mk .na \fB\fIname\fR\fR .ad .RS 12n .rt A pointer to a string that uniquely identifies this structure. Only \fBKSTAT_STRLEN \(mi 1\fR characters are significant. .RE .sp .ne 2 .mk .na \fB\fIclass\fR\fR .ad .RS 12n .rt The general class that this kstat belongs to. The following classes are currently in use: \fBdisk\fR, \fBtape\fR, \fBnet\fR, \fBcontroller\fR, \fBvm\fR, \fBkvm\fR, \fBhat\fR, \fBstreams\fR, \fBkstat\fR, and \fBmisc\fR. .RE .sp .ne 2 .mk .na \fB\fItype\fR\fR .ad .RS 12n .rt The type of \fBkstat\fR to allocate. Valid types are: .sp .ne 2 .mk .na \fB\fBKSTAT_TYPE_NAMED\fR\fR .ad .sp .6 .RS 4n Allows more than one data record per \fBkstat\fR. .RE .sp .ne 2 .mk .na \fB\fBKSTAT_TYPE_INTR\fR\fR .ad .sp .6 .RS 4n Interrupt; only one data record per \fBkstat\fR. .RE .sp .ne 2 .mk .na \fB\fBKSTAT_TYPE_IO\fR\fR .ad .sp .6 .RS 4n \fBI/O\fR; only one data record per \fBkstat\fR .RE .RE .sp .ne 2 .mk .na \fB\fIndata\fR\fR .ad .RS 12n .rt The number of type-specific data records to allocate. .RE .sp .ne 2 .mk .na \fB\fIks_flag\fR\fR .ad .RS 12n .rt A bit-field of various flags for this \fBkstat\fR. \fIks_flag\fR is some combination of: .sp .ne 2 .mk .na \fB\fBKSTAT_FLAG_VIRTUAL\fR\fR .ad .sp .6 .RS 4n Tells \fBkstat_create()\fR not to allocate memory for the \fBkstat\fR data section; instead, the driver will set the \fBks_data\fR field to point to the data it wishes to export. This provides a convenient way to export existing data structures. .RE .sp .ne 2 .mk .na \fB\fBKSTAT_FLAG_WRITABLE\fR\fR .ad .sp .6 .RS 4n Makes the \fBkstat\fR data section writable by root. .RE .sp .ne 2 .mk .na \fB\fBKSTAT_FLAG_PERSISTENT\fR\fR .ad .sp .6 .RS 4n Indicates that this \fBkstat\fR is to be persistent over time. For persistent \fBkstat\fRs, \fBkstat_delete\fR(9F) simply marks the \fBkstat\fR as dormant; a subsequent \fBkstat_create()\fR reactivates the kstat. This feature is provided so that statistics are not lost across driver close/open (such as raw disk \fBI/O\fR on a disk with no mounted partitions.) Note: Persistent \fBkstat\fRs cannot be virtual, since \fBks_data\fR points to garbage as soon as the driver goes away. .RE .RE .SH DESCRIPTION .sp .LP The \fBnet_kstat_create()\fR function allocates and initializes a \fBkstat\fR(9S) structure. See \fBkstat_create\fR(9F) for a complete discussion of this function. .SH RETURN VALUES .sp .LP If successful, \fBnet_kstat_create()\fR returns a pointer to the allocated \fBkstat\fR. \fINULL\fR is returned upon failure. .SH CONTEXT .sp .LP The \fBnet_kstat_create()\fR function may be called from user or kernel context. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Availabilitysystem/core-os _ Interface StabilityCommitted .TE .SH SEE ALSO .sp .LP \fBddi_get_instance\fR(9F), \fBkstat_create\fR(9F), \fBkstat_delete\fR(9F), \fBnet_kstat_delete\fR(9F), \fBhook_t\fR(9S), \fBkstat_named\fR(9S)