xref: /illumos-gate/usr/src/lib/libkstat/kstat.h (revision 1b6debbb96f2c66931b6ec520e8dd07ece57d2dd)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1992 by Sun Microsystems, Inc.
24  * Copyright 2021 Oxide Computer Company
25  */
26 
27 #ifndef	_KSTAT_H
28 #define	_KSTAT_H
29 
30 #include <sys/types.h>
31 #include <sys/kstat.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * kstat_open() returns a pointer to a kstat_ctl_t.
39  * This is used for subsequent libkstat operations.
40  */
41 typedef struct kstat_ctl {
42 	kid_t	kc_chain_id;	/* current kstat chain ID	*/
43 	kstat_t	*kc_chain;	/* pointer to kstat chain	*/
44 	int	kc_kd;		/* /dev/kstat descriptor	*/
45 } kstat_ctl_t;
46 
47 extern	kstat_ctl_t	*kstat_open(void);
48 extern	int		kstat_close(kstat_ctl_t *);
49 extern	kid_t		kstat_read(kstat_ctl_t *, kstat_t *, void *);
50 extern	kid_t		kstat_write(kstat_ctl_t *, kstat_t *, void *);
51 extern	kid_t		kstat_chain_update(kstat_ctl_t *);
52 extern	kstat_t		*kstat_lookup(kstat_ctl_t *, const char *, int,
53     const char *);
54 extern	void		*kstat_data_lookup(kstat_t *, const char *);
55 
56 #ifdef	__cplusplus
57 }
58 #endif
59 
60 #endif	/* _KSTAT_H */
61