1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//! This module corresponds to `mach/mach_types.h`

use core::ffi::{c_uchar, c_ulong};
type clock_t = c_ulong; // in all apple/darwin platforms, type `clock_t` is equiv to `c_ulong`.

use crate::port::mach_port_t;

pub type task_t                  = mach_port_t;
pub type task_name_t             = mach_port_t;
pub type task_suspension_token_t = mach_port_t;
pub type thread_t                = mach_port_t;
pub type thread_act_t            = mach_port_t;
pub type ipc_space_t             = mach_port_t;
pub type coalition_t             = mach_port_t;
pub type host_t                  = mach_port_t;
pub type host_priv_t             = mach_port_t;
pub type host_security_t         = mach_port_t;
pub type processor_t             = mach_port_t;
pub type processor_set_t         = mach_port_t;
pub type processor_set_control_t = mach_port_t;
pub type semaphore_t             = mach_port_t;
pub type lock_set_t              = mach_port_t;
pub type ledger_t                = mach_port_t;
pub type alarm_t                 = mach_port_t;
pub type clock_serv_t            = mach_port_t;
pub type clock_ctrl_t            = mach_port_t;

pub type processor_set_name_t = processor_set_t;

pub type clock_reply_t              = mach_port_t;
pub type bootstrap_t                = mach_port_t;
pub type mem_entry_name_port_t      = mach_port_t;
pub type exception_handler_t        = mach_port_t;
pub type exception_handler_array_t  = *mut exception_handler_t;
pub type vm_task_entry_t            = mach_port_t;
pub type io_master_t                = mach_port_t;
pub type UNDServerRef               = mach_port_t;

pub type task_array_t               = *mut task_t;
pub type thread_array_t             = *mut thread_t;
pub type processor_set_array_t      = *mut processor_set_t;
pub type processor_set_name_array_t = *mut processor_set_t;
pub type processor_array_t          = *mut processor_t;
pub type thread_act_array_t         = *mut thread_act_t;
pub type ledger_array_t             = *mut ledger_t;

pub type task_port_t                     = task_t;
pub type task_port_array_t               = task_array_t;
pub type thread_port_t                   = thread_t;
pub type thread_port_array_t             = thread_array_t;
pub type ipc_space_port_t                = ipc_space_t;
pub type host_name_t                     = host_t;
pub type host_name_port_t                = host_t;
pub type processor_set_port_t            = processor_set_t;
pub type processor_set_name_port_t       = processor_set_t;
pub type processor_set_name_port_array_t = processor_set_array_t;
pub type processor_set_control_port_t    = processor_set_t;
pub type processor_port_t                = processor_t;
pub type processor_port_array_t          = processor_array_t;
pub type thread_act_port_t               = thread_act_t;
pub type thread_act_port_array_t         = thread_act_array_t;
pub type semaphore_port_t                = semaphore_t;
pub type lock_set_port_t                 = lock_set_t;
pub type ledger_port_t                   = ledger_t;
pub type ledger_port_array_t             = ledger_array_t;
pub type alarm_port_t                    = alarm_t;
pub type clock_serv_port_t               = clock_serv_t;
pub type clock_ctrl_port_t               = clock_ctrl_t;
pub type exception_port_t                = exception_handler_t;
pub type exception_port_arrary_t         = exception_handler_array_t;

pub const TASK_NULL:          task_t = 0;
pub const TASK_NAME_NULL:     task_name_t = 0;
pub const THREAD_NULL:        thread_t = 0;
pub const TID_NULL:           u64 = 0;
pub const THR_ACT_NULL:       thread_act_t = 0;
pub const IPC_SPACE_NULL:     ipc_space_t = 0;
pub const COALITION_NULL:     coalition_t = 0;
pub const HOST_NULL:          host_t = 0;
pub const HOST_PRIV_NULL:     host_priv_t = 0;
pub const HOST_SECURITY_NULL: host_security_t = 0;
pub const PROCESSOR_SET_NULL: processor_set_t = 0;
pub const PROCESSOR_NULL:     processor_t = 0;
pub const SEMAPHORE_NULL:     semaphore_t = 0;
pub const LOCK_SET_NULL:      lock_set_t = 0;
pub const LEDGER_NULL:        ledger_t = 0;
pub const ALARM_NULL:         alarm_t = 0;
pub const CLOCK_NULL:         clock_t = 0;
pub const UND_SERVER_NULL:    UNDServerRef = 0;

// <sys/_types.h>: typedef	unsigned char	__darwin_uuid_t[16];
pub type uuid_t = [c_uchar; 16];

// <sys/_types/_fsid_t.h>
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct fsid_t {
    pub val: [i32; 2],
}
pub type fsid = fsid_t;

// <sys/_types/_fsobj_id_t.h>
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct fsobj_id_t {
    pub fid_objno:      u32,
    pub fid_generation: u32,
}
pub type fsobj_id = fsobj_id_t;