9022 loader.efi: module placement must check memory map
[unleashed.git] / share / man / man3kstat / kstat_lookup.3kstat
blob3458f61f210c5ce4bcb22b815ceffca1008a73a9
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_LOOKUP 3KSTAT "Aug 3, 2004"
7 .SH NAME
8 kstat_lookup, kstat_data_lookup \- find a kstat by name
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_t *\fR\fBkstat_lookup\fR(\fBkstat_ctl_t *\fR\fIkc\fR, \fBchar *\fR\fIks_module\fR, \fBint\fR \fIks_instance\fR,
16      \fBchar *\fR\fIks_name\fR);
17 .fi
19 .LP
20 .nf
21 \fBvoid *\fR\fBkstat_data_lookup\fR(\fBkstat_t *\fR\fIksp\fR, \fBchar *\fR\fIname\fR);
22 .fi
24 .SH DESCRIPTION
25 .sp
26 .LP
27 The \fBkstat_lookup()\fR function traverses the kstat chain,
28 \fIkc\fR->\fBkc_chain\fR, searching for a kstat with the same \fIks_module\fR,
29 \fIks_instance\fR, and \fIks_name\fR fields; this triplet uniquely identifies a
30 kstat.  If \fIks_module\fR is \fINULL\fR, \fIks_instance\fR is  -1, or
31 \fIks_name\fR is \fINULL\fR, those fields will be ignored in the search.  For
32 example, \fBkstat_lookup(kc, NULL, -1, "foo")\fR  will find the first kstat
33 with name "foo".
34 .sp
35 .LP
36 The \fBkstat_data_lookup()\fR function searches the kstat's data section for
37 the record with the specified \fIname\fR. This operation is valid only for
38 those kstat types that have named data records: \fBKSTAT_TYPE_NAMED\fR and
39 \fBKSTAT_TYPE_TIMER\fR.
40 .SH RETURN VALUES
41 .sp
42 .LP
43 The \fBkstat_lookup()\fR function returns a pointer to the requested kstat if
44 it is found. Otherwise it returns \fINULL\fR and sets \fBerrno\fR to indicate
45 the error.
46 .sp
47 .LP
48 The \fBkstat_data_lookup()\fR function returns a pointer to the requested data
49 record if it is found. Otherwise it returns \fINULL\fR and sets \fBerrno\fR to
50 indicate the error .
51 .SH ERRORS
52 .sp
53 .LP
54 The \fBkstat_lookup()\fR and \fBkstat_data_lookup()\fR functions will fail if:
55 .sp
56 .ne 2
57 .na
58 \fB\fBEINVAL\fR\fR
59 .ad
60 .RS 10n
61 An attempt was made to look up data for a kstat that was not of type
62 \fBKSTAT_TYPE_NAMED\fR or \fBKSTAT_TYPE_TIMER\fR.
63 .RE
65 .sp
66 .ne 2
67 .na
68 \fB\fBENOENT\fR\fR
69 .ad
70 .RS 10n
71 The requested kstat could not be found.
72 .RE
74 .SH FILES
75 .sp
76 .ne 2
77 .na
78 \fB\fB/dev/kstat\fR\fR
79 .ad
80 .RS 14n
81 kernel statistics driver
82 .RE
84 .SH ATTRIBUTES
85 .sp
86 .LP
87 See \fBattributes\fR(5) for descriptions of the following attributes:
88 .sp
90 .sp
91 .TS
92 box;
93 c | c
94 l | l .
95 ATTRIBUTE TYPE  ATTRIBUTE VALUE
97 Interface Stability     Stable
99 MT-Level        Unsafe
102 .SH SEE ALSO
105 \fBkstat\fR(3KSTAT), \fBkstat_chain_update\fR(3KSTAT),
106 \fBkstat_open\fR(3KSTAT), \fBkstat_read\fR(3KSTAT), \fBattributes\fR(5)