mach_exc.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. #ifndef _mach_exc_user_
  2. #define _mach_exc_user_
  3. /* Module mach_exc */
  4. #include <string.h>
  5. #include <mach/ndr.h>
  6. #include <mach/boolean.h>
  7. #include <mach/kern_return.h>
  8. #include <mach/notify.h>
  9. #include <mach/mach_types.h>
  10. #include <mach/message.h>
  11. #include <mach/mig_errors.h>
  12. #include <mach/port.h>
  13. /* BEGIN VOUCHER CODE */
  14. #ifndef KERNEL
  15. #if defined(__has_include)
  16. #if __has_include(<mach/mig_voucher_support.h>)
  17. #ifndef USING_VOUCHERS
  18. #define USING_VOUCHERS
  19. #endif
  20. #ifndef __VOUCHER_FORWARD_TYPE_DECLS__
  21. #define __VOUCHER_FORWARD_TYPE_DECLS__
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. extern boolean_t voucher_mach_msg_set(mach_msg_header_t *msg) __attribute__((weak_import));
  26. #ifdef __cplusplus
  27. }
  28. #endif
  29. #endif // __VOUCHER_FORWARD_TYPE_DECLS__
  30. #endif // __has_include(<mach/mach_voucher_types.h>)
  31. #endif // __has_include
  32. #endif // !KERNEL
  33. /* END VOUCHER CODE */
  34. /* BEGIN MIG_STRNCPY_ZEROFILL CODE */
  35. #if defined(__has_include)
  36. #if __has_include(<mach/mig_strncpy_zerofill_support.h>)
  37. #ifndef USING_MIG_STRNCPY_ZEROFILL
  38. #define USING_MIG_STRNCPY_ZEROFILL
  39. #endif
  40. #ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
  41. #define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45. extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
  46. #ifdef __cplusplus
  47. }
  48. #endif
  49. #endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
  50. #endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
  51. #endif /* __has_include */
  52. /* END MIG_STRNCPY_ZEROFILL CODE */
  53. #ifdef AUTOTEST
  54. #ifndef FUNCTION_PTR_T
  55. #define FUNCTION_PTR_T
  56. typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
  57. typedef struct {
  58. char *name;
  59. function_ptr_t function;
  60. } function_table_entry;
  61. typedef function_table_entry *function_table_t;
  62. #endif /* FUNCTION_PTR_T */
  63. #endif /* AUTOTEST */
  64. #ifndef mach_exc_MSG_COUNT
  65. #define mach_exc_MSG_COUNT 3
  66. #endif /* mach_exc_MSG_COUNT */
  67. #include <mach/std_types.h>
  68. #include <mach/mig.h>
  69. #include <mach/mig.h>
  70. #include <mach/mach_types.h>
  71. #ifdef __BeforeMigUserHeader
  72. __BeforeMigUserHeader
  73. #endif /* __BeforeMigUserHeader */
  74. #include <sys/cdefs.h>
  75. __BEGIN_DECLS
  76. /* Routine mach_exception_raise */
  77. #ifdef mig_external
  78. mig_external
  79. #else
  80. extern
  81. #endif /* mig_external */
  82. kern_return_t mach_exception_raise
  83. (
  84. mach_port_t exception_port,
  85. mach_port_t thread,
  86. mach_port_t task,
  87. exception_type_t exception,
  88. mach_exception_data_t code,
  89. mach_msg_type_number_t codeCnt
  90. );
  91. /* Routine mach_exception_raise_state */
  92. #ifdef mig_external
  93. mig_external
  94. #else
  95. extern
  96. #endif /* mig_external */
  97. kern_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. /* Routine mach_exception_raise_state_identity */
  110. #ifdef mig_external
  111. mig_external
  112. #else
  113. extern
  114. #endif /* mig_external */
  115. kern_return_t mach_exception_raise_state_identity
  116. (
  117. mach_port_t exception_port,
  118. mach_port_t thread,
  119. mach_port_t task,
  120. exception_type_t exception,
  121. mach_exception_data_t code,
  122. mach_msg_type_number_t codeCnt,
  123. int *flavor,
  124. thread_state_t old_state,
  125. mach_msg_type_number_t old_stateCnt,
  126. thread_state_t new_state,
  127. mach_msg_type_number_t *new_stateCnt
  128. );
  129. __END_DECLS
  130. /********************** Caution **************************/
  131. /* The following data types should be used to calculate */
  132. /* maximum message sizes only. The actual message may be */
  133. /* smaller, and the position of the arguments within the */
  134. /* message layout may vary from what is presented here. */
  135. /* For example, if any of the arguments are variable- */
  136. /* sized, and less than the maximum is sent, the data */
  137. /* will be packed tight in the actual message to reduce */
  138. /* the presence of holes. */
  139. /********************** Caution **************************/
  140. /* typedefs for all requests */
  141. #ifndef __Request__mach_exc_subsystem__defined
  142. #define __Request__mach_exc_subsystem__defined
  143. #ifdef __MigPackStructs
  144. #pragma pack(push, 4)
  145. #endif
  146. typedef struct {
  147. mach_msg_header_t Head;
  148. /* start of the kernel processed data */
  149. mach_msg_body_t msgh_body;
  150. mach_msg_port_descriptor_t thread;
  151. mach_msg_port_descriptor_t task;
  152. /* end of the kernel processed data */
  153. NDR_record_t NDR;
  154. exception_type_t exception;
  155. mach_msg_type_number_t codeCnt;
  156. int64_t code[2];
  157. } __Request__mach_exception_raise_t __attribute__((unused));
  158. #ifdef __MigPackStructs
  159. #pragma pack(pop)
  160. #endif
  161. #ifdef __MigPackStructs
  162. #pragma pack(push, 4)
  163. #endif
  164. typedef struct {
  165. mach_msg_header_t Head;
  166. NDR_record_t NDR;
  167. exception_type_t exception;
  168. mach_msg_type_number_t codeCnt;
  169. int64_t code[2];
  170. int flavor;
  171. mach_msg_type_number_t old_stateCnt;
  172. natural_t old_state[614];
  173. } __Request__mach_exception_raise_state_t __attribute__((unused));
  174. #ifdef __MigPackStructs
  175. #pragma pack(pop)
  176. #endif
  177. #ifdef __MigPackStructs
  178. #pragma pack(push, 4)
  179. #endif
  180. typedef struct {
  181. mach_msg_header_t Head;
  182. /* start of the kernel processed data */
  183. mach_msg_body_t msgh_body;
  184. mach_msg_port_descriptor_t thread;
  185. mach_msg_port_descriptor_t task;
  186. /* end of the kernel processed data */
  187. NDR_record_t NDR;
  188. exception_type_t exception;
  189. mach_msg_type_number_t codeCnt;
  190. int64_t code[2];
  191. int flavor;
  192. mach_msg_type_number_t old_stateCnt;
  193. natural_t old_state[614];
  194. } __Request__mach_exception_raise_state_identity_t __attribute__((unused));
  195. #ifdef __MigPackStructs
  196. #pragma pack(pop)
  197. #endif
  198. #endif /* !__Request__mach_exc_subsystem__defined */
  199. /* union of all requests */
  200. #ifndef __RequestUnion__mach_exc_subsystem__defined
  201. #define __RequestUnion__mach_exc_subsystem__defined
  202. union __RequestUnion__mach_exc_subsystem {
  203. __Request__mach_exception_raise_t Request_mach_exception_raise;
  204. __Request__mach_exception_raise_state_t Request_mach_exception_raise_state;
  205. __Request__mach_exception_raise_state_identity_t Request_mach_exception_raise_state_identity;
  206. };
  207. #endif /* !__RequestUnion__mach_exc_subsystem__defined */
  208. /* typedefs for all replies */
  209. #ifndef __Reply__mach_exc_subsystem__defined
  210. #define __Reply__mach_exc_subsystem__defined
  211. #ifdef __MigPackStructs
  212. #pragma pack(push, 4)
  213. #endif
  214. typedef struct {
  215. mach_msg_header_t Head;
  216. NDR_record_t NDR;
  217. kern_return_t RetCode;
  218. } __Reply__mach_exception_raise_t __attribute__((unused));
  219. #ifdef __MigPackStructs
  220. #pragma pack(pop)
  221. #endif
  222. #ifdef __MigPackStructs
  223. #pragma pack(push, 4)
  224. #endif
  225. typedef struct {
  226. mach_msg_header_t Head;
  227. NDR_record_t NDR;
  228. kern_return_t RetCode;
  229. int flavor;
  230. mach_msg_type_number_t new_stateCnt;
  231. natural_t new_state[614];
  232. } __Reply__mach_exception_raise_state_t __attribute__((unused));
  233. #ifdef __MigPackStructs
  234. #pragma pack(pop)
  235. #endif
  236. #ifdef __MigPackStructs
  237. #pragma pack(push, 4)
  238. #endif
  239. typedef struct {
  240. mach_msg_header_t Head;
  241. NDR_record_t NDR;
  242. kern_return_t RetCode;
  243. int flavor;
  244. mach_msg_type_number_t new_stateCnt;
  245. natural_t new_state[614];
  246. } __Reply__mach_exception_raise_state_identity_t __attribute__((unused));
  247. #ifdef __MigPackStructs
  248. #pragma pack(pop)
  249. #endif
  250. #endif /* !__Reply__mach_exc_subsystem__defined */
  251. /* union of all replies */
  252. #ifndef __ReplyUnion__mach_exc_subsystem__defined
  253. #define __ReplyUnion__mach_exc_subsystem__defined
  254. union __ReplyUnion__mach_exc_subsystem {
  255. __Reply__mach_exception_raise_t Reply_mach_exception_raise;
  256. __Reply__mach_exception_raise_state_t Reply_mach_exception_raise_state;
  257. __Reply__mach_exception_raise_state_identity_t Reply_mach_exception_raise_state_identity;
  258. };
  259. #endif /* !__RequestUnion__mach_exc_subsystem__defined */
  260. #ifndef subsystem_to_name_map_mach_exc
  261. #define subsystem_to_name_map_mach_exc \
  262. { "mach_exception_raise", 2405 },\
  263. { "mach_exception_raise_state", 2406 },\
  264. { "mach_exception_raise_state_identity", 2407 }
  265. #endif
  266. #ifdef __AfterMigUserHeader
  267. __AfterMigUserHeader
  268. #endif /* __AfterMigUserHeader */
  269. #endif /* _mach_exc_user_ */