1#ifndef _mach_exc_user_
2#define _mach_exc_user_
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#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#if (__MigKernelSpecificCode) || (_MIG_KERNEL_SPECIFIC_CODE_)
42#include <kern/ipc_mig.h>
43#endif /* __MigKernelSpecificCode */
44
45#ifdef AUTOTEST
46#ifndef FUNCTION_PTR_T
47#define FUNCTION_PTR_T
48typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
49typedef struct {
50 char * name;
51 function_ptr_t function;
52} function_table_entry;
53typedef function_table_entry *function_table_t;
54#endif /* FUNCTION_PTR_T */
55#endif /* AUTOTEST */
56
57#ifndef mach_exc_MSG_COUNT
58#define mach_exc_MSG_COUNT 5
59#endif /* mach_exc_MSG_COUNT */
60
61#include <Availability.h>
62#include <mach/std_types.h>
63#include <mach/mig.h>
64#include <mach/mig.h>
65#include <mach/mach_types.h>
66
67#ifdef __BeforeMigUserHeader
68__BeforeMigUserHeader
69#endif /* __BeforeMigUserHeader */
70
71#include <sys/cdefs.h>
72__BEGIN_DECLS
73
74
75/* Routine mach_exception_raise */
76#ifdef mig_external
77mig_external
78#else
79extern
80#endif /* mig_external */
81kern_return_t mach_exception_raise
82(
83 mach_port_t exception_port,
84 mach_port_t thread,
85 mach_port_t task,
86 exception_type_t exception,
87 mach_exception_data_t code,
88 mach_msg_type_number_t codeCnt
89);
90
91/* Routine mach_exception_raise_state */
92#ifdef mig_external
93mig_external
94#else
95extern
96#endif /* mig_external */
97kern_return_t mach_exception_raise_state
98(
99 mach_port_t exception_port,
100 exception_type_t exception,
101 const mach_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 mach_exception_raise_state_identity */
111#ifdef mig_external
112mig_external
113#else
114extern
115#endif /* mig_external */
116kern_return_t mach_exception_raise_state_identity
117(
118 mach_port_t exception_port,
119 mach_port_t thread,
120 mach_port_t task,
121 exception_type_t exception,
122 mach_exception_data_t code,
123 mach_msg_type_number_t codeCnt,
124 int *flavor,
125 thread_state_t old_state,
126 mach_msg_type_number_t old_stateCnt,
127 thread_state_t new_state,
128 mach_msg_type_number_t *new_stateCnt
129);
130
131/* Routine mach_exception_raise_identity_protected */
132#ifdef mig_external
133mig_external
134#else
135extern
136#endif /* mig_external */
137kern_return_t mach_exception_raise_identity_protected
138(
139 mach_port_t exception_port,
140 uint64_t thread_id,
141 mach_port_t task_id_token_t,
142 exception_type_t exception,
143 mach_exception_data_t code,
144 mach_msg_type_number_t codeCnt
145);
146
147/* Routine mach_exception_raise_backtrace */
148#ifdef mig_external
149mig_external
150#else
151extern
152#endif /* mig_external */
153kern_return_t mach_exception_raise_backtrace
154(
155 mach_port_t exception_port,
156 mach_port_t kcdata_object_t,
157 exception_type_t exception,
158 mach_exception_data_t code,
159 mach_msg_type_number_t codeCnt
160);
161
162__END_DECLS
163
164/********************** Caution **************************/
165/* The following data types should be used to calculate */
166/* maximum message sizes only. The actual message may be */
167/* smaller, and the position of the arguments within the */
168/* message layout may vary from what is presented here. */
169/* For example, if any of the arguments are variable- */
170/* sized, and less than the maximum is sent, the data */
171/* will be packed tight in the actual message to reduce */
172/* the presence of holes. */
173/********************** Caution **************************/
174
175/* typedefs for all requests */
176
177#ifndef __Request__mach_exc_subsystem__defined
178#define __Request__mach_exc_subsystem__defined
179
180#ifdef __MigPackStructs
181#pragma pack(push, 4)
182#endif
183 typedef struct {
184 mach_msg_header_t Head;
185 /* start of the kernel processed data */
186 mach_msg_body_t msgh_body;
187 mach_msg_port_descriptor_t thread;
188 mach_msg_port_descriptor_t task;
189 /* end of the kernel processed data */
190 NDR_record_t NDR;
191 exception_type_t exception;
192 mach_msg_type_number_t codeCnt;
193 int64_t code[2];
194 } __Request__mach_exception_raise_t __attribute__((unused));
195#ifdef __MigPackStructs
196#pragma pack(pop)
197#endif
198
199#ifdef __MigPackStructs
200#pragma pack(push, 4)
201#endif
202 typedef struct {
203 mach_msg_header_t Head;
204 NDR_record_t NDR;
205 exception_type_t exception;
206 mach_msg_type_number_t codeCnt;
207 int64_t code[2];
208 int flavor;
209 mach_msg_type_number_t old_stateCnt;
210 natural_t old_state[1296];
211 } __Request__mach_exception_raise_state_t __attribute__((unused));
212#ifdef __MigPackStructs
213#pragma pack(pop)
214#endif
215
216#ifdef __MigPackStructs
217#pragma pack(push, 4)
218#endif
219 typedef struct {
220 mach_msg_header_t Head;
221 /* start of the kernel processed data */
222 mach_msg_body_t msgh_body;
223 mach_msg_port_descriptor_t thread;
224 mach_msg_port_descriptor_t task;
225 /* end of the kernel processed data */
226 NDR_record_t NDR;
227 exception_type_t exception;
228 mach_msg_type_number_t codeCnt;
229 int64_t code[2];
230 int flavor;
231 mach_msg_type_number_t old_stateCnt;
232 natural_t old_state[1296];
233 } __Request__mach_exception_raise_state_identity_t __attribute__((unused));
234#ifdef __MigPackStructs
235#pragma pack(pop)
236#endif
237
238#ifdef __MigPackStructs
239#pragma pack(push, 4)
240#endif
241 typedef struct {
242 mach_msg_header_t Head;
243 /* start of the kernel processed data */
244 mach_msg_body_t msgh_body;
245 mach_msg_port_descriptor_t task_id_token_t;
246 /* end of the kernel processed data */
247 NDR_record_t NDR;
248 uint64_t thread_id;
249 exception_type_t exception;
250 mach_msg_type_number_t codeCnt;
251 int64_t code[2];
252 } __Request__mach_exception_raise_identity_protected_t __attribute__((unused));
253#ifdef __MigPackStructs
254#pragma pack(pop)
255#endif
256
257#ifdef __MigPackStructs
258#pragma pack(push, 4)
259#endif
260 typedef struct {
261 mach_msg_header_t Head;
262 /* start of the kernel processed data */
263 mach_msg_body_t msgh_body;
264 mach_msg_port_descriptor_t kcdata_object_t;
265 /* end of the kernel processed data */
266 NDR_record_t NDR;
267 exception_type_t exception;
268 mach_msg_type_number_t codeCnt;
269 int64_t code[2];
270 } __Request__mach_exception_raise_backtrace_t __attribute__((unused));
271#ifdef __MigPackStructs
272#pragma pack(pop)
273#endif
274#endif /* !__Request__mach_exc_subsystem__defined */
275
276/* union of all requests */
277
278#ifndef __RequestUnion__mach_exc_subsystem__defined
279#define __RequestUnion__mach_exc_subsystem__defined
280union __RequestUnion__mach_exc_subsystem {
281 __Request__mach_exception_raise_t Request_mach_exception_raise;
282 __Request__mach_exception_raise_state_t Request_mach_exception_raise_state;
283 __Request__mach_exception_raise_state_identity_t Request_mach_exception_raise_state_identity;
284 __Request__mach_exception_raise_identity_protected_t Request_mach_exception_raise_identity_protected;
285 __Request__mach_exception_raise_backtrace_t Request_mach_exception_raise_backtrace;
286};
287#endif /* !__RequestUnion__mach_exc_subsystem__defined */
288/* typedefs for all replies */
289
290#ifndef __Reply__mach_exc_subsystem__defined
291#define __Reply__mach_exc_subsystem__defined
292
293#ifdef __MigPackStructs
294#pragma pack(push, 4)
295#endif
296 typedef struct {
297 mach_msg_header_t Head;
298 NDR_record_t NDR;
299 kern_return_t RetCode;
300 } __Reply__mach_exception_raise_t __attribute__((unused));
301#ifdef __MigPackStructs
302#pragma pack(pop)
303#endif
304
305#ifdef __MigPackStructs
306#pragma pack(push, 4)
307#endif
308 typedef struct {
309 mach_msg_header_t Head;
310 NDR_record_t NDR;
311 kern_return_t RetCode;
312 int flavor;
313 mach_msg_type_number_t new_stateCnt;
314 natural_t new_state[1296];
315 } __Reply__mach_exception_raise_state_t __attribute__((unused));
316#ifdef __MigPackStructs
317#pragma pack(pop)
318#endif
319
320#ifdef __MigPackStructs
321#pragma pack(push, 4)
322#endif
323 typedef struct {
324 mach_msg_header_t Head;
325 NDR_record_t NDR;
326 kern_return_t RetCode;
327 int flavor;
328 mach_msg_type_number_t new_stateCnt;
329 natural_t new_state[1296];
330 } __Reply__mach_exception_raise_state_identity_t __attribute__((unused));
331#ifdef __MigPackStructs
332#pragma pack(pop)
333#endif
334
335#ifdef __MigPackStructs
336#pragma pack(push, 4)
337#endif
338 typedef struct {
339 mach_msg_header_t Head;
340 NDR_record_t NDR;
341 kern_return_t RetCode;
342 } __Reply__mach_exception_raise_identity_protected_t __attribute__((unused));
343#ifdef __MigPackStructs
344#pragma pack(pop)
345#endif
346
347#ifdef __MigPackStructs
348#pragma pack(push, 4)
349#endif
350 typedef struct {
351 mach_msg_header_t Head;
352 NDR_record_t NDR;
353 kern_return_t RetCode;
354 } __Reply__mach_exception_raise_backtrace_t __attribute__((unused));
355#ifdef __MigPackStructs
356#pragma pack(pop)
357#endif
358#endif /* !__Reply__mach_exc_subsystem__defined */
359
360/* union of all replies */
361
362#ifndef __ReplyUnion__mach_exc_subsystem__defined
363#define __ReplyUnion__mach_exc_subsystem__defined
364union __ReplyUnion__mach_exc_subsystem {
365 __Reply__mach_exception_raise_t Reply_mach_exception_raise;
366 __Reply__mach_exception_raise_state_t Reply_mach_exception_raise_state;
367 __Reply__mach_exception_raise_state_identity_t Reply_mach_exception_raise_state_identity;
368 __Reply__mach_exception_raise_identity_protected_t Reply_mach_exception_raise_identity_protected;
369 __Reply__mach_exception_raise_backtrace_t Reply_mach_exception_raise_backtrace;
370};
371#endif /* !__RequestUnion__mach_exc_subsystem__defined */
372
373#ifndef subsystem_to_name_map_mach_exc
374#define subsystem_to_name_map_mach_exc \
375 { "mach_exception_raise", 2405 },\
376 { "mach_exception_raise_state", 2406 },\
377 { "mach_exception_raise_state_identity", 2407 },\
378 { "mach_exception_raise_identity_protected", 2408 },\
379 { "mach_exception_raise_backtrace", 2409 }
380#endif
381
382#ifdef __AfterMigUserHeader
383__AfterMigUserHeader
384#endif /* __AfterMigUserHeader */
385
386#endif /* _mach_exc_user_ */
387