xref: /onnv-gate/usr/src/uts/common/sys/tnf.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  *	Copyright (c) 1994, by Sun Microsytems, Inc.
24*0Sstevel@tonic-gate  *	All rights reserved.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef _SYS_TNF_H
28*0Sstevel@tonic-gate #define	_SYS_TNF_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifndef NPROBE
33*0Sstevel@tonic-gate 
34*0Sstevel@tonic-gate #include <sys/types.h>
35*0Sstevel@tonic-gate #include <sys/thread.h>
36*0Sstevel@tonic-gate #include <sys/proc.h>
37*0Sstevel@tonic-gate #include <sys/cpuvar.h>
38*0Sstevel@tonic-gate 
39*0Sstevel@tonic-gate #ifdef __cplusplus
40*0Sstevel@tonic-gate extern "C" {
41*0Sstevel@tonic-gate #endif
42*0Sstevel@tonic-gate 
43*0Sstevel@tonic-gate /*
44*0Sstevel@tonic-gate  *
45*0Sstevel@tonic-gate  */
46*0Sstevel@tonic-gate 
47*0Sstevel@tonic-gate typedef struct {
48*0Sstevel@tonic-gate 	ulong_t probenum;
49*0Sstevel@tonic-gate 	int enabled;
50*0Sstevel@tonic-gate 	int traced;
51*0Sstevel@tonic-gate 	int attrsize;
52*0Sstevel@tonic-gate } tnf_probevals_t;
53*0Sstevel@tonic-gate 
54*0Sstevel@tonic-gate /*
55*0Sstevel@tonic-gate  *
56*0Sstevel@tonic-gate  */
57*0Sstevel@tonic-gate 
58*0Sstevel@tonic-gate typedef struct {
59*0Sstevel@tonic-gate 	enum {
60*0Sstevel@tonic-gate 		TIFIOCBUF_NONE,
61*0Sstevel@tonic-gate 		TIFIOCBUF_UNINIT,
62*0Sstevel@tonic-gate 		TIFIOCBUF_OK,
63*0Sstevel@tonic-gate 		TIFIOCBUF_BROKEN
64*0Sstevel@tonic-gate 		} buffer_state;
65*0Sstevel@tonic-gate 	int buffer_size;
66*0Sstevel@tonic-gate 	int trace_stopped;
67*0Sstevel@tonic-gate 	int pidfilter_mode;
68*0Sstevel@tonic-gate 	int pidfilter_size;
69*0Sstevel@tonic-gate } tifiocstate_t;
70*0Sstevel@tonic-gate 
71*0Sstevel@tonic-gate typedef struct {
72*0Sstevel@tonic-gate 	char *dst_addr;
73*0Sstevel@tonic-gate 	int block_num;
74*0Sstevel@tonic-gate } tifiocgblock_t;
75*0Sstevel@tonic-gate 
76*0Sstevel@tonic-gate typedef struct {
77*0Sstevel@tonic-gate 	long *dst_addr;
78*0Sstevel@tonic-gate 	int start;
79*0Sstevel@tonic-gate 	int slots;
80*0Sstevel@tonic-gate } tifiocgfw_t;
81*0Sstevel@tonic-gate 
82*0Sstevel@tonic-gate /*
83*0Sstevel@tonic-gate  * ioctl codes
84*0Sstevel@tonic-gate  */
85*0Sstevel@tonic-gate 
86*0Sstevel@tonic-gate #define	TIFIOCGMAXPROBE		(('t' << 8) | 1) /* get max probe number */
87*0Sstevel@tonic-gate #define	TIFIOCGPROBEVALS	(('t' << 8) | 2) /* get probe info */
88*0Sstevel@tonic-gate #define	TIFIOCGPROBESTRING	(('t' << 8) | 3) /* get probe string */
89*0Sstevel@tonic-gate #define	TIFIOCSPROBEVALS	(('t' << 8) | 4) /* set probe info */
90*0Sstevel@tonic-gate #define	TIFIOCGSTATE		(('t' << 8) | 5) /* get tracing system state */
91*0Sstevel@tonic-gate #define	TIFIOCALLOCBUF		(('t' << 8) | 6) /* allocate trace buffer */
92*0Sstevel@tonic-gate #define	TIFIOCDEALLOCBUF	(('t' << 8) | 7) /* dealloc trace buffer */
93*0Sstevel@tonic-gate #define	TIFIOCSTRACING		(('t' << 8) | 8) /* set ktrace mode */
94*0Sstevel@tonic-gate #define	TIFIOCSPIDFILTER	(('t' << 8) | 9) /* set pidfilter mode */
95*0Sstevel@tonic-gate #define	TIFIOCGPIDSTATE		(('t' << 8) | 10) /* check pid filter member */
96*0Sstevel@tonic-gate #define	TIFIOCSPIDON		(('t' << 8) | 11) /* add pid to filter */
97*0Sstevel@tonic-gate #define	TIFIOCSPIDOFF		(('t' << 8) | 12) /* drop pid from filter */
98*0Sstevel@tonic-gate #define	TIFIOCPIDFILTERGET	(('t' << 8) | 13) /* return pid filter set */
99*0Sstevel@tonic-gate #define	TIFIOCGHEADER		(('t' << 8) | 14) /* copy out tnf header blk */
100*0Sstevel@tonic-gate #define	TIFIOCGBLOCK		(('t' << 8) | 15) /* copy out tnf block */
101*0Sstevel@tonic-gate #define	TIFIOCGFWZONE		(('t' << 8) | 16) /* copy out forwarding ptrs */
102*0Sstevel@tonic-gate 
103*0Sstevel@tonic-gate #ifdef _KERNEL
104*0Sstevel@tonic-gate 
105*0Sstevel@tonic-gate extern volatile int tnf_tracing_active;
106*0Sstevel@tonic-gate 
107*0Sstevel@tonic-gate extern void tnf_thread_create(kthread_t *);
108*0Sstevel@tonic-gate extern void tnf_thread_queue(kthread_t *, cpu_t *, pri_t);
109*0Sstevel@tonic-gate extern void tnf_thread_switch(kthread_t *);
110*0Sstevel@tonic-gate extern void tnf_thread_exit(void);
111*0Sstevel@tonic-gate extern void tnf_thread_free(kthread_t *);
112*0Sstevel@tonic-gate 
113*0Sstevel@tonic-gate #endif /* _KERNEL */
114*0Sstevel@tonic-gate 
115*0Sstevel@tonic-gate #ifdef __cplusplus
116*0Sstevel@tonic-gate }
117*0Sstevel@tonic-gate #endif
118*0Sstevel@tonic-gate 
119*0Sstevel@tonic-gate #endif /* NPROBE */
120*0Sstevel@tonic-gate 
121*0Sstevel@tonic-gate #endif /* _SYS_TNF_H */
122