1 | #ifndef _task_access_user_ |
2 | #define _task_access_user_ |
3 | |
4 | /* Module task_access */ |
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 |
26 | extern "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 | |
42 | #ifdef AUTOTEST |
43 | #ifndef FUNCTION_PTR_T |
44 | #define FUNCTION_PTR_T |
45 | typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); |
46 | typedef struct { |
47 | char * name; |
48 | function_ptr_t function; |
49 | } function_table_entry; |
50 | typedef function_table_entry *function_table_t; |
51 | #endif /* FUNCTION_PTR_T */ |
52 | #endif /* AUTOTEST */ |
53 | |
54 | #ifndef task_access_MSG_COUNT |
55 | #define task_access_MSG_COUNT 3 |
56 | #endif /* task_access_MSG_COUNT */ |
57 | |
58 | #include <Availability.h> |
59 | #include <mach/std_types.h> |
60 | #include <mach/mig.h> |
61 | #include <mach/mig.h> |
62 | #include <mach/mach_types.h> |
63 | |
64 | #ifdef __BeforeMigUserHeader |
65 | __BeforeMigUserHeader |
66 | #endif /* __BeforeMigUserHeader */ |
67 | |
68 | #include <sys/cdefs.h> |
69 | __BEGIN_DECLS |
70 | |
71 | |
72 | /* Routine check_task_access */ |
73 | #ifdef mig_external |
74 | mig_external |
75 | #else |
76 | extern |
77 | #endif /* mig_external */ |
78 | kern_return_t check_task_access |
79 | ( |
80 | mach_port_t task_access_port, |
81 | int32_t calling_pid, |
82 | uint32_t calling_gid, |
83 | int32_t target_pid |
84 | ); |
85 | |
86 | /* Routine find_code_signature */ |
87 | #ifdef mig_external |
88 | mig_external |
89 | #else |
90 | extern |
91 | #endif /* mig_external */ |
92 | kern_return_t find_code_signature |
93 | ( |
94 | mach_port_t task_access_port, |
95 | int32_t new_pid |
96 | ); |
97 | |
98 | /* Routine check_task_access_with_flavor */ |
99 | #ifdef mig_external |
100 | mig_external |
101 | #else |
102 | extern |
103 | #endif /* mig_external */ |
104 | kern_return_t check_task_access_with_flavor |
105 | ( |
106 | mach_port_t task_access_port, |
107 | int32_t calling_pid, |
108 | uint32_t calling_gid, |
109 | int32_t target_pid, |
110 | mach_task_flavor_t flavor |
111 | ); |
112 | |
113 | __END_DECLS |
114 | |
115 | /********************** Caution **************************/ |
116 | /* The following data types should be used to calculate */ |
117 | /* maximum message sizes only. The actual message may be */ |
118 | /* smaller, and the position of the arguments within the */ |
119 | /* message layout may vary from what is presented here. */ |
120 | /* For example, if any of the arguments are variable- */ |
121 | /* sized, and less than the maximum is sent, the data */ |
122 | /* will be packed tight in the actual message to reduce */ |
123 | /* the presence of holes. */ |
124 | /********************** Caution **************************/ |
125 | |
126 | /* typedefs for all requests */ |
127 | |
128 | #ifndef __Request__task_access_subsystem__defined |
129 | #define __Request__task_access_subsystem__defined |
130 | |
131 | #ifdef __MigPackStructs |
132 | #pragma pack(push, 4) |
133 | #endif |
134 | typedef struct { |
135 | mach_msg_header_t Head; |
136 | NDR_record_t NDR; |
137 | int32_t calling_pid; |
138 | uint32_t calling_gid; |
139 | int32_t target_pid; |
140 | } __Request__check_task_access_t __attribute__((unused)); |
141 | #ifdef __MigPackStructs |
142 | #pragma pack(pop) |
143 | #endif |
144 | |
145 | #ifdef __MigPackStructs |
146 | #pragma pack(push, 4) |
147 | #endif |
148 | typedef struct { |
149 | mach_msg_header_t Head; |
150 | NDR_record_t NDR; |
151 | int32_t new_pid; |
152 | } __Request__find_code_signature_t __attribute__((unused)); |
153 | #ifdef __MigPackStructs |
154 | #pragma pack(pop) |
155 | #endif |
156 | |
157 | #ifdef __MigPackStructs |
158 | #pragma pack(push, 4) |
159 | #endif |
160 | typedef struct { |
161 | mach_msg_header_t Head; |
162 | NDR_record_t NDR; |
163 | int32_t calling_pid; |
164 | uint32_t calling_gid; |
165 | int32_t target_pid; |
166 | mach_task_flavor_t flavor; |
167 | } __Request__check_task_access_with_flavor_t __attribute__((unused)); |
168 | #ifdef __MigPackStructs |
169 | #pragma pack(pop) |
170 | #endif |
171 | #endif /* !__Request__task_access_subsystem__defined */ |
172 | |
173 | /* union of all requests */ |
174 | |
175 | #ifndef __RequestUnion__task_access_subsystem__defined |
176 | #define __RequestUnion__task_access_subsystem__defined |
177 | union __RequestUnion__task_access_subsystem { |
178 | __Request__check_task_access_t Request_check_task_access; |
179 | __Request__find_code_signature_t Request_find_code_signature; |
180 | __Request__check_task_access_with_flavor_t Request_check_task_access_with_flavor; |
181 | }; |
182 | #endif /* !__RequestUnion__task_access_subsystem__defined */ |
183 | /* typedefs for all replies */ |
184 | |
185 | #ifndef __Reply__task_access_subsystem__defined |
186 | #define __Reply__task_access_subsystem__defined |
187 | |
188 | #ifdef __MigPackStructs |
189 | #pragma pack(push, 4) |
190 | #endif |
191 | typedef struct { |
192 | mach_msg_header_t Head; |
193 | NDR_record_t NDR; |
194 | kern_return_t RetCode; |
195 | } __Reply__check_task_access_t __attribute__((unused)); |
196 | #ifdef __MigPackStructs |
197 | #pragma pack(pop) |
198 | #endif |
199 | |
200 | #ifdef __MigPackStructs |
201 | #pragma pack(push, 4) |
202 | #endif |
203 | typedef struct { |
204 | mach_msg_header_t Head; |
205 | NDR_record_t NDR; |
206 | kern_return_t RetCode; |
207 | } __Reply__find_code_signature_t __attribute__((unused)); |
208 | #ifdef __MigPackStructs |
209 | #pragma pack(pop) |
210 | #endif |
211 | |
212 | #ifdef __MigPackStructs |
213 | #pragma pack(push, 4) |
214 | #endif |
215 | typedef struct { |
216 | mach_msg_header_t Head; |
217 | NDR_record_t NDR; |
218 | kern_return_t RetCode; |
219 | } __Reply__check_task_access_with_flavor_t __attribute__((unused)); |
220 | #ifdef __MigPackStructs |
221 | #pragma pack(pop) |
222 | #endif |
223 | #endif /* !__Reply__task_access_subsystem__defined */ |
224 | |
225 | /* union of all replies */ |
226 | |
227 | #ifndef __ReplyUnion__task_access_subsystem__defined |
228 | #define __ReplyUnion__task_access_subsystem__defined |
229 | union __ReplyUnion__task_access_subsystem { |
230 | __Reply__check_task_access_t Reply_check_task_access; |
231 | __Reply__find_code_signature_t Reply_find_code_signature; |
232 | __Reply__check_task_access_with_flavor_t Reply_check_task_access_with_flavor; |
233 | }; |
234 | #endif /* !__RequestUnion__task_access_subsystem__defined */ |
235 | |
236 | #ifndef subsystem_to_name_map_task_access |
237 | #define subsystem_to_name_map_task_access \ |
238 | { "check_task_access", 27000 },\ |
239 | { "find_code_signature", 27001 },\ |
240 | { "check_task_access_with_flavor", 27002 } |
241 | #endif |
242 | |
243 | #ifdef __AfterMigUserHeader |
244 | __AfterMigUserHeader |
245 | #endif /* __AfterMigUserHeader */ |
246 | |
247 | #endif /* _task_access_user_ */ |
248 | |