Print this page
2976 remove useless offsetof() macros
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libumem/common/misc.h
+++ new/usr/src/lib/libumem/common/misc.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
20 20 */
21 21
22 22 /*
23 23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 27 #ifndef _MISC_H
28 28 #define _MISC_H
29 29
30 -#pragma ident "%Z%%M% %I% %E% SMI"
31 -
32 30 #include <sys/types.h>
33 31 #include <sys/time.h>
34 32 #include <thread.h>
35 33 #include <pthread.h>
36 34 #include <stdarg.h>
35 +#include <stddef.h>
37 36
38 37 #ifdef __cplusplus
39 38 extern "C" {
40 39 #endif
41 40
42 41 extern uint_t umem_abort; /* abort when errors occur */
43 42 extern uint_t umem_output; /* output error messages to stderr */
44 43 extern caddr_t umem_min_stack; /* max stack address for audit log */
45 44 extern caddr_t umem_max_stack; /* min stack address for audit log */
46 45
47 46 /*
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 47 * a safe printf -- do not use for error messages.
57 48 */
58 49 void debug_printf(const char *format, ...);
59 50
60 51 /*
61 52 * adds a message to the log without writing it out.
62 53 */
63 54 void log_message(const char *format, ...);
64 55
65 56 /*
66 57 * returns the index of the (high/low) bit + 1
67 58 */
68 59 int highbit(ulong_t);
69 60 int lowbit(ulong_t);
70 61 #pragma no_side_effect(highbit, lowbit)
71 62
72 63 /*
73 64 * Converts a hrtime_t to a timestruc_t
74 65 */
75 66 void hrt2ts(hrtime_t hrt, timestruc_t *tsp);
76 67
77 68 /*
78 69 * tries to print out the symbol and offset of a pointer using umem_error_info
79 70 */
80 71 int print_sym(void *pointer);
81 72
82 73 /*
83 74 * Information about the current error. Can be called multiple times, should
84 75 * be followed eventually with a call to umem_err or umem_err_recoverable.
85 76 */
86 77 void umem_printf(const char *format, ...);
87 78 void umem_vprintf(const char *format, va_list);
88 79
89 80 void umem_printf_warn(void *ignored, const char *format, ...);
90 81
91 82 void umem_error_enter(const char *);
92 83
93 84 /*
94 85 * prints error message and stack trace, then aborts. Cannot return.
95 86 */
96 87 void umem_panic(const char *format, ...) __NORETURN;
97 88 #pragma does_not_return(umem_panic)
98 89 #pragma rarely_called(umem_panic)
99 90
100 91 /*
101 92 * like umem_err, but only aborts if umem_abort > 0
102 93 */
103 94 void umem_err_recoverable(const char *format, ...);
104 95
105 96 /*
106 97 * We define our own assertion handling since libc's assert() calls malloc()
107 98 */
108 99 #ifdef NDEBUG
109 100 #define ASSERT(assertion) (void)0
110 101 #else
111 102 #define ASSERT(assertion) (void)((assertion) || \
112 103 __umem_assert_failed(#assertion, __FILE__, __LINE__))
113 104 #endif
114 105
115 106 int __umem_assert_failed(const char *assertion, const char *file, int line);
116 107 #pragma does_not_return(__umem_assert_failed)
117 108 #pragma rarely_called(__umem_assert_failed)
118 109 /*
119 110 * These have architecture-specific implementations.
120 111 */
121 112
122 113 /*
123 114 * Returns the current function's frame pointer.
124 115 */
125 116 extern void *getfp(void);
126 117
127 118 /*
128 119 * puts a pc-only stack trace of up to pcstack_limit frames into pcstack.
129 120 * Returns the number of stacks written.
130 121 *
131 122 * if check_sighandler != 0, and we are in a signal context, calls
132 123 * umem_err_recoverable.
133 124 */
134 125 extern int getpcstack(uintptr_t *pcstack, int pcstack_limit,
135 126 int check_sighandler);
136 127
137 128 #ifdef __cplusplus
138 129 }
139 130 #endif
140 131
141 132 #endif /* _MISC_H */
↓ open down ↓ |
76 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX