10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #ifndef _MISC_H
28 #define _MISC_H
29
30 #pragma ident "%Z%%M% %I% %E% SMI"
31
32 #include <sys/types.h>
33 #include <sys/time.h>
34 #include <thread.h>
35 #include <pthread.h>
36 #include <stdarg.h>
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 extern uint_t umem_abort; /* abort when errors occur */
43 extern uint_t umem_output; /* output error messages to stderr */
44 extern caddr_t umem_min_stack; /* max stack address for audit log */
45 extern caddr_t umem_max_stack; /* min stack address for audit log */
46
47 /*
48 * various utility functions
49 * These are globally implemented.
50 */
51
52 #undef offsetof
53 #define offsetof(s, m) ((size_t)(&(((s *)0)->m)))
54
55 /*
56 * a safe printf -- do not use for error messages.
57 */
58 void debug_printf(const char *format, ...);
59
60 /*
61 * adds a message to the log without writing it out.
62 */
63 void log_message(const char *format, ...);
64
65 /*
66 * returns the index of the (high/low) bit + 1
67 */
68 int highbit(ulong_t);
69 int lowbit(ulong_t);
70 #pragma no_side_effect(highbit, lowbit)
71
72 /*
73 * Converts a hrtime_t to a timestruc_t
|
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #ifndef _MISC_H
28 #define _MISC_H
29
30 #include <sys/types.h>
31 #include <sys/time.h>
32 #include <thread.h>
33 #include <pthread.h>
34 #include <stdarg.h>
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 extern uint_t umem_abort; /* abort when errors occur */
41 extern uint_t umem_output; /* output error messages to stderr */
42 extern caddr_t umem_min_stack; /* max stack address for audit log */
43 extern caddr_t umem_max_stack; /* min stack address for audit log */
44
45 /*
46 * various utility functions
47 * These are globally implemented.
48 */
49
50 #undef offsetof
51 #if defined(__GNUC__)
52 #define offsetof(s, m) __builtin_offsetof(s, m)
53 #else
54 #define offsetof(s, m) ((size_t)(&(((s *)0)->m)))
55 #endif
56
57 /*
58 * a safe printf -- do not use for error messages.
59 */
60 void debug_printf(const char *format, ...);
61
62 /*
63 * adds a message to the log without writing it out.
64 */
65 void log_message(const char *format, ...);
66
67 /*
68 * returns the index of the (high/low) bit + 1
69 */
70 int highbit(ulong_t);
71 int lowbit(ulong_t);
72 #pragma no_side_effect(highbit, lowbit)
73
74 /*
75 * Converts a hrtime_t to a timestruc_t
|