xref: /onnv-gate/usr/src/uts/common/sys/tnf_writer.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 1994,2003 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef _SYS_TNF_WRITER_H
28*0Sstevel@tonic-gate #define	_SYS_TNF_WRITER_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate /*
33*0Sstevel@tonic-gate  * Public interface for writing predefined TNF types
34*0Sstevel@tonic-gate  */
35*0Sstevel@tonic-gate #include <sys/types.h>
36*0Sstevel@tonic-gate #include <sys/tnf_com.h>
37*0Sstevel@tonic-gate 
38*0Sstevel@tonic-gate #ifdef __cplusplus
39*0Sstevel@tonic-gate extern "C" {
40*0Sstevel@tonic-gate #endif
41*0Sstevel@tonic-gate 
42*0Sstevel@tonic-gate /*
43*0Sstevel@tonic-gate  * Defines
44*0Sstevel@tonic-gate  */
45*0Sstevel@tonic-gate 
46*0Sstevel@tonic-gate #define	TNF_OFFSETOF(s, m) 	((size_t)(&(((s *)0)->m)))
47*0Sstevel@tonic-gate #define	TNF_ALIGN(type)		TNF_OFFSETOF(struct { char _c; type _t; }, _t)
48*0Sstevel@tonic-gate 
49*0Sstevel@tonic-gate /*
50*0Sstevel@tonic-gate  * Typedefs
51*0Sstevel@tonic-gate  */
52*0Sstevel@tonic-gate 
53*0Sstevel@tonic-gate typedef char 		*tnf_record_p;	  /* trace buffer memory ptr */
54*0Sstevel@tonic-gate typedef tnf_ref32_t	tnf_reference_t;  /* generic reference */
55*0Sstevel@tonic-gate 
56*0Sstevel@tonic-gate typedef struct _tnf_ops		tnf_ops_t; /* opaque */
57*0Sstevel@tonic-gate typedef struct _tnf_tag_version	tnf_tag_version_t;
58*0Sstevel@tonic-gate typedef struct _tnf_tag_data	tnf_tag_data_t;
59*0Sstevel@tonic-gate 
60*0Sstevel@tonic-gate /*
61*0Sstevel@tonic-gate  * In-memory reader's classification of TNF types
62*0Sstevel@tonic-gate  */
63*0Sstevel@tonic-gate 
64*0Sstevel@tonic-gate typedef enum {
65*0Sstevel@tonic-gate 	TNF_UNKNOWN	= 0,
66*0Sstevel@tonic-gate 	TNF_INT32,
67*0Sstevel@tonic-gate 	TNF_UINT32,
68*0Sstevel@tonic-gate 	TNF_INT64,
69*0Sstevel@tonic-gate 	TNF_UINT64,
70*0Sstevel@tonic-gate 	TNF_FLOAT32,
71*0Sstevel@tonic-gate 	TNF_FLOAT64,
72*0Sstevel@tonic-gate 	TNF_STRING,
73*0Sstevel@tonic-gate 	TNF_ARRAY,
74*0Sstevel@tonic-gate 	TNF_STRUCT,
75*0Sstevel@tonic-gate 	TNF_OPAQUE,
76*0Sstevel@tonic-gate #ifdef _LP64
77*0Sstevel@tonic-gate 	TNF_ULONG = TNF_UINT64,
78*0Sstevel@tonic-gate 	TNF_LONG = TNF_INT64
79*0Sstevel@tonic-gate #else
80*0Sstevel@tonic-gate 	TNF_ULONG = TNF_UINT32,
81*0Sstevel@tonic-gate 	TNF_LONG = TNF_INT32
82*0Sstevel@tonic-gate #endif
83*0Sstevel@tonic-gate } tnf_arg_kind_t;
84*0Sstevel@tonic-gate 
85*0Sstevel@tonic-gate /*
86*0Sstevel@tonic-gate  * Structures
87*0Sstevel@tonic-gate  */
88*0Sstevel@tonic-gate 
89*0Sstevel@tonic-gate struct _tnf_tag_version {
90*0Sstevel@tonic-gate 	size_t		version_size;	/* sizeof(tnf_tag_version_t) */
91*0Sstevel@tonic-gate 	size_t		tag_data_size;	/* sizeof(tnf_tag_data_t) */
92*0Sstevel@tonic-gate };
93*0Sstevel@tonic-gate 
94*0Sstevel@tonic-gate struct _tnf_tag_data {
95*0Sstevel@tonic-gate 	tnf_tag_version_t *tag_version; /* TNF_TAG_VERSION */
96*0Sstevel@tonic-gate 	tnf_record_p	(*tag_desc)(tnf_ops_t *, tnf_tag_data_t *);
97*0Sstevel@tonic-gate 	tnf_record_p	tag_index;	/* trace buffer address */
98*0Sstevel@tonic-gate 	const char	*tag_name;	/* name */
99*0Sstevel@tonic-gate 	tnf_tag_data_t	****tag_props;	/* properties */
100*0Sstevel@tonic-gate 	size_t		tag_size;	/* type_size, header_size */
101*0Sstevel@tonic-gate 	size_t		tag_align;	/* alignment */
102*0Sstevel@tonic-gate 	size_t		tag_ref_size;	/* reference size */
103*0Sstevel@tonic-gate 	tnf_arg_kind_t	tag_kind;	/* type of object */
104*0Sstevel@tonic-gate 	tnf_tag_data_t	**tag_base;	/* element_type, derived_base */
105*0Sstevel@tonic-gate 	tnf_tag_data_t	***tag_slots;	/* slot_types, header_types */
106*0Sstevel@tonic-gate 	char		**tag_slot_names; /* slot_names */
107*0Sstevel@tonic-gate };
108*0Sstevel@tonic-gate 
109*0Sstevel@tonic-gate /*
110*0Sstevel@tonic-gate  * TNF tag version
111*0Sstevel@tonic-gate  * A client can scan a binary's relocation table for data relocation
112*0Sstevel@tonic-gate  * entries corresponding to __tnf_tag_version_1.  These identify
113*0Sstevel@tonic-gate  * tags.  The actual version information is stored in an associated
114*0Sstevel@tonic-gate  * structure called __tnf_tag_version_1_info
115*0Sstevel@tonic-gate  */
116*0Sstevel@tonic-gate 
117*0Sstevel@tonic-gate extern tnf_tag_version_t __tnf_tag_version_1_info;
118*0Sstevel@tonic-gate 
119*0Sstevel@tonic-gate extern tnf_tag_version_t __tnf_tag_version_1;
120*0Sstevel@tonic-gate #pragma weak __tnf_tag_version_1	/* placeholder: never defined */
121*0Sstevel@tonic-gate #define	TNF_TAG_VERSION	&__tnf_tag_version_1
122*0Sstevel@tonic-gate 
123*0Sstevel@tonic-gate /*
124*0Sstevel@tonic-gate  * TNF primitive types
125*0Sstevel@tonic-gate  */
126*0Sstevel@tonic-gate 
127*0Sstevel@tonic-gate extern tnf_tag_data_t	*tnf_char_tag_data;
128*0Sstevel@tonic-gate #define	tnf_char(ops, item, ref)	(item)
129*0Sstevel@tonic-gate 
130*0Sstevel@tonic-gate extern tnf_tag_data_t	*tnf_int8_tag_data;
131*0Sstevel@tonic-gate #define	tnf_int8(ops, item, ref)	(item)
132*0Sstevel@tonic-gate 
133*0Sstevel@tonic-gate extern tnf_tag_data_t	*tnf_uint8_tag_data;
134*0Sstevel@tonic-gate #define	tnf_uint8(ops, item, ref)	(item)
135*0Sstevel@tonic-gate 
136*0Sstevel@tonic-gate extern tnf_tag_data_t	*tnf_int16_tag_data;
137*0Sstevel@tonic-gate #define	tnf_int16(ops, item, ref)	(item)
138*0Sstevel@tonic-gate 
139*0Sstevel@tonic-gate extern tnf_tag_data_t	*tnf_uint16_tag_data;
140*0Sstevel@tonic-gate #define	tnf_uint16(ops, item, ref)	(item)
141*0Sstevel@tonic-gate 
142*0Sstevel@tonic-gate extern tnf_tag_data_t	*tnf_int32_tag_data;
143*0Sstevel@tonic-gate #define	tnf_int32(ops, item, ref) 	(item)
144*0Sstevel@tonic-gate 
145*0Sstevel@tonic-gate extern tnf_tag_data_t	*tnf_uint32_tag_data;
146*0Sstevel@tonic-gate #define	tnf_uint32(ops, item, ref)	(item)
147*0Sstevel@tonic-gate 
148*0Sstevel@tonic-gate extern tnf_tag_data_t	*tnf_int64_tag_data;
149*0Sstevel@tonic-gate #define	tnf_int64(ops, item, ref)	(item)
150*0Sstevel@tonic-gate 
151*0Sstevel@tonic-gate extern tnf_tag_data_t	*tnf_uint64_tag_data;
152*0Sstevel@tonic-gate #define	tnf_uint64(ops, item, ref)	(item)
153*0Sstevel@tonic-gate 
154*0Sstevel@tonic-gate extern tnf_tag_data_t	*tnf_float32_tag_data;
155*0Sstevel@tonic-gate #define	tnf_float32(ops, item, ref)	(item)
156*0Sstevel@tonic-gate 
157*0Sstevel@tonic-gate extern tnf_tag_data_t	*tnf_float64_tag_data;
158*0Sstevel@tonic-gate #define	tnf_float64(ops, item, ref)	(item)
159*0Sstevel@tonic-gate 
160*0Sstevel@tonic-gate /*
161*0Sstevel@tonic-gate  * ``Portable'' primitive types
162*0Sstevel@tonic-gate  * These are defined as the well-defined TNF types they map into.
163*0Sstevel@tonic-gate  * XXX Machine-dependent
164*0Sstevel@tonic-gate  */
165*0Sstevel@tonic-gate 
166*0Sstevel@tonic-gate typedef tnf_uint8_t			tnf_uchar_t;
167*0Sstevel@tonic-gate #define	tnf_uchar(ops, item, ref)	tnf_uint8(ops, item, ref)
168*0Sstevel@tonic-gate #define	tnf_uchar_tag_data		tnf_uint8_tag_data
169*0Sstevel@tonic-gate 
170*0Sstevel@tonic-gate typedef tnf_int16_t			tnf_short_t;
171*0Sstevel@tonic-gate #define	tnf_short(ops, item, ref)	tnf_int16(ops, item, ref)
172*0Sstevel@tonic-gate #define	tnf_short_tag_data		tnf_int16_tag_data
173*0Sstevel@tonic-gate 
174*0Sstevel@tonic-gate typedef tnf_uint16_t			tnf_ushort_t;
175*0Sstevel@tonic-gate #define	tnf_ushort(ops, item, ref)	tnf_uint16(ops, item, ref)
176*0Sstevel@tonic-gate #define	tnf_ushort_tag_data		tnf_uint16_tag_data
177*0Sstevel@tonic-gate 
178*0Sstevel@tonic-gate typedef tnf_int32_t			tnf_int_t;
179*0Sstevel@tonic-gate #define	tnf_int(ops, item, ref)	tnf_int32(ops, item, ref)
180*0Sstevel@tonic-gate #define	tnf_int_tag_data		tnf_int32_tag_data
181*0Sstevel@tonic-gate 
182*0Sstevel@tonic-gate typedef tnf_uint32_t			tnf_uint_t;
183*0Sstevel@tonic-gate #define	tnf_uint(ops, item, ref)	tnf_uint32(ops, item, ref)
184*0Sstevel@tonic-gate #define	tnf_uint_tag_data		tnf_uint32_tag_data
185*0Sstevel@tonic-gate 
186*0Sstevel@tonic-gate #if defined(_LP64)
187*0Sstevel@tonic-gate 
188*0Sstevel@tonic-gate typedef tnf_int64_t			tnf_long_t;
189*0Sstevel@tonic-gate #define	tnf_long(ops, item, ref)	tnf_int64(ops, item, ref)
190*0Sstevel@tonic-gate #define	tnf_long_tag_data		tnf_int64_tag_data
191*0Sstevel@tonic-gate 
192*0Sstevel@tonic-gate typedef tnf_uint64_t			tnf_ulong_t;
193*0Sstevel@tonic-gate #define	tnf_ulong(ops, item, ref)	tnf_uint64(ops, item, ref)
194*0Sstevel@tonic-gate #define	tnf_ulong_tag_data		tnf_uint64_tag_data
195*0Sstevel@tonic-gate 
196*0Sstevel@tonic-gate #else
197*0Sstevel@tonic-gate 
198*0Sstevel@tonic-gate typedef tnf_int32_t			tnf_long_t;
199*0Sstevel@tonic-gate #define	tnf_long(ops, item, ref)	tnf_int32(ops, item, ref)
200*0Sstevel@tonic-gate #define	tnf_long_tag_data		tnf_int32_tag_data
201*0Sstevel@tonic-gate 
202*0Sstevel@tonic-gate typedef tnf_uint32_t			tnf_ulong_t;
203*0Sstevel@tonic-gate #define	tnf_ulong(ops, item, ref)	tnf_uint32(ops, item, ref)
204*0Sstevel@tonic-gate #define	tnf_ulong_tag_data		tnf_uint32_tag_data
205*0Sstevel@tonic-gate 
206*0Sstevel@tonic-gate #endif /* defined(_LP64) */
207*0Sstevel@tonic-gate 
208*0Sstevel@tonic-gate typedef tnf_int64_t			tnf_longlong_t;
209*0Sstevel@tonic-gate #define	tnf_longlong(ops, item, ref)	tnf_int64(ops, item, ref)
210*0Sstevel@tonic-gate #define	tnf_longlong_tag_data		tnf_int64_tag_data
211*0Sstevel@tonic-gate 
212*0Sstevel@tonic-gate typedef tnf_uint64_t			tnf_ulonglong_t;
213*0Sstevel@tonic-gate #define	tnf_ulonglong(ops, item, ref)	tnf_uint64(ops, item, ref)
214*0Sstevel@tonic-gate #define	tnf_ulonglong_tag_data		tnf_uint64_tag_data
215*0Sstevel@tonic-gate 
216*0Sstevel@tonic-gate typedef tnf_float32_t			tnf_float_t;
217*0Sstevel@tonic-gate #define	tnf_float(ops, item, ref)	tnf_float32(ops, item, ref)
218*0Sstevel@tonic-gate #define	tnf_float_tag_data		tnf_float32_tag_data
219*0Sstevel@tonic-gate 
220*0Sstevel@tonic-gate typedef tnf_float64_t			tnf_double_t;
221*0Sstevel@tonic-gate #define	tnf_double(ops, item, ref)	tnf_float64(ops, item, ref)
222*0Sstevel@tonic-gate #define	tnf_double_tag_data		tnf_float64_tag_data
223*0Sstevel@tonic-gate 
224*0Sstevel@tonic-gate /*
225*0Sstevel@tonic-gate  * Derived and aggregate TNF types
226*0Sstevel@tonic-gate  */
227*0Sstevel@tonic-gate 
228*0Sstevel@tonic-gate /* Not explicitly represented in type system */
229*0Sstevel@tonic-gate #define	tnf_ref32(ops, item, ref)	\
230*0Sstevel@tonic-gate 	tnf_ref32_1(ops, item, ref)
231*0Sstevel@tonic-gate 
232*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_tag_tag_data;
233*0Sstevel@tonic-gate typedef tnf_ref32_t		tnf_tag_t;
234*0Sstevel@tonic-gate #define	tnf_tag(ops, item, ref) 	\
235*0Sstevel@tonic-gate 	(tnf_ref32(ops, item, ref) | TNF_REF32_T_TAG)
236*0Sstevel@tonic-gate 
237*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_string_tag_data;
238*0Sstevel@tonic-gate typedef tnf_reference_t		tnf_string_t;
239*0Sstevel@tonic-gate #define	tnf_string(ops, item, ref)	\
240*0Sstevel@tonic-gate 	tnf_string_1(ops, item, ref, tnf_string_tag_data)
241*0Sstevel@tonic-gate 
242*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_name_tag_data;
243*0Sstevel@tonic-gate typedef tnf_string_t 		tnf_name_t;
244*0Sstevel@tonic-gate #define	tnf_name(ops, item, ref) 	\
245*0Sstevel@tonic-gate 	tnf_string_1(ops, item, ref, tnf_name_tag_data)
246*0Sstevel@tonic-gate 
247*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_size_tag_data;
248*0Sstevel@tonic-gate typedef tnf_ulong_t		tnf_size_t;
249*0Sstevel@tonic-gate #define	tnf_size(ops, item, ref) 	\
250*0Sstevel@tonic-gate 	tnf_ulong(ops, item, ref)
251*0Sstevel@tonic-gate 
252*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_opaque_tag_data;
253*0Sstevel@tonic-gate 
254*0Sstevel@tonic-gate #if defined(_LP64)
255*0Sstevel@tonic-gate 
256*0Sstevel@tonic-gate typedef tnf_uint64_t			tnf_opaque_t;
257*0Sstevel@tonic-gate #define	tnf_opaque(ops, item, ref)	\
258*0Sstevel@tonic-gate 	((tnf_uint64_t)(item))
259*0Sstevel@tonic-gate 
260*0Sstevel@tonic-gate #else
261*0Sstevel@tonic-gate 
262*0Sstevel@tonic-gate typedef tnf_uint32_t			tnf_opaque_t;
263*0Sstevel@tonic-gate #define	tnf_opaque(ops, item, ref)	\
264*0Sstevel@tonic-gate 	((tnf_uint32_t)(item))
265*0Sstevel@tonic-gate 
266*0Sstevel@tonic-gate #endif /* defined(_LP64) */
267*0Sstevel@tonic-gate 
268*0Sstevel@tonic-gate /*
269*0Sstevel@tonic-gate  * TNF types for tracing
270*0Sstevel@tonic-gate  */
271*0Sstevel@tonic-gate 
272*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_time_base_tag_data;
273*0Sstevel@tonic-gate typedef tnf_int64_t		tnf_time_base_t;
274*0Sstevel@tonic-gate #define	tnf_time_base(ops, item, ref) 	\
275*0Sstevel@tonic-gate 	tnf_int64(ops, item, ref)
276*0Sstevel@tonic-gate 
277*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_time_delta_tag_data;
278*0Sstevel@tonic-gate typedef tnf_uint32_t		tnf_time_delta_t;
279*0Sstevel@tonic-gate #define	tnf_time_delta(ops, item, ref) 	\
280*0Sstevel@tonic-gate 	tnf_uint32(ops, item, ref)
281*0Sstevel@tonic-gate 
282*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_probe_event_tag_data;
283*0Sstevel@tonic-gate typedef tnf_ref32_t		tnf_probe_event_t;
284*0Sstevel@tonic-gate #define	tnf_probe_event(ops, item, ref) \
285*0Sstevel@tonic-gate 	((tnf_ref32_t)(item) | TNF_REF32_T_PAIR)
286*0Sstevel@tonic-gate 
287*0Sstevel@tonic-gate /* process ID */
288*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_pid_tag_data;
289*0Sstevel@tonic-gate typedef tnf_int32_t		tnf_pid_t;
290*0Sstevel@tonic-gate #define	tnf_pid(ops, item, ref)		\
291*0Sstevel@tonic-gate 	tnf_int32(ops, item, ref)
292*0Sstevel@tonic-gate 
293*0Sstevel@tonic-gate /* LWP ID */
294*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_lwpid_tag_data;
295*0Sstevel@tonic-gate typedef tnf_uint32_t		tnf_lwpid_t;
296*0Sstevel@tonic-gate #define	tnf_lwpid(ops, item, ref)	\
297*0Sstevel@tonic-gate 	tnf_uint32(ops, item, ref)
298*0Sstevel@tonic-gate 
299*0Sstevel@tonic-gate #ifdef _KERNEL
300*0Sstevel@tonic-gate 
301*0Sstevel@tonic-gate /* kernel thread ID */
302*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_kthread_id_tag_data;
303*0Sstevel@tonic-gate typedef tnf_opaque_t		tnf_kthread_id_t;
304*0Sstevel@tonic-gate #define	tnf_kthread_id(ops, item, ref)	\
305*0Sstevel@tonic-gate 	tnf_opaque(ops, item, ref)
306*0Sstevel@tonic-gate 
307*0Sstevel@tonic-gate /* processor ID */
308*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_cpuid_tag_data;
309*0Sstevel@tonic-gate typedef tnf_int32_t		tnf_cpuid_t;
310*0Sstevel@tonic-gate #define	tnf_cpuid(ops, item, ref)	\
311*0Sstevel@tonic-gate 	tnf_int32(ops, item, ref)
312*0Sstevel@tonic-gate 
313*0Sstevel@tonic-gate /* device ID */
314*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_device_tag_data;
315*0Sstevel@tonic-gate typedef tnf_ulong_t		tnf_device_t;
316*0Sstevel@tonic-gate #define	tnf_device(ops, item, ref)	\
317*0Sstevel@tonic-gate 	tnf_ulong(ops, item, ref)
318*0Sstevel@tonic-gate 
319*0Sstevel@tonic-gate /* kernel symbol */
320*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_symbol_tag_data;
321*0Sstevel@tonic-gate typedef	tnf_opaque_t		tnf_symbol_t;
322*0Sstevel@tonic-gate #define	tnf_symbol(ops, item, ref)	\
323*0Sstevel@tonic-gate 	tnf_opaque(ops, item, ref)
324*0Sstevel@tonic-gate 
325*0Sstevel@tonic-gate /* array of symbols */
326*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_symbols_tag_data;
327*0Sstevel@tonic-gate typedef tnf_ref32_t		tnf_symbols_t;
328*0Sstevel@tonic-gate 
329*0Sstevel@tonic-gate #if defined(__sparc)
330*0Sstevel@tonic-gate #define	tnf_symbols(ops, item, ref)	\
331*0Sstevel@tonic-gate 	tnf_opaque32_array_1(ops, item, ref, tnf_symbols_tag_data)
332*0Sstevel@tonic-gate #else /* defined(__sparc) */
333*0Sstevel@tonic-gate #define	tnf_symbols(ops, item, ref)	\
334*0Sstevel@tonic-gate 	tnf_opaque_array_1(ops, item, ref, tnf_symbols_tag_data)
335*0Sstevel@tonic-gate #endif /* defined(__sparc) */
336*0Sstevel@tonic-gate 
337*0Sstevel@tonic-gate /* system call number */
338*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_sysnum_tag_data;
339*0Sstevel@tonic-gate typedef tnf_int16_t		tnf_sysnum_t;
340*0Sstevel@tonic-gate #define	tnf_sysnum(ops, item, ref)	\
341*0Sstevel@tonic-gate 	tnf_int16(ops, item, ref)
342*0Sstevel@tonic-gate 
343*0Sstevel@tonic-gate /* thread microstate XXX enum */
344*0Sstevel@tonic-gate /* XXX should have a new type tnf_enum of appropriate size to map C enum's */
345*0Sstevel@tonic-gate /* XXX cast below is to avoid lint warnings */
346*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_microstate_tag_data;
347*0Sstevel@tonic-gate typedef tnf_int32_t		tnf_microstate_t;
348*0Sstevel@tonic-gate #define	tnf_microstate(ops, item, ref)	\
349*0Sstevel@tonic-gate 	tnf_int32(ops, (tnf_int32_t)(item), ref)
350*0Sstevel@tonic-gate 
351*0Sstevel@tonic-gate /* file offset */
352*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_offset_tag_data;
353*0Sstevel@tonic-gate typedef tnf_int64_t		tnf_offset_t;
354*0Sstevel@tonic-gate #define	tnf_offset(ops, item, ref)	\
355*0Sstevel@tonic-gate 	tnf_int64(ops, item, ref)
356*0Sstevel@tonic-gate 
357*0Sstevel@tonic-gate /* address fault type XXX enum */
358*0Sstevel@tonic-gate /* XXX should have a new type tnf_enum of appropriate size to map C enum's */
359*0Sstevel@tonic-gate /* XXX cast below is to avoid lint warnings */
360*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_fault_type_tag_data;
361*0Sstevel@tonic-gate typedef tnf_int32_t		tnf_fault_type_t;
362*0Sstevel@tonic-gate #define	tnf_fault_type(ops, item, ref)	\
363*0Sstevel@tonic-gate 	tnf_int32(ops, (tnf_int32_t)(item), ref)
364*0Sstevel@tonic-gate 
365*0Sstevel@tonic-gate /* segment access type XXX enum */
366*0Sstevel@tonic-gate /* XXX should have a new type tnf_enum of appropriate size to map C enum's */
367*0Sstevel@tonic-gate /* XXX cast below is to avoid lint warnings */
368*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_seg_access_tag_data;
369*0Sstevel@tonic-gate typedef tnf_int32_t		tnf_seg_access_t;
370*0Sstevel@tonic-gate #define	tnf_seg_access(ops, item, ref)	\
371*0Sstevel@tonic-gate 	tnf_int32(ops, (tnf_int32_t)(item), ref)
372*0Sstevel@tonic-gate 
373*0Sstevel@tonic-gate /* buffered I/O flags */
374*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_bioflags_tag_data;
375*0Sstevel@tonic-gate typedef tnf_int32_t		tnf_bioflags_t;
376*0Sstevel@tonic-gate #define	tnf_bioflags(ops, item, ref)	\
377*0Sstevel@tonic-gate 	tnf_int32(ops, item, ref)
378*0Sstevel@tonic-gate 
379*0Sstevel@tonic-gate /* disk block addresses */
380*0Sstevel@tonic-gate extern tnf_tag_data_t		*tnf_diskaddr_tag_data;
381*0Sstevel@tonic-gate typedef tnf_int64_t		tnf_diskaddr_t;
382*0Sstevel@tonic-gate #define	tnf_diskaddr(ops, item, ref)	\
383*0Sstevel@tonic-gate 	tnf_int64(ops, item, ref)
384*0Sstevel@tonic-gate 
385*0Sstevel@tonic-gate #endif /* _KERNEL */
386*0Sstevel@tonic-gate 
387*0Sstevel@tonic-gate /*
388*0Sstevel@tonic-gate  * Type extension interface
389*0Sstevel@tonic-gate  */
390*0Sstevel@tonic-gate 
391*0Sstevel@tonic-gate extern tnf_tag_data_t	***tnf_user_struct_properties;
392*0Sstevel@tonic-gate 
393*0Sstevel@tonic-gate /*
394*0Sstevel@tonic-gate  * Data encoders
395*0Sstevel@tonic-gate  */
396*0Sstevel@tonic-gate 
397*0Sstevel@tonic-gate extern tnf_ref32_t	tnf_ref32_1(tnf_ops_t *,
398*0Sstevel@tonic-gate 					tnf_record_p,
399*0Sstevel@tonic-gate 					tnf_record_p);
400*0Sstevel@tonic-gate 
401*0Sstevel@tonic-gate extern tnf_reference_t 	tnf_string_1(tnf_ops_t *,
402*0Sstevel@tonic-gate 					const char *,
403*0Sstevel@tonic-gate 					tnf_record_p,
404*0Sstevel@tonic-gate 					tnf_tag_data_t *);
405*0Sstevel@tonic-gate 
406*0Sstevel@tonic-gate #ifdef _KERNEL
407*0Sstevel@tonic-gate 
408*0Sstevel@tonic-gate extern tnf_reference_t	tnf_opaque_array_1(tnf_ops_t *,
409*0Sstevel@tonic-gate 					tnf_opaque_t *,
410*0Sstevel@tonic-gate 					tnf_record_p,
411*0Sstevel@tonic-gate 					tnf_tag_data_t *);
412*0Sstevel@tonic-gate 
413*0Sstevel@tonic-gate #ifdef __sparc
414*0Sstevel@tonic-gate extern tnf_reference_t	tnf_opaque32_array_1(tnf_ops_t *,
415*0Sstevel@tonic-gate 					tnf_uint32_t *,
416*0Sstevel@tonic-gate 					tnf_record_p,
417*0Sstevel@tonic-gate 					tnf_tag_data_t *);
418*0Sstevel@tonic-gate #endif /* __sparc */
419*0Sstevel@tonic-gate 
420*0Sstevel@tonic-gate #endif /* _KERNEL */
421*0Sstevel@tonic-gate 
422*0Sstevel@tonic-gate /*
423*0Sstevel@tonic-gate  * Tag descriptors
424*0Sstevel@tonic-gate  */
425*0Sstevel@tonic-gate 
426*0Sstevel@tonic-gate extern tnf_record_p tnf_struct_tag_1(tnf_ops_t *, tnf_tag_data_t *);
427*0Sstevel@tonic-gate 
428*0Sstevel@tonic-gate /*
429*0Sstevel@tonic-gate  * Buffer memory allocator
430*0Sstevel@tonic-gate  */
431*0Sstevel@tonic-gate 
432*0Sstevel@tonic-gate extern void *tnf_allocate(tnf_ops_t *, size_t);
433*0Sstevel@tonic-gate 
434*0Sstevel@tonic-gate /*
435*0Sstevel@tonic-gate  * Weak symbol definitions to allow unprobed operation
436*0Sstevel@tonic-gate  */
437*0Sstevel@tonic-gate 
438*0Sstevel@tonic-gate #if !defined(_KERNEL) && !defined(_TNF_LIBRARY)
439*0Sstevel@tonic-gate 
440*0Sstevel@tonic-gate #pragma weak	__tnf_tag_version_1_info
441*0Sstevel@tonic-gate 
442*0Sstevel@tonic-gate #pragma weak	tnf_char_tag_data
443*0Sstevel@tonic-gate #pragma	weak	tnf_int8_tag_data
444*0Sstevel@tonic-gate #pragma	weak	tnf_uint8_tag_data
445*0Sstevel@tonic-gate #pragma	weak	tnf_int16_tag_data
446*0Sstevel@tonic-gate #pragma	weak	tnf_uint16_tag_data
447*0Sstevel@tonic-gate #pragma weak	tnf_int32_tag_data
448*0Sstevel@tonic-gate #pragma weak	tnf_uint32_tag_data
449*0Sstevel@tonic-gate #pragma weak	tnf_int64_tag_data
450*0Sstevel@tonic-gate #pragma weak	tnf_uint64_tag_data
451*0Sstevel@tonic-gate #pragma weak	tnf_float32_tag_data
452*0Sstevel@tonic-gate #pragma weak	tnf_float64_tag_data
453*0Sstevel@tonic-gate 
454*0Sstevel@tonic-gate #pragma weak	tnf_tag_tag_data
455*0Sstevel@tonic-gate #pragma weak	tnf_string_tag_data
456*0Sstevel@tonic-gate #pragma weak	tnf_name_tag_data
457*0Sstevel@tonic-gate #pragma weak	tnf_opaque_tag_data
458*0Sstevel@tonic-gate #pragma weak	tnf_size_tag_data
459*0Sstevel@tonic-gate 
460*0Sstevel@tonic-gate #pragma weak	tnf_probe_event_tag_data
461*0Sstevel@tonic-gate #pragma weak	tnf_time_delta_tag_data
462*0Sstevel@tonic-gate 
463*0Sstevel@tonic-gate #pragma weak	tnf_user_struct_properties
464*0Sstevel@tonic-gate 
465*0Sstevel@tonic-gate #pragma weak	tnf_ref32_1
466*0Sstevel@tonic-gate #pragma weak	tnf_string_1
467*0Sstevel@tonic-gate #pragma weak	tnf_struct_tag_1
468*0Sstevel@tonic-gate #pragma weak	tnf_allocate
469*0Sstevel@tonic-gate 
470*0Sstevel@tonic-gate #endif /* !defined(_KERNEL) || !defined(_TNF_LIBRARY) */
471*0Sstevel@tonic-gate 
472*0Sstevel@tonic-gate #ifdef __cplusplus
473*0Sstevel@tonic-gate }
474*0Sstevel@tonic-gate #endif
475*0Sstevel@tonic-gate 
476*0Sstevel@tonic-gate #endif	/* _SYS_TNF_WRITER_H */
477