misc.h revision 5c5f137104b2d56181283389fa902220f2023809
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _MISC_H
#define _MISC_H
#include <thread.h>
#include <pthread.h>
#include <stdarg.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* a safe printf -- do not use for error messages.
*/
void debug_printf(const char *format, ...);
/*
* adds a message to the log without writing it out.
*/
void log_message(const char *format, ...);
/*
*/
/*
* Converts a hrtime_t to a timestruc_t
*/
/*
* tries to print out the symbol and offset of a pointer using umem_error_info
*/
/*
* Information about the current error. Can be called multiple times, should
* be followed eventually with a call to umem_err or umem_err_recoverable.
*/
void umem_printf(const char *format, ...);
void umem_error_enter(const char *);
/*
* prints error message and stack trace, then aborts. Cannot return.
*/
#pragma does_not_return(umem_panic)
#pragma rarely_called(umem_panic)
/*
* like umem_err, but only aborts if umem_abort > 0
*/
void umem_err_recoverable(const char *format, ...);
/*
* We define our own assertion handling since libc's assert() calls malloc()
*/
#ifdef NDEBUG
#else
#endif
#pragma does_not_return(__umem_assert_failed)
#pragma rarely_called(__umem_assert_failed)
/*
* These have architecture-specific implementations.
*/
/*
* Returns the current function's frame pointer.
*/
extern void *getfp(void);
/*
* puts a pc-only stack trace of up to pcstack_limit frames into pcstack.
* Returns the number of stacks written.
*
* if check_sighandler != 0, and we are in a signal context, calls
* umem_err_recoverable.
*/
int check_sighandler);
#ifdef __cplusplus
}
#endif
#endif /* _MISC_H */