7964 Want usba hcdi manual pages
[unleashed.git] / usr / src / man / man3kstat / kstat_open.3kstat
blobe37e92a32361ad9976779a7a51c331484846029d
1 '\" te
2 .\" Copyright (c) 2004, 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_OPEN 3KSTAT "Aug 3, 2004"
7 .SH NAME
8 kstat_open, kstat_close \- initialize kernel statistics facility
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fBcc\fR[ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lkstat\fR [ \fIlibrary\fR\&.\|.\|.]
13 #include <kstat.h>
15 \fBkstat_ctl_t *\fR\fBkstat_open\fR(\fB\fR\fIvoid\fR);
16 .fi
18 .LP
19 .nf
20 \fBint\fR \fBkstat_close\fR(\fBkstat_ctl_t *\fR\fIkc\fR);
21 .fi
23 .SH DESCRIPTION
24 .sp
25 .LP
26 The \fBkstat_open()\fR function initializes a kstat control structure that
27 provides access to the kernel statistics library.  It returns a pointer to this
28 structure, which must be supplied as the \fIkc\fR argument in subsequent
29 \fBlibkstat\fR function calls.
30 .sp
31 .LP
32 The \fBkstat_close()\fR function frees all resources that were associated with
33 \fIkc\fR. This is performed automatically on \fBexit\fR(2) and \fBexecve\fR(2).
34 .SH RETURN VALUES
35 .sp
36 .LP
37 Upon successful completion, \fBkstat_open()\fR returns a pointer to a kstat
38 control structure.  Otherwise, it returns \fINULL\fR, no resources are
39 allocated, and \fBerrno\fR is set to indicate the error.
40 .sp
41 .LP
42 Upon successful completion, \fBkstat_close()\fR returns 0. Otherwise, \(mi1 is
43 returned and \fBerrno\fR is set to indicate the error.
44 .SH ERRORS
45 .sp
46 .LP
47 The \fBkstat_open()\fR function will fail if:
48 .sp
49 .ne 2
50 .na
51 \fB\fBENOMEM\fR\fR
52 .ad
53 .RS 13n
54 Insufficient storage space is available.
55 .RE
57 .sp
58 .ne 2
59 .na
60 \fB\fBEAGAIN\fR\fR
61 .ad
62 .RS 13n
63 The kstat was temporarily unavailable for reading or writing.
64 .RE
66 .sp
67 .ne 2
68 .na
69 \fB\fBENXIO\fR\fR
70 .ad
71 .RS 13n
72 The given kstat could not be located for reading.
73 .RE
75 .sp
76 .ne 2
77 .na
78 \fB\fBEOVERFLOW\fR\fR
79 .ad
80 .RS 13n
81 The data for the given kstat was too large to be stored in the structure.
82 .RE
84 .sp
85 .LP
86 The \fBkstat_open()\fR function can also return the error values for
87 \fBopen\fR(2).
88 .sp
89 .LP
90 The \fBkstat_close()\fR function can also return the error values for
91 \fBclose\fR(2).
92 .SH FILES
93 .sp
94 .ne 2
95 .na
96 \fB\fB/dev/kstat\fR\fR
97 .ad
98 .RS 14n
99 kernel statistics driver
102 .SH ATTRIBUTES
105 See \fBattributes\fR(5) for descriptions of the following attributes:
110 box;
111 c | c
112 l | l .
113 ATTRIBUTE TYPE  ATTRIBUTE VALUE
115 Interface Stability     Stable
117 MT-Level        Unsafe
120 .SH SEE ALSO
123 \fBclose\fR(2), \fBexecve\fR(2), \fBopen\fR(2), \fBexit\fR(2),
124 \fBkstat\fR(3KSTAT), \fBkstat_chain_update\fR(3KSTAT),
125 \fBkstat_lookup\fR(3KSTAT), \fBkstat_read\fR(3KSTAT), \fBattributes\fR(5)