10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 22*1193Smws 230Sstevel@tonic-gate /* 24*1193Smws * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 250Sstevel@tonic-gate * Use is subject to license terms. 260Sstevel@tonic-gate */ 270Sstevel@tonic-gate 280Sstevel@tonic-gate #ifndef _FMD_TRACE_H 290Sstevel@tonic-gate #define _FMD_TRACE_H 300Sstevel@tonic-gate 310Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 320Sstevel@tonic-gate 330Sstevel@tonic-gate #include <sys/types.h> 340Sstevel@tonic-gate #include <stdarg.h> 350Sstevel@tonic-gate 360Sstevel@tonic-gate #ifdef __cplusplus 370Sstevel@tonic-gate extern "C" { 380Sstevel@tonic-gate #endif 390Sstevel@tonic-gate 400Sstevel@tonic-gate typedef struct fmd_tracerec { 410Sstevel@tonic-gate hrtime_t tr_time; /* high-resolution timestamp */ 420Sstevel@tonic-gate const char *tr_file; /* source file name */ 430Sstevel@tonic-gate uint32_t tr_line; /* source file line */ 440Sstevel@tonic-gate uint16_t tr_errno; /* errno value if error */ 450Sstevel@tonic-gate uint8_t tr_tag; /* tag (see <fmd_subr.h>) */ 460Sstevel@tonic-gate uint8_t tr_depth; /* depth of tr_stack[] */ 470Sstevel@tonic-gate char tr_msg[64]; /* formatted message */ 480Sstevel@tonic-gate uintptr_t tr_stack[1]; /* stack trace (optional) */ 490Sstevel@tonic-gate } fmd_tracerec_t; 500Sstevel@tonic-gate 510Sstevel@tonic-gate typedef struct fmd_tracebuf { 520Sstevel@tonic-gate fmd_tracerec_t *tb_buf; /* pointer to first trace record */ 530Sstevel@tonic-gate fmd_tracerec_t *tb_end; /* pointer to last trace record */ 540Sstevel@tonic-gate fmd_tracerec_t *tb_ptr; /* next trace record to use */ 550Sstevel@tonic-gate uint_t tb_frames; /* maximum captured frames */ 560Sstevel@tonic-gate uint_t tb_recs; /* number of trace records */ 570Sstevel@tonic-gate uint_t tb_size; /* size of each record */ 58*1193Smws uint_t tb_depth; /* recursion depth of trace function */ 590Sstevel@tonic-gate } fmd_tracebuf_t; 600Sstevel@tonic-gate 610Sstevel@tonic-gate typedef fmd_tracerec_t *fmd_tracebuf_f(fmd_tracebuf_t *, 62*1193Smws uint_t, const char *, va_list); 630Sstevel@tonic-gate 640Sstevel@tonic-gate extern fmd_tracebuf_t *fmd_trace_create(void); 650Sstevel@tonic-gate extern void fmd_trace_destroy(fmd_tracebuf_t *); 660Sstevel@tonic-gate 670Sstevel@tonic-gate extern fmd_tracebuf_f fmd_trace_none; 680Sstevel@tonic-gate extern fmd_tracebuf_f fmd_trace_lite; 690Sstevel@tonic-gate extern fmd_tracebuf_f fmd_trace_full; 700Sstevel@tonic-gate 710Sstevel@tonic-gate #ifdef __cplusplus 720Sstevel@tonic-gate } 730Sstevel@tonic-gate #endif 740Sstevel@tonic-gate 750Sstevel@tonic-gate #endif /* _FMD_TRACE_H */ 76