tnf_writer.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1994,2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_TNF_WRITER_H
#define _SYS_TNF_WRITER_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Public interface for writing predefined TNF types
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Defines
*/
#define TNF_OFFSETOF(s, m) ((size_t)(&(((s *)0)->m)))
/*
* Typedefs
*/
typedef char *tnf_record_p; /* trace buffer memory ptr */
typedef struct _tnf_tag_version tnf_tag_version_t;
typedef struct _tnf_tag_data tnf_tag_data_t;
/*
* In-memory reader's classification of TNF types
*/
typedef enum {
TNF_UNKNOWN = 0,
#ifdef _LP64
#else
#endif
/*
* Structures
*/
struct _tnf_tag_version {
};
struct _tnf_tag_data {
const char *tag_name; /* name */
char **tag_slot_names; /* slot_names */
};
/*
* TNF tag version
* A client can scan a binary's relocation table for data relocation
* entries corresponding to __tnf_tag_version_1. These identify
* tags. The actual version information is stored in an associated
* structure called __tnf_tag_version_1_info
*/
extern tnf_tag_version_t __tnf_tag_version_1;
#define TNF_TAG_VERSION &__tnf_tag_version_1
/*
* TNF primitive types
*/
extern tnf_tag_data_t *tnf_char_tag_data;
extern tnf_tag_data_t *tnf_int8_tag_data;
extern tnf_tag_data_t *tnf_uint8_tag_data;
extern tnf_tag_data_t *tnf_int16_tag_data;
extern tnf_tag_data_t *tnf_uint16_tag_data;
extern tnf_tag_data_t *tnf_int32_tag_data;
extern tnf_tag_data_t *tnf_uint32_tag_data;
extern tnf_tag_data_t *tnf_int64_tag_data;
extern tnf_tag_data_t *tnf_uint64_tag_data;
extern tnf_tag_data_t *tnf_float32_tag_data;
extern tnf_tag_data_t *tnf_float64_tag_data;
/*
* ``Portable'' primitive types
* These are defined as the well-defined TNF types they map into.
* XXX Machine-dependent
*/
typedef tnf_uint8_t tnf_uchar_t;
#define tnf_uchar_tag_data tnf_uint8_tag_data
typedef tnf_int16_t tnf_short_t;
#define tnf_short_tag_data tnf_int16_tag_data
typedef tnf_uint16_t tnf_ushort_t;
typedef tnf_int32_t tnf_int_t;
#define tnf_int_tag_data tnf_int32_tag_data
typedef tnf_uint32_t tnf_uint_t;
#define tnf_uint_tag_data tnf_uint32_tag_data
#if defined(_LP64)
typedef tnf_int64_t tnf_long_t;
#define tnf_long_tag_data tnf_int64_tag_data
typedef tnf_uint64_t tnf_ulong_t;
#else
typedef tnf_int32_t tnf_long_t;
#define tnf_long_tag_data tnf_int32_tag_data
typedef tnf_uint32_t tnf_ulong_t;
#endif /* defined(_LP64) */
typedef tnf_int64_t tnf_longlong_t;
typedef tnf_uint64_t tnf_ulonglong_t;
typedef tnf_float32_t tnf_float_t;
typedef tnf_float64_t tnf_double_t;
/*
* Derived and aggregate TNF types
*/
/* Not explicitly represented in type system */
extern tnf_tag_data_t *tnf_tag_tag_data;
typedef tnf_ref32_t tnf_tag_t;
extern tnf_tag_data_t *tnf_string_tag_data;
typedef tnf_reference_t tnf_string_t;
extern tnf_tag_data_t *tnf_name_tag_data;
typedef tnf_string_t tnf_name_t;
extern tnf_tag_data_t *tnf_size_tag_data;
typedef tnf_ulong_t tnf_size_t;
extern tnf_tag_data_t *tnf_opaque_tag_data;
#if defined(_LP64)
typedef tnf_uint64_t tnf_opaque_t;
((tnf_uint64_t)(item))
#else
typedef tnf_uint32_t tnf_opaque_t;
((tnf_uint32_t)(item))
#endif /* defined(_LP64) */
/*
* TNF types for tracing
*/
extern tnf_tag_data_t *tnf_time_base_tag_data;
typedef tnf_int64_t tnf_time_base_t;
extern tnf_tag_data_t *tnf_time_delta_tag_data;
typedef tnf_uint32_t tnf_time_delta_t;
extern tnf_tag_data_t *tnf_probe_event_tag_data;
typedef tnf_ref32_t tnf_probe_event_t;
/* process ID */
extern tnf_tag_data_t *tnf_pid_tag_data;
typedef tnf_int32_t tnf_pid_t;
/* LWP ID */
extern tnf_tag_data_t *tnf_lwpid_tag_data;
typedef tnf_uint32_t tnf_lwpid_t;
#ifdef _KERNEL
/* kernel thread ID */
extern tnf_tag_data_t *tnf_kthread_id_tag_data;
typedef tnf_opaque_t tnf_kthread_id_t;
/* processor ID */
extern tnf_tag_data_t *tnf_cpuid_tag_data;
typedef tnf_int32_t tnf_cpuid_t;
/* device ID */
extern tnf_tag_data_t *tnf_device_tag_data;
typedef tnf_ulong_t tnf_device_t;
/* kernel symbol */
extern tnf_tag_data_t *tnf_symbol_tag_data;
typedef tnf_opaque_t tnf_symbol_t;
/* array of symbols */
extern tnf_tag_data_t *tnf_symbols_tag_data;
typedef tnf_ref32_t tnf_symbols_t;
#if defined(__sparc)
#else /* defined(__sparc) */
#endif /* defined(__sparc) */
/* system call number */
extern tnf_tag_data_t *tnf_sysnum_tag_data;
typedef tnf_int16_t tnf_sysnum_t;
/* thread microstate XXX enum */
/* XXX should have a new type tnf_enum of appropriate size to map C enum's */
/* XXX cast below is to avoid lint warnings */
extern tnf_tag_data_t *tnf_microstate_tag_data;
typedef tnf_int32_t tnf_microstate_t;
/* file offset */
extern tnf_tag_data_t *tnf_offset_tag_data;
typedef tnf_int64_t tnf_offset_t;
/* address fault type XXX enum */
/* XXX should have a new type tnf_enum of appropriate size to map C enum's */
/* XXX cast below is to avoid lint warnings */
extern tnf_tag_data_t *tnf_fault_type_tag_data;
typedef tnf_int32_t tnf_fault_type_t;
/* segment access type XXX enum */
/* XXX should have a new type tnf_enum of appropriate size to map C enum's */
/* XXX cast below is to avoid lint warnings */
extern tnf_tag_data_t *tnf_seg_access_tag_data;
typedef tnf_int32_t tnf_seg_access_t;
/* buffered I/O flags */
extern tnf_tag_data_t *tnf_bioflags_tag_data;
typedef tnf_int32_t tnf_bioflags_t;
/* disk block addresses */
extern tnf_tag_data_t *tnf_diskaddr_tag_data;
typedef tnf_int64_t tnf_diskaddr_t;
#endif /* _KERNEL */
/*
* Type extension interface
*/
extern tnf_tag_data_t ***tnf_user_struct_properties;
/*
* Data encoders
*/
const char *,
tnf_tag_data_t *);
#ifdef _KERNEL
tnf_opaque_t *,
tnf_tag_data_t *);
#ifdef __sparc
tnf_uint32_t *,
tnf_tag_data_t *);
#endif /* __sparc */
#endif /* _KERNEL */
/*
* Tag descriptors
*/
/*
* Buffer memory allocator
*/
/*
* Weak symbol definitions to allow unprobed operation
*/
#if !defined(_KERNEL) && !defined(_TNF_LIBRARY)
#pragma weak __tnf_tag_version_1_info
#pragma weak tnf_char_tag_data
#pragma weak tnf_int8_tag_data
#pragma weak tnf_uint8_tag_data
#pragma weak tnf_int16_tag_data
#pragma weak tnf_uint16_tag_data
#pragma weak tnf_int32_tag_data
#pragma weak tnf_uint32_tag_data
#pragma weak tnf_int64_tag_data
#pragma weak tnf_uint64_tag_data
#pragma weak tnf_float32_tag_data
#pragma weak tnf_float64_tag_data
#pragma weak tnf_tag_tag_data
#pragma weak tnf_string_tag_data
#pragma weak tnf_name_tag_data
#pragma weak tnf_opaque_tag_data
#pragma weak tnf_size_tag_data
#pragma weak tnf_probe_event_tag_data
#pragma weak tnf_time_delta_tag_data
#pragma weak tnf_user_struct_properties
#pragma weak tnf_ref32_1
#pragma weak tnf_string_1
#pragma weak tnf_struct_tag_1
#pragma weak tnf_allocate
#endif /* !defined(_KERNEL) || !defined(_TNF_LIBRARY) */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_TNF_WRITER_H */