1 | #ifndef _exc_server_ |
2 | #define _exc_server_ |
3 | |
4 | /* Module exc */ |
5 | |
6 | #include <string.h> |
7 | #include <mach/ndr.h> |
8 | #include <mach/boolean.h> |
9 | #include <mach/kern_return.h> |
10 | #include <mach/notify.h> |
11 | #include <mach/mach_types.h> |
12 | #include <mach/message.h> |
13 | #include <mach/mig_errors.h> |
14 | #include <mach/port.h> |
15 | |
16 | /* BEGIN MIG_STRNCPY_ZEROFILL CODE */ |
17 | |
18 | #if defined(__has_include) |
19 | #if __has_include(<mach/mig_strncpy_zerofill_support.h>) |
20 | #ifndef USING_MIG_STRNCPY_ZEROFILL |
21 | #define USING_MIG_STRNCPY_ZEROFILL |
22 | #endif |
23 | #ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ |
24 | #define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ |
25 | #ifdef __cplusplus |
26 | extern "C" { |
27 | #endif |
28 | #ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR |
29 | #define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable |
30 | #endif |
31 | extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import)); |
32 | #ifdef __cplusplus |
33 | } |
34 | #endif |
35 | #endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */ |
36 | #endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */ |
37 | #endif /* __has_include */ |
38 | |
39 | /* END MIG_STRNCPY_ZEROFILL CODE */ |
40 | |
41 | |
42 | #ifdef AUTOTEST |
43 | #ifndef FUNCTION_PTR_T |
44 | #define FUNCTION_PTR_T |
45 | typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); |
46 | typedef struct { |
47 | char * name; |
48 | function_ptr_t function; |
49 | } function_table_entry; |
50 | typedef function_table_entry *function_table_t; |
51 | #endif /* FUNCTION_PTR_T */ |
52 | #endif /* AUTOTEST */ |
53 | |
54 | #ifndef exc_MSG_COUNT |
55 | #define exc_MSG_COUNT 3 |
56 | #endif /* exc_MSG_COUNT */ |
57 | |
58 | #include <Availability.h> |
59 | #include <mach/std_types.h> |
60 | #include <mach/mig.h> |
61 | #include <mach/mig.h> |
62 | #include <mach/mach_types.h> |
63 | |
64 | #ifdef __BeforeMigServerHeader |
65 | __BeforeMigServerHeader |
66 | #endif /* __BeforeMigServerHeader */ |
67 | |
68 | #ifndef MIG_SERVER_ROUTINE |
69 | #define MIG_SERVER_ROUTINE |
70 | #endif |
71 | |
72 | |
73 | /* Routine exception_raise */ |
74 | #ifdef mig_external |
75 | mig_external |
76 | #else |
77 | extern |
78 | #endif /* mig_external */ |
79 | MIG_SERVER_ROUTINE |
80 | kern_return_t catch_exception_raise |
81 | ( |
82 | mach_port_t exception_port, |
83 | mach_port_t thread, |
84 | mach_port_t task, |
85 | exception_type_t exception, |
86 | exception_data_t code, |
87 | mach_msg_type_number_t codeCnt |
88 | ); |
89 | |
90 | /* Routine exception_raise_state */ |
91 | #ifdef mig_external |
92 | mig_external |
93 | #else |
94 | extern |
95 | #endif /* mig_external */ |
96 | MIG_SERVER_ROUTINE |
97 | kern_return_t catch_exception_raise_state |
98 | ( |
99 | mach_port_t exception_port, |
100 | exception_type_t exception, |
101 | const exception_data_t code, |
102 | mach_msg_type_number_t codeCnt, |
103 | int *flavor, |
104 | const thread_state_t old_state, |
105 | mach_msg_type_number_t old_stateCnt, |
106 | thread_state_t new_state, |
107 | mach_msg_type_number_t *new_stateCnt |
108 | ); |
109 | |
110 | /* Routine exception_raise_state_identity */ |
111 | #ifdef mig_external |
112 | mig_external |
113 | #else |
114 | extern |
115 | #endif /* mig_external */ |
116 | MIG_SERVER_ROUTINE |
117 | kern_return_t catch_exception_raise_state_identity |
118 | ( |
119 | mach_port_t exception_port, |
120 | mach_port_t thread, |
121 | mach_port_t task, |
122 | exception_type_t exception, |
123 | exception_data_t code, |
124 | mach_msg_type_number_t codeCnt, |
125 | int *flavor, |
126 | thread_state_t old_state, |
127 | mach_msg_type_number_t old_stateCnt, |
128 | thread_state_t new_state, |
129 | mach_msg_type_number_t *new_stateCnt |
130 | ); |
131 | |
132 | #ifdef mig_external |
133 | mig_external |
134 | #else |
135 | extern |
136 | #endif /* mig_external */ |
137 | boolean_t exc_server( |
138 | mach_msg_header_t *InHeadP, |
139 | mach_msg_header_t *OutHeadP); |
140 | |
141 | #ifdef mig_external |
142 | mig_external |
143 | #else |
144 | extern |
145 | #endif /* mig_external */ |
146 | mig_routine_t exc_server_routine( |
147 | mach_msg_header_t *InHeadP); |
148 | |
149 | |
150 | /* Description of this subsystem, for use in direct RPC */ |
151 | extern const struct catch_exc_subsystem { |
152 | mig_server_routine_t server; /* Server routine */ |
153 | mach_msg_id_t start; /* Min routine number */ |
154 | mach_msg_id_t end; /* Max routine number + 1 */ |
155 | unsigned int maxsize; /* Max msg size */ |
156 | vm_address_t reserved; /* Reserved */ |
157 | struct routine_descriptor /* Array of routine descriptors */ |
158 | routine[3]; |
159 | } catch_exc_subsystem; |
160 | |
161 | /* typedefs for all requests */ |
162 | |
163 | #ifndef __Request__exc_subsystem__defined |
164 | #define __Request__exc_subsystem__defined |
165 | |
166 | #ifdef __MigPackStructs |
167 | #pragma pack(push, 4) |
168 | #endif |
169 | typedef struct { |
170 | mach_msg_header_t Head; |
171 | /* start of the kernel processed data */ |
172 | mach_msg_body_t msgh_body; |
173 | mach_msg_port_descriptor_t thread; |
174 | mach_msg_port_descriptor_t task; |
175 | /* end of the kernel processed data */ |
176 | NDR_record_t NDR; |
177 | exception_type_t exception; |
178 | mach_msg_type_number_t codeCnt; |
179 | integer_t code[2]; |
180 | } __Request__exception_raise_t __attribute__((unused)); |
181 | #ifdef __MigPackStructs |
182 | #pragma pack(pop) |
183 | #endif |
184 | |
185 | #ifdef __MigPackStructs |
186 | #pragma pack(push, 4) |
187 | #endif |
188 | typedef struct { |
189 | mach_msg_header_t Head; |
190 | NDR_record_t NDR; |
191 | exception_type_t exception; |
192 | mach_msg_type_number_t codeCnt; |
193 | integer_t code[2]; |
194 | int flavor; |
195 | mach_msg_type_number_t old_stateCnt; |
196 | natural_t old_state[1296]; |
197 | } __Request__exception_raise_state_t __attribute__((unused)); |
198 | #ifdef __MigPackStructs |
199 | #pragma pack(pop) |
200 | #endif |
201 | |
202 | #ifdef __MigPackStructs |
203 | #pragma pack(push, 4) |
204 | #endif |
205 | typedef struct { |
206 | mach_msg_header_t Head; |
207 | /* start of the kernel processed data */ |
208 | mach_msg_body_t msgh_body; |
209 | mach_msg_port_descriptor_t thread; |
210 | mach_msg_port_descriptor_t task; |
211 | /* end of the kernel processed data */ |
212 | NDR_record_t NDR; |
213 | exception_type_t exception; |
214 | mach_msg_type_number_t codeCnt; |
215 | integer_t code[2]; |
216 | int flavor; |
217 | mach_msg_type_number_t old_stateCnt; |
218 | natural_t old_state[1296]; |
219 | } __Request__exception_raise_state_identity_t __attribute__((unused)); |
220 | #ifdef __MigPackStructs |
221 | #pragma pack(pop) |
222 | #endif |
223 | #endif /* !__Request__exc_subsystem__defined */ |
224 | |
225 | |
226 | /* union of all requests */ |
227 | |
228 | #ifndef __RequestUnion__catch_exc_subsystem__defined |
229 | #define __RequestUnion__catch_exc_subsystem__defined |
230 | union __RequestUnion__catch_exc_subsystem { |
231 | __Request__exception_raise_t Request_exception_raise; |
232 | __Request__exception_raise_state_t Request_exception_raise_state; |
233 | __Request__exception_raise_state_identity_t Request_exception_raise_state_identity; |
234 | }; |
235 | #endif /* __RequestUnion__catch_exc_subsystem__defined */ |
236 | /* typedefs for all replies */ |
237 | |
238 | #ifndef __Reply__exc_subsystem__defined |
239 | #define __Reply__exc_subsystem__defined |
240 | |
241 | #ifdef __MigPackStructs |
242 | #pragma pack(push, 4) |
243 | #endif |
244 | typedef struct { |
245 | mach_msg_header_t Head; |
246 | NDR_record_t NDR; |
247 | kern_return_t RetCode; |
248 | } __Reply__exception_raise_t __attribute__((unused)); |
249 | #ifdef __MigPackStructs |
250 | #pragma pack(pop) |
251 | #endif |
252 | |
253 | #ifdef __MigPackStructs |
254 | #pragma pack(push, 4) |
255 | #endif |
256 | typedef struct { |
257 | mach_msg_header_t Head; |
258 | NDR_record_t NDR; |
259 | kern_return_t RetCode; |
260 | int flavor; |
261 | mach_msg_type_number_t new_stateCnt; |
262 | natural_t new_state[1296]; |
263 | } __Reply__exception_raise_state_t __attribute__((unused)); |
264 | #ifdef __MigPackStructs |
265 | #pragma pack(pop) |
266 | #endif |
267 | |
268 | #ifdef __MigPackStructs |
269 | #pragma pack(push, 4) |
270 | #endif |
271 | typedef struct { |
272 | mach_msg_header_t Head; |
273 | NDR_record_t NDR; |
274 | kern_return_t RetCode; |
275 | int flavor; |
276 | mach_msg_type_number_t new_stateCnt; |
277 | natural_t new_state[1296]; |
278 | } __Reply__exception_raise_state_identity_t __attribute__((unused)); |
279 | #ifdef __MigPackStructs |
280 | #pragma pack(pop) |
281 | #endif |
282 | #endif /* !__Reply__exc_subsystem__defined */ |
283 | |
284 | |
285 | /* union of all replies */ |
286 | |
287 | #ifndef __ReplyUnion__catch_exc_subsystem__defined |
288 | #define __ReplyUnion__catch_exc_subsystem__defined |
289 | union __ReplyUnion__catch_exc_subsystem { |
290 | __Reply__exception_raise_t Reply_exception_raise; |
291 | __Reply__exception_raise_state_t Reply_exception_raise_state; |
292 | __Reply__exception_raise_state_identity_t Reply_exception_raise_state_identity; |
293 | }; |
294 | #endif /* __ReplyUnion__catch_exc_subsystem__defined */ |
295 | |
296 | #ifndef subsystem_to_name_map_exc |
297 | #define subsystem_to_name_map_exc \ |
298 | { "exception_raise", 2401 },\ |
299 | { "exception_raise_state", 2402 },\ |
300 | { "exception_raise_state_identity", 2403 } |
301 | #endif |
302 | |
303 | #ifdef __AfterMigServerHeader |
304 | __AfterMigServerHeader |
305 | #endif /* __AfterMigServerHeader */ |
306 | |
307 | #endif /* _exc_server_ */ |
308 | |