1#ifndef _mach_exc_server_
2#define _mach_exc_server_
3
4/* Module mach_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
26extern "C" {
27#endif
28 extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
29#ifdef __cplusplus
30}
31#endif
32#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
33#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
34#endif /* __has_include */
35
36/* END MIG_STRNCPY_ZEROFILL CODE */
37
38
39#ifdef AUTOTEST
40#ifndef FUNCTION_PTR_T
41#define FUNCTION_PTR_T
42typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
43typedef struct {
44 char *name;
45 function_ptr_t function;
46} function_table_entry;
47typedef function_table_entry *function_table_t;
48#endif /* FUNCTION_PTR_T */
49#endif /* AUTOTEST */
50
51#ifndef mach_exc_MSG_COUNT
52#define mach_exc_MSG_COUNT 3
53#endif /* mach_exc_MSG_COUNT */
54
55#include <mach/std_types.h>
56#include <mach/mig.h>
57#include <mach/mig.h>
58#include <mach/mach_types.h>
59
60#ifdef __BeforeMigServerHeader
61__BeforeMigServerHeader
62#endif /* __BeforeMigServerHeader */
63
64
65/* Routine mach_exception_raise */
66#ifdef mig_external
67mig_external
68#else
69extern
70#endif /* mig_external */
71kern_return_t catch_mach_exception_raise
72(
73 mach_port_t exception_port,
74 mach_port_t thread,
75 mach_port_t task,
76 exception_type_t exception,
77 mach_exception_data_t code,
78 mach_msg_type_number_t codeCnt
79);
80
81/* Routine mach_exception_raise_state */
82#ifdef mig_external
83mig_external
84#else
85extern
86#endif /* mig_external */
87kern_return_t catch_mach_exception_raise_state
88(
89 mach_port_t exception_port,
90 exception_type_t exception,
91 const mach_exception_data_t code,
92 mach_msg_type_number_t codeCnt,
93 int *flavor,
94 const thread_state_t old_state,
95 mach_msg_type_number_t old_stateCnt,
96 thread_state_t new_state,
97 mach_msg_type_number_t *new_stateCnt
98);
99
100/* Routine mach_exception_raise_state_identity */
101#ifdef mig_external
102mig_external
103#else
104extern
105#endif /* mig_external */
106kern_return_t catch_mach_exception_raise_state_identity
107(
108 mach_port_t exception_port,
109 mach_port_t thread,
110 mach_port_t task,
111 exception_type_t exception,
112 mach_exception_data_t code,
113 mach_msg_type_number_t codeCnt,
114 int *flavor,
115 thread_state_t old_state,
116 mach_msg_type_number_t old_stateCnt,
117 thread_state_t new_state,
118 mach_msg_type_number_t *new_stateCnt
119);
120
121#ifdef mig_external
122mig_external
123#else
124extern
125#endif /* mig_external */
126boolean_t mach_exc_server(
127 mach_msg_header_t *InHeadP,
128 mach_msg_header_t *OutHeadP);
129
130#ifdef mig_external
131mig_external
132#else
133extern
134#endif /* mig_external */
135mig_routine_t mach_exc_server_routine(
136 mach_msg_header_t *InHeadP);
137
138
139/* Description of this subsystem, for use in direct RPC */
140extern const struct catch_mach_exc_subsystem {
141 mig_server_routine_t server; /* Server routine */
142 mach_msg_id_t start; /* Min routine number */
143 mach_msg_id_t end; /* Max routine number + 1 */
144 unsigned int maxsize; /* Max msg size */
145 vm_address_t reserved; /* Reserved */
146 struct routine_descriptor /*Array of routine descriptors */
147 routine[3];
148} catch_mach_exc_subsystem;
149
150/* typedefs for all requests */
151
152#ifndef __Request__mach_exc_subsystem__defined
153#define __Request__mach_exc_subsystem__defined
154
155#ifdef __MigPackStructs
156#pragma pack(4)
157#endif
158 typedef struct {
159 mach_msg_header_t Head;
160 /* start of the kernel processed data */
161 mach_msg_body_t msgh_body;
162 mach_msg_port_descriptor_t thread;
163 mach_msg_port_descriptor_t task;
164 /* end of the kernel processed data */
165 NDR_record_t NDR;
166 exception_type_t exception;
167 mach_msg_type_number_t codeCnt;
168 int64_t code[2];
169 } __Request__mach_exception_raise_t __attribute__((unused));
170#ifdef __MigPackStructs
171#pragma pack()
172#endif
173
174#ifdef __MigPackStructs
175#pragma pack(4)
176#endif
177 typedef struct {
178 mach_msg_header_t Head;
179 NDR_record_t NDR;
180 exception_type_t exception;
181 mach_msg_type_number_t codeCnt;
182 int64_t code[2];
183 int flavor;
184 mach_msg_type_number_t old_stateCnt;
185 natural_t old_state[144];
186 } __Request__mach_exception_raise_state_t __attribute__((unused));
187#ifdef __MigPackStructs
188#pragma pack()
189#endif
190
191#ifdef __MigPackStructs
192#pragma pack(4)
193#endif
194 typedef struct {
195 mach_msg_header_t Head;
196 /* start of the kernel processed data */
197 mach_msg_body_t msgh_body;
198 mach_msg_port_descriptor_t thread;
199 mach_msg_port_descriptor_t task;
200 /* end of the kernel processed data */
201 NDR_record_t NDR;
202 exception_type_t exception;
203 mach_msg_type_number_t codeCnt;
204 int64_t code[2];
205 int flavor;
206 mach_msg_type_number_t old_stateCnt;
207 natural_t old_state[144];
208 } __Request__mach_exception_raise_state_identity_t __attribute__((unused));
209#ifdef __MigPackStructs
210#pragma pack()
211#endif
212#endif /* !__Request__mach_exc_subsystem__defined */
213
214
215/* union of all requests */
216
217#ifndef __RequestUnion__catch_mach_exc_subsystem__defined
218#define __RequestUnion__catch_mach_exc_subsystem__defined
219union __RequestUnion__catch_mach_exc_subsystem {
220 __Request__mach_exception_raise_t Request_mach_exception_raise;
221 __Request__mach_exception_raise_state_t Request_mach_exception_raise_state;
222 __Request__mach_exception_raise_state_identity_t Request_mach_exception_raise_state_identity;
223};
224#endif /* __RequestUnion__catch_mach_exc_subsystem__defined */
225/* typedefs for all replies */
226
227#ifndef __Reply__mach_exc_subsystem__defined
228#define __Reply__mach_exc_subsystem__defined
229
230#ifdef __MigPackStructs
231#pragma pack(4)
232#endif
233 typedef struct {
234 mach_msg_header_t Head;
235 NDR_record_t NDR;
236 kern_return_t RetCode;
237 } __Reply__mach_exception_raise_t __attribute__((unused));
238#ifdef __MigPackStructs
239#pragma pack()
240#endif
241
242#ifdef __MigPackStructs
243#pragma pack(4)
244#endif
245 typedef struct {
246 mach_msg_header_t Head;
247 NDR_record_t NDR;
248 kern_return_t RetCode;
249 int flavor;
250 mach_msg_type_number_t new_stateCnt;
251 natural_t new_state[144];
252 } __Reply__mach_exception_raise_state_t __attribute__((unused));
253#ifdef __MigPackStructs
254#pragma pack()
255#endif
256
257#ifdef __MigPackStructs
258#pragma pack(4)
259#endif
260 typedef struct {
261 mach_msg_header_t Head;
262 NDR_record_t NDR;
263 kern_return_t RetCode;
264 int flavor;
265 mach_msg_type_number_t new_stateCnt;
266 natural_t new_state[144];
267 } __Reply__mach_exception_raise_state_identity_t __attribute__((unused));
268#ifdef __MigPackStructs
269#pragma pack()
270#endif
271#endif /* !__Reply__mach_exc_subsystem__defined */
272
273
274/* union of all replies */
275
276#ifndef __ReplyUnion__catch_mach_exc_subsystem__defined
277#define __ReplyUnion__catch_mach_exc_subsystem__defined
278union __ReplyUnion__catch_mach_exc_subsystem {
279 __Reply__mach_exception_raise_t Reply_mach_exception_raise;
280 __Reply__mach_exception_raise_state_t Reply_mach_exception_raise_state;
281 __Reply__mach_exception_raise_state_identity_t Reply_mach_exception_raise_state_identity;
282};
283#endif /* __RequestUnion__catch_mach_exc_subsystem__defined */
284
285#ifndef subsystem_to_name_map_mach_exc
286#define subsystem_to_name_map_mach_exc \
287 { "mach_exception_raise", 2405 },\
288 { "mach_exception_raise_state", 2406 },\
289 { "mach_exception_raise_state_identity", 2407 }
290#endif
291
292#ifdef __AfterMigServerHeader
293__AfterMigServerHeader
294#endif /* __AfterMigServerHeader */
295
296#endif /* _mach_exc_server_ */
297