/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/sysmacros.h>
#include <ucontext.h>
#include <strings.h>
#include <stdio.h>
#include <errno.h>
#include <fmd_trace.h>
#include <fmd_alloc.h>
#include <fmd_subr.h>
#include <fmd_conf.h>
#include <fmd.h>
fmd_trace_create(void)
{
/*
* We require 8-byte alignment of fmd_tracerec_t to store hrtime_t's.
* Since the trailing flexible array member is of type uintptr_t, we
* may need to allocate an additional element if we are compiling
* 32-bit; otherwise uintptr_t is 8 bytes so any value of tb_frames is
* acceptable.
*
* tb_frames includes the first element, whose size is reflected in
* sizeof (fmd_tracerec_t). Therefore, if fmd_tracerec_t's size is
* 0 mod 8, we must be sure the total number of frames is odd.
* Otherwise, we need at least one extra frame, so the total count
* must be even. This will continue to work even if the sizes or
* types of other fmd_tracerec_t members are changed.
*/
#ifdef _ILP32
/*CONSTCOND*/
if (sizeof (fmd_tracerec_t) % sizeof (hrtime_t) == 0)
else
#endif
return (tbp);
}
void
{
}
/*
* Callback for walkcontext(3C) to store the stack trace. We use tr_tag below
* to store the maximum value of depth that is permitted so we can use it here.
*/
/*ARGSUSED*/
static int
{
}
/*ARGSUSED*/
{
return (NULL);
}
{
char *p;
return (NULL);
}
p[-1] = '\0';
else
return (trp);
}
{
char *p;
return (NULL);
}
(void) getcontext(&uc);
p[-1] = '\0';
else
return (trp);
}