1use crate::ffi::{c_uint, c_int, c_char, uid_t};
4
5use crate::port::mach_port_t;
6use crate::boolean::boolean_t;
7use crate::kern_return::kern_return_t;
8
9pub const BOOTSTRAP_MAX_LOOKUP_COUNT: c_uint = 20;
10
11pub const BOOTSTRAP_SUCCESS: c_uint = 0;
12pub const BOOTSTRAP_NOT_PRIVILEGED: c_uint = 1100;
13pub const BOOTSTRAP_NAME_IN_USE: c_uint = 1101;
14pub const BOOTSTRAP_UNKNOWN_SERVICE: c_uint = 1102;
15pub const BOOTSTRAP_SERVICE_ACTIVE: c_uint = 1103;
16pub const BOOTSTRAP_BAD_COUNT: c_uint = 1104;
17pub const BOOTSTRAP_NO_MEMORY: c_uint = 1105;
18pub const BOOTSTRAP_NO_CHILDREN: c_uint = 1106;
19
20pub const BOOTSTRAP_STATUS_INACTIVE: c_uint = 0;
21pub const BOOTSTRAP_STATUS_ACTIVE: c_uint = 1;
22pub const BOOTSTRAP_STATUS_ON_DEMAND: c_uint = 2;
23
24pub const BOOTSTRAP_MAX_CMD_LEN: c_uint = 512;
25pub const BOOTSTRAP_MAX_NAME_LEN: c_uint = 128;
26
27pub type cmd_t = [c_char; BOOTSTRAP_MAX_CMD_LEN as usize];
28pub type name_t = [c_char; BOOTSTRAP_MAX_NAME_LEN as usize];
29
30pub type bool_array_t = *mut boolean_t;
31pub type name_array_t = *mut name_t;
32
33pub type bootstrap_status_t = c_int;
34pub type bootstrap_status_array_t = *mut bootstrap_status_t;
35
36pub type bootstrap_property_t = c_uint;
37pub type bootstrap_property_array_t = *mut bootstrap_property_t;
38
39extern "C" {
40 pub static bootstrap_port: mach_port_t;
41
42 pub fn bootstrap_create_server(
43 bp: mach_port_t,
44 server_cmd: *mut c_char,
45 server_uid: uid_t,
46 on_demand: boolean_t,
47 server_port: *mut mach_port_t,
48 ) -> kern_return_t;
49
50 pub fn bootstrap_subset(
51 bp: mach_port_t,
52 requestor_port: mach_port_t,
53 subset_port: *mut mach_port_t,
54 ) -> kern_return_t;
55
56 pub fn bootstrap_unprivileged(
57 bp: mach_port_t,
58 unpriv_port: *mut mach_port_t,
59 ) -> kern_return_t;
60
61 pub fn bootstrap_parent(
62 bp: mach_port_t,
63 parent_port: *mut mach_port_t,
64 ) -> kern_return_t;
65
66 pub fn bootstrap_register(
67 bp: mach_port_t,
68 service_name: *mut c_char,
69 sp: mach_port_t,
70 ) -> kern_return_t;
71
72 pub fn bootstrap_create_service(
73 bp: mach_port_t,
74 service_name: *mut c_char,
75 sp: *mut mach_port_t,
76 ) -> kern_return_t;
77
78 pub fn bootstrap_check_in(
79 bp: mach_port_t,
80 service_name: *const c_char,
81 sp: *mut mach_port_t,
82 ) -> kern_return_t;
83
84 pub fn bootstrap_look_up(
85 bp: mach_port_t,
86 service_name: *const c_char,
87 sp: *mut mach_port_t,
88 ) -> kern_return_t;
89
90 pub fn bootstrap_status(
91 bp: mach_port_t,
92 service_name: *mut c_char,
93 service_active: *mut bootstrap_status_t,
94 ) -> kern_return_t;
95
96 pub fn bootstrap_strerror(
97 r: kern_return_t,
98 ) -> *const c_char;
99}
100