Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man9f / kstat_install.9f
blob4324cf1797884eb5406f85e9215f2519d4fbf4fe
1 '\" te
2 .\" Copyright (c) 1994, 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_INSTALL 9F "May 26, 1994"
7 .SH NAME
8 kstat_install \- add a fully initialized kstat to the system
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/types.h>
13 #include <sys/kstat.h>
17 \fBvoid\fR \fBkstat_install\fR(\fBkstat_t *\fR\fIksp\fR);
18 .fi
20 .SH INTERFACE LEVEL
21 .sp
22 .LP
23 Solaris DDI specific (Solaris DDI)
24 .SH PARAMETERS
25 .sp
26 .ne 2
27 .na
28 \fB\fIksp\fR\fR
29 .ad
30 .RS 7n
31 Pointer to a fully initialized \fBkstat\fR(9S) structure.
32 .RE
34 .SH DESCRIPTION
35 .sp
36 .LP
37 \fBkstat_install()\fR is used in conjunction with \fBkstat_create\fR(9F) to
38 allocate and initialize a \fBkstat\fR(9S) structure.
39 .sp
40 .LP
41 After a successful call to \fBkstat_create()\fR the driver must perform any
42 necessary initialization of the data section (such as setting the name fields
43 in a kstat of type  \fBKSTAT_TYPE_NAMED\fR). Virtual kstats must have the
44 \fBks_data\fR field set at this time. The provider may also set the
45 \fBks_update\fR, \fBks_private\fR, and \fBks_lock\fR fields if necessary.
46 .sp
47 .LP
48 Once the kstat is completely initialized, \fBkstat_install\fR is used to make
49 the kstat accessible to the outside world.
50 .SH RETURN VALUES
51 .sp
52 .LP
53 None.
54 .SH CONTEXT
55 .sp
56 .LP
57 \fBkstat_install()\fR can be called from user or kernel context.
58 .SH EXAMPLES
59 .LP
60 \fBExample 1 \fRAllocating and Initializing a \fBkstat\fR Structure
61 .sp
62 .LP
63 The method for allocating and initializing a \fBkstat\fR structure is generally
64 as follows:
66 .sp
67 .in +2
68 .nf
69 kstat_t *ksp;
70 ksp = kstat_create(module, instance, name, class, type, ndata, flags);
71 if (ksp) {      
72          /* ... provider initialization, if necessary */
73         kstat_install(ksp);
75 .fi
76 .in -2
78 .SH SEE ALSO
79 .sp
80 .LP
81 \fBkstat_create\fR(9F), \fBkstat_delete\fR(9F), \fBkstat_named_init\fR(9F),
82 \fBkstat\fR(9S)
83 .sp
84 .LP
85 \fIWriting Device Drivers\fR