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