mach_sys/
exc.rs

1//! This module roughly corresponds to `mach/exc.h`.
2
3#![allow(non_snake_case)]
4
5use crate::ffi::*;
6
7use crate::exception_types::{exception_data_t, exception_type_t};
8use crate::kern_return::kern_return_t;
9use crate::message::{
10    mach_msg_body_t,
11    mach_msg_header_t,
12    mach_msg_port_descriptor_t,
13    mach_msg_type_number_t,
14};
15use crate::ndr::NDR_record_t;
16use crate::port::mach_port_t;
17use crate::thread_status::thread_state_t;
18use crate::vm_types::integer_t;
19
20pub const exc_MSG_COUNT: c_uint = 3;
21
22extern "C" {
23    pub fn exception_raise(
24        exception_port: mach_port_t,
25        thread:         mach_port_t,
26        task:           mach_port_t,
27        exception:      exception_type_t,
28        code:           exception_data_t,
29        codeCnt:        mach_msg_type_number_t,
30    ) -> kern_return_t;
31
32    pub fn exception_raise_state(
33        exception_port: mach_port_t,
34        exception:      exception_type_t,
35        code:           exception_data_t,
36        codeCnt:        mach_msg_type_number_t,
37        flavor:         *mut c_int,
38        old_state:      thread_state_t,
39        old_stateCnt:   mach_msg_type_number_t,
40        new_state:      thread_state_t,
41        new_stateCnt:   *mut mach_msg_type_number_t,
42    ) -> kern_return_t;
43
44    pub fn exception_raise_state_identity(
45        exception_port: mach_port_t,
46        thread:         mach_port_t,
47        task:           mach_port_t,
48        exception:      exception_type_t,
49        code:           exception_data_t,
50        codeCnt:        mach_msg_type_number_t,
51        flavor:         *mut c_int,
52        old_state:      thread_state_t,
53        old_stateCnt:   mach_msg_type_number_t,
54        new_state:      thread_state_t,
55        new_stateCnt:   *mut mach_msg_type_number_t,
56    ) -> kern_return_t;
57}
58
59#[repr(C)]
60#[derive(Copy, Clone, Debug)]
61pub struct __Request__exception_raise_t {
62    pub Head:      mach_msg_header_t,
63
64    /* start of the kernel processed data */
65    pub msgh_body: mach_msg_body_t,
66    pub thread:    mach_msg_port_descriptor_t,
67    pub task:      mach_msg_port_descriptor_t,
68    /* end of the kernel processed data */
69
70    pub NDR:       NDR_record_t,
71    pub exception: exception_type_t,
72    pub codeCnt:   mach_msg_type_number_t,
73    pub code:      [integer_t; 2],
74}
75
76#[repr(C)]
77#[derive(Copy, Clone, Debug)]
78pub struct __Reply__exception_raise_t {
79    pub Head:    mach_msg_header_t,
80    pub NDR:     NDR_record_t,
81    pub RetCode: kern_return_t,
82}
83