xref: /titanic_41/usr/src/uts/common/sys/tnf.h (revision cde2885fdf538266ee2a3b08dee2d5075ce8fa2b)
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) 1994, by Sun Microsytems, Inc.
24  *	All rights reserved.
25  */
26 
27 #ifndef _SYS_TNF_H
28 #define	_SYS_TNF_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifndef NPROBE
33 
34 #include <sys/types.h>
35 #include <sys/thread.h>
36 #include <sys/proc.h>
37 #include <sys/cpuvar.h>
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 /*
44  *
45  */
46 
47 typedef struct {
48 	ulong_t probenum;
49 	int enabled;
50 	int traced;
51 	int attrsize;
52 } tnf_probevals_t;
53 
54 /*
55  *
56  */
57 
58 typedef struct {
59 	enum {
60 		TIFIOCBUF_NONE,
61 		TIFIOCBUF_UNINIT,
62 		TIFIOCBUF_OK,
63 		TIFIOCBUF_BROKEN
64 		} buffer_state;
65 	int buffer_size;
66 	int trace_stopped;
67 	int pidfilter_mode;
68 	int pidfilter_size;
69 } tifiocstate_t;
70 
71 typedef struct {
72 	char *dst_addr;
73 	int block_num;
74 } tifiocgblock_t;
75 
76 typedef struct {
77 	long *dst_addr;
78 	int start;
79 	int slots;
80 } tifiocgfw_t;
81 
82 /*
83  * ioctl codes
84  */
85 
86 #define	TIFIOCGMAXPROBE		(('t' << 8) | 1) /* get max probe number */
87 #define	TIFIOCGPROBEVALS	(('t' << 8) | 2) /* get probe info */
88 #define	TIFIOCGPROBESTRING	(('t' << 8) | 3) /* get probe string */
89 #define	TIFIOCSPROBEVALS	(('t' << 8) | 4) /* set probe info */
90 #define	TIFIOCGSTATE		(('t' << 8) | 5) /* get tracing system state */
91 #define	TIFIOCALLOCBUF		(('t' << 8) | 6) /* allocate trace buffer */
92 #define	TIFIOCDEALLOCBUF	(('t' << 8) | 7) /* dealloc trace buffer */
93 #define	TIFIOCSTRACING		(('t' << 8) | 8) /* set ktrace mode */
94 #define	TIFIOCSPIDFILTER	(('t' << 8) | 9) /* set pidfilter mode */
95 #define	TIFIOCGPIDSTATE		(('t' << 8) | 10) /* check pid filter member */
96 #define	TIFIOCSPIDON		(('t' << 8) | 11) /* add pid to filter */
97 #define	TIFIOCSPIDOFF		(('t' << 8) | 12) /* drop pid from filter */
98 #define	TIFIOCPIDFILTERGET	(('t' << 8) | 13) /* return pid filter set */
99 #define	TIFIOCGHEADER		(('t' << 8) | 14) /* copy out tnf header blk */
100 #define	TIFIOCGBLOCK		(('t' << 8) | 15) /* copy out tnf block */
101 #define	TIFIOCGFWZONE		(('t' << 8) | 16) /* copy out forwarding ptrs */
102 
103 #ifdef _KERNEL
104 
105 extern volatile int tnf_tracing_active;
106 
107 extern void tnf_thread_create(kthread_t *);
108 extern void tnf_thread_queue(kthread_t *, cpu_t *, pri_t);
109 extern void tnf_thread_switch(kthread_t *);
110 extern void tnf_thread_exit(void);
111 extern void tnf_thread_free(kthread_t *);
112 
113 #endif /* _KERNEL */
114 
115 #ifdef __cplusplus
116 }
117 #endif
118 
119 #endif /* NPROBE */
120 
121 #endif /* _SYS_TNF_H */
122