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"
8 kstat_lookup, kstat_data_lookup \- find a kstat by name
12 \fBcc\fR [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lkstat\fR [ \fIlibrary\fR\&.\|.\|.]
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);
21 \fBvoid *\fR\fBkstat_data_lookup\fR(\fBkstat_t *\fR\fIksp\fR, \fBchar *\fR\fIname\fR);
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
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.
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
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
54 The \fBkstat_lookup()\fR and \fBkstat_data_lookup()\fR functions will fail if:
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.
71 The requested kstat could not be found.
78 \fB\fB/dev/kstat\fR\fR
81 kernel statistics driver
87 See \fBattributes\fR(5) for descriptions of the following attributes:
95 ATTRIBUTE TYPE ATTRIBUTE VALUE
97 Interface Stability Stable
105 \fBkstat\fR(3KSTAT), \fBkstat_chain_update\fR(3KSTAT),
106 \fBkstat_open\fR(3KSTAT), \fBkstat_read\fR(3KSTAT), \fBattributes\fR(5)