File: | obj-scan-build/proc/processServer.c |
Location: | line 339, column 2 |
Description: | Assigned value is garbage or undefined |
1 | /* Module process */ |
2 | |
3 | #ifndef _GNU_SOURCE1 |
4 | #define _GNU_SOURCE1 1 |
5 | #endif |
6 | |
7 | #define EXPORT_BOOLEAN |
8 | #include <mach/boolean.h> |
9 | #include <mach/kern_return.h> |
10 | #include <mach/message.h> |
11 | #include <mach/mig_errors.h> |
12 | #include <mach/mig_support.h> |
13 | |
14 | #ifndef mig_internalstatic |
15 | #define mig_internalstatic static |
16 | #endif |
17 | |
18 | #ifndef mig_external |
19 | #define mig_external |
20 | #endif |
21 | |
22 | #ifndef mig_unlikely |
23 | #define mig_unlikely(X)__builtin_expect (!! (X), 0) __builtin_expect (!! (X), 0) |
24 | #endif |
25 | |
26 | #ifndef TypeCheck1 |
27 | #define TypeCheck1 1 |
28 | #endif |
29 | |
30 | #ifndef UseExternRCSId1 |
31 | #define UseExternRCSId1 1 |
32 | #endif |
33 | |
34 | #define BAD_TYPECHECK(type, check)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; } )), 0) mig_unlikely (({\__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; } )), 0) |
35 | union { mach_msg_type_t t; unsigned32_t w; } _t, _c;\__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; } )), 0) |
36 | _t.t = *(type); _c.t = *(check);_t.w != _c.w; }))__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; } )), 0) |
37 | #define msgh_request_portmsgh_local_port msgh_local_port |
38 | #define MACH_MSGH_BITS_REQUEST(bits)(((bits) & 0x0000ff00) >> 8) MACH_MSGH_BITS_LOCAL(bits)(((bits) & 0x0000ff00) >> 8) |
39 | #define msgh_reply_portmsgh_remote_port msgh_remote_port |
40 | #define MACH_MSGH_BITS_REPLY(bits)((bits) & 0x000000ff) MACH_MSGH_BITS_REMOTE(bits)((bits) & 0x000000ff) |
41 | |
42 | #include <hurd/ports.h> |
43 | #include <mach/std_types.h> |
44 | #include <mach/mach_types.h> |
45 | #include <device/device_types.h> |
46 | #include <device/net_status.h> |
47 | #include <sys/types.h> |
48 | #include <sys/stat.h> |
49 | #include <sys/statfs.h> |
50 | #include <sys/resource.h> |
51 | #include <sys/utsname.h> |
52 | #include <hurd/hurd_types.h> |
53 | #include "mig-decls.h" |
54 | |
55 | /* Routine proc_getprivports */ |
56 | mig_internalstatic void _Xproc_getprivports |
57 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
58 | { |
59 | typedef struct { |
60 | mach_msg_header_t Head; |
61 | } Request; |
62 | |
63 | typedef struct { |
64 | mach_msg_header_t Head; |
65 | mach_msg_type_t RetCodeType; |
66 | kern_return_t RetCode; |
67 | mach_msg_type_t host_privType; |
68 | mach_port_t host_priv; |
69 | mach_msg_type_t device_masterType; |
70 | mach_port_t device_master; |
71 | } Reply; |
72 | |
73 | Request *In0P = (Request *) InHeadP; |
74 | Reply *OutP = (Reply *) OutHeadP; |
75 | mig_external kern_return_t S_proc_getprivports |
76 | (pstruct_t process, mach_port_t *host_priv, mach_port_t *device_master); |
77 | |
78 | const mach_msg_type_t host_privType = { |
79 | /* msgt_name = */ 19, |
80 | /* msgt_size = */ 32, |
81 | /* msgt_number = */ 1, |
82 | /* msgt_inline = */ TRUE((boolean_t) 1), |
83 | /* msgt_longform = */ FALSE((boolean_t) 0), |
84 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
85 | /* msgt_unused = */ 0 |
86 | }; |
87 | |
88 | const mach_msg_type_t device_masterType = { |
89 | /* msgt_name = */ 19, |
90 | /* msgt_size = */ 32, |
91 | /* msgt_number = */ 1, |
92 | /* msgt_inline = */ TRUE((boolean_t) 1), |
93 | /* msgt_longform = */ FALSE((boolean_t) 0), |
94 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
95 | /* msgt_unused = */ 0 |
96 | }; |
97 | |
98 | pstruct_t process; |
99 | |
100 | #if TypeCheck1 |
101 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
102 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
103 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
104 | #endif /* TypeCheck */ |
105 | |
106 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
107 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
108 | else |
109 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
110 | |
111 | OutP->RetCode = S_proc_getprivports(process, &OutP->host_priv, &OutP->device_master); |
112 | end_using_proc(process); |
113 | if (OutP->RetCode != KERN_SUCCESS0) |
114 | return; |
115 | |
116 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
117 | OutP->Head.msgh_size = 48; |
118 | |
119 | OutP->host_privType = host_privType; |
120 | |
121 | OutP->device_masterType = device_masterType; |
122 | } |
123 | |
124 | /* Default implementation of S_proc_getprivports */ |
125 | #ifdef MIG_EOPNOTSUPP |
126 | kern_return_t __attribute__ ((weak)) |
127 | S_proc_getprivports |
128 | ( |
129 | pstruct_t process, |
130 | mach_port_t *host_priv, |
131 | mach_port_t *device_master |
132 | ) { return MIG_EOPNOTSUPP; } |
133 | #endif /* MIG_EOPNOTSUPP */ |
134 | |
135 | /* Routine proc_getallpids */ |
136 | mig_internalstatic void _Xproc_getallpids |
137 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
138 | { |
139 | typedef struct { |
140 | mach_msg_header_t Head; |
141 | } Request; |
142 | |
143 | typedef struct { |
144 | mach_msg_header_t Head; |
145 | mach_msg_type_t RetCodeType; |
146 | kern_return_t RetCode; |
147 | mach_msg_type_long_t pidarrayType; |
148 | pid_t pidarray[512]; |
149 | } Reply; |
150 | |
151 | Request *In0P = (Request *) InHeadP; |
152 | Reply *OutP = (Reply *) OutHeadP; |
153 | mig_external kern_return_t S_proc_getallpids |
154 | (pstruct_t process, pidarray_t *pidarray, mach_msg_type_number_t *pidarrayCnt); |
155 | |
156 | boolean_t msgh_simple = msgh_simple; |
157 | const mach_msg_type_long_t pidarrayType = { |
158 | { |
159 | /* msgt_name = */ 0, |
160 | /* msgt_size = */ 0, |
161 | /* msgt_number = */ 0, |
162 | /* msgt_inline = */ TRUE((boolean_t) 1), |
163 | /* msgt_longform = */ TRUE((boolean_t) 1), |
164 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
165 | /* msgt_unused = */ 0 |
166 | }, |
167 | /* msgtl_name = */ 2, |
168 | /* msgtl_size = */ 32, |
169 | /* msgtl_number = */ 512, |
170 | }; |
171 | |
172 | pstruct_t process; |
173 | mach_msg_type_number_t pidarrayCnt; |
174 | |
175 | pid_t *pidarrayP; |
176 | |
177 | #if TypeCheck1 |
178 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
179 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
180 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
181 | #endif /* TypeCheck */ |
182 | |
183 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
184 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
185 | else |
186 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
187 | |
188 | pidarrayP = OutP->pidarray; |
189 | pidarrayCnt = 512; |
190 | |
191 | OutP->RetCode = S_proc_getallpids(process, &pidarrayP, &pidarrayCnt); |
192 | end_using_proc(process); |
193 | if (OutP->RetCode != KERN_SUCCESS0) |
194 | return; |
195 | |
196 | msgh_simple = TRUE((boolean_t) 1); |
197 | |
198 | OutP->pidarrayType = pidarrayType; |
199 | if (pidarrayP != OutP->pidarray) { |
200 | OutP->pidarrayType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
201 | OutP->pidarrayType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
202 | *((pid_t **)OutP->pidarray) = pidarrayP; |
203 | msgh_simple = FALSE((boolean_t) 0); |
204 | } |
205 | |
206 | OutP->pidarrayType.msgtl_number = pidarrayCnt; |
207 | OutP->Head.msgh_size = 44 + ((OutP->pidarrayType.msgtl_header.msgt_inline) ? 4 * pidarrayCnt : sizeof(pid_t *)); |
208 | |
209 | if (!msgh_simple) |
210 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
211 | } |
212 | |
213 | /* Default implementation of S_proc_getallpids */ |
214 | #ifdef MIG_EOPNOTSUPP |
215 | kern_return_t __attribute__ ((weak)) |
216 | S_proc_getallpids |
217 | ( |
218 | pstruct_t process, |
219 | pidarray_t *pidarray, |
220 | mach_msg_type_number_t *pidarrayCnt |
221 | ) { return MIG_EOPNOTSUPP; } |
222 | #endif /* MIG_EOPNOTSUPP */ |
223 | |
224 | /* Routine proc_setexecdata */ |
225 | mig_internalstatic void _Xproc_setexecdata |
226 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
227 | { |
228 | typedef struct { |
229 | mach_msg_header_t Head; |
230 | mach_msg_type_long_t portsType; |
231 | mach_port_t ports[512]; |
232 | mach_msg_type_long_t intsType; |
233 | int ints[512]; |
234 | } Request; |
235 | |
236 | typedef struct { |
237 | mach_msg_header_t Head; |
238 | mach_msg_type_t RetCodeType; |
239 | kern_return_t RetCode; |
240 | } Reply; |
241 | |
242 | Request *In0P = (Request *) InHeadP; |
243 | Request *In1P; |
244 | Reply *OutP = (Reply *) OutHeadP; |
245 | mig_external kern_return_t S_proc_setexecdata |
246 | (pstruct_t process, portarray_t ports, mach_msg_type_number_t portsCnt, intarray_t ints, mach_msg_type_number_t intsCnt); |
247 | |
248 | unsigned int msgh_size; |
249 | unsigned int msgh_size_delta; |
250 | |
251 | pstruct_t process; |
252 | |
253 | #if TypeCheck1 |
254 | msgh_size = In0P->Head.msgh_size; |
255 | if (mig_unlikely ((msgh_size < 48) ||__builtin_expect (!! ((msgh_size < 48) || !(In0P->Head. msgh_bits & 0x80000000U)), 0) |
256 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((msgh_size < 48) || !(In0P->Head. msgh_bits & 0x80000000U)), 0)) |
257 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
258 | #endif /* TypeCheck */ |
259 | |
260 | #if TypeCheck1 |
261 | if (mig_unlikely ((In0P->portsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->portsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->portsType.msgtl_name != 17) || (In0P->portsType.msgtl_size != 32)), 0) |
262 | (In0P->portsType.msgtl_name != 17) ||__builtin_expect (!! ((In0P->portsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->portsType.msgtl_name != 17) || (In0P->portsType.msgtl_size != 32)), 0) |
263 | (In0P->portsType.msgtl_size != 32))__builtin_expect (!! ((In0P->portsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->portsType.msgtl_name != 17) || (In0P->portsType.msgtl_size != 32)), 0)) |
264 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
265 | #endif /* TypeCheck */ |
266 | |
267 | msgh_size_delta = (In0P->portsType.msgtl_header.msgt_inline) ? 4 * In0P->portsType.msgtl_number : sizeof(mach_port_t *); |
268 | #if TypeCheck1 |
269 | if (mig_unlikely (msgh_size < 48 + msgh_size_delta)__builtin_expect (!! (msgh_size < 48 + msgh_size_delta), 0 )) |
270 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
271 | msgh_size -= msgh_size_delta; |
272 | #endif /* TypeCheck */ |
273 | |
274 | In1P = (Request *) ((char *) In0P + msgh_size_delta - 2048); |
275 | |
276 | #if TypeCheck1 |
277 | if (mig_unlikely ((In1P->intsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In1P->intsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->intsType.msgtl_name != 2) || (In1P->intsType.msgtl_size != 32)), 0) |
278 | (In1P->intsType.msgtl_name != 2) ||__builtin_expect (!! ((In1P->intsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->intsType.msgtl_name != 2) || (In1P->intsType.msgtl_size != 32)), 0) |
279 | (In1P->intsType.msgtl_size != 32))__builtin_expect (!! ((In1P->intsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->intsType.msgtl_name != 2) || (In1P->intsType.msgtl_size != 32)), 0)) |
280 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
281 | #endif /* TypeCheck */ |
282 | |
283 | #if TypeCheck1 |
284 | if (mig_unlikely (msgh_size != 48 + ((In1P->intsType.msgtl_header.msgt_inline) ? 4 * In1P->intsType.msgtl_number : sizeof(int *)))__builtin_expect (!! (msgh_size != 48 + ((In1P->intsType.msgtl_header .msgt_inline) ? 4 * In1P->intsType.msgtl_number : sizeof(int *))), 0)) |
285 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
286 | #endif /* TypeCheck */ |
287 | |
288 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
289 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
290 | else |
291 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
292 | |
293 | OutP->RetCode = S_proc_setexecdata(process, (In0P->portsType.msgtl_header.msgt_inline) ? In0P->ports : *((mach_port_t **)In0P->ports), In0P->portsType.msgtl_number, (In1P->intsType.msgtl_header.msgt_inline) ? In1P->ints : *((int **)In1P->ints), In1P->intsType.msgtl_number); |
294 | if (OutP->RetCode == KERN_SUCCESS0) |
295 | if (!In1P->intsType.msgtl_header.msgt_inline) |
296 | __mig_deallocate(* (vm_offset_t *) In1P->ints, 4 * In1P->intsType.msgtl_number); |
297 | if (OutP->RetCode == KERN_SUCCESS0) |
298 | if (!In0P->portsType.msgtl_header.msgt_inline) |
299 | __mig_deallocate(* (vm_offset_t *) In0P->ports, 4 * In0P->portsType.msgtl_number); |
300 | end_using_proc(process); |
301 | } |
302 | |
303 | /* Default implementation of S_proc_setexecdata */ |
304 | #ifdef MIG_EOPNOTSUPP |
305 | kern_return_t __attribute__ ((weak)) |
306 | S_proc_setexecdata |
307 | ( |
308 | pstruct_t process, |
309 | portarray_t ports, |
310 | mach_msg_type_number_t portsCnt, |
311 | intarray_t ints, |
312 | mach_msg_type_number_t intsCnt |
313 | ) { return MIG_EOPNOTSUPP; } |
314 | #endif /* MIG_EOPNOTSUPP */ |
315 | |
316 | /* Routine proc_getexecdata */ |
317 | mig_internalstatic void _Xproc_getexecdata |
318 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
319 | { |
320 | typedef struct { |
321 | mach_msg_header_t Head; |
322 | } Request; |
323 | |
324 | typedef struct { |
325 | mach_msg_header_t Head; |
326 | mach_msg_type_t RetCodeType; |
327 | kern_return_t RetCode; |
328 | mach_msg_type_long_t portsType; |
329 | mach_port_t ports[512]; |
330 | mach_msg_type_long_t intsType; |
331 | int ints[512]; |
332 | } Reply; |
333 | |
334 | Request *In0P = (Request *) InHeadP; |
335 | Reply *OutP = (Reply *) OutHeadP; |
336 | mig_external kern_return_t S_proc_getexecdata |
337 | (pstruct_t process, portarray_t *ports, mach_msg_type_name_t *portsPoly, mach_msg_type_number_t *portsCnt, intarray_t *ints, mach_msg_type_number_t *intsCnt); |
338 | |
339 | boolean_t msgh_simple = msgh_simple; |
Assigned value is garbage or undefined | |
340 | unsigned int msgh_size; |
341 | unsigned int msgh_size_delta; |
342 | |
343 | const mach_msg_type_long_t portsType = { |
344 | { |
345 | /* msgt_name = */ 0, |
346 | /* msgt_size = */ 0, |
347 | /* msgt_number = */ 0, |
348 | /* msgt_inline = */ TRUE((boolean_t) 1), |
349 | /* msgt_longform = */ TRUE((boolean_t) 1), |
350 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
351 | /* msgt_unused = */ 0 |
352 | }, |
353 | /* msgtl_name = */ -1, |
354 | /* msgtl_size = */ 32, |
355 | /* msgtl_number = */ 512, |
356 | }; |
357 | |
358 | const mach_msg_type_long_t intsType = { |
359 | { |
360 | /* msgt_name = */ 0, |
361 | /* msgt_size = */ 0, |
362 | /* msgt_number = */ 0, |
363 | /* msgt_inline = */ TRUE((boolean_t) 1), |
364 | /* msgt_longform = */ TRUE((boolean_t) 1), |
365 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
366 | /* msgt_unused = */ 0 |
367 | }, |
368 | /* msgtl_name = */ 2, |
369 | /* msgtl_size = */ 32, |
370 | /* msgtl_number = */ 512, |
371 | }; |
372 | |
373 | pstruct_t process; |
374 | mach_msg_type_name_t portsPoly; |
375 | mach_msg_type_number_t portsCnt; |
376 | int ints[512]; |
377 | mach_msg_type_number_t intsCnt; |
378 | |
379 | mach_port_t *portsP; |
380 | int *intsP; |
381 | |
382 | #if TypeCheck1 |
383 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
384 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
385 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
386 | #endif /* TypeCheck */ |
387 | |
388 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
389 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
390 | else |
391 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
392 | |
393 | portsP = OutP->ports; |
394 | portsCnt = 512; |
395 | |
396 | intsP = ints; |
397 | intsCnt = 512; |
398 | |
399 | OutP->RetCode = S_proc_getexecdata(process, &portsP, &portsPoly, &portsCnt, &intsP, &intsCnt); |
400 | end_using_proc(process); |
401 | if (OutP->RetCode != KERN_SUCCESS0) |
402 | return; |
403 | |
404 | msgh_simple = TRUE((boolean_t) 1); |
405 | |
406 | OutP->portsType = portsType; |
407 | if (portsP != OutP->ports) { |
408 | OutP->portsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
409 | OutP->portsType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
410 | *((mach_port_t **)OutP->ports) = portsP; |
411 | msgh_simple = FALSE((boolean_t) 0); |
412 | } |
413 | |
414 | if (MACH_MSG_TYPE_PORT_ANY(portsPoly)(((portsPoly) >= 16) && ((portsPoly) <= 21))) |
415 | msgh_simple = FALSE((boolean_t) 0); |
416 | |
417 | OutP->portsType.msgtl_name = portsPoly; |
418 | |
419 | OutP->portsType.msgtl_number = portsCnt; |
420 | msgh_size_delta = (OutP->portsType.msgtl_header.msgt_inline) ? 4 * portsCnt : sizeof(mach_port_t *); |
421 | msgh_size = 56 + msgh_size_delta; |
422 | OutP = (Reply *) ((char *) OutP + msgh_size_delta - 2048); |
423 | |
424 | OutP->intsType = intsType; |
425 | |
426 | if (intsP != ints) { |
427 | OutP->intsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
428 | OutP->intsType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
429 | *((int **)OutP->ints) = intsP; |
430 | msgh_simple = FALSE((boolean_t) 0); |
431 | } |
432 | else { |
433 | memcpy(OutP->ints, ints, 4 * intsCnt); |
434 | } |
435 | |
436 | OutP->intsType.msgtl_number = intsCnt; |
437 | msgh_size += (OutP->intsType.msgtl_header.msgt_inline) ? 4 * intsCnt : sizeof(int *); |
438 | |
439 | OutP = (Reply *) OutHeadP; |
440 | if (!msgh_simple) |
441 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
442 | OutP->Head.msgh_size = msgh_size; |
443 | } |
444 | |
445 | /* Default implementation of S_proc_getexecdata */ |
446 | #ifdef MIG_EOPNOTSUPP |
447 | kern_return_t __attribute__ ((weak)) |
448 | S_proc_getexecdata |
449 | ( |
450 | pstruct_t process, |
451 | portarray_t *ports, |
452 | mach_msg_type_name_t *portsPoly, |
453 | mach_msg_type_number_t *portsCnt, |
454 | intarray_t *ints, |
455 | mach_msg_type_number_t *intsCnt |
456 | ) { return MIG_EOPNOTSUPP; } |
457 | #endif /* MIG_EOPNOTSUPP */ |
458 | |
459 | /* Routine proc_execdata_notify */ |
460 | mig_internalstatic void _Xproc_execdata_notify |
461 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
462 | { |
463 | typedef struct { |
464 | mach_msg_header_t Head; |
465 | mach_msg_type_t notifyType; |
466 | mach_port_t notify; |
467 | } Request; |
468 | |
469 | typedef struct { |
470 | mach_msg_header_t Head; |
471 | mach_msg_type_t RetCodeType; |
472 | kern_return_t RetCode; |
473 | } Reply; |
474 | |
475 | Request *In0P = (Request *) InHeadP; |
476 | Reply *OutP = (Reply *) OutHeadP; |
477 | mig_external kern_return_t S_proc_execdata_notify |
478 | (pstruct_t process, mach_port_t notify); |
479 | |
480 | const mach_msg_type_t notifyCheck = { |
481 | /* msgt_name = */ 17, |
482 | /* msgt_size = */ 32, |
483 | /* msgt_number = */ 1, |
484 | /* msgt_inline = */ TRUE((boolean_t) 1), |
485 | /* msgt_longform = */ FALSE((boolean_t) 0), |
486 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
487 | /* msgt_unused = */ 0 |
488 | }; |
489 | |
490 | pstruct_t process; |
491 | |
492 | #if TypeCheck1 |
493 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
494 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
495 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
496 | #endif /* TypeCheck */ |
497 | |
498 | #if TypeCheck1 |
499 | if (BAD_TYPECHECK(&In0P->notifyType, ¬ifyCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->notifyType); _c.t = *(& notifyCheck);_t.w != _c.w; })), 0)) |
500 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
501 | #endif /* TypeCheck */ |
502 | |
503 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
504 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
505 | else |
506 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
507 | |
508 | OutP->RetCode = S_proc_execdata_notify(process, In0P->notify); |
509 | end_using_proc(process); |
510 | } |
511 | |
512 | /* Default implementation of S_proc_execdata_notify */ |
513 | #ifdef MIG_EOPNOTSUPP |
514 | kern_return_t __attribute__ ((weak)) |
515 | S_proc_execdata_notify |
516 | ( |
517 | pstruct_t process, |
518 | mach_port_t notify |
519 | ) { return MIG_EOPNOTSUPP; } |
520 | #endif /* MIG_EOPNOTSUPP */ |
521 | |
522 | /* Routine proc_uname */ |
523 | mig_internalstatic void _Xproc_uname |
524 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
525 | { |
526 | typedef struct { |
527 | mach_msg_header_t Head; |
528 | } Request; |
529 | |
530 | typedef struct { |
531 | mach_msg_header_t Head; |
532 | mach_msg_type_t RetCodeType; |
533 | kern_return_t RetCode; |
534 | mach_msg_type_long_t unameType; |
535 | utsname_t uname; |
536 | } Reply; |
537 | |
538 | Request *In0P = (Request *) InHeadP; |
539 | Reply *OutP = (Reply *) OutHeadP; |
540 | mig_external kern_return_t S_proc_uname |
541 | (pstruct_t process, utsname_t *uname); |
542 | |
543 | const mach_msg_type_long_t unameType = { |
544 | { |
545 | /* msgt_name = */ 0, |
546 | /* msgt_size = */ 0, |
547 | /* msgt_number = */ 0, |
548 | /* msgt_inline = */ TRUE((boolean_t) 1), |
549 | /* msgt_longform = */ TRUE((boolean_t) 1), |
550 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
551 | /* msgt_unused = */ 0 |
552 | }, |
553 | /* msgtl_name = */ 8, |
554 | /* msgtl_size = */ 8, |
555 | /* msgtl_number = */ 5120, |
556 | }; |
557 | |
558 | pstruct_t process; |
559 | |
560 | #if TypeCheck1 |
561 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
562 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
563 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
564 | #endif /* TypeCheck */ |
565 | |
566 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
567 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
568 | else |
569 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
570 | |
571 | OutP->RetCode = S_proc_uname(process, &OutP->uname); |
572 | end_using_proc(process); |
573 | if (OutP->RetCode != KERN_SUCCESS0) |
574 | return; |
575 | |
576 | OutP->Head.msgh_size = 5164; |
577 | |
578 | OutP->unameType = unameType; |
579 | } |
580 | |
581 | /* Default implementation of S_proc_uname */ |
582 | #ifdef MIG_EOPNOTSUPP |
583 | kern_return_t __attribute__ ((weak)) |
584 | S_proc_uname |
585 | ( |
586 | pstruct_t process, |
587 | utsname_t *uname |
588 | ) { return MIG_EOPNOTSUPP; } |
589 | #endif /* MIG_EOPNOTSUPP */ |
590 | |
591 | /* Routine proc_register_version */ |
592 | mig_internalstatic void _Xproc_register_version |
593 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
594 | { |
595 | typedef struct { |
596 | mach_msg_header_t Head; |
597 | mach_msg_type_t credentialType; |
598 | mach_port_t credential; |
599 | mach_msg_type_t nameType; |
600 | string_t name; |
601 | mach_msg_type_t releaseType; |
602 | string_t release; |
603 | mach_msg_type_t versionType; |
604 | string_t version; |
605 | } Request; |
606 | |
607 | typedef struct { |
608 | mach_msg_header_t Head; |
609 | mach_msg_type_t RetCodeType; |
610 | kern_return_t RetCode; |
611 | } Reply; |
612 | |
613 | Request *In0P = (Request *) InHeadP; |
614 | Reply *OutP = (Reply *) OutHeadP; |
615 | mig_external kern_return_t S_proc_register_version |
616 | (pstruct_t process, mach_port_t credential, string_t name, string_t release, string_t version); |
617 | |
618 | const mach_msg_type_t credentialCheck = { |
619 | /* msgt_name = */ 17, |
620 | /* msgt_size = */ 32, |
621 | /* msgt_number = */ 1, |
622 | /* msgt_inline = */ TRUE((boolean_t) 1), |
623 | /* msgt_longform = */ FALSE((boolean_t) 0), |
624 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
625 | /* msgt_unused = */ 0 |
626 | }; |
627 | |
628 | const mach_msg_type_t nameCheck = { |
629 | /* msgt_name = */ MACH_MSG_TYPE_STRING_C12, |
630 | /* msgt_size = */ 8, |
631 | /* msgt_number = */ 1024, |
632 | /* msgt_inline = */ TRUE((boolean_t) 1), |
633 | /* msgt_longform = */ FALSE((boolean_t) 0), |
634 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
635 | /* msgt_unused = */ 0 |
636 | }; |
637 | |
638 | const mach_msg_type_t releaseCheck = { |
639 | /* msgt_name = */ MACH_MSG_TYPE_STRING_C12, |
640 | /* msgt_size = */ 8, |
641 | /* msgt_number = */ 1024, |
642 | /* msgt_inline = */ TRUE((boolean_t) 1), |
643 | /* msgt_longform = */ FALSE((boolean_t) 0), |
644 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
645 | /* msgt_unused = */ 0 |
646 | }; |
647 | |
648 | const mach_msg_type_t versionCheck = { |
649 | /* msgt_name = */ MACH_MSG_TYPE_STRING_C12, |
650 | /* msgt_size = */ 8, |
651 | /* msgt_number = */ 1024, |
652 | /* msgt_inline = */ TRUE((boolean_t) 1), |
653 | /* msgt_longform = */ FALSE((boolean_t) 0), |
654 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
655 | /* msgt_unused = */ 0 |
656 | }; |
657 | |
658 | pstruct_t process; |
659 | |
660 | #if TypeCheck1 |
661 | if (mig_unlikely ((In0P->Head.msgh_size != 3116) ||__builtin_expect (!! ((In0P->Head.msgh_size != 3116) || !( In0P->Head.msgh_bits & 0x80000000U)), 0) |
662 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 3116) || !( In0P->Head.msgh_bits & 0x80000000U)), 0)) |
663 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
664 | #endif /* TypeCheck */ |
665 | |
666 | #if TypeCheck1 |
667 | if (BAD_TYPECHECK(&In0P->credentialType, &credentialCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->credentialType); _c.t = * (&credentialCheck);_t.w != _c.w; })), 0)) |
668 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
669 | #endif /* TypeCheck */ |
670 | |
671 | #if TypeCheck1 |
672 | if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(& nameCheck);_t.w != _c.w; })), 0)) |
673 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
674 | #endif /* TypeCheck */ |
675 | |
676 | #if TypeCheck1 |
677 | if (BAD_TYPECHECK(&In0P->releaseType, &releaseCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->releaseType); _c.t = *(& releaseCheck);_t.w != _c.w; })), 0)) |
678 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
679 | #endif /* TypeCheck */ |
680 | |
681 | #if TypeCheck1 |
682 | if (BAD_TYPECHECK(&In0P->versionType, &versionCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->versionType); _c.t = *(& versionCheck);_t.w != _c.w; })), 0)) |
683 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
684 | #endif /* TypeCheck */ |
685 | |
686 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
687 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
688 | else |
689 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
690 | |
691 | OutP->RetCode = S_proc_register_version(process, In0P->credential, In0P->name, In0P->release, In0P->version); |
692 | end_using_proc(process); |
693 | } |
694 | |
695 | /* Default implementation of S_proc_register_version */ |
696 | #ifdef MIG_EOPNOTSUPP |
697 | kern_return_t __attribute__ ((weak)) |
698 | S_proc_register_version |
699 | ( |
700 | pstruct_t process, |
701 | mach_port_t credential, |
702 | string_t name, |
703 | string_t release, |
704 | string_t version |
705 | ) { return MIG_EOPNOTSUPP; } |
706 | #endif /* MIG_EOPNOTSUPP */ |
707 | |
708 | /* SimpleRoutine proc_reauthenticate */ |
709 | mig_internalstatic void _Xproc_reauthenticate |
710 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
711 | { |
712 | typedef struct { |
713 | mach_msg_header_t Head; |
714 | mach_msg_type_t rendezvous2Type; |
715 | mach_port_t rendezvous2; |
716 | } Request; |
717 | |
718 | typedef struct { |
719 | mach_msg_header_t Head; |
720 | mach_msg_type_t RetCodeType; |
721 | kern_return_t RetCode; |
722 | } Reply; |
723 | |
724 | Request *In0P = (Request *) InHeadP; |
725 | Reply *OutP = (Reply *) OutHeadP; |
726 | mig_external kern_return_t S_proc_reauthenticate |
727 | (pstruct_t process, mach_port_t rendezvous2); |
728 | |
729 | const mach_msg_type_t rendezvous2Check = { |
730 | /* msgt_name = */ 17, |
731 | /* msgt_size = */ 32, |
732 | /* msgt_number = */ 1, |
733 | /* msgt_inline = */ TRUE((boolean_t) 1), |
734 | /* msgt_longform = */ FALSE((boolean_t) 0), |
735 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
736 | /* msgt_unused = */ 0 |
737 | }; |
738 | |
739 | pstruct_t process; |
740 | |
741 | #if TypeCheck1 |
742 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
743 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
744 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
745 | #endif /* TypeCheck */ |
746 | |
747 | #if TypeCheck1 |
748 | if (BAD_TYPECHECK(&In0P->rendezvous2Type, &rendezvous2Check)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->rendezvous2Type); _c.t = *(&rendezvous2Check);_t.w != _c.w; })), 0)) |
749 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
750 | #endif /* TypeCheck */ |
751 | |
752 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
753 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
754 | else |
755 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
756 | |
757 | OutP->RetCode = S_proc_reauthenticate(process, In0P->rendezvous2); |
758 | end_using_proc(process); |
759 | } |
760 | |
761 | /* Default implementation of S_proc_reauthenticate */ |
762 | #ifdef MIG_EOPNOTSUPP |
763 | kern_return_t __attribute__ ((weak)) |
764 | S_proc_reauthenticate |
765 | ( |
766 | pstruct_t process, |
767 | mach_port_t rendezvous2 |
768 | ) { return MIG_EOPNOTSUPP; } |
769 | #endif /* MIG_EOPNOTSUPP */ |
770 | |
771 | /* Routine proc_child */ |
772 | mig_internalstatic void _Xproc_child |
773 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
774 | { |
775 | typedef struct { |
776 | mach_msg_header_t Head; |
777 | mach_msg_type_t childType; |
778 | mach_port_t child; |
779 | } Request; |
780 | |
781 | typedef struct { |
782 | mach_msg_header_t Head; |
783 | mach_msg_type_t RetCodeType; |
784 | kern_return_t RetCode; |
785 | } Reply; |
786 | |
787 | Request *In0P = (Request *) InHeadP; |
788 | Reply *OutP = (Reply *) OutHeadP; |
789 | mig_external kern_return_t S_proc_child |
790 | (pstruct_t process, mach_port_t child); |
791 | |
792 | const mach_msg_type_t childCheck = { |
793 | /* msgt_name = */ 17, |
794 | /* msgt_size = */ 32, |
795 | /* msgt_number = */ 1, |
796 | /* msgt_inline = */ TRUE((boolean_t) 1), |
797 | /* msgt_longform = */ FALSE((boolean_t) 0), |
798 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
799 | /* msgt_unused = */ 0 |
800 | }; |
801 | |
802 | pstruct_t process; |
803 | |
804 | #if TypeCheck1 |
805 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
806 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
807 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
808 | #endif /* TypeCheck */ |
809 | |
810 | #if TypeCheck1 |
811 | if (BAD_TYPECHECK(&In0P->childType, &childCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->childType); _c.t = *(& childCheck);_t.w != _c.w; })), 0)) |
812 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
813 | #endif /* TypeCheck */ |
814 | |
815 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
816 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
817 | else |
818 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
819 | |
820 | OutP->RetCode = S_proc_child(process, In0P->child); |
821 | end_using_proc(process); |
822 | } |
823 | |
824 | /* Default implementation of S_proc_child */ |
825 | #ifdef MIG_EOPNOTSUPP |
826 | kern_return_t __attribute__ ((weak)) |
827 | S_proc_child |
828 | ( |
829 | pstruct_t process, |
830 | mach_port_t child |
831 | ) { return MIG_EOPNOTSUPP; } |
832 | #endif /* MIG_EOPNOTSUPP */ |
833 | |
834 | /* Routine proc_setmsgport */ |
835 | mig_internalstatic void _Xproc_setmsgport |
836 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
837 | { |
838 | typedef struct { |
839 | mach_msg_header_t Head; |
840 | mach_msg_type_t newmsgportType; |
841 | mach_port_t newmsgport; |
842 | } Request; |
843 | |
844 | typedef struct { |
845 | mach_msg_header_t Head; |
846 | mach_msg_type_t RetCodeType; |
847 | kern_return_t RetCode; |
848 | mach_msg_type_t oldmsgportType; |
849 | mach_port_t oldmsgport; |
850 | } Reply; |
851 | |
852 | Request *In0P = (Request *) InHeadP; |
853 | Reply *OutP = (Reply *) OutHeadP; |
854 | mig_external kern_return_t S_proc_setmsgport |
855 | (pstruct_t process, mach_port_t reply_port, mach_msg_type_name_t reply_portPoly, mach_port_t newmsgport, mach_port_t *oldmsgport, mach_msg_type_name_t *oldmsgportPoly); |
856 | |
857 | boolean_t msgh_simple = msgh_simple; |
858 | const mach_msg_type_t newmsgportCheck = { |
859 | /* msgt_name = */ 17, |
860 | /* msgt_size = */ 32, |
861 | /* msgt_number = */ 1, |
862 | /* msgt_inline = */ TRUE((boolean_t) 1), |
863 | /* msgt_longform = */ FALSE((boolean_t) 0), |
864 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
865 | /* msgt_unused = */ 0 |
866 | }; |
867 | |
868 | const mach_msg_type_t oldmsgportType = { |
869 | /* msgt_name = */ -1, |
870 | /* msgt_size = */ 32, |
871 | /* msgt_number = */ 1, |
872 | /* msgt_inline = */ TRUE((boolean_t) 1), |
873 | /* msgt_longform = */ FALSE((boolean_t) 0), |
874 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
875 | /* msgt_unused = */ 0 |
876 | }; |
877 | |
878 | pstruct_t process; |
879 | mach_port_t reply_port; |
880 | mach_port_t newmsgport; |
881 | mach_msg_type_name_t oldmsgportPoly; |
882 | |
883 | #if TypeCheck1 |
884 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
885 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
886 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
887 | #endif /* TypeCheck */ |
888 | |
889 | #if TypeCheck1 |
890 | if (BAD_TYPECHECK(&In0P->newmsgportType, &newmsgportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->newmsgportType); _c.t = * (&newmsgportCheck);_t.w != _c.w; })), 0)) |
891 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
892 | #endif /* TypeCheck */ |
893 | |
894 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
895 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
896 | else |
897 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
898 | |
899 | reply_port = In0P->Head.msgh_reply_portmsgh_remote_port; |
900 | |
901 | newmsgport = In0P->newmsgport; |
902 | |
903 | OutP->RetCode = S_proc_setmsgport(process, reply_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), newmsgport, &OutP->oldmsgport, &oldmsgportPoly); |
904 | end_using_proc(process); |
905 | if (OutP->RetCode != KERN_SUCCESS0) |
906 | return; |
907 | |
908 | msgh_simple = TRUE((boolean_t) 1); |
909 | OutP->Head.msgh_size = 40; |
910 | |
911 | OutP->oldmsgportType = oldmsgportType; |
912 | |
913 | if (MACH_MSG_TYPE_PORT_ANY(oldmsgportPoly)(((oldmsgportPoly) >= 16) && ((oldmsgportPoly) <= 21))) |
914 | msgh_simple = FALSE((boolean_t) 0); |
915 | |
916 | OutP->oldmsgportType.msgt_name = oldmsgportPoly; |
917 | |
918 | if (!msgh_simple) |
919 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
920 | } |
921 | |
922 | /* Default implementation of S_proc_setmsgport */ |
923 | #ifdef MIG_EOPNOTSUPP |
924 | kern_return_t __attribute__ ((weak)) |
925 | S_proc_setmsgport |
926 | ( |
927 | pstruct_t process, |
928 | mach_port_t reply_port, |
929 | mach_msg_type_name_t reply_portPoly, |
930 | mach_port_t newmsgport, |
931 | mach_port_t *oldmsgport, |
932 | mach_msg_type_name_t *oldmsgportPoly |
933 | ) { return MIG_EOPNOTSUPP; } |
934 | #endif /* MIG_EOPNOTSUPP */ |
935 | |
936 | /* Routine proc_reassign */ |
937 | mig_internalstatic void _Xproc_reassign |
938 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
939 | { |
940 | typedef struct { |
941 | mach_msg_header_t Head; |
942 | mach_msg_type_t newtaskType; |
943 | mach_port_t newtask; |
944 | } Request; |
945 | |
946 | typedef struct { |
947 | mach_msg_header_t Head; |
948 | mach_msg_type_t RetCodeType; |
949 | kern_return_t RetCode; |
950 | } Reply; |
951 | |
952 | Request *In0P = (Request *) InHeadP; |
953 | Reply *OutP = (Reply *) OutHeadP; |
954 | mig_external kern_return_t S_proc_reassign |
955 | (pstruct_t process, mach_port_t newtask); |
956 | |
957 | const mach_msg_type_t newtaskCheck = { |
958 | /* msgt_name = */ 17, |
959 | /* msgt_size = */ 32, |
960 | /* msgt_number = */ 1, |
961 | /* msgt_inline = */ TRUE((boolean_t) 1), |
962 | /* msgt_longform = */ FALSE((boolean_t) 0), |
963 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
964 | /* msgt_unused = */ 0 |
965 | }; |
966 | |
967 | pstruct_t process; |
968 | |
969 | #if TypeCheck1 |
970 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
971 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
972 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
973 | #endif /* TypeCheck */ |
974 | |
975 | #if TypeCheck1 |
976 | if (BAD_TYPECHECK(&In0P->newtaskType, &newtaskCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->newtaskType); _c.t = *(& newtaskCheck);_t.w != _c.w; })), 0)) |
977 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
978 | #endif /* TypeCheck */ |
979 | |
980 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
981 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
982 | else |
983 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
984 | |
985 | OutP->RetCode = S_proc_reassign(process, In0P->newtask); |
986 | end_using_proc(process); |
987 | } |
988 | |
989 | /* Default implementation of S_proc_reassign */ |
990 | #ifdef MIG_EOPNOTSUPP |
991 | kern_return_t __attribute__ ((weak)) |
992 | S_proc_reassign |
993 | ( |
994 | pstruct_t process, |
995 | mach_port_t newtask |
996 | ) { return MIG_EOPNOTSUPP; } |
997 | #endif /* MIG_EOPNOTSUPP */ |
998 | |
999 | /* Routine proc_setowner */ |
1000 | mig_internalstatic void _Xproc_setowner |
1001 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1002 | { |
1003 | typedef struct { |
1004 | mach_msg_header_t Head; |
1005 | mach_msg_type_t ownerType; |
1006 | uid_t owner; |
1007 | mach_msg_type_t clearType; |
1008 | int clear; |
1009 | } Request; |
1010 | |
1011 | typedef struct { |
1012 | mach_msg_header_t Head; |
1013 | mach_msg_type_t RetCodeType; |
1014 | kern_return_t RetCode; |
1015 | } Reply; |
1016 | |
1017 | Request *In0P = (Request *) InHeadP; |
1018 | Reply *OutP = (Reply *) OutHeadP; |
1019 | mig_external kern_return_t S_proc_setowner |
1020 | (pstruct_t process, uid_t owner, int clear); |
1021 | |
1022 | const mach_msg_type_t ownerCheck = { |
1023 | /* msgt_name = */ 2, |
1024 | /* msgt_size = */ 32, |
1025 | /* msgt_number = */ 1, |
1026 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1027 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1028 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1029 | /* msgt_unused = */ 0 |
1030 | }; |
1031 | |
1032 | const mach_msg_type_t clearCheck = { |
1033 | /* msgt_name = */ 2, |
1034 | /* msgt_size = */ 32, |
1035 | /* msgt_number = */ 1, |
1036 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1037 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1038 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1039 | /* msgt_unused = */ 0 |
1040 | }; |
1041 | |
1042 | pstruct_t process; |
1043 | |
1044 | #if TypeCheck1 |
1045 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1046 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1047 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1048 | #endif /* TypeCheck */ |
1049 | |
1050 | #if TypeCheck1 |
1051 | if (BAD_TYPECHECK(&In0P->ownerType, &ownerCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->ownerType); _c.t = *(& ownerCheck);_t.w != _c.w; })), 0)) |
1052 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1053 | #endif /* TypeCheck */ |
1054 | |
1055 | #if TypeCheck1 |
1056 | if (BAD_TYPECHECK(&In0P->clearType, &clearCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->clearType); _c.t = *(& clearCheck);_t.w != _c.w; })), 0)) |
1057 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1058 | #endif /* TypeCheck */ |
1059 | |
1060 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1061 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
1062 | else |
1063 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
1064 | |
1065 | OutP->RetCode = S_proc_setowner(process, In0P->owner, In0P->clear); |
1066 | end_using_proc(process); |
1067 | } |
1068 | |
1069 | /* Default implementation of S_proc_setowner */ |
1070 | #ifdef MIG_EOPNOTSUPP |
1071 | kern_return_t __attribute__ ((weak)) |
1072 | S_proc_setowner |
1073 | ( |
1074 | pstruct_t process, |
1075 | uid_t owner, |
1076 | int clear |
1077 | ) { return MIG_EOPNOTSUPP; } |
1078 | #endif /* MIG_EOPNOTSUPP */ |
1079 | |
1080 | /* Routine proc_getpids */ |
1081 | mig_internalstatic void _Xproc_getpids |
1082 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1083 | { |
1084 | typedef struct { |
1085 | mach_msg_header_t Head; |
1086 | } Request; |
1087 | |
1088 | typedef struct { |
1089 | mach_msg_header_t Head; |
1090 | mach_msg_type_t RetCodeType; |
1091 | kern_return_t RetCode; |
1092 | mach_msg_type_t pidType; |
1093 | pid_t pid; |
1094 | mach_msg_type_t ppidType; |
1095 | pid_t ppid; |
1096 | mach_msg_type_t orphanedType; |
1097 | int orphaned; |
1098 | } Reply; |
1099 | |
1100 | Request *In0P = (Request *) InHeadP; |
1101 | Reply *OutP = (Reply *) OutHeadP; |
1102 | mig_external kern_return_t S_proc_getpids |
1103 | (pstruct_t process, pid_t *pid, pid_t *ppid, int *orphaned); |
1104 | |
1105 | const mach_msg_type_t pidType = { |
1106 | /* msgt_name = */ 2, |
1107 | /* msgt_size = */ 32, |
1108 | /* msgt_number = */ 1, |
1109 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1110 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1111 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1112 | /* msgt_unused = */ 0 |
1113 | }; |
1114 | |
1115 | const mach_msg_type_t ppidType = { |
1116 | /* msgt_name = */ 2, |
1117 | /* msgt_size = */ 32, |
1118 | /* msgt_number = */ 1, |
1119 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1120 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1121 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1122 | /* msgt_unused = */ 0 |
1123 | }; |
1124 | |
1125 | const mach_msg_type_t orphanedType = { |
1126 | /* msgt_name = */ 2, |
1127 | /* msgt_size = */ 32, |
1128 | /* msgt_number = */ 1, |
1129 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1130 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1131 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1132 | /* msgt_unused = */ 0 |
1133 | }; |
1134 | |
1135 | pstruct_t process; |
1136 | |
1137 | #if TypeCheck1 |
1138 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1139 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1140 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1141 | #endif /* TypeCheck */ |
1142 | |
1143 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1144 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
1145 | else |
1146 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
1147 | |
1148 | OutP->RetCode = S_proc_getpids(process, &OutP->pid, &OutP->ppid, &OutP->orphaned); |
1149 | end_using_proc(process); |
1150 | if (OutP->RetCode != KERN_SUCCESS0) |
1151 | return; |
1152 | |
1153 | OutP->Head.msgh_size = 56; |
1154 | |
1155 | OutP->pidType = pidType; |
1156 | |
1157 | OutP->ppidType = ppidType; |
1158 | |
1159 | OutP->orphanedType = orphanedType; |
1160 | } |
1161 | |
1162 | /* Default implementation of S_proc_getpids */ |
1163 | #ifdef MIG_EOPNOTSUPP |
1164 | kern_return_t __attribute__ ((weak)) |
1165 | S_proc_getpids |
1166 | ( |
1167 | pstruct_t process, |
1168 | pid_t *pid, |
1169 | pid_t *ppid, |
1170 | int *orphaned |
1171 | ) { return MIG_EOPNOTSUPP; } |
1172 | #endif /* MIG_EOPNOTSUPP */ |
1173 | |
1174 | /* Routine proc_set_arg_locations */ |
1175 | mig_internalstatic void _Xproc_set_arg_locations |
1176 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1177 | { |
1178 | typedef struct { |
1179 | mach_msg_header_t Head; |
1180 | mach_msg_type_t argvType; |
1181 | vm_address_t argv; |
1182 | mach_msg_type_t envpType; |
1183 | vm_address_t envp; |
1184 | } Request; |
1185 | |
1186 | typedef struct { |
1187 | mach_msg_header_t Head; |
1188 | mach_msg_type_t RetCodeType; |
1189 | kern_return_t RetCode; |
1190 | } Reply; |
1191 | |
1192 | Request *In0P = (Request *) InHeadP; |
1193 | Reply *OutP = (Reply *) OutHeadP; |
1194 | mig_external kern_return_t S_proc_set_arg_locations |
1195 | (pstruct_t process, vm_address_t argv, vm_address_t envp); |
1196 | |
1197 | const mach_msg_type_t argvCheck = { |
1198 | /* msgt_name = */ 2, |
1199 | /* msgt_size = */ 32, |
1200 | /* msgt_number = */ 1, |
1201 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1202 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1203 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1204 | /* msgt_unused = */ 0 |
1205 | }; |
1206 | |
1207 | const mach_msg_type_t envpCheck = { |
1208 | /* msgt_name = */ 2, |
1209 | /* msgt_size = */ 32, |
1210 | /* msgt_number = */ 1, |
1211 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1212 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1213 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1214 | /* msgt_unused = */ 0 |
1215 | }; |
1216 | |
1217 | pstruct_t process; |
1218 | |
1219 | #if TypeCheck1 |
1220 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1221 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1222 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1223 | #endif /* TypeCheck */ |
1224 | |
1225 | #if TypeCheck1 |
1226 | if (BAD_TYPECHECK(&In0P->argvType, &argvCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->argvType); _c.t = *(& argvCheck);_t.w != _c.w; })), 0)) |
1227 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1228 | #endif /* TypeCheck */ |
1229 | |
1230 | #if TypeCheck1 |
1231 | if (BAD_TYPECHECK(&In0P->envpType, &envpCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->envpType); _c.t = *(& envpCheck);_t.w != _c.w; })), 0)) |
1232 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1233 | #endif /* TypeCheck */ |
1234 | |
1235 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1236 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
1237 | else |
1238 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
1239 | |
1240 | OutP->RetCode = S_proc_set_arg_locations(process, In0P->argv, In0P->envp); |
1241 | end_using_proc(process); |
1242 | } |
1243 | |
1244 | /* Default implementation of S_proc_set_arg_locations */ |
1245 | #ifdef MIG_EOPNOTSUPP |
1246 | kern_return_t __attribute__ ((weak)) |
1247 | S_proc_set_arg_locations |
1248 | ( |
1249 | pstruct_t process, |
1250 | vm_address_t argv, |
1251 | vm_address_t envp |
1252 | ) { return MIG_EOPNOTSUPP; } |
1253 | #endif /* MIG_EOPNOTSUPP */ |
1254 | |
1255 | /* Routine proc_get_arg_locations */ |
1256 | mig_internalstatic void _Xproc_get_arg_locations |
1257 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1258 | { |
1259 | typedef struct { |
1260 | mach_msg_header_t Head; |
1261 | } Request; |
1262 | |
1263 | typedef struct { |
1264 | mach_msg_header_t Head; |
1265 | mach_msg_type_t RetCodeType; |
1266 | kern_return_t RetCode; |
1267 | mach_msg_type_t argvType; |
1268 | vm_address_t argv; |
1269 | mach_msg_type_t envpType; |
1270 | vm_address_t envp; |
1271 | } Reply; |
1272 | |
1273 | Request *In0P = (Request *) InHeadP; |
1274 | Reply *OutP = (Reply *) OutHeadP; |
1275 | mig_external kern_return_t S_proc_get_arg_locations |
1276 | (pstruct_t process, vm_address_t *argv, vm_address_t *envp); |
1277 | |
1278 | const mach_msg_type_t argvType = { |
1279 | /* msgt_name = */ 2, |
1280 | /* msgt_size = */ 32, |
1281 | /* msgt_number = */ 1, |
1282 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1283 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1284 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1285 | /* msgt_unused = */ 0 |
1286 | }; |
1287 | |
1288 | const mach_msg_type_t envpType = { |
1289 | /* msgt_name = */ 2, |
1290 | /* msgt_size = */ 32, |
1291 | /* msgt_number = */ 1, |
1292 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1293 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1294 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1295 | /* msgt_unused = */ 0 |
1296 | }; |
1297 | |
1298 | pstruct_t process; |
1299 | |
1300 | #if TypeCheck1 |
1301 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1302 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1303 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1304 | #endif /* TypeCheck */ |
1305 | |
1306 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1307 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
1308 | else |
1309 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
1310 | |
1311 | OutP->RetCode = S_proc_get_arg_locations(process, &OutP->argv, &OutP->envp); |
1312 | end_using_proc(process); |
1313 | if (OutP->RetCode != KERN_SUCCESS0) |
1314 | return; |
1315 | |
1316 | OutP->Head.msgh_size = 48; |
1317 | |
1318 | OutP->argvType = argvType; |
1319 | |
1320 | OutP->envpType = envpType; |
1321 | } |
1322 | |
1323 | /* Default implementation of S_proc_get_arg_locations */ |
1324 | #ifdef MIG_EOPNOTSUPP |
1325 | kern_return_t __attribute__ ((weak)) |
1326 | S_proc_get_arg_locations |
1327 | ( |
1328 | pstruct_t process, |
1329 | vm_address_t *argv, |
1330 | vm_address_t *envp |
1331 | ) { return MIG_EOPNOTSUPP; } |
1332 | #endif /* MIG_EOPNOTSUPP */ |
1333 | |
1334 | /* Routine proc_getmsgport */ |
1335 | mig_internalstatic void _Xproc_getmsgport |
1336 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1337 | { |
1338 | typedef struct { |
1339 | mach_msg_header_t Head; |
1340 | mach_msg_type_t pidType; |
1341 | pid_t pid; |
1342 | } Request; |
1343 | |
1344 | typedef struct { |
1345 | mach_msg_header_t Head; |
1346 | mach_msg_type_t RetCodeType; |
1347 | kern_return_t RetCode; |
1348 | mach_msg_type_t msgportType; |
1349 | mach_port_t msgport; |
1350 | } Reply; |
1351 | |
1352 | Request *In0P = (Request *) InHeadP; |
1353 | Reply *OutP = (Reply *) OutHeadP; |
1354 | mig_external kern_return_t S_proc_getmsgport |
1355 | (pstruct_t process, mach_port_t reply_port, mach_msg_type_name_t reply_portPoly, pid_t pid, mach_port_t *msgport); |
1356 | |
1357 | const mach_msg_type_t pidCheck = { |
1358 | /* msgt_name = */ 2, |
1359 | /* msgt_size = */ 32, |
1360 | /* msgt_number = */ 1, |
1361 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1362 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1363 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1364 | /* msgt_unused = */ 0 |
1365 | }; |
1366 | |
1367 | const mach_msg_type_t msgportType = { |
1368 | /* msgt_name = */ 19, |
1369 | /* msgt_size = */ 32, |
1370 | /* msgt_number = */ 1, |
1371 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1372 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1373 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1374 | /* msgt_unused = */ 0 |
1375 | }; |
1376 | |
1377 | pstruct_t process; |
1378 | mach_port_t reply_port; |
1379 | mach_port_t msgport; |
1380 | |
1381 | #if TypeCheck1 |
1382 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1383 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1384 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1385 | #endif /* TypeCheck */ |
1386 | |
1387 | #if TypeCheck1 |
1388 | if (BAD_TYPECHECK(&In0P->pidType, &pidCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->pidType); _c.t = *(& pidCheck);_t.w != _c.w; })), 0)) |
1389 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1390 | #endif /* TypeCheck */ |
1391 | |
1392 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1393 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
1394 | else |
1395 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
1396 | |
1397 | reply_port = In0P->Head.msgh_reply_portmsgh_remote_port; |
1398 | |
1399 | OutP->RetCode = S_proc_getmsgport(process, reply_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), In0P->pid, &msgport); |
1400 | end_using_proc(process); |
1401 | if (OutP->RetCode != KERN_SUCCESS0) |
1402 | return; |
1403 | |
1404 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
1405 | OutP->Head.msgh_size = 40; |
1406 | |
1407 | OutP->msgportType = msgportType; |
1408 | |
1409 | OutP->msgport = msgport; |
1410 | } |
1411 | |
1412 | /* Default implementation of S_proc_getmsgport */ |
1413 | #ifdef MIG_EOPNOTSUPP |
1414 | kern_return_t __attribute__ ((weak)) |
1415 | S_proc_getmsgport |
1416 | ( |
1417 | pstruct_t process, |
1418 | mach_port_t reply_port, |
1419 | mach_msg_type_name_t reply_portPoly, |
1420 | pid_t pid, |
1421 | mach_port_t *msgport |
1422 | ) { return MIG_EOPNOTSUPP; } |
1423 | #endif /* MIG_EOPNOTSUPP */ |
1424 | |
1425 | /* Routine proc_wait */ |
1426 | mig_internalstatic void _Xproc_wait |
1427 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1428 | { |
1429 | typedef struct { |
1430 | mach_msg_header_t Head; |
1431 | mach_msg_type_t pidType; |
1432 | pid_t pid; |
1433 | mach_msg_type_t optionsType; |
1434 | int options; |
1435 | } Request; |
1436 | |
1437 | typedef struct { |
1438 | mach_msg_header_t Head; |
1439 | mach_msg_type_t RetCodeType; |
1440 | kern_return_t RetCode; |
1441 | mach_msg_type_t statusType; |
1442 | int status; |
1443 | mach_msg_type_t sigcodeType; |
1444 | int sigcode; |
1445 | mach_msg_type_t rusageType; |
1446 | rusage_t rusage; |
1447 | mach_msg_type_t pid_statusType; |
1448 | pid_t pid_status; |
1449 | } Reply; |
1450 | |
1451 | Request *In0P = (Request *) InHeadP; |
1452 | Reply *OutP = (Reply *) OutHeadP; |
1453 | mig_external kern_return_t S_proc_wait |
1454 | (pstruct_t process, mach_port_t reply_port, mach_msg_type_name_t reply_portPoly, pid_t pid, int options, int *status, int *sigcode, rusage_t *rusage, pid_t *pid_status); |
1455 | |
1456 | const mach_msg_type_t pidCheck = { |
1457 | /* msgt_name = */ 2, |
1458 | /* msgt_size = */ 32, |
1459 | /* msgt_number = */ 1, |
1460 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1461 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1462 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1463 | /* msgt_unused = */ 0 |
1464 | }; |
1465 | |
1466 | const mach_msg_type_t optionsCheck = { |
1467 | /* msgt_name = */ 2, |
1468 | /* msgt_size = */ 32, |
1469 | /* msgt_number = */ 1, |
1470 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1471 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1472 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1473 | /* msgt_unused = */ 0 |
1474 | }; |
1475 | |
1476 | const mach_msg_type_t statusType = { |
1477 | /* msgt_name = */ 2, |
1478 | /* msgt_size = */ 32, |
1479 | /* msgt_number = */ 1, |
1480 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1481 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1482 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1483 | /* msgt_unused = */ 0 |
1484 | }; |
1485 | |
1486 | const mach_msg_type_t sigcodeType = { |
1487 | /* msgt_name = */ 2, |
1488 | /* msgt_size = */ 32, |
1489 | /* msgt_number = */ 1, |
1490 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1491 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1492 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1493 | /* msgt_unused = */ 0 |
1494 | }; |
1495 | |
1496 | const mach_msg_type_t rusageType = { |
1497 | /* msgt_name = */ 2, |
1498 | /* msgt_size = */ 32, |
1499 | /* msgt_number = */ 18, |
1500 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1501 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1502 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1503 | /* msgt_unused = */ 0 |
1504 | }; |
1505 | |
1506 | const mach_msg_type_t pid_statusType = { |
1507 | /* msgt_name = */ 2, |
1508 | /* msgt_size = */ 32, |
1509 | /* msgt_number = */ 1, |
1510 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1511 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1512 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1513 | /* msgt_unused = */ 0 |
1514 | }; |
1515 | |
1516 | pstruct_t process; |
1517 | mach_port_t reply_port; |
1518 | |
1519 | #if TypeCheck1 |
1520 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1521 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1522 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1523 | #endif /* TypeCheck */ |
1524 | |
1525 | #if TypeCheck1 |
1526 | if (BAD_TYPECHECK(&In0P->pidType, &pidCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->pidType); _c.t = *(& pidCheck);_t.w != _c.w; })), 0)) |
1527 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1528 | #endif /* TypeCheck */ |
1529 | |
1530 | #if TypeCheck1 |
1531 | if (BAD_TYPECHECK(&In0P->optionsType, &optionsCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->optionsType); _c.t = *(& optionsCheck);_t.w != _c.w; })), 0)) |
1532 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1533 | #endif /* TypeCheck */ |
1534 | |
1535 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1536 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
1537 | else |
1538 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
1539 | |
1540 | reply_port = In0P->Head.msgh_reply_portmsgh_remote_port; |
1541 | |
1542 | OutP->RetCode = S_proc_wait(process, reply_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), In0P->pid, In0P->options, &OutP->status, &OutP->sigcode, &OutP->rusage, &OutP->pid_status); |
1543 | end_using_proc(process); |
1544 | if (OutP->RetCode != KERN_SUCCESS0) |
1545 | return; |
1546 | |
1547 | OutP->Head.msgh_size = 132; |
1548 | |
1549 | OutP->statusType = statusType; |
1550 | |
1551 | OutP->sigcodeType = sigcodeType; |
1552 | |
1553 | OutP->rusageType = rusageType; |
1554 | |
1555 | OutP->pid_statusType = pid_statusType; |
1556 | } |
1557 | |
1558 | /* Default implementation of S_proc_wait */ |
1559 | #ifdef MIG_EOPNOTSUPP |
1560 | kern_return_t __attribute__ ((weak)) |
1561 | S_proc_wait |
1562 | ( |
1563 | pstruct_t process, |
1564 | mach_port_t reply_port, |
1565 | mach_msg_type_name_t reply_portPoly, |
1566 | pid_t pid, |
1567 | int options, |
1568 | int *status, |
1569 | int *sigcode, |
1570 | rusage_t *rusage, |
1571 | pid_t *pid_status |
1572 | ) { return MIG_EOPNOTSUPP; } |
1573 | #endif /* MIG_EOPNOTSUPP */ |
1574 | |
1575 | /* Routine proc_dostop */ |
1576 | mig_internalstatic void _Xproc_dostop |
1577 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1578 | { |
1579 | typedef struct { |
1580 | mach_msg_header_t Head; |
1581 | mach_msg_type_t contthreadType; |
1582 | mach_port_t contthread; |
1583 | } Request; |
1584 | |
1585 | typedef struct { |
1586 | mach_msg_header_t Head; |
1587 | mach_msg_type_t RetCodeType; |
1588 | kern_return_t RetCode; |
1589 | } Reply; |
1590 | |
1591 | Request *In0P = (Request *) InHeadP; |
1592 | Reply *OutP = (Reply *) OutHeadP; |
1593 | mig_external kern_return_t S_proc_dostop |
1594 | (pstruct_t process, mach_port_t contthread); |
1595 | |
1596 | const mach_msg_type_t contthreadCheck = { |
1597 | /* msgt_name = */ 17, |
1598 | /* msgt_size = */ 32, |
1599 | /* msgt_number = */ 1, |
1600 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1601 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1602 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1603 | /* msgt_unused = */ 0 |
1604 | }; |
1605 | |
1606 | pstruct_t process; |
1607 | |
1608 | #if TypeCheck1 |
1609 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1610 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1611 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1612 | #endif /* TypeCheck */ |
1613 | |
1614 | #if TypeCheck1 |
1615 | if (BAD_TYPECHECK(&In0P->contthreadType, &contthreadCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->contthreadType); _c.t = * (&contthreadCheck);_t.w != _c.w; })), 0)) |
1616 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1617 | #endif /* TypeCheck */ |
1618 | |
1619 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1620 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
1621 | else |
1622 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
1623 | |
1624 | OutP->RetCode = S_proc_dostop(process, In0P->contthread); |
1625 | end_using_proc(process); |
1626 | } |
1627 | |
1628 | /* Default implementation of S_proc_dostop */ |
1629 | #ifdef MIG_EOPNOTSUPP |
1630 | kern_return_t __attribute__ ((weak)) |
1631 | S_proc_dostop |
1632 | ( |
1633 | pstruct_t process, |
1634 | mach_port_t contthread |
1635 | ) { return MIG_EOPNOTSUPP; } |
1636 | #endif /* MIG_EOPNOTSUPP */ |
1637 | |
1638 | /* Routine proc_handle_exceptions */ |
1639 | mig_internalstatic void _Xproc_handle_exceptions |
1640 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1641 | { |
1642 | typedef struct { |
1643 | mach_msg_header_t Head; |
1644 | mach_msg_type_t msgportType; |
1645 | mach_port_t msgport; |
1646 | mach_msg_type_t forwardportType; |
1647 | mach_port_t forwardport; |
1648 | mach_msg_type_t flavorType; |
1649 | int flavor; |
1650 | mach_msg_type_t new_stateType; |
1651 | natural_t new_state[1024]; |
1652 | } Request; |
1653 | |
1654 | typedef struct { |
1655 | mach_msg_header_t Head; |
1656 | mach_msg_type_t RetCodeType; |
1657 | kern_return_t RetCode; |
1658 | } Reply; |
1659 | |
1660 | Request *In0P = (Request *) InHeadP; |
1661 | Reply *OutP = (Reply *) OutHeadP; |
1662 | mig_external kern_return_t S_proc_handle_exceptions |
1663 | (pstruct_t process, mach_port_t msgport, mach_port_t forwardport, int flavor, thread_state_t new_state, mach_msg_type_number_t new_stateCnt); |
1664 | |
1665 | unsigned int msgh_size; |
1666 | |
1667 | const mach_msg_type_t msgportCheck = { |
1668 | /* msgt_name = */ 16, |
1669 | /* msgt_size = */ 32, |
1670 | /* msgt_number = */ 1, |
1671 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1672 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1673 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1674 | /* msgt_unused = */ 0 |
1675 | }; |
1676 | |
1677 | const mach_msg_type_t forwardportCheck = { |
1678 | /* msgt_name = */ 17, |
1679 | /* msgt_size = */ 32, |
1680 | /* msgt_number = */ 1, |
1681 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1682 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1683 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1684 | /* msgt_unused = */ 0 |
1685 | }; |
1686 | |
1687 | const mach_msg_type_t flavorCheck = { |
1688 | /* msgt_name = */ 2, |
1689 | /* msgt_size = */ 32, |
1690 | /* msgt_number = */ 1, |
1691 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1692 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1693 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1694 | /* msgt_unused = */ 0 |
1695 | }; |
1696 | |
1697 | pstruct_t process; |
1698 | |
1699 | #if TypeCheck1 |
1700 | msgh_size = In0P->Head.msgh_size; |
1701 | if (mig_unlikely ((msgh_size < 52) ||__builtin_expect (!! ((msgh_size < 52) || !(In0P->Head. msgh_bits & 0x80000000U)), 0) |
1702 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((msgh_size < 52) || !(In0P->Head. msgh_bits & 0x80000000U)), 0)) |
1703 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1704 | #endif /* TypeCheck */ |
1705 | |
1706 | #if TypeCheck1 |
1707 | if (BAD_TYPECHECK(&In0P->msgportType, &msgportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->msgportType); _c.t = *(& msgportCheck);_t.w != _c.w; })), 0)) |
1708 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1709 | #endif /* TypeCheck */ |
1710 | |
1711 | #if TypeCheck1 |
1712 | if (BAD_TYPECHECK(&In0P->forwardportType, &forwardportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->forwardportType); _c.t = *(&forwardportCheck);_t.w != _c.w; })), 0)) |
1713 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1714 | #endif /* TypeCheck */ |
1715 | |
1716 | #if TypeCheck1 |
1717 | if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->flavorType); _c.t = *(& flavorCheck);_t.w != _c.w; })), 0)) |
1718 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1719 | #endif /* TypeCheck */ |
1720 | |
1721 | #if TypeCheck1 |
1722 | if (mig_unlikely ((In0P->new_stateType.msgt_inline != TRUE) ||__builtin_expect (!! ((In0P->new_stateType.msgt_inline != ( (boolean_t) 1)) || (In0P->new_stateType.msgt_longform != ( (boolean_t) 0)) || (In0P->new_stateType.msgt_name != 2) || (In0P->new_stateType.msgt_size != 32)), 0) |
1723 | (In0P->new_stateType.msgt_longform != FALSE) ||__builtin_expect (!! ((In0P->new_stateType.msgt_inline != ( (boolean_t) 1)) || (In0P->new_stateType.msgt_longform != ( (boolean_t) 0)) || (In0P->new_stateType.msgt_name != 2) || (In0P->new_stateType.msgt_size != 32)), 0) |
1724 | (In0P->new_stateType.msgt_name != 2) ||__builtin_expect (!! ((In0P->new_stateType.msgt_inline != ( (boolean_t) 1)) || (In0P->new_stateType.msgt_longform != ( (boolean_t) 0)) || (In0P->new_stateType.msgt_name != 2) || (In0P->new_stateType.msgt_size != 32)), 0) |
1725 | (In0P->new_stateType.msgt_size != 32))__builtin_expect (!! ((In0P->new_stateType.msgt_inline != ( (boolean_t) 1)) || (In0P->new_stateType.msgt_longform != ( (boolean_t) 0)) || (In0P->new_stateType.msgt_name != 2) || (In0P->new_stateType.msgt_size != 32)), 0)) |
1726 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1727 | #endif /* TypeCheck */ |
1728 | |
1729 | #if TypeCheck1 |
1730 | if (mig_unlikely (msgh_size != 52 + (4 * In0P->new_stateType.msgt_number))__builtin_expect (!! (msgh_size != 52 + (4 * In0P->new_stateType .msgt_number)), 0)) |
1731 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1732 | #endif /* TypeCheck */ |
1733 | |
1734 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1735 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
1736 | else |
1737 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
1738 | |
1739 | OutP->RetCode = S_proc_handle_exceptions(process, In0P->msgport, In0P->forwardport, In0P->flavor, In0P->new_state, In0P->new_stateType.msgt_number); |
1740 | end_using_proc(process); |
1741 | } |
1742 | |
1743 | /* Default implementation of S_proc_handle_exceptions */ |
1744 | #ifdef MIG_EOPNOTSUPP |
1745 | kern_return_t __attribute__ ((weak)) |
1746 | S_proc_handle_exceptions |
1747 | ( |
1748 | pstruct_t process, |
1749 | mach_port_t msgport, |
1750 | mach_port_t forwardport, |
1751 | int flavor, |
1752 | thread_state_t new_state, |
1753 | mach_msg_type_number_t new_stateCnt |
1754 | ) { return MIG_EOPNOTSUPP; } |
1755 | #endif /* MIG_EOPNOTSUPP */ |
1756 | |
1757 | /* Routine proc_mark_stop */ |
1758 | mig_internalstatic void _Xproc_mark_stop |
1759 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1760 | { |
1761 | typedef struct { |
1762 | mach_msg_header_t Head; |
1763 | mach_msg_type_t signoType; |
1764 | int signo; |
1765 | mach_msg_type_t sigcodeType; |
1766 | int sigcode; |
1767 | } Request; |
1768 | |
1769 | typedef struct { |
1770 | mach_msg_header_t Head; |
1771 | mach_msg_type_t RetCodeType; |
1772 | kern_return_t RetCode; |
1773 | } Reply; |
1774 | |
1775 | Request *In0P = (Request *) InHeadP; |
1776 | Reply *OutP = (Reply *) OutHeadP; |
1777 | mig_external kern_return_t S_proc_mark_stop |
1778 | (pstruct_t process, int signo, int sigcode); |
1779 | |
1780 | const mach_msg_type_t signoCheck = { |
1781 | /* msgt_name = */ 2, |
1782 | /* msgt_size = */ 32, |
1783 | /* msgt_number = */ 1, |
1784 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1785 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1786 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1787 | /* msgt_unused = */ 0 |
1788 | }; |
1789 | |
1790 | const mach_msg_type_t sigcodeCheck = { |
1791 | /* msgt_name = */ 2, |
1792 | /* msgt_size = */ 32, |
1793 | /* msgt_number = */ 1, |
1794 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1795 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1796 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1797 | /* msgt_unused = */ 0 |
1798 | }; |
1799 | |
1800 | pstruct_t process; |
1801 | |
1802 | #if TypeCheck1 |
1803 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1804 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1805 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1806 | #endif /* TypeCheck */ |
1807 | |
1808 | #if TypeCheck1 |
1809 | if (BAD_TYPECHECK(&In0P->signoType, &signoCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->signoType); _c.t = *(& signoCheck);_t.w != _c.w; })), 0)) |
1810 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1811 | #endif /* TypeCheck */ |
1812 | |
1813 | #if TypeCheck1 |
1814 | if (BAD_TYPECHECK(&In0P->sigcodeType, &sigcodeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->sigcodeType); _c.t = *(& sigcodeCheck);_t.w != _c.w; })), 0)) |
1815 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1816 | #endif /* TypeCheck */ |
1817 | |
1818 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1819 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
1820 | else |
1821 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
1822 | |
1823 | OutP->RetCode = S_proc_mark_stop(process, In0P->signo, In0P->sigcode); |
1824 | end_using_proc(process); |
1825 | } |
1826 | |
1827 | /* Default implementation of S_proc_mark_stop */ |
1828 | #ifdef MIG_EOPNOTSUPP |
1829 | kern_return_t __attribute__ ((weak)) |
1830 | S_proc_mark_stop |
1831 | ( |
1832 | pstruct_t process, |
1833 | int signo, |
1834 | int sigcode |
1835 | ) { return MIG_EOPNOTSUPP; } |
1836 | #endif /* MIG_EOPNOTSUPP */ |
1837 | |
1838 | /* Routine proc_mark_cont */ |
1839 | mig_internalstatic void _Xproc_mark_cont |
1840 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1841 | { |
1842 | typedef struct { |
1843 | mach_msg_header_t Head; |
1844 | } Request; |
1845 | |
1846 | typedef struct { |
1847 | mach_msg_header_t Head; |
1848 | mach_msg_type_t RetCodeType; |
1849 | kern_return_t RetCode; |
1850 | } Reply; |
1851 | |
1852 | Request *In0P = (Request *) InHeadP; |
1853 | Reply *OutP = (Reply *) OutHeadP; |
1854 | mig_external kern_return_t S_proc_mark_cont |
1855 | (pstruct_t process); |
1856 | |
1857 | pstruct_t process; |
1858 | |
1859 | #if TypeCheck1 |
1860 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1861 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1862 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1863 | #endif /* TypeCheck */ |
1864 | |
1865 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1866 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
1867 | else |
1868 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
1869 | |
1870 | OutP->RetCode = S_proc_mark_cont(process); |
1871 | end_using_proc(process); |
1872 | } |
1873 | |
1874 | /* Default implementation of S_proc_mark_cont */ |
1875 | #ifdef MIG_EOPNOTSUPP |
1876 | kern_return_t __attribute__ ((weak)) |
1877 | S_proc_mark_cont |
1878 | ( |
1879 | pstruct_t process |
1880 | ) { return MIG_EOPNOTSUPP; } |
1881 | #endif /* MIG_EOPNOTSUPP */ |
1882 | |
1883 | /* Routine proc_mark_exit */ |
1884 | mig_internalstatic void _Xproc_mark_exit |
1885 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1886 | { |
1887 | typedef struct { |
1888 | mach_msg_header_t Head; |
1889 | mach_msg_type_t statusType; |
1890 | int status; |
1891 | mach_msg_type_t sigcodeType; |
1892 | int sigcode; |
1893 | } Request; |
1894 | |
1895 | typedef struct { |
1896 | mach_msg_header_t Head; |
1897 | mach_msg_type_t RetCodeType; |
1898 | kern_return_t RetCode; |
1899 | } Reply; |
1900 | |
1901 | Request *In0P = (Request *) InHeadP; |
1902 | Reply *OutP = (Reply *) OutHeadP; |
1903 | mig_external kern_return_t S_proc_mark_exit |
1904 | (pstruct_t process, int status, int sigcode); |
1905 | |
1906 | const mach_msg_type_t statusCheck = { |
1907 | /* msgt_name = */ 2, |
1908 | /* msgt_size = */ 32, |
1909 | /* msgt_number = */ 1, |
1910 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1911 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1912 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1913 | /* msgt_unused = */ 0 |
1914 | }; |
1915 | |
1916 | const mach_msg_type_t sigcodeCheck = { |
1917 | /* msgt_name = */ 2, |
1918 | /* msgt_size = */ 32, |
1919 | /* msgt_number = */ 1, |
1920 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1921 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1922 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1923 | /* msgt_unused = */ 0 |
1924 | }; |
1925 | |
1926 | pstruct_t process; |
1927 | |
1928 | #if TypeCheck1 |
1929 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1930 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1931 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1932 | #endif /* TypeCheck */ |
1933 | |
1934 | #if TypeCheck1 |
1935 | if (BAD_TYPECHECK(&In0P->statusType, &statusCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->statusType); _c.t = *(& statusCheck);_t.w != _c.w; })), 0)) |
1936 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1937 | #endif /* TypeCheck */ |
1938 | |
1939 | #if TypeCheck1 |
1940 | if (BAD_TYPECHECK(&In0P->sigcodeType, &sigcodeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->sigcodeType); _c.t = *(& sigcodeCheck);_t.w != _c.w; })), 0)) |
1941 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1942 | #endif /* TypeCheck */ |
1943 | |
1944 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1945 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
1946 | else |
1947 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
1948 | |
1949 | OutP->RetCode = S_proc_mark_exit(process, In0P->status, In0P->sigcode); |
1950 | end_using_proc(process); |
1951 | } |
1952 | |
1953 | /* Default implementation of S_proc_mark_exit */ |
1954 | #ifdef MIG_EOPNOTSUPP |
1955 | kern_return_t __attribute__ ((weak)) |
1956 | S_proc_mark_exit |
1957 | ( |
1958 | pstruct_t process, |
1959 | int status, |
1960 | int sigcode |
1961 | ) { return MIG_EOPNOTSUPP; } |
1962 | #endif /* MIG_EOPNOTSUPP */ |
1963 | |
1964 | /* Routine proc_mark_exec */ |
1965 | mig_internalstatic void _Xproc_mark_exec |
1966 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1967 | { |
1968 | typedef struct { |
1969 | mach_msg_header_t Head; |
1970 | } Request; |
1971 | |
1972 | typedef struct { |
1973 | mach_msg_header_t Head; |
1974 | mach_msg_type_t RetCodeType; |
1975 | kern_return_t RetCode; |
1976 | } Reply; |
1977 | |
1978 | Request *In0P = (Request *) InHeadP; |
1979 | Reply *OutP = (Reply *) OutHeadP; |
1980 | mig_external kern_return_t S_proc_mark_exec |
1981 | (pstruct_t process); |
1982 | |
1983 | pstruct_t process; |
1984 | |
1985 | #if TypeCheck1 |
1986 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1987 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1988 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1989 | #endif /* TypeCheck */ |
1990 | |
1991 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1992 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
1993 | else |
1994 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
1995 | |
1996 | OutP->RetCode = S_proc_mark_exec(process); |
1997 | end_using_proc(process); |
1998 | } |
1999 | |
2000 | /* Default implementation of S_proc_mark_exec */ |
2001 | #ifdef MIG_EOPNOTSUPP |
2002 | kern_return_t __attribute__ ((weak)) |
2003 | S_proc_mark_exec |
2004 | ( |
2005 | pstruct_t process |
2006 | ) { return MIG_EOPNOTSUPP; } |
2007 | #endif /* MIG_EOPNOTSUPP */ |
2008 | |
2009 | /* Routine proc_mark_traced */ |
2010 | mig_internalstatic void _Xproc_mark_traced |
2011 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
2012 | { |
2013 | typedef struct { |
2014 | mach_msg_header_t Head; |
2015 | } Request; |
2016 | |
2017 | typedef struct { |
2018 | mach_msg_header_t Head; |
2019 | mach_msg_type_t RetCodeType; |
2020 | kern_return_t RetCode; |
2021 | } Reply; |
2022 | |
2023 | Request *In0P = (Request *) InHeadP; |
2024 | Reply *OutP = (Reply *) OutHeadP; |
2025 | mig_external kern_return_t S_proc_mark_traced |
2026 | (pstruct_t process); |
2027 | |
2028 | pstruct_t process; |
2029 | |
2030 | #if TypeCheck1 |
2031 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
2032 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
2033 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2034 | #endif /* TypeCheck */ |
2035 | |
2036 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
2037 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
2038 | else |
2039 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
2040 | |
2041 | OutP->RetCode = S_proc_mark_traced(process); |
2042 | end_using_proc(process); |
2043 | } |
2044 | |
2045 | /* Default implementation of S_proc_mark_traced */ |
2046 | #ifdef MIG_EOPNOTSUPP |
2047 | kern_return_t __attribute__ ((weak)) |
2048 | S_proc_mark_traced |
2049 | ( |
2050 | pstruct_t process |
2051 | ) { return MIG_EOPNOTSUPP; } |
2052 | #endif /* MIG_EOPNOTSUPP */ |
2053 | |
2054 | /* Routine proc_mod_stopchild */ |
2055 | mig_internalstatic void _Xproc_mod_stopchild |
2056 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
2057 | { |
2058 | typedef struct { |
2059 | mach_msg_header_t Head; |
2060 | mach_msg_type_t doitType; |
2061 | int doit; |
2062 | } Request; |
2063 | |
2064 | typedef struct { |
2065 | mach_msg_header_t Head; |
2066 | mach_msg_type_t RetCodeType; |
2067 | kern_return_t RetCode; |
2068 | } Reply; |
2069 | |
2070 | Request *In0P = (Request *) InHeadP; |
2071 | Reply *OutP = (Reply *) OutHeadP; |
2072 | mig_external kern_return_t S_proc_mod_stopchild |
2073 | (pstruct_t process, int doit); |
2074 | |
2075 | const mach_msg_type_t doitCheck = { |
2076 | /* msgt_name = */ 2, |
2077 | /* msgt_size = */ 32, |
2078 | /* msgt_number = */ 1, |
2079 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2080 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2081 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2082 | /* msgt_unused = */ 0 |
2083 | }; |
2084 | |
2085 | pstruct_t process; |
2086 | |
2087 | #if TypeCheck1 |
2088 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
2089 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
2090 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2091 | #endif /* TypeCheck */ |
2092 | |
2093 | #if TypeCheck1 |
2094 | if (BAD_TYPECHECK(&In0P->doitType, &doitCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->doitType); _c.t = *(& doitCheck);_t.w != _c.w; })), 0)) |
2095 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2096 | #endif /* TypeCheck */ |
2097 | |
2098 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
2099 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
2100 | else |
2101 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
2102 | |
2103 | OutP->RetCode = S_proc_mod_stopchild(process, In0P->doit); |
2104 | end_using_proc(process); |
2105 | } |
2106 | |
2107 | /* Default implementation of S_proc_mod_stopchild */ |
2108 | #ifdef MIG_EOPNOTSUPP |
2109 | kern_return_t __attribute__ ((weak)) |
2110 | S_proc_mod_stopchild |
2111 | ( |
2112 | pstruct_t process, |
2113 | int doit |
2114 | ) { return MIG_EOPNOTSUPP; } |
2115 | #endif /* MIG_EOPNOTSUPP */ |
2116 | |
2117 | /* Routine proc_pid2task */ |
2118 | mig_internalstatic void _Xproc_pid2task |
2119 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
2120 | { |
2121 | typedef struct { |
2122 | mach_msg_header_t Head; |
2123 | mach_msg_type_t pidType; |
2124 | pid_t pid; |
2125 | } Request; |
2126 | |
2127 | typedef struct { |
2128 | mach_msg_header_t Head; |
2129 | mach_msg_type_t RetCodeType; |
2130 | kern_return_t RetCode; |
2131 | mach_msg_type_t taskType; |
2132 | mach_port_t task; |
2133 | } Reply; |
2134 | |
2135 | Request *In0P = (Request *) InHeadP; |
2136 | Reply *OutP = (Reply *) OutHeadP; |
2137 | mig_external kern_return_t S_proc_pid2task |
2138 | (pstruct_t process, pid_t pid, mach_port_t *task); |
2139 | |
2140 | const mach_msg_type_t pidCheck = { |
2141 | /* msgt_name = */ 2, |
2142 | /* msgt_size = */ 32, |
2143 | /* msgt_number = */ 1, |
2144 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2145 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2146 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2147 | /* msgt_unused = */ 0 |
2148 | }; |
2149 | |
2150 | const mach_msg_type_t taskType = { |
2151 | /* msgt_name = */ 19, |
2152 | /* msgt_size = */ 32, |
2153 | /* msgt_number = */ 1, |
2154 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2155 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2156 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2157 | /* msgt_unused = */ 0 |
2158 | }; |
2159 | |
2160 | pstruct_t process; |
2161 | |
2162 | #if TypeCheck1 |
2163 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
2164 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
2165 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2166 | #endif /* TypeCheck */ |
2167 | |
2168 | #if TypeCheck1 |
2169 | if (BAD_TYPECHECK(&In0P->pidType, &pidCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->pidType); _c.t = *(& pidCheck);_t.w != _c.w; })), 0)) |
2170 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2171 | #endif /* TypeCheck */ |
2172 | |
2173 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
2174 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
2175 | else |
2176 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
2177 | |
2178 | OutP->RetCode = S_proc_pid2task(process, In0P->pid, &OutP->task); |
2179 | end_using_proc(process); |
2180 | if (OutP->RetCode != KERN_SUCCESS0) |
2181 | return; |
2182 | |
2183 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
2184 | OutP->Head.msgh_size = 40; |
2185 | |
2186 | OutP->taskType = taskType; |
2187 | } |
2188 | |
2189 | /* Default implementation of S_proc_pid2task */ |
2190 | #ifdef MIG_EOPNOTSUPP |
2191 | kern_return_t __attribute__ ((weak)) |
2192 | S_proc_pid2task |
2193 | ( |
2194 | pstruct_t process, |
2195 | pid_t pid, |
2196 | mach_port_t *task |
2197 | ) { return MIG_EOPNOTSUPP; } |
2198 | #endif /* MIG_EOPNOTSUPP */ |
2199 | |
2200 | /* Routine proc_task2pid */ |
2201 | mig_internalstatic void _Xproc_task2pid |
2202 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
2203 | { |
2204 | typedef struct { |
2205 | mach_msg_header_t Head; |
2206 | mach_msg_type_t taskType; |
2207 | mach_port_t task; |
2208 | } Request; |
2209 | |
2210 | typedef struct { |
2211 | mach_msg_header_t Head; |
2212 | mach_msg_type_t RetCodeType; |
2213 | kern_return_t RetCode; |
2214 | mach_msg_type_t pidType; |
2215 | pid_t pid; |
2216 | } Reply; |
2217 | |
2218 | Request *In0P = (Request *) InHeadP; |
2219 | Reply *OutP = (Reply *) OutHeadP; |
2220 | mig_external kern_return_t S_proc_task2pid |
2221 | (pstruct_t process, mach_port_t task, pid_t *pid); |
2222 | |
2223 | const mach_msg_type_t taskCheck = { |
2224 | /* msgt_name = */ 17, |
2225 | /* msgt_size = */ 32, |
2226 | /* msgt_number = */ 1, |
2227 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2228 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2229 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2230 | /* msgt_unused = */ 0 |
2231 | }; |
2232 | |
2233 | const mach_msg_type_t pidType = { |
2234 | /* msgt_name = */ 2, |
2235 | /* msgt_size = */ 32, |
2236 | /* msgt_number = */ 1, |
2237 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2238 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2239 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2240 | /* msgt_unused = */ 0 |
2241 | }; |
2242 | |
2243 | pstruct_t process; |
2244 | |
2245 | #if TypeCheck1 |
2246 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
2247 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
2248 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2249 | #endif /* TypeCheck */ |
2250 | |
2251 | #if TypeCheck1 |
2252 | if (BAD_TYPECHECK(&In0P->taskType, &taskCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->taskType); _c.t = *(& taskCheck);_t.w != _c.w; })), 0)) |
2253 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2254 | #endif /* TypeCheck */ |
2255 | |
2256 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
2257 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
2258 | else |
2259 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
2260 | |
2261 | OutP->RetCode = S_proc_task2pid(process, In0P->task, &OutP->pid); |
2262 | end_using_proc(process); |
2263 | if (OutP->RetCode != KERN_SUCCESS0) |
2264 | return; |
2265 | |
2266 | OutP->Head.msgh_size = 40; |
2267 | |
2268 | OutP->pidType = pidType; |
2269 | } |
2270 | |
2271 | /* Default implementation of S_proc_task2pid */ |
2272 | #ifdef MIG_EOPNOTSUPP |
2273 | kern_return_t __attribute__ ((weak)) |
2274 | S_proc_task2pid |
2275 | ( |
2276 | pstruct_t process, |
2277 | mach_port_t task, |
2278 | pid_t *pid |
2279 | ) { return MIG_EOPNOTSUPP; } |
2280 | #endif /* MIG_EOPNOTSUPP */ |
2281 | |
2282 | /* Routine proc_task2proc */ |
2283 | mig_internalstatic void _Xproc_task2proc |
2284 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
2285 | { |
2286 | typedef struct { |
2287 | mach_msg_header_t Head; |
2288 | mach_msg_type_t taskType; |
2289 | mach_port_t task; |
2290 | } Request; |
2291 | |
2292 | typedef struct { |
2293 | mach_msg_header_t Head; |
2294 | mach_msg_type_t RetCodeType; |
2295 | kern_return_t RetCode; |
2296 | mach_msg_type_t procType; |
2297 | mach_port_t proc; |
2298 | } Reply; |
2299 | |
2300 | Request *In0P = (Request *) InHeadP; |
2301 | Reply *OutP = (Reply *) OutHeadP; |
2302 | mig_external kern_return_t S_proc_task2proc |
2303 | (pstruct_t process, mach_port_t task, mach_port_t *proc); |
2304 | |
2305 | const mach_msg_type_t taskCheck = { |
2306 | /* msgt_name = */ 17, |
2307 | /* msgt_size = */ 32, |
2308 | /* msgt_number = */ 1, |
2309 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2310 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2311 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2312 | /* msgt_unused = */ 0 |
2313 | }; |
2314 | |
2315 | const mach_msg_type_t procType = { |
2316 | /* msgt_name = */ 20, |
2317 | /* msgt_size = */ 32, |
2318 | /* msgt_number = */ 1, |
2319 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2320 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2321 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2322 | /* msgt_unused = */ 0 |
2323 | }; |
2324 | |
2325 | pstruct_t process; |
2326 | |
2327 | #if TypeCheck1 |
2328 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
2329 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
2330 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2331 | #endif /* TypeCheck */ |
2332 | |
2333 | #if TypeCheck1 |
2334 | if (BAD_TYPECHECK(&In0P->taskType, &taskCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->taskType); _c.t = *(& taskCheck);_t.w != _c.w; })), 0)) |
2335 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2336 | #endif /* TypeCheck */ |
2337 | |
2338 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
2339 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
2340 | else |
2341 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
2342 | |
2343 | OutP->RetCode = S_proc_task2proc(process, In0P->task, &OutP->proc); |
2344 | end_using_proc(process); |
2345 | if (OutP->RetCode != KERN_SUCCESS0) |
2346 | return; |
2347 | |
2348 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
2349 | OutP->Head.msgh_size = 40; |
2350 | |
2351 | OutP->procType = procType; |
2352 | } |
2353 | |
2354 | /* Default implementation of S_proc_task2proc */ |
2355 | #ifdef MIG_EOPNOTSUPP |
2356 | kern_return_t __attribute__ ((weak)) |
2357 | S_proc_task2proc |
2358 | ( |
2359 | pstruct_t process, |
2360 | mach_port_t task, |
2361 | mach_port_t *proc |
2362 | ) { return MIG_EOPNOTSUPP; } |
2363 | #endif /* MIG_EOPNOTSUPP */ |
2364 | |
2365 | /* Routine proc_proc2task */ |
2366 | mig_internalstatic void _Xproc_proc2task |
2367 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
2368 | { |
2369 | typedef struct { |
2370 | mach_msg_header_t Head; |
2371 | } Request; |
2372 | |
2373 | typedef struct { |
2374 | mach_msg_header_t Head; |
2375 | mach_msg_type_t RetCodeType; |
2376 | kern_return_t RetCode; |
2377 | mach_msg_type_t taskType; |
2378 | mach_port_t task; |
2379 | } Reply; |
2380 | |
2381 | Request *In0P = (Request *) InHeadP; |
2382 | Reply *OutP = (Reply *) OutHeadP; |
2383 | mig_external kern_return_t S_proc_proc2task |
2384 | (pstruct_t process, mach_port_t *task); |
2385 | |
2386 | const mach_msg_type_t taskType = { |
2387 | /* msgt_name = */ 19, |
2388 | /* msgt_size = */ 32, |
2389 | /* msgt_number = */ 1, |
2390 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2391 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2392 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2393 | /* msgt_unused = */ 0 |
2394 | }; |
2395 | |
2396 | pstruct_t process; |
2397 | |
2398 | #if TypeCheck1 |
2399 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
2400 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
2401 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2402 | #endif /* TypeCheck */ |
2403 | |
2404 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
2405 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
2406 | else |
2407 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
2408 | |
2409 | OutP->RetCode = S_proc_proc2task(process, &OutP->task); |
2410 | end_using_proc(process); |
2411 | if (OutP->RetCode != KERN_SUCCESS0) |
2412 | return; |
2413 | |
2414 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
2415 | OutP->Head.msgh_size = 40; |
2416 | |
2417 | OutP->taskType = taskType; |
2418 | } |
2419 | |
2420 | /* Default implementation of S_proc_proc2task */ |
2421 | #ifdef MIG_EOPNOTSUPP |
2422 | kern_return_t __attribute__ ((weak)) |
2423 | S_proc_proc2task |
2424 | ( |
2425 | pstruct_t process, |
2426 | mach_port_t *task |
2427 | ) { return MIG_EOPNOTSUPP; } |
2428 | #endif /* MIG_EOPNOTSUPP */ |
2429 | |
2430 | /* Routine proc_pid2proc */ |
2431 | mig_internalstatic void _Xproc_pid2proc |
2432 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
2433 | { |
2434 | typedef struct { |
2435 | mach_msg_header_t Head; |
2436 | mach_msg_type_t pidType; |
2437 | pid_t pid; |
2438 | } Request; |
2439 | |
2440 | typedef struct { |
2441 | mach_msg_header_t Head; |
2442 | mach_msg_type_t RetCodeType; |
2443 | kern_return_t RetCode; |
2444 | mach_msg_type_t procType; |
2445 | mach_port_t proc; |
2446 | } Reply; |
2447 | |
2448 | Request *In0P = (Request *) InHeadP; |
2449 | Reply *OutP = (Reply *) OutHeadP; |
2450 | mig_external kern_return_t S_proc_pid2proc |
2451 | (pstruct_t process, pid_t pid, mach_port_t *proc); |
2452 | |
2453 | const mach_msg_type_t pidCheck = { |
2454 | /* msgt_name = */ 2, |
2455 | /* msgt_size = */ 32, |
2456 | /* msgt_number = */ 1, |
2457 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2458 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2459 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2460 | /* msgt_unused = */ 0 |
2461 | }; |
2462 | |
2463 | const mach_msg_type_t procType = { |
2464 | /* msgt_name = */ 20, |
2465 | /* msgt_size = */ 32, |
2466 | /* msgt_number = */ 1, |
2467 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2468 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2469 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2470 | /* msgt_unused = */ 0 |
2471 | }; |
2472 | |
2473 | pstruct_t process; |
2474 | |
2475 | #if TypeCheck1 |
2476 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
2477 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
2478 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2479 | #endif /* TypeCheck */ |
2480 | |
2481 | #if TypeCheck1 |
2482 | if (BAD_TYPECHECK(&In0P->pidType, &pidCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->pidType); _c.t = *(& pidCheck);_t.w != _c.w; })), 0)) |
2483 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2484 | #endif /* TypeCheck */ |
2485 | |
2486 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
2487 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
2488 | else |
2489 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
2490 | |
2491 | OutP->RetCode = S_proc_pid2proc(process, In0P->pid, &OutP->proc); |
2492 | end_using_proc(process); |
2493 | if (OutP->RetCode != KERN_SUCCESS0) |
2494 | return; |
2495 | |
2496 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
2497 | OutP->Head.msgh_size = 40; |
2498 | |
2499 | OutP->procType = procType; |
2500 | } |
2501 | |
2502 | /* Default implementation of S_proc_pid2proc */ |
2503 | #ifdef MIG_EOPNOTSUPP |
2504 | kern_return_t __attribute__ ((weak)) |
2505 | S_proc_pid2proc |
2506 | ( |
2507 | pstruct_t process, |
2508 | pid_t pid, |
2509 | mach_port_t *proc |
2510 | ) { return MIG_EOPNOTSUPP; } |
2511 | #endif /* MIG_EOPNOTSUPP */ |
2512 | |
2513 | /* Routine proc_getprocinfo */ |
2514 | mig_internalstatic void _Xproc_getprocinfo |
2515 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
2516 | { |
2517 | typedef struct { |
2518 | mach_msg_header_t Head; |
2519 | mach_msg_type_t whichType; |
2520 | pid_t which; |
2521 | mach_msg_type_t flagsType; |
2522 | int flags; |
2523 | } Request; |
2524 | |
2525 | typedef struct { |
2526 | mach_msg_header_t Head; |
2527 | mach_msg_type_t RetCodeType; |
2528 | kern_return_t RetCode; |
2529 | mach_msg_type_t flagsType; |
2530 | int flags; |
2531 | mach_msg_type_long_t procinfoType; |
2532 | int procinfo[512]; |
2533 | mach_msg_type_long_t threadwaitsType; |
2534 | char threadwaits[2048]; |
2535 | } Reply; |
2536 | |
2537 | Request *In0P = (Request *) InHeadP; |
2538 | Reply *OutP = (Reply *) OutHeadP; |
2539 | mig_external kern_return_t S_proc_getprocinfo |
2540 | (pstruct_t process, pid_t which, int *flags, procinfo_t *procinfo, mach_msg_type_number_t *procinfoCnt, data_t *threadwaits, mach_msg_type_number_t *threadwaitsCnt); |
2541 | |
2542 | boolean_t msgh_simple = msgh_simple; |
2543 | unsigned int msgh_size; |
2544 | unsigned int msgh_size_delta; |
2545 | |
2546 | const mach_msg_type_t whichCheck = { |
2547 | /* msgt_name = */ 2, |
2548 | /* msgt_size = */ 32, |
2549 | /* msgt_number = */ 1, |
2550 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2551 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2552 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2553 | /* msgt_unused = */ 0 |
2554 | }; |
2555 | |
2556 | const mach_msg_type_t flagsCheck = { |
2557 | /* msgt_name = */ 2, |
2558 | /* msgt_size = */ 32, |
2559 | /* msgt_number = */ 1, |
2560 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2561 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2562 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2563 | /* msgt_unused = */ 0 |
2564 | }; |
2565 | |
2566 | const mach_msg_type_t flagsType = { |
2567 | /* msgt_name = */ 2, |
2568 | /* msgt_size = */ 32, |
2569 | /* msgt_number = */ 1, |
2570 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2571 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2572 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2573 | /* msgt_unused = */ 0 |
2574 | }; |
2575 | |
2576 | const mach_msg_type_long_t procinfoType = { |
2577 | { |
2578 | /* msgt_name = */ 0, |
2579 | /* msgt_size = */ 0, |
2580 | /* msgt_number = */ 0, |
2581 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2582 | /* msgt_longform = */ TRUE((boolean_t) 1), |
2583 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2584 | /* msgt_unused = */ 0 |
2585 | }, |
2586 | /* msgtl_name = */ 2, |
2587 | /* msgtl_size = */ 32, |
2588 | /* msgtl_number = */ 512, |
2589 | }; |
2590 | |
2591 | const mach_msg_type_long_t threadwaitsType = { |
2592 | { |
2593 | /* msgt_name = */ 0, |
2594 | /* msgt_size = */ 0, |
2595 | /* msgt_number = */ 0, |
2596 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2597 | /* msgt_longform = */ TRUE((boolean_t) 1), |
2598 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2599 | /* msgt_unused = */ 0 |
2600 | }, |
2601 | /* msgtl_name = */ 8, |
2602 | /* msgtl_size = */ 8, |
2603 | /* msgtl_number = */ 2048, |
2604 | }; |
2605 | |
2606 | pstruct_t process; |
2607 | mach_msg_type_number_t procinfoCnt; |
2608 | char threadwaits[2048]; |
2609 | mach_msg_type_number_t threadwaitsCnt; |
2610 | |
2611 | int *procinfoP; |
2612 | char *threadwaitsP; |
2613 | |
2614 | #if TypeCheck1 |
2615 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
2616 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
2617 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2618 | #endif /* TypeCheck */ |
2619 | |
2620 | #if TypeCheck1 |
2621 | if (BAD_TYPECHECK(&In0P->whichType, &whichCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->whichType); _c.t = *(& whichCheck);_t.w != _c.w; })), 0)) |
2622 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2623 | #endif /* TypeCheck */ |
2624 | |
2625 | #if TypeCheck1 |
2626 | if (BAD_TYPECHECK(&In0P->flagsType, &flagsCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->flagsType); _c.t = *(& flagsCheck);_t.w != _c.w; })), 0)) |
2627 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2628 | #endif /* TypeCheck */ |
2629 | |
2630 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
2631 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
2632 | else |
2633 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
2634 | |
2635 | procinfoP = OutP->procinfo; |
2636 | procinfoCnt = 512; |
2637 | |
2638 | threadwaitsP = threadwaits; |
2639 | threadwaitsCnt = 2048; |
2640 | |
2641 | OutP->RetCode = S_proc_getprocinfo(process, In0P->which, &In0P->flags, &procinfoP, &procinfoCnt, &threadwaitsP, &threadwaitsCnt); |
2642 | end_using_proc(process); |
2643 | if (OutP->RetCode != KERN_SUCCESS0) |
2644 | return; |
2645 | |
2646 | msgh_simple = TRUE((boolean_t) 1); |
2647 | |
2648 | OutP->flagsType = flagsType; |
2649 | |
2650 | OutP->flags = In0P->flags; |
2651 | |
2652 | OutP->procinfoType = procinfoType; |
2653 | if (procinfoP != OutP->procinfo) { |
2654 | OutP->procinfoType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
2655 | OutP->procinfoType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
2656 | *((int **)OutP->procinfo) = procinfoP; |
2657 | msgh_simple = FALSE((boolean_t) 0); |
2658 | } |
2659 | |
2660 | OutP->procinfoType.msgtl_number = procinfoCnt; |
2661 | msgh_size_delta = (OutP->procinfoType.msgtl_header.msgt_inline) ? 4 * procinfoCnt : sizeof(int *); |
2662 | msgh_size = 64 + msgh_size_delta; |
2663 | OutP = (Reply *) ((char *) OutP + msgh_size_delta - 2048); |
2664 | |
2665 | OutP->threadwaitsType = threadwaitsType; |
2666 | |
2667 | if (threadwaitsP != threadwaits) { |
2668 | OutP->threadwaitsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
2669 | OutP->threadwaitsType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
2670 | *((char **)OutP->threadwaits) = threadwaitsP; |
2671 | msgh_simple = FALSE((boolean_t) 0); |
2672 | } |
2673 | else { |
2674 | memcpy(OutP->threadwaits, threadwaits, threadwaitsCnt); |
2675 | } |
2676 | |
2677 | OutP->threadwaitsType.msgtl_number = threadwaitsCnt; |
2678 | msgh_size += (OutP->threadwaitsType.msgtl_header.msgt_inline) ? (threadwaitsCnt + 3) & ~3 : sizeof(char *); |
2679 | |
2680 | OutP = (Reply *) OutHeadP; |
2681 | if (!msgh_simple) |
2682 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
2683 | OutP->Head.msgh_size = msgh_size; |
2684 | } |
2685 | |
2686 | /* Default implementation of S_proc_getprocinfo */ |
2687 | #ifdef MIG_EOPNOTSUPP |
2688 | kern_return_t __attribute__ ((weak)) |
2689 | S_proc_getprocinfo |
2690 | ( |
2691 | pstruct_t process, |
2692 | pid_t which, |
2693 | int *flags, |
2694 | procinfo_t *procinfo, |
2695 | mach_msg_type_number_t *procinfoCnt, |
2696 | data_t *threadwaits, |
2697 | mach_msg_type_number_t *threadwaitsCnt |
2698 | ) { return MIG_EOPNOTSUPP; } |
2699 | #endif /* MIG_EOPNOTSUPP */ |
2700 | |
2701 | /* Routine proc_getprocargs */ |
2702 | mig_internalstatic void _Xproc_getprocargs |
2703 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
2704 | { |
2705 | typedef struct { |
2706 | mach_msg_header_t Head; |
2707 | mach_msg_type_t whichType; |
2708 | pid_t which; |
2709 | } Request; |
2710 | |
2711 | typedef struct { |
2712 | mach_msg_header_t Head; |
2713 | mach_msg_type_t RetCodeType; |
2714 | kern_return_t RetCode; |
2715 | mach_msg_type_long_t procargsType; |
2716 | char procargs[2048]; |
2717 | } Reply; |
2718 | |
2719 | Request *In0P = (Request *) InHeadP; |
2720 | Reply *OutP = (Reply *) OutHeadP; |
2721 | mig_external kern_return_t S_proc_getprocargs |
2722 | (pstruct_t process, pid_t which, data_t *procargs, mach_msg_type_number_t *procargsCnt); |
2723 | |
2724 | boolean_t msgh_simple = msgh_simple; |
2725 | const mach_msg_type_t whichCheck = { |
2726 | /* msgt_name = */ 2, |
2727 | /* msgt_size = */ 32, |
2728 | /* msgt_number = */ 1, |
2729 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2730 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2731 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2732 | /* msgt_unused = */ 0 |
2733 | }; |
2734 | |
2735 | const mach_msg_type_long_t procargsType = { |
2736 | { |
2737 | /* msgt_name = */ 0, |
2738 | /* msgt_size = */ 0, |
2739 | /* msgt_number = */ 0, |
2740 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2741 | /* msgt_longform = */ TRUE((boolean_t) 1), |
2742 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2743 | /* msgt_unused = */ 0 |
2744 | }, |
2745 | /* msgtl_name = */ 8, |
2746 | /* msgtl_size = */ 8, |
2747 | /* msgtl_number = */ 2048, |
2748 | }; |
2749 | |
2750 | pstruct_t process; |
2751 | mach_msg_type_number_t procargsCnt; |
2752 | |
2753 | char *procargsP; |
2754 | |
2755 | #if TypeCheck1 |
2756 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
2757 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
2758 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2759 | #endif /* TypeCheck */ |
2760 | |
2761 | #if TypeCheck1 |
2762 | if (BAD_TYPECHECK(&In0P->whichType, &whichCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->whichType); _c.t = *(& whichCheck);_t.w != _c.w; })), 0)) |
2763 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2764 | #endif /* TypeCheck */ |
2765 | |
2766 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
2767 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
2768 | else |
2769 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
2770 | |
2771 | procargsP = OutP->procargs; |
2772 | procargsCnt = 2048; |
2773 | |
2774 | OutP->RetCode = S_proc_getprocargs(process, In0P->which, &procargsP, &procargsCnt); |
2775 | end_using_proc(process); |
2776 | if (OutP->RetCode != KERN_SUCCESS0) |
2777 | return; |
2778 | |
2779 | msgh_simple = TRUE((boolean_t) 1); |
2780 | |
2781 | OutP->procargsType = procargsType; |
2782 | if (procargsP != OutP->procargs) { |
2783 | OutP->procargsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
2784 | OutP->procargsType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
2785 | *((char **)OutP->procargs) = procargsP; |
2786 | msgh_simple = FALSE((boolean_t) 0); |
2787 | } |
2788 | |
2789 | OutP->procargsType.msgtl_number = procargsCnt; |
2790 | OutP->Head.msgh_size = 44 + ((OutP->procargsType.msgtl_header.msgt_inline) ? (procargsCnt + 3) & ~3 : sizeof(char *)); |
2791 | |
2792 | if (!msgh_simple) |
2793 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
2794 | } |
2795 | |
2796 | /* Default implementation of S_proc_getprocargs */ |
2797 | #ifdef MIG_EOPNOTSUPP |
2798 | kern_return_t __attribute__ ((weak)) |
2799 | S_proc_getprocargs |
2800 | ( |
2801 | pstruct_t process, |
2802 | pid_t which, |
2803 | data_t *procargs, |
2804 | mach_msg_type_number_t *procargsCnt |
2805 | ) { return MIG_EOPNOTSUPP; } |
2806 | #endif /* MIG_EOPNOTSUPP */ |
2807 | |
2808 | /* Routine proc_getprocenv */ |
2809 | mig_internalstatic void _Xproc_getprocenv |
2810 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
2811 | { |
2812 | typedef struct { |
2813 | mach_msg_header_t Head; |
2814 | mach_msg_type_t whichType; |
2815 | pid_t which; |
2816 | } Request; |
2817 | |
2818 | typedef struct { |
2819 | mach_msg_header_t Head; |
2820 | mach_msg_type_t RetCodeType; |
2821 | kern_return_t RetCode; |
2822 | mach_msg_type_long_t procenvType; |
2823 | char procenv[2048]; |
2824 | } Reply; |
2825 | |
2826 | Request *In0P = (Request *) InHeadP; |
2827 | Reply *OutP = (Reply *) OutHeadP; |
2828 | mig_external kern_return_t S_proc_getprocenv |
2829 | (pstruct_t process, pid_t which, data_t *procenv, mach_msg_type_number_t *procenvCnt); |
2830 | |
2831 | boolean_t msgh_simple = msgh_simple; |
2832 | const mach_msg_type_t whichCheck = { |
2833 | /* msgt_name = */ 2, |
2834 | /* msgt_size = */ 32, |
2835 | /* msgt_number = */ 1, |
2836 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2837 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2838 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2839 | /* msgt_unused = */ 0 |
2840 | }; |
2841 | |
2842 | const mach_msg_type_long_t procenvType = { |
2843 | { |
2844 | /* msgt_name = */ 0, |
2845 | /* msgt_size = */ 0, |
2846 | /* msgt_number = */ 0, |
2847 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2848 | /* msgt_longform = */ TRUE((boolean_t) 1), |
2849 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2850 | /* msgt_unused = */ 0 |
2851 | }, |
2852 | /* msgtl_name = */ 8, |
2853 | /* msgtl_size = */ 8, |
2854 | /* msgtl_number = */ 2048, |
2855 | }; |
2856 | |
2857 | pstruct_t process; |
2858 | mach_msg_type_number_t procenvCnt; |
2859 | |
2860 | char *procenvP; |
2861 | |
2862 | #if TypeCheck1 |
2863 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
2864 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
2865 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2866 | #endif /* TypeCheck */ |
2867 | |
2868 | #if TypeCheck1 |
2869 | if (BAD_TYPECHECK(&In0P->whichType, &whichCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->whichType); _c.t = *(& whichCheck);_t.w != _c.w; })), 0)) |
2870 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2871 | #endif /* TypeCheck */ |
2872 | |
2873 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
2874 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
2875 | else |
2876 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
2877 | |
2878 | procenvP = OutP->procenv; |
2879 | procenvCnt = 2048; |
2880 | |
2881 | OutP->RetCode = S_proc_getprocenv(process, In0P->which, &procenvP, &procenvCnt); |
2882 | end_using_proc(process); |
2883 | if (OutP->RetCode != KERN_SUCCESS0) |
2884 | return; |
2885 | |
2886 | msgh_simple = TRUE((boolean_t) 1); |
2887 | |
2888 | OutP->procenvType = procenvType; |
2889 | if (procenvP != OutP->procenv) { |
2890 | OutP->procenvType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
2891 | OutP->procenvType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
2892 | *((char **)OutP->procenv) = procenvP; |
2893 | msgh_simple = FALSE((boolean_t) 0); |
2894 | } |
2895 | |
2896 | OutP->procenvType.msgtl_number = procenvCnt; |
2897 | OutP->Head.msgh_size = 44 + ((OutP->procenvType.msgtl_header.msgt_inline) ? (procenvCnt + 3) & ~3 : sizeof(char *)); |
2898 | |
2899 | if (!msgh_simple) |
2900 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
2901 | } |
2902 | |
2903 | /* Default implementation of S_proc_getprocenv */ |
2904 | #ifdef MIG_EOPNOTSUPP |
2905 | kern_return_t __attribute__ ((weak)) |
2906 | S_proc_getprocenv |
2907 | ( |
2908 | pstruct_t process, |
2909 | pid_t which, |
2910 | data_t *procenv, |
2911 | mach_msg_type_number_t *procenvCnt |
2912 | ) { return MIG_EOPNOTSUPP; } |
2913 | #endif /* MIG_EOPNOTSUPP */ |
2914 | |
2915 | /* Routine proc_make_login_coll */ |
2916 | mig_internalstatic void _Xproc_make_login_coll |
2917 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
2918 | { |
2919 | typedef struct { |
2920 | mach_msg_header_t Head; |
2921 | } Request; |
2922 | |
2923 | typedef struct { |
2924 | mach_msg_header_t Head; |
2925 | mach_msg_type_t RetCodeType; |
2926 | kern_return_t RetCode; |
2927 | } Reply; |
2928 | |
2929 | Request *In0P = (Request *) InHeadP; |
2930 | Reply *OutP = (Reply *) OutHeadP; |
2931 | mig_external kern_return_t S_proc_make_login_coll |
2932 | (pstruct_t process); |
2933 | |
2934 | pstruct_t process; |
2935 | |
2936 | #if TypeCheck1 |
2937 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
2938 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
2939 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2940 | #endif /* TypeCheck */ |
2941 | |
2942 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
2943 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
2944 | else |
2945 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
2946 | |
2947 | OutP->RetCode = S_proc_make_login_coll(process); |
2948 | end_using_proc(process); |
2949 | } |
2950 | |
2951 | /* Default implementation of S_proc_make_login_coll */ |
2952 | #ifdef MIG_EOPNOTSUPP |
2953 | kern_return_t __attribute__ ((weak)) |
2954 | S_proc_make_login_coll |
2955 | ( |
2956 | pstruct_t process |
2957 | ) { return MIG_EOPNOTSUPP; } |
2958 | #endif /* MIG_EOPNOTSUPP */ |
2959 | |
2960 | /* Routine proc_getloginid */ |
2961 | mig_internalstatic void _Xproc_getloginid |
2962 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
2963 | { |
2964 | typedef struct { |
2965 | mach_msg_header_t Head; |
2966 | mach_msg_type_t pidType; |
2967 | pid_t pid; |
2968 | } Request; |
2969 | |
2970 | typedef struct { |
2971 | mach_msg_header_t Head; |
2972 | mach_msg_type_t RetCodeType; |
2973 | kern_return_t RetCode; |
2974 | mach_msg_type_t login_idType; |
2975 | pid_t login_id; |
2976 | } Reply; |
2977 | |
2978 | Request *In0P = (Request *) InHeadP; |
2979 | Reply *OutP = (Reply *) OutHeadP; |
2980 | mig_external kern_return_t S_proc_getloginid |
2981 | (pstruct_t process, pid_t pid, pid_t *login_id); |
2982 | |
2983 | const mach_msg_type_t pidCheck = { |
2984 | /* msgt_name = */ 2, |
2985 | /* msgt_size = */ 32, |
2986 | /* msgt_number = */ 1, |
2987 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2988 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2989 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2990 | /* msgt_unused = */ 0 |
2991 | }; |
2992 | |
2993 | const mach_msg_type_t login_idType = { |
2994 | /* msgt_name = */ 2, |
2995 | /* msgt_size = */ 32, |
2996 | /* msgt_number = */ 1, |
2997 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2998 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2999 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3000 | /* msgt_unused = */ 0 |
3001 | }; |
3002 | |
3003 | pstruct_t process; |
3004 | |
3005 | #if TypeCheck1 |
3006 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
3007 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
3008 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3009 | #endif /* TypeCheck */ |
3010 | |
3011 | #if TypeCheck1 |
3012 | if (BAD_TYPECHECK(&In0P->pidType, &pidCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->pidType); _c.t = *(& pidCheck);_t.w != _c.w; })), 0)) |
3013 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3014 | #endif /* TypeCheck */ |
3015 | |
3016 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
3017 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
3018 | else |
3019 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
3020 | |
3021 | OutP->RetCode = S_proc_getloginid(process, In0P->pid, &OutP->login_id); |
3022 | end_using_proc(process); |
3023 | if (OutP->RetCode != KERN_SUCCESS0) |
3024 | return; |
3025 | |
3026 | OutP->Head.msgh_size = 40; |
3027 | |
3028 | OutP->login_idType = login_idType; |
3029 | } |
3030 | |
3031 | /* Default implementation of S_proc_getloginid */ |
3032 | #ifdef MIG_EOPNOTSUPP |
3033 | kern_return_t __attribute__ ((weak)) |
3034 | S_proc_getloginid |
3035 | ( |
3036 | pstruct_t process, |
3037 | pid_t pid, |
3038 | pid_t *login_id |
3039 | ) { return MIG_EOPNOTSUPP; } |
3040 | #endif /* MIG_EOPNOTSUPP */ |
3041 | |
3042 | /* Routine proc_getloginpids */ |
3043 | mig_internalstatic void _Xproc_getloginpids |
3044 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
3045 | { |
3046 | typedef struct { |
3047 | mach_msg_header_t Head; |
3048 | mach_msg_type_t idType; |
3049 | pid_t id; |
3050 | } Request; |
3051 | |
3052 | typedef struct { |
3053 | mach_msg_header_t Head; |
3054 | mach_msg_type_t RetCodeType; |
3055 | kern_return_t RetCode; |
3056 | mach_msg_type_long_t pidsType; |
3057 | pid_t pids[512]; |
3058 | } Reply; |
3059 | |
3060 | Request *In0P = (Request *) InHeadP; |
3061 | Reply *OutP = (Reply *) OutHeadP; |
3062 | mig_external kern_return_t S_proc_getloginpids |
3063 | (pstruct_t process, pid_t id, pidarray_t *pids, mach_msg_type_number_t *pidsCnt); |
3064 | |
3065 | boolean_t msgh_simple = msgh_simple; |
3066 | const mach_msg_type_t idCheck = { |
3067 | /* msgt_name = */ 2, |
3068 | /* msgt_size = */ 32, |
3069 | /* msgt_number = */ 1, |
3070 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3071 | /* msgt_longform = */ FALSE((boolean_t) 0), |
3072 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3073 | /* msgt_unused = */ 0 |
3074 | }; |
3075 | |
3076 | const mach_msg_type_long_t pidsType = { |
3077 | { |
3078 | /* msgt_name = */ 0, |
3079 | /* msgt_size = */ 0, |
3080 | /* msgt_number = */ 0, |
3081 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3082 | /* msgt_longform = */ TRUE((boolean_t) 1), |
3083 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3084 | /* msgt_unused = */ 0 |
3085 | }, |
3086 | /* msgtl_name = */ 2, |
3087 | /* msgtl_size = */ 32, |
3088 | /* msgtl_number = */ 512, |
3089 | }; |
3090 | |
3091 | pstruct_t process; |
3092 | mach_msg_type_number_t pidsCnt; |
3093 | |
3094 | pid_t *pidsP; |
3095 | |
3096 | #if TypeCheck1 |
3097 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
3098 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
3099 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3100 | #endif /* TypeCheck */ |
3101 | |
3102 | #if TypeCheck1 |
3103 | if (BAD_TYPECHECK(&In0P->idType, &idCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->idType); _c.t = *(&idCheck );_t.w != _c.w; })), 0)) |
3104 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3105 | #endif /* TypeCheck */ |
3106 | |
3107 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
3108 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
3109 | else |
3110 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
3111 | |
3112 | pidsP = OutP->pids; |
3113 | pidsCnt = 512; |
3114 | |
3115 | OutP->RetCode = S_proc_getloginpids(process, In0P->id, &pidsP, &pidsCnt); |
3116 | end_using_proc(process); |
3117 | if (OutP->RetCode != KERN_SUCCESS0) |
3118 | return; |
3119 | |
3120 | msgh_simple = TRUE((boolean_t) 1); |
3121 | |
3122 | OutP->pidsType = pidsType; |
3123 | if (pidsP != OutP->pids) { |
3124 | OutP->pidsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
3125 | OutP->pidsType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
3126 | *((pid_t **)OutP->pids) = pidsP; |
3127 | msgh_simple = FALSE((boolean_t) 0); |
3128 | } |
3129 | |
3130 | OutP->pidsType.msgtl_number = pidsCnt; |
3131 | OutP->Head.msgh_size = 44 + ((OutP->pidsType.msgtl_header.msgt_inline) ? 4 * pidsCnt : sizeof(pid_t *)); |
3132 | |
3133 | if (!msgh_simple) |
3134 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
3135 | } |
3136 | |
3137 | /* Default implementation of S_proc_getloginpids */ |
3138 | #ifdef MIG_EOPNOTSUPP |
3139 | kern_return_t __attribute__ ((weak)) |
3140 | S_proc_getloginpids |
3141 | ( |
3142 | pstruct_t process, |
3143 | pid_t id, |
3144 | pidarray_t *pids, |
3145 | mach_msg_type_number_t *pidsCnt |
3146 | ) { return MIG_EOPNOTSUPP; } |
3147 | #endif /* MIG_EOPNOTSUPP */ |
3148 | |
3149 | /* Routine proc_setlogin */ |
3150 | mig_internalstatic void _Xproc_setlogin |
3151 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
3152 | { |
3153 | typedef struct { |
3154 | mach_msg_header_t Head; |
3155 | mach_msg_type_t lognameType; |
3156 | string_t logname; |
3157 | } Request; |
3158 | |
3159 | typedef struct { |
3160 | mach_msg_header_t Head; |
3161 | mach_msg_type_t RetCodeType; |
3162 | kern_return_t RetCode; |
3163 | } Reply; |
3164 | |
3165 | Request *In0P = (Request *) InHeadP; |
3166 | Reply *OutP = (Reply *) OutHeadP; |
3167 | mig_external kern_return_t S_proc_setlogin |
3168 | (pstruct_t process, string_t logname); |
3169 | |
3170 | const mach_msg_type_t lognameCheck = { |
3171 | /* msgt_name = */ MACH_MSG_TYPE_STRING_C12, |
3172 | /* msgt_size = */ 8, |
3173 | /* msgt_number = */ 1024, |
3174 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3175 | /* msgt_longform = */ FALSE((boolean_t) 0), |
3176 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3177 | /* msgt_unused = */ 0 |
3178 | }; |
3179 | |
3180 | pstruct_t process; |
3181 | |
3182 | #if TypeCheck1 |
3183 | if (mig_unlikely ((In0P->Head.msgh_size != 1052) ||__builtin_expect (!! ((In0P->Head.msgh_size != 1052) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
3184 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 1052) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
3185 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3186 | #endif /* TypeCheck */ |
3187 | |
3188 | #if TypeCheck1 |
3189 | if (BAD_TYPECHECK(&In0P->lognameType, &lognameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->lognameType); _c.t = *(& lognameCheck);_t.w != _c.w; })), 0)) |
3190 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3191 | #endif /* TypeCheck */ |
3192 | |
3193 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
3194 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
3195 | else |
3196 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
3197 | |
3198 | OutP->RetCode = S_proc_setlogin(process, In0P->logname); |
3199 | end_using_proc(process); |
3200 | } |
3201 | |
3202 | /* Default implementation of S_proc_setlogin */ |
3203 | #ifdef MIG_EOPNOTSUPP |
3204 | kern_return_t __attribute__ ((weak)) |
3205 | S_proc_setlogin |
3206 | ( |
3207 | pstruct_t process, |
3208 | string_t logname |
3209 | ) { return MIG_EOPNOTSUPP; } |
3210 | #endif /* MIG_EOPNOTSUPP */ |
3211 | |
3212 | /* Routine proc_getlogin */ |
3213 | mig_internalstatic void _Xproc_getlogin |
3214 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
3215 | { |
3216 | typedef struct { |
3217 | mach_msg_header_t Head; |
3218 | } Request; |
3219 | |
3220 | typedef struct { |
3221 | mach_msg_header_t Head; |
3222 | mach_msg_type_t RetCodeType; |
3223 | kern_return_t RetCode; |
3224 | mach_msg_type_t lognameType; |
3225 | string_t logname; |
3226 | } Reply; |
3227 | |
3228 | Request *In0P = (Request *) InHeadP; |
3229 | Reply *OutP = (Reply *) OutHeadP; |
3230 | mig_external kern_return_t S_proc_getlogin |
3231 | (pstruct_t process, string_t logname); |
3232 | |
3233 | const mach_msg_type_t lognameType = { |
3234 | /* msgt_name = */ MACH_MSG_TYPE_STRING_C12, |
3235 | /* msgt_size = */ 8, |
3236 | /* msgt_number = */ 1024, |
3237 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3238 | /* msgt_longform = */ FALSE((boolean_t) 0), |
3239 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3240 | /* msgt_unused = */ 0 |
3241 | }; |
3242 | |
3243 | pstruct_t process; |
3244 | |
3245 | #if TypeCheck1 |
3246 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
3247 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
3248 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3249 | #endif /* TypeCheck */ |
3250 | |
3251 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
3252 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
3253 | else |
3254 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
3255 | |
3256 | OutP->RetCode = S_proc_getlogin(process, OutP->logname); |
3257 | end_using_proc(process); |
3258 | if (OutP->RetCode != KERN_SUCCESS0) |
3259 | return; |
3260 | |
3261 | OutP->Head.msgh_size = 1060; |
3262 | |
3263 | OutP->lognameType = lognameType; |
3264 | } |
3265 | |
3266 | /* Default implementation of S_proc_getlogin */ |
3267 | #ifdef MIG_EOPNOTSUPP |
3268 | kern_return_t __attribute__ ((weak)) |
3269 | S_proc_getlogin |
3270 | ( |
3271 | pstruct_t process, |
3272 | string_t logname |
3273 | ) { return MIG_EOPNOTSUPP; } |
3274 | #endif /* MIG_EOPNOTSUPP */ |
3275 | |
3276 | /* Routine proc_setsid */ |
3277 | mig_internalstatic void _Xproc_setsid |
3278 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
3279 | { |
3280 | typedef struct { |
3281 | mach_msg_header_t Head; |
3282 | } Request; |
3283 | |
3284 | typedef struct { |
3285 | mach_msg_header_t Head; |
3286 | mach_msg_type_t RetCodeType; |
3287 | kern_return_t RetCode; |
3288 | } Reply; |
3289 | |
3290 | Request *In0P = (Request *) InHeadP; |
3291 | Reply *OutP = (Reply *) OutHeadP; |
3292 | mig_external kern_return_t S_proc_setsid |
3293 | (pstruct_t process); |
3294 | |
3295 | pstruct_t process; |
3296 | |
3297 | #if TypeCheck1 |
3298 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
3299 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
3300 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3301 | #endif /* TypeCheck */ |
3302 | |
3303 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
3304 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
3305 | else |
3306 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
3307 | |
3308 | OutP->RetCode = S_proc_setsid(process); |
3309 | end_using_proc(process); |
3310 | } |
3311 | |
3312 | /* Default implementation of S_proc_setsid */ |
3313 | #ifdef MIG_EOPNOTSUPP |
3314 | kern_return_t __attribute__ ((weak)) |
3315 | S_proc_setsid |
3316 | ( |
3317 | pstruct_t process |
3318 | ) { return MIG_EOPNOTSUPP; } |
3319 | #endif /* MIG_EOPNOTSUPP */ |
3320 | |
3321 | /* Routine proc_getsid */ |
3322 | mig_internalstatic void _Xproc_getsid |
3323 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
3324 | { |
3325 | typedef struct { |
3326 | mach_msg_header_t Head; |
3327 | mach_msg_type_t pidType; |
3328 | pid_t pid; |
3329 | } Request; |
3330 | |
3331 | typedef struct { |
3332 | mach_msg_header_t Head; |
3333 | mach_msg_type_t RetCodeType; |
3334 | kern_return_t RetCode; |
3335 | mach_msg_type_t sidType; |
3336 | pid_t sid; |
3337 | } Reply; |
3338 | |
3339 | Request *In0P = (Request *) InHeadP; |
3340 | Reply *OutP = (Reply *) OutHeadP; |
3341 | mig_external kern_return_t S_proc_getsid |
3342 | (pstruct_t process, pid_t pid, pid_t *sid); |
3343 | |
3344 | const mach_msg_type_t pidCheck = { |
3345 | /* msgt_name = */ 2, |
3346 | /* msgt_size = */ 32, |
3347 | /* msgt_number = */ 1, |
3348 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3349 | /* msgt_longform = */ FALSE((boolean_t) 0), |
3350 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3351 | /* msgt_unused = */ 0 |
3352 | }; |
3353 | |
3354 | const mach_msg_type_t sidType = { |
3355 | /* msgt_name = */ 2, |
3356 | /* msgt_size = */ 32, |
3357 | /* msgt_number = */ 1, |
3358 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3359 | /* msgt_longform = */ FALSE((boolean_t) 0), |
3360 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3361 | /* msgt_unused = */ 0 |
3362 | }; |
3363 | |
3364 | pstruct_t process; |
3365 | |
3366 | #if TypeCheck1 |
3367 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
3368 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
3369 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3370 | #endif /* TypeCheck */ |
3371 | |
3372 | #if TypeCheck1 |
3373 | if (BAD_TYPECHECK(&In0P->pidType, &pidCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->pidType); _c.t = *(& pidCheck);_t.w != _c.w; })), 0)) |
3374 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3375 | #endif /* TypeCheck */ |
3376 | |
3377 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
3378 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
3379 | else |
3380 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
3381 | |
3382 | OutP->RetCode = S_proc_getsid(process, In0P->pid, &OutP->sid); |
3383 | end_using_proc(process); |
3384 | if (OutP->RetCode != KERN_SUCCESS0) |
3385 | return; |
3386 | |
3387 | OutP->Head.msgh_size = 40; |
3388 | |
3389 | OutP->sidType = sidType; |
3390 | } |
3391 | |
3392 | /* Default implementation of S_proc_getsid */ |
3393 | #ifdef MIG_EOPNOTSUPP |
3394 | kern_return_t __attribute__ ((weak)) |
3395 | S_proc_getsid |
3396 | ( |
3397 | pstruct_t process, |
3398 | pid_t pid, |
3399 | pid_t *sid |
3400 | ) { return MIG_EOPNOTSUPP; } |
3401 | #endif /* MIG_EOPNOTSUPP */ |
3402 | |
3403 | /* Routine proc_getsessionpgids */ |
3404 | mig_internalstatic void _Xproc_getsessionpgids |
3405 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
3406 | { |
3407 | typedef struct { |
3408 | mach_msg_header_t Head; |
3409 | mach_msg_type_t sidType; |
3410 | pid_t sid; |
3411 | } Request; |
3412 | |
3413 | typedef struct { |
3414 | mach_msg_header_t Head; |
3415 | mach_msg_type_t RetCodeType; |
3416 | kern_return_t RetCode; |
3417 | mach_msg_type_long_t pgidsetType; |
3418 | pid_t pgidset[512]; |
3419 | } Reply; |
3420 | |
3421 | Request *In0P = (Request *) InHeadP; |
3422 | Reply *OutP = (Reply *) OutHeadP; |
3423 | mig_external kern_return_t S_proc_getsessionpgids |
3424 | (pstruct_t process, pid_t sid, pidarray_t *pgidset, mach_msg_type_number_t *pgidsetCnt); |
3425 | |
3426 | boolean_t msgh_simple = msgh_simple; |
3427 | const mach_msg_type_t sidCheck = { |
3428 | /* msgt_name = */ 2, |
3429 | /* msgt_size = */ 32, |
3430 | /* msgt_number = */ 1, |
3431 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3432 | /* msgt_longform = */ FALSE((boolean_t) 0), |
3433 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3434 | /* msgt_unused = */ 0 |
3435 | }; |
3436 | |
3437 | const mach_msg_type_long_t pgidsetType = { |
3438 | { |
3439 | /* msgt_name = */ 0, |
3440 | /* msgt_size = */ 0, |
3441 | /* msgt_number = */ 0, |
3442 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3443 | /* msgt_longform = */ TRUE((boolean_t) 1), |
3444 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3445 | /* msgt_unused = */ 0 |
3446 | }, |
3447 | /* msgtl_name = */ 2, |
3448 | /* msgtl_size = */ 32, |
3449 | /* msgtl_number = */ 512, |
3450 | }; |
3451 | |
3452 | pstruct_t process; |
3453 | mach_msg_type_number_t pgidsetCnt; |
3454 | |
3455 | pid_t *pgidsetP; |
3456 | |
3457 | #if TypeCheck1 |
3458 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
3459 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
3460 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3461 | #endif /* TypeCheck */ |
3462 | |
3463 | #if TypeCheck1 |
3464 | if (BAD_TYPECHECK(&In0P->sidType, &sidCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->sidType); _c.t = *(& sidCheck);_t.w != _c.w; })), 0)) |
3465 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3466 | #endif /* TypeCheck */ |
3467 | |
3468 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
3469 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
3470 | else |
3471 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
3472 | |
3473 | pgidsetP = OutP->pgidset; |
3474 | pgidsetCnt = 512; |
3475 | |
3476 | OutP->RetCode = S_proc_getsessionpgids(process, In0P->sid, &pgidsetP, &pgidsetCnt); |
3477 | end_using_proc(process); |
3478 | if (OutP->RetCode != KERN_SUCCESS0) |
3479 | return; |
3480 | |
3481 | msgh_simple = TRUE((boolean_t) 1); |
3482 | |
3483 | OutP->pgidsetType = pgidsetType; |
3484 | if (pgidsetP != OutP->pgidset) { |
3485 | OutP->pgidsetType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
3486 | OutP->pgidsetType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
3487 | *((pid_t **)OutP->pgidset) = pgidsetP; |
3488 | msgh_simple = FALSE((boolean_t) 0); |
3489 | } |
3490 | |
3491 | OutP->pgidsetType.msgtl_number = pgidsetCnt; |
3492 | OutP->Head.msgh_size = 44 + ((OutP->pgidsetType.msgtl_header.msgt_inline) ? 4 * pgidsetCnt : sizeof(pid_t *)); |
3493 | |
3494 | if (!msgh_simple) |
3495 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
3496 | } |
3497 | |
3498 | /* Default implementation of S_proc_getsessionpgids */ |
3499 | #ifdef MIG_EOPNOTSUPP |
3500 | kern_return_t __attribute__ ((weak)) |
3501 | S_proc_getsessionpgids |
3502 | ( |
3503 | pstruct_t process, |
3504 | pid_t sid, |
3505 | pidarray_t *pgidset, |
3506 | mach_msg_type_number_t *pgidsetCnt |
3507 | ) { return MIG_EOPNOTSUPP; } |
3508 | #endif /* MIG_EOPNOTSUPP */ |
3509 | |
3510 | /* Routine proc_getsessionpids */ |
3511 | mig_internalstatic void _Xproc_getsessionpids |
3512 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
3513 | { |
3514 | typedef struct { |
3515 | mach_msg_header_t Head; |
3516 | mach_msg_type_t sidType; |
3517 | pid_t sid; |
3518 | } Request; |
3519 | |
3520 | typedef struct { |
3521 | mach_msg_header_t Head; |
3522 | mach_msg_type_t RetCodeType; |
3523 | kern_return_t RetCode; |
3524 | mach_msg_type_long_t pidsetType; |
3525 | pid_t pidset[512]; |
3526 | } Reply; |
3527 | |
3528 | Request *In0P = (Request *) InHeadP; |
3529 | Reply *OutP = (Reply *) OutHeadP; |
3530 | mig_external kern_return_t S_proc_getsessionpids |
3531 | (pstruct_t process, pid_t sid, pidarray_t *pidset, mach_msg_type_number_t *pidsetCnt); |
3532 | |
3533 | boolean_t msgh_simple = msgh_simple; |
3534 | const mach_msg_type_t sidCheck = { |
3535 | /* msgt_name = */ 2, |
3536 | /* msgt_size = */ 32, |
3537 | /* msgt_number = */ 1, |
3538 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3539 | /* msgt_longform = */ FALSE((boolean_t) 0), |
3540 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3541 | /* msgt_unused = */ 0 |
3542 | }; |
3543 | |
3544 | const mach_msg_type_long_t pidsetType = { |
3545 | { |
3546 | /* msgt_name = */ 0, |
3547 | /* msgt_size = */ 0, |
3548 | /* msgt_number = */ 0, |
3549 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3550 | /* msgt_longform = */ TRUE((boolean_t) 1), |
3551 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3552 | /* msgt_unused = */ 0 |
3553 | }, |
3554 | /* msgtl_name = */ 2, |
3555 | /* msgtl_size = */ 32, |
3556 | /* msgtl_number = */ 512, |
3557 | }; |
3558 | |
3559 | pstruct_t process; |
3560 | mach_msg_type_number_t pidsetCnt; |
3561 | |
3562 | pid_t *pidsetP; |
3563 | |
3564 | #if TypeCheck1 |
3565 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
3566 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
3567 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3568 | #endif /* TypeCheck */ |
3569 | |
3570 | #if TypeCheck1 |
3571 | if (BAD_TYPECHECK(&In0P->sidType, &sidCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->sidType); _c.t = *(& sidCheck);_t.w != _c.w; })), 0)) |
3572 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3573 | #endif /* TypeCheck */ |
3574 | |
3575 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
3576 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
3577 | else |
3578 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
3579 | |
3580 | pidsetP = OutP->pidset; |
3581 | pidsetCnt = 512; |
3582 | |
3583 | OutP->RetCode = S_proc_getsessionpids(process, In0P->sid, &pidsetP, &pidsetCnt); |
3584 | end_using_proc(process); |
3585 | if (OutP->RetCode != KERN_SUCCESS0) |
3586 | return; |
3587 | |
3588 | msgh_simple = TRUE((boolean_t) 1); |
3589 | |
3590 | OutP->pidsetType = pidsetType; |
3591 | if (pidsetP != OutP->pidset) { |
3592 | OutP->pidsetType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
3593 | OutP->pidsetType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
3594 | *((pid_t **)OutP->pidset) = pidsetP; |
3595 | msgh_simple = FALSE((boolean_t) 0); |
3596 | } |
3597 | |
3598 | OutP->pidsetType.msgtl_number = pidsetCnt; |
3599 | OutP->Head.msgh_size = 44 + ((OutP->pidsetType.msgtl_header.msgt_inline) ? 4 * pidsetCnt : sizeof(pid_t *)); |
3600 | |
3601 | if (!msgh_simple) |
3602 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
3603 | } |
3604 | |
3605 | /* Default implementation of S_proc_getsessionpids */ |
3606 | #ifdef MIG_EOPNOTSUPP |
3607 | kern_return_t __attribute__ ((weak)) |
3608 | S_proc_getsessionpids |
3609 | ( |
3610 | pstruct_t process, |
3611 | pid_t sid, |
3612 | pidarray_t *pidset, |
3613 | mach_msg_type_number_t *pidsetCnt |
3614 | ) { return MIG_EOPNOTSUPP; } |
3615 | #endif /* MIG_EOPNOTSUPP */ |
3616 | |
3617 | /* Routine proc_getsidport */ |
3618 | mig_internalstatic void _Xproc_getsidport |
3619 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
3620 | { |
3621 | typedef struct { |
3622 | mach_msg_header_t Head; |
3623 | } Request; |
3624 | |
3625 | typedef struct { |
3626 | mach_msg_header_t Head; |
3627 | mach_msg_type_t RetCodeType; |
3628 | kern_return_t RetCode; |
3629 | mach_msg_type_t sessportType; |
3630 | mach_port_t sessport; |
3631 | } Reply; |
3632 | |
3633 | Request *In0P = (Request *) InHeadP; |
3634 | Reply *OutP = (Reply *) OutHeadP; |
3635 | mig_external kern_return_t S_proc_getsidport |
3636 | (pstruct_t process, mach_port_t *sessport, mach_msg_type_name_t *sessportPoly); |
3637 | |
3638 | boolean_t msgh_simple = msgh_simple; |
3639 | const mach_msg_type_t sessportType = { |
3640 | /* msgt_name = */ -1, |
3641 | /* msgt_size = */ 32, |
3642 | /* msgt_number = */ 1, |
3643 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3644 | /* msgt_longform = */ FALSE((boolean_t) 0), |
3645 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3646 | /* msgt_unused = */ 0 |
3647 | }; |
3648 | |
3649 | pstruct_t process; |
3650 | mach_msg_type_name_t sessportPoly; |
3651 | |
3652 | #if TypeCheck1 |
3653 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
3654 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
3655 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3656 | #endif /* TypeCheck */ |
3657 | |
3658 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
3659 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
3660 | else |
3661 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
3662 | |
3663 | OutP->RetCode = S_proc_getsidport(process, &OutP->sessport, &sessportPoly); |
3664 | end_using_proc(process); |
3665 | if (OutP->RetCode != KERN_SUCCESS0) |
3666 | return; |
3667 | |
3668 | msgh_simple = TRUE((boolean_t) 1); |
3669 | OutP->Head.msgh_size = 40; |
3670 | |
3671 | OutP->sessportType = sessportType; |
3672 | |
3673 | if (MACH_MSG_TYPE_PORT_ANY(sessportPoly)(((sessportPoly) >= 16) && ((sessportPoly) <= 21 ))) |
3674 | msgh_simple = FALSE((boolean_t) 0); |
3675 | |
3676 | OutP->sessportType.msgt_name = sessportPoly; |
3677 | |
3678 | if (!msgh_simple) |
3679 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
3680 | } |
3681 | |
3682 | /* Default implementation of S_proc_getsidport */ |
3683 | #ifdef MIG_EOPNOTSUPP |
3684 | kern_return_t __attribute__ ((weak)) |
3685 | S_proc_getsidport |
3686 | ( |
3687 | pstruct_t process, |
3688 | mach_port_t *sessport, |
3689 | mach_msg_type_name_t *sessportPoly |
3690 | ) { return MIG_EOPNOTSUPP; } |
3691 | #endif /* MIG_EOPNOTSUPP */ |
3692 | |
3693 | /* Routine proc_setpgrp */ |
3694 | mig_internalstatic void _Xproc_setpgrp |
3695 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
3696 | { |
3697 | typedef struct { |
3698 | mach_msg_header_t Head; |
3699 | mach_msg_type_t pidType; |
3700 | pid_t pid; |
3701 | mach_msg_type_t pgrpType; |
3702 | pid_t pgrp; |
3703 | } Request; |
3704 | |
3705 | typedef struct { |
3706 | mach_msg_header_t Head; |
3707 | mach_msg_type_t RetCodeType; |
3708 | kern_return_t RetCode; |
3709 | } Reply; |
3710 | |
3711 | Request *In0P = (Request *) InHeadP; |
3712 | Reply *OutP = (Reply *) OutHeadP; |
3713 | mig_external kern_return_t S_proc_setpgrp |
3714 | (pstruct_t process, pid_t pid, pid_t pgrp); |
3715 | |
3716 | const mach_msg_type_t pidCheck = { |
3717 | /* msgt_name = */ 2, |
3718 | /* msgt_size = */ 32, |
3719 | /* msgt_number = */ 1, |
3720 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3721 | /* msgt_longform = */ FALSE((boolean_t) 0), |
3722 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3723 | /* msgt_unused = */ 0 |
3724 | }; |
3725 | |
3726 | const mach_msg_type_t pgrpCheck = { |
3727 | /* msgt_name = */ 2, |
3728 | /* msgt_size = */ 32, |
3729 | /* msgt_number = */ 1, |
3730 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3731 | /* msgt_longform = */ FALSE((boolean_t) 0), |
3732 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3733 | /* msgt_unused = */ 0 |
3734 | }; |
3735 | |
3736 | pstruct_t process; |
3737 | |
3738 | #if TypeCheck1 |
3739 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
3740 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
3741 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3742 | #endif /* TypeCheck */ |
3743 | |
3744 | #if TypeCheck1 |
3745 | if (BAD_TYPECHECK(&In0P->pidType, &pidCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->pidType); _c.t = *(& pidCheck);_t.w != _c.w; })), 0)) |
3746 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3747 | #endif /* TypeCheck */ |
3748 | |
3749 | #if TypeCheck1 |
3750 | if (BAD_TYPECHECK(&In0P->pgrpType, &pgrpCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->pgrpType); _c.t = *(& pgrpCheck);_t.w != _c.w; })), 0)) |
3751 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3752 | #endif /* TypeCheck */ |
3753 | |
3754 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
3755 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
3756 | else |
3757 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
3758 | |
3759 | OutP->RetCode = S_proc_setpgrp(process, In0P->pid, In0P->pgrp); |
3760 | end_using_proc(process); |
3761 | } |
3762 | |
3763 | /* Default implementation of S_proc_setpgrp */ |
3764 | #ifdef MIG_EOPNOTSUPP |
3765 | kern_return_t __attribute__ ((weak)) |
3766 | S_proc_setpgrp |
3767 | ( |
3768 | pstruct_t process, |
3769 | pid_t pid, |
3770 | pid_t pgrp |
3771 | ) { return MIG_EOPNOTSUPP; } |
3772 | #endif /* MIG_EOPNOTSUPP */ |
3773 | |
3774 | /* Routine proc_getpgrp */ |
3775 | mig_internalstatic void _Xproc_getpgrp |
3776 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
3777 | { |
3778 | typedef struct { |
3779 | mach_msg_header_t Head; |
3780 | mach_msg_type_t pidType; |
3781 | pid_t pid; |
3782 | } Request; |
3783 | |
3784 | typedef struct { |
3785 | mach_msg_header_t Head; |
3786 | mach_msg_type_t RetCodeType; |
3787 | kern_return_t RetCode; |
3788 | mach_msg_type_t pgrpType; |
3789 | pid_t pgrp; |
3790 | } Reply; |
3791 | |
3792 | Request *In0P = (Request *) InHeadP; |
3793 | Reply *OutP = (Reply *) OutHeadP; |
3794 | mig_external kern_return_t S_proc_getpgrp |
3795 | (pstruct_t process, pid_t pid, pid_t *pgrp); |
3796 | |
3797 | const mach_msg_type_t pidCheck = { |
3798 | /* msgt_name = */ 2, |
3799 | /* msgt_size = */ 32, |
3800 | /* msgt_number = */ 1, |
3801 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3802 | /* msgt_longform = */ FALSE((boolean_t) 0), |
3803 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3804 | /* msgt_unused = */ 0 |
3805 | }; |
3806 | |
3807 | const mach_msg_type_t pgrpType = { |
3808 | /* msgt_name = */ 2, |
3809 | /* msgt_size = */ 32, |
3810 | /* msgt_number = */ 1, |
3811 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3812 | /* msgt_longform = */ FALSE((boolean_t) 0), |
3813 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3814 | /* msgt_unused = */ 0 |
3815 | }; |
3816 | |
3817 | pstruct_t process; |
3818 | |
3819 | #if TypeCheck1 |
3820 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
3821 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
3822 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3823 | #endif /* TypeCheck */ |
3824 | |
3825 | #if TypeCheck1 |
3826 | if (BAD_TYPECHECK(&In0P->pidType, &pidCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->pidType); _c.t = *(& pidCheck);_t.w != _c.w; })), 0)) |
3827 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3828 | #endif /* TypeCheck */ |
3829 | |
3830 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
3831 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
3832 | else |
3833 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
3834 | |
3835 | OutP->RetCode = S_proc_getpgrp(process, In0P->pid, &OutP->pgrp); |
3836 | end_using_proc(process); |
3837 | if (OutP->RetCode != KERN_SUCCESS0) |
3838 | return; |
3839 | |
3840 | OutP->Head.msgh_size = 40; |
3841 | |
3842 | OutP->pgrpType = pgrpType; |
3843 | } |
3844 | |
3845 | /* Default implementation of S_proc_getpgrp */ |
3846 | #ifdef MIG_EOPNOTSUPP |
3847 | kern_return_t __attribute__ ((weak)) |
3848 | S_proc_getpgrp |
3849 | ( |
3850 | pstruct_t process, |
3851 | pid_t pid, |
3852 | pid_t *pgrp |
3853 | ) { return MIG_EOPNOTSUPP; } |
3854 | #endif /* MIG_EOPNOTSUPP */ |
3855 | |
3856 | /* Routine proc_getpgrppids */ |
3857 | mig_internalstatic void _Xproc_getpgrppids |
3858 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
3859 | { |
3860 | typedef struct { |
3861 | mach_msg_header_t Head; |
3862 | mach_msg_type_t pgrpType; |
3863 | pid_t pgrp; |
3864 | } Request; |
3865 | |
3866 | typedef struct { |
3867 | mach_msg_header_t Head; |
3868 | mach_msg_type_t RetCodeType; |
3869 | kern_return_t RetCode; |
3870 | mach_msg_type_long_t pidsetType; |
3871 | pid_t pidset[512]; |
3872 | } Reply; |
3873 | |
3874 | Request *In0P = (Request *) InHeadP; |
3875 | Reply *OutP = (Reply *) OutHeadP; |
3876 | mig_external kern_return_t S_proc_getpgrppids |
3877 | (pstruct_t process, pid_t pgrp, pidarray_t *pidset, mach_msg_type_number_t *pidsetCnt); |
3878 | |
3879 | boolean_t msgh_simple = msgh_simple; |
3880 | const mach_msg_type_t pgrpCheck = { |
3881 | /* msgt_name = */ 2, |
3882 | /* msgt_size = */ 32, |
3883 | /* msgt_number = */ 1, |
3884 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3885 | /* msgt_longform = */ FALSE((boolean_t) 0), |
3886 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3887 | /* msgt_unused = */ 0 |
3888 | }; |
3889 | |
3890 | const mach_msg_type_long_t pidsetType = { |
3891 | { |
3892 | /* msgt_name = */ 0, |
3893 | /* msgt_size = */ 0, |
3894 | /* msgt_number = */ 0, |
3895 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3896 | /* msgt_longform = */ TRUE((boolean_t) 1), |
3897 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3898 | /* msgt_unused = */ 0 |
3899 | }, |
3900 | /* msgtl_name = */ 2, |
3901 | /* msgtl_size = */ 32, |
3902 | /* msgtl_number = */ 512, |
3903 | }; |
3904 | |
3905 | pstruct_t process; |
3906 | mach_msg_type_number_t pidsetCnt; |
3907 | |
3908 | pid_t *pidsetP; |
3909 | |
3910 | #if TypeCheck1 |
3911 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
3912 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
3913 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3914 | #endif /* TypeCheck */ |
3915 | |
3916 | #if TypeCheck1 |
3917 | if (BAD_TYPECHECK(&In0P->pgrpType, &pgrpCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->pgrpType); _c.t = *(& pgrpCheck);_t.w != _c.w; })), 0)) |
3918 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
3919 | #endif /* TypeCheck */ |
3920 | |
3921 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
3922 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
3923 | else |
3924 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
3925 | |
3926 | pidsetP = OutP->pidset; |
3927 | pidsetCnt = 512; |
3928 | |
3929 | OutP->RetCode = S_proc_getpgrppids(process, In0P->pgrp, &pidsetP, &pidsetCnt); |
3930 | end_using_proc(process); |
3931 | if (OutP->RetCode != KERN_SUCCESS0) |
3932 | return; |
3933 | |
3934 | msgh_simple = TRUE((boolean_t) 1); |
3935 | |
3936 | OutP->pidsetType = pidsetType; |
3937 | if (pidsetP != OutP->pidset) { |
3938 | OutP->pidsetType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
3939 | OutP->pidsetType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
3940 | *((pid_t **)OutP->pidset) = pidsetP; |
3941 | msgh_simple = FALSE((boolean_t) 0); |
3942 | } |
3943 | |
3944 | OutP->pidsetType.msgtl_number = pidsetCnt; |
3945 | OutP->Head.msgh_size = 44 + ((OutP->pidsetType.msgtl_header.msgt_inline) ? 4 * pidsetCnt : sizeof(pid_t *)); |
3946 | |
3947 | if (!msgh_simple) |
3948 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
3949 | } |
3950 | |
3951 | /* Default implementation of S_proc_getpgrppids */ |
3952 | #ifdef MIG_EOPNOTSUPP |
3953 | kern_return_t __attribute__ ((weak)) |
3954 | S_proc_getpgrppids |
3955 | ( |
3956 | pstruct_t process, |
3957 | pid_t pgrp, |
3958 | pidarray_t *pidset, |
3959 | mach_msg_type_number_t *pidsetCnt |
3960 | ) { return MIG_EOPNOTSUPP; } |
3961 | #endif /* MIG_EOPNOTSUPP */ |
3962 | |
3963 | /* Routine proc_get_tty */ |
3964 | mig_internalstatic void _Xproc_get_tty |
3965 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
3966 | { |
3967 | typedef struct { |
3968 | mach_msg_header_t Head; |
3969 | mach_msg_type_t target_processType; |
3970 | pid_t target_process; |
3971 | } Request; |
3972 | |
3973 | typedef struct { |
3974 | mach_msg_header_t Head; |
3975 | mach_msg_type_t RetCodeType; |
3976 | kern_return_t RetCode; |
3977 | mach_msg_type_t ttyType; |
3978 | mach_port_t tty; |
3979 | } Reply; |
3980 | |
3981 | Request *In0P = (Request *) InHeadP; |
3982 | Reply *OutP = (Reply *) OutHeadP; |
3983 | mig_external kern_return_t S_proc_get_tty |
3984 | (pstruct_t calling_process, pid_t target_process, mach_port_t *tty, mach_msg_type_name_t *ttyPoly); |
3985 | |
3986 | boolean_t msgh_simple = msgh_simple; |
3987 | const mach_msg_type_t target_processCheck = { |
3988 | /* msgt_name = */ 2, |
3989 | /* msgt_size = */ 32, |
3990 | /* msgt_number = */ 1, |
3991 | /* msgt_inline = */ TRUE((boolean_t) 1), |
3992 | /* msgt_longform = */ FALSE((boolean_t) 0), |
3993 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
3994 | /* msgt_unused = */ 0 |
3995 | }; |
3996 | |
3997 | const mach_msg_type_t ttyType = { |
3998 | /* msgt_name = */ -1, |
3999 | /* msgt_size = */ 32, |
4000 | /* msgt_number = */ 1, |
4001 | /* msgt_inline = */ TRUE((boolean_t) 1), |
4002 | /* msgt_longform = */ FALSE((boolean_t) 0), |
4003 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
4004 | /* msgt_unused = */ 0 |
4005 | }; |
4006 | |
4007 | pstruct_t calling_process; |
4008 | mach_msg_type_name_t ttyPoly; |
4009 | |
4010 | #if TypeCheck1 |
4011 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
4012 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
4013 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
4014 | #endif /* TypeCheck */ |
4015 | |
4016 | #if TypeCheck1 |
4017 | if (BAD_TYPECHECK(&In0P->target_processType, &target_processCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->target_processType); _c. t = *(&target_processCheck);_t.w != _c.w; })), 0)) |
4018 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
4019 | #endif /* TypeCheck */ |
4020 | |
4021 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
4022 | calling_process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
4023 | else |
4024 | calling_process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
4025 | |
4026 | OutP->RetCode = S_proc_get_tty(calling_process, In0P->target_process, &OutP->tty, &ttyPoly); |
4027 | end_using_proc(calling_process); |
4028 | if (OutP->RetCode != KERN_SUCCESS0) |
4029 | return; |
4030 | |
4031 | msgh_simple = TRUE((boolean_t) 1); |
4032 | OutP->Head.msgh_size = 40; |
4033 | |
4034 | OutP->ttyType = ttyType; |
4035 | |
4036 | if (MACH_MSG_TYPE_PORT_ANY(ttyPoly)(((ttyPoly) >= 16) && ((ttyPoly) <= 21))) |
4037 | msgh_simple = FALSE((boolean_t) 0); |
4038 | |
4039 | OutP->ttyType.msgt_name = ttyPoly; |
4040 | |
4041 | if (!msgh_simple) |
4042 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
4043 | } |
4044 | |
4045 | /* Default implementation of S_proc_get_tty */ |
4046 | #ifdef MIG_EOPNOTSUPP |
4047 | kern_return_t __attribute__ ((weak)) |
4048 | S_proc_get_tty |
4049 | ( |
4050 | pstruct_t calling_process, |
4051 | pid_t target_process, |
4052 | mach_port_t *tty, |
4053 | mach_msg_type_name_t *ttyPoly |
4054 | ) { return MIG_EOPNOTSUPP; } |
4055 | #endif /* MIG_EOPNOTSUPP */ |
4056 | |
4057 | /* Routine proc_getnports */ |
4058 | mig_internalstatic void _Xproc_getnports |
4059 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
4060 | { |
4061 | typedef struct { |
4062 | mach_msg_header_t Head; |
4063 | mach_msg_type_t whichType; |
4064 | pid_t which; |
4065 | } Request; |
4066 | |
4067 | typedef struct { |
4068 | mach_msg_header_t Head; |
4069 | mach_msg_type_t RetCodeType; |
4070 | kern_return_t RetCode; |
4071 | mach_msg_type_t nportsType; |
4072 | mach_msg_type_number_t nports; |
4073 | } Reply; |
4074 | |
4075 | Request *In0P = (Request *) InHeadP; |
4076 | Reply *OutP = (Reply *) OutHeadP; |
4077 | mig_external kern_return_t S_proc_getnports |
4078 | (pstruct_t process, pid_t which, mach_msg_type_number_t *nports); |
4079 | |
4080 | const mach_msg_type_t whichCheck = { |
4081 | /* msgt_name = */ 2, |
4082 | /* msgt_size = */ 32, |
4083 | /* msgt_number = */ 1, |
4084 | /* msgt_inline = */ TRUE((boolean_t) 1), |
4085 | /* msgt_longform = */ FALSE((boolean_t) 0), |
4086 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
4087 | /* msgt_unused = */ 0 |
4088 | }; |
4089 | |
4090 | const mach_msg_type_t nportsType = { |
4091 | /* msgt_name = */ 2, |
4092 | /* msgt_size = */ 32, |
4093 | /* msgt_number = */ 1, |
4094 | /* msgt_inline = */ TRUE((boolean_t) 1), |
4095 | /* msgt_longform = */ FALSE((boolean_t) 0), |
4096 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
4097 | /* msgt_unused = */ 0 |
4098 | }; |
4099 | |
4100 | pstruct_t process; |
4101 | |
4102 | #if TypeCheck1 |
4103 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
4104 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
4105 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
4106 | #endif /* TypeCheck */ |
4107 | |
4108 | #if TypeCheck1 |
4109 | if (BAD_TYPECHECK(&In0P->whichType, &whichCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->whichType); _c.t = *(& whichCheck);_t.w != _c.w; })), 0)) |
4110 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
4111 | #endif /* TypeCheck */ |
4112 | |
4113 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
4114 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
4115 | else |
4116 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
4117 | |
4118 | OutP->RetCode = S_proc_getnports(process, In0P->which, &OutP->nports); |
4119 | end_using_proc(process); |
4120 | if (OutP->RetCode != KERN_SUCCESS0) |
4121 | return; |
4122 | |
4123 | OutP->Head.msgh_size = 40; |
4124 | |
4125 | OutP->nportsType = nportsType; |
4126 | } |
4127 | |
4128 | /* Default implementation of S_proc_getnports */ |
4129 | #ifdef MIG_EOPNOTSUPP |
4130 | kern_return_t __attribute__ ((weak)) |
4131 | S_proc_getnports |
4132 | ( |
4133 | pstruct_t process, |
4134 | pid_t which, |
4135 | mach_msg_type_number_t *nports |
4136 | ) { return MIG_EOPNOTSUPP; } |
4137 | #endif /* MIG_EOPNOTSUPP */ |
4138 | |
4139 | /* Routine proc_set_init_task */ |
4140 | mig_internalstatic void _Xproc_set_init_task |
4141 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
4142 | { |
4143 | typedef struct { |
4144 | mach_msg_header_t Head; |
4145 | mach_msg_type_t taskType; |
4146 | mach_port_t task; |
4147 | } Request; |
4148 | |
4149 | typedef struct { |
4150 | mach_msg_header_t Head; |
4151 | mach_msg_type_t RetCodeType; |
4152 | kern_return_t RetCode; |
4153 | } Reply; |
4154 | |
4155 | Request *In0P = (Request *) InHeadP; |
4156 | Reply *OutP = (Reply *) OutHeadP; |
4157 | mig_external kern_return_t S_proc_set_init_task |
4158 | (pstruct_t process, mach_port_t task); |
4159 | |
4160 | const mach_msg_type_t taskCheck = { |
4161 | /* msgt_name = */ 17, |
4162 | /* msgt_size = */ 32, |
4163 | /* msgt_number = */ 1, |
4164 | /* msgt_inline = */ TRUE((boolean_t) 1), |
4165 | /* msgt_longform = */ FALSE((boolean_t) 0), |
4166 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
4167 | /* msgt_unused = */ 0 |
4168 | }; |
4169 | |
4170 | pstruct_t process; |
4171 | |
4172 | #if TypeCheck1 |
4173 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
4174 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
4175 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
4176 | #endif /* TypeCheck */ |
4177 | |
4178 | #if TypeCheck1 |
4179 | if (BAD_TYPECHECK(&In0P->taskType, &taskCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->taskType); _c.t = *(& taskCheck);_t.w != _c.w; })), 0)) |
4180 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
4181 | #endif /* TypeCheck */ |
4182 | |
4183 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
4184 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
4185 | else |
4186 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
4187 | |
4188 | OutP->RetCode = S_proc_set_init_task(process, In0P->task); |
4189 | end_using_proc(process); |
4190 | } |
4191 | |
4192 | /* Default implementation of S_proc_set_init_task */ |
4193 | #ifdef MIG_EOPNOTSUPP |
4194 | kern_return_t __attribute__ ((weak)) |
4195 | S_proc_set_init_task |
4196 | ( |
4197 | pstruct_t process, |
4198 | mach_port_t task |
4199 | ) { return MIG_EOPNOTSUPP; } |
4200 | #endif /* MIG_EOPNOTSUPP */ |
4201 | |
4202 | /* Routine proc_mark_important */ |
4203 | mig_internalstatic void _Xproc_mark_important |
4204 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
4205 | { |
4206 | typedef struct { |
4207 | mach_msg_header_t Head; |
4208 | } Request; |
4209 | |
4210 | typedef struct { |
4211 | mach_msg_header_t Head; |
4212 | mach_msg_type_t RetCodeType; |
4213 | kern_return_t RetCode; |
4214 | } Reply; |
4215 | |
4216 | Request *In0P = (Request *) InHeadP; |
4217 | Reply *OutP = (Reply *) OutHeadP; |
4218 | mig_external kern_return_t S_proc_mark_important |
4219 | (pstruct_t process); |
4220 | |
4221 | pstruct_t process; |
4222 | |
4223 | #if TypeCheck1 |
4224 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
4225 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
4226 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
4227 | #endif /* TypeCheck */ |
4228 | |
4229 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
4230 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
4231 | else |
4232 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
4233 | |
4234 | OutP->RetCode = S_proc_mark_important(process); |
4235 | end_using_proc(process); |
4236 | } |
4237 | |
4238 | /* Default implementation of S_proc_mark_important */ |
4239 | #ifdef MIG_EOPNOTSUPP |
4240 | kern_return_t __attribute__ ((weak)) |
4241 | S_proc_mark_important |
4242 | ( |
4243 | pstruct_t process |
4244 | ) { return MIG_EOPNOTSUPP; } |
4245 | #endif /* MIG_EOPNOTSUPP */ |
4246 | |
4247 | /* Routine proc_is_important */ |
4248 | mig_internalstatic void _Xproc_is_important |
4249 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
4250 | { |
4251 | typedef struct { |
4252 | mach_msg_header_t Head; |
4253 | } Request; |
4254 | |
4255 | typedef struct { |
4256 | mach_msg_header_t Head; |
4257 | mach_msg_type_t RetCodeType; |
4258 | kern_return_t RetCode; |
4259 | mach_msg_type_t essentialType; |
4260 | boolean_t essential; |
4261 | } Reply; |
4262 | |
4263 | Request *In0P = (Request *) InHeadP; |
4264 | Reply *OutP = (Reply *) OutHeadP; |
4265 | mig_external kern_return_t S_proc_is_important |
4266 | (pstruct_t process, boolean_t *essential); |
4267 | |
4268 | const mach_msg_type_t essentialType = { |
4269 | /* msgt_name = */ 0, |
4270 | /* msgt_size = */ 32, |
4271 | /* msgt_number = */ 1, |
4272 | /* msgt_inline = */ TRUE((boolean_t) 1), |
4273 | /* msgt_longform = */ FALSE((boolean_t) 0), |
4274 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
4275 | /* msgt_unused = */ 0 |
4276 | }; |
4277 | |
4278 | pstruct_t process; |
4279 | |
4280 | #if TypeCheck1 |
4281 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
4282 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
4283 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
4284 | #endif /* TypeCheck */ |
4285 | |
4286 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
4287 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
4288 | else |
4289 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
4290 | |
4291 | OutP->RetCode = S_proc_is_important(process, &OutP->essential); |
4292 | end_using_proc(process); |
4293 | if (OutP->RetCode != KERN_SUCCESS0) |
4294 | return; |
4295 | |
4296 | OutP->Head.msgh_size = 40; |
4297 | |
4298 | OutP->essentialType = essentialType; |
4299 | } |
4300 | |
4301 | /* Default implementation of S_proc_is_important */ |
4302 | #ifdef MIG_EOPNOTSUPP |
4303 | kern_return_t __attribute__ ((weak)) |
4304 | S_proc_is_important |
4305 | ( |
4306 | pstruct_t process, |
4307 | boolean_t *essential |
4308 | ) { return MIG_EOPNOTSUPP; } |
4309 | #endif /* MIG_EOPNOTSUPP */ |
4310 | |
4311 | /* Routine proc_set_code */ |
4312 | mig_internalstatic void _Xproc_set_code |
4313 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
4314 | { |
4315 | typedef struct { |
4316 | mach_msg_header_t Head; |
4317 | mach_msg_type_t start_codeType; |
4318 | vm_address_t start_code; |
4319 | mach_msg_type_t end_codeType; |
4320 | vm_address_t end_code; |
4321 | } Request; |
4322 | |
4323 | typedef struct { |
4324 | mach_msg_header_t Head; |
4325 | mach_msg_type_t RetCodeType; |
4326 | kern_return_t RetCode; |
4327 | } Reply; |
4328 | |
4329 | Request *In0P = (Request *) InHeadP; |
4330 | Reply *OutP = (Reply *) OutHeadP; |
4331 | mig_external kern_return_t S_proc_set_code |
4332 | (pstruct_t process, vm_address_t start_code, vm_address_t end_code); |
4333 | |
4334 | const mach_msg_type_t start_codeCheck = { |
4335 | /* msgt_name = */ 2, |
4336 | /* msgt_size = */ 32, |
4337 | /* msgt_number = */ 1, |
4338 | /* msgt_inline = */ TRUE((boolean_t) 1), |
4339 | /* msgt_longform = */ FALSE((boolean_t) 0), |
4340 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
4341 | /* msgt_unused = */ 0 |
4342 | }; |
4343 | |
4344 | const mach_msg_type_t end_codeCheck = { |
4345 | /* msgt_name = */ 2, |
4346 | /* msgt_size = */ 32, |
4347 | /* msgt_number = */ 1, |
4348 | /* msgt_inline = */ TRUE((boolean_t) 1), |
4349 | /* msgt_longform = */ FALSE((boolean_t) 0), |
4350 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
4351 | /* msgt_unused = */ 0 |
4352 | }; |
4353 | |
4354 | pstruct_t process; |
4355 | |
4356 | #if TypeCheck1 |
4357 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
4358 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
4359 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
4360 | #endif /* TypeCheck */ |
4361 | |
4362 | #if TypeCheck1 |
4363 | if (BAD_TYPECHECK(&In0P->start_codeType, &start_codeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->start_codeType); _c.t = * (&start_codeCheck);_t.w != _c.w; })), 0)) |
4364 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
4365 | #endif /* TypeCheck */ |
4366 | |
4367 | #if TypeCheck1 |
4368 | if (BAD_TYPECHECK(&In0P->end_codeType, &end_codeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->end_codeType); _c.t = *( &end_codeCheck);_t.w != _c.w; })), 0)) |
4369 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
4370 | #endif /* TypeCheck */ |
4371 | |
4372 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
4373 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
4374 | else |
4375 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
4376 | |
4377 | OutP->RetCode = S_proc_set_code(process, In0P->start_code, In0P->end_code); |
4378 | end_using_proc(process); |
4379 | } |
4380 | |
4381 | /* Default implementation of S_proc_set_code */ |
4382 | #ifdef MIG_EOPNOTSUPP |
4383 | kern_return_t __attribute__ ((weak)) |
4384 | S_proc_set_code |
4385 | ( |
4386 | pstruct_t process, |
4387 | vm_address_t start_code, |
4388 | vm_address_t end_code |
4389 | ) { return MIG_EOPNOTSUPP; } |
4390 | #endif /* MIG_EOPNOTSUPP */ |
4391 | |
4392 | /* Routine proc_get_code */ |
4393 | mig_internalstatic void _Xproc_get_code |
4394 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
4395 | { |
4396 | typedef struct { |
4397 | mach_msg_header_t Head; |
4398 | } Request; |
4399 | |
4400 | typedef struct { |
4401 | mach_msg_header_t Head; |
4402 | mach_msg_type_t RetCodeType; |
4403 | kern_return_t RetCode; |
4404 | mach_msg_type_t start_codeType; |
4405 | vm_address_t start_code; |
4406 | mach_msg_type_t end_codeType; |
4407 | vm_address_t end_code; |
4408 | } Reply; |
4409 | |
4410 | Request *In0P = (Request *) InHeadP; |
4411 | Reply *OutP = (Reply *) OutHeadP; |
4412 | mig_external kern_return_t S_proc_get_code |
4413 | (pstruct_t process, vm_address_t *start_code, vm_address_t *end_code); |
4414 | |
4415 | const mach_msg_type_t start_codeType = { |
4416 | /* msgt_name = */ 2, |
4417 | /* msgt_size = */ 32, |
4418 | /* msgt_number = */ 1, |
4419 | /* msgt_inline = */ TRUE((boolean_t) 1), |
4420 | /* msgt_longform = */ FALSE((boolean_t) 0), |
4421 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
4422 | /* msgt_unused = */ 0 |
4423 | }; |
4424 | |
4425 | const mach_msg_type_t end_codeType = { |
4426 | /* msgt_name = */ 2, |
4427 | /* msgt_size = */ 32, |
4428 | /* msgt_number = */ 1, |
4429 | /* msgt_inline = */ TRUE((boolean_t) 1), |
4430 | /* msgt_longform = */ FALSE((boolean_t) 0), |
4431 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
4432 | /* msgt_unused = */ 0 |
4433 | }; |
4434 | |
4435 | pstruct_t process; |
4436 | |
4437 | #if TypeCheck1 |
4438 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
4439 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
4440 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
4441 | #endif /* TypeCheck */ |
4442 | |
4443 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
4444 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
4445 | else |
4446 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
4447 | |
4448 | OutP->RetCode = S_proc_get_code(process, &OutP->start_code, &OutP->end_code); |
4449 | end_using_proc(process); |
4450 | if (OutP->RetCode != KERN_SUCCESS0) |
4451 | return; |
4452 | |
4453 | OutP->Head.msgh_size = 48; |
4454 | |
4455 | OutP->start_codeType = start_codeType; |
4456 | |
4457 | OutP->end_codeType = end_codeType; |
4458 | } |
4459 | |
4460 | /* Default implementation of S_proc_get_code */ |
4461 | #ifdef MIG_EOPNOTSUPP |
4462 | kern_return_t __attribute__ ((weak)) |
4463 | S_proc_get_code |
4464 | ( |
4465 | pstruct_t process, |
4466 | vm_address_t *start_code, |
4467 | vm_address_t *end_code |
4468 | ) { return MIG_EOPNOTSUPP; } |
4469 | #endif /* MIG_EOPNOTSUPP */ |
4470 | |
4471 | /* Routine proc_make_task_namespace */ |
4472 | mig_internalstatic void _Xproc_make_task_namespace |
4473 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
4474 | { |
4475 | typedef struct { |
4476 | mach_msg_header_t Head; |
4477 | mach_msg_type_t notifyType; |
4478 | mach_port_t notify; |
4479 | } Request; |
4480 | |
4481 | typedef struct { |
4482 | mach_msg_header_t Head; |
4483 | mach_msg_type_t RetCodeType; |
4484 | kern_return_t RetCode; |
4485 | } Reply; |
4486 | |
4487 | Request *In0P = (Request *) InHeadP; |
4488 | Reply *OutP = (Reply *) OutHeadP; |
4489 | mig_external kern_return_t S_proc_make_task_namespace |
4490 | (pstruct_t process, mach_port_t notify); |
4491 | |
4492 | const mach_msg_type_t notifyCheck = { |
4493 | /* msgt_name = */ 17, |
4494 | /* msgt_size = */ 32, |
4495 | /* msgt_number = */ 1, |
4496 | /* msgt_inline = */ TRUE((boolean_t) 1), |
4497 | /* msgt_longform = */ FALSE((boolean_t) 0), |
4498 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
4499 | /* msgt_unused = */ 0 |
4500 | }; |
4501 | |
4502 | pstruct_t process; |
4503 | |
4504 | #if TypeCheck1 |
4505 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
4506 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
4507 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
4508 | #endif /* TypeCheck */ |
4509 | |
4510 | #if TypeCheck1 |
4511 | if (BAD_TYPECHECK(&In0P->notifyType, ¬ifyCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->notifyType); _c.t = *(& notifyCheck);_t.w != _c.w; })), 0)) |
4512 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
4513 | #endif /* TypeCheck */ |
4514 | |
4515 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
4516 | process = begin_using_proc_payload(In0P->Head.msgh_protected_payload); |
4517 | else |
4518 | process = begin_using_proc_port(In0P->Head.msgh_request_portmsgh_local_port); |
4519 | |
4520 | OutP->RetCode = S_proc_make_task_namespace(process, In0P->notify); |
4521 | end_using_proc(process); |
4522 | } |
4523 | |
4524 | /* Default implementation of S_proc_make_task_namespace */ |
4525 | #ifdef MIG_EOPNOTSUPP |
4526 | kern_return_t __attribute__ ((weak)) |
4527 | S_proc_make_task_namespace |
4528 | ( |
4529 | pstruct_t process, |
4530 | mach_port_t notify |
4531 | ) { return MIG_EOPNOTSUPP; } |
4532 | #endif /* MIG_EOPNOTSUPP */ |
4533 | |
4534 | mig_routine_t process_server_routines[] = { |
4535 | 0, |
4536 | 0, |
4537 | 0, |
4538 | 0, |
4539 | _Xproc_getprivports, |
4540 | _Xproc_getallpids, |
4541 | _Xproc_setexecdata, |
4542 | _Xproc_getexecdata, |
4543 | _Xproc_execdata_notify, |
4544 | _Xproc_uname, |
4545 | _Xproc_register_version, |
4546 | _Xproc_reauthenticate, |
4547 | _Xproc_child, |
4548 | _Xproc_setmsgport, |
4549 | _Xproc_reassign, |
4550 | _Xproc_setowner, |
4551 | _Xproc_getpids, |
4552 | _Xproc_set_arg_locations, |
4553 | _Xproc_get_arg_locations, |
4554 | _Xproc_getmsgport, |
4555 | _Xproc_wait, |
4556 | _Xproc_dostop, |
4557 | _Xproc_handle_exceptions, |
4558 | _Xproc_mark_stop, |
4559 | _Xproc_mark_cont, |
4560 | _Xproc_mark_exit, |
4561 | _Xproc_mark_exec, |
4562 | _Xproc_mark_traced, |
4563 | _Xproc_mod_stopchild, |
4564 | _Xproc_pid2task, |
4565 | _Xproc_task2pid, |
4566 | _Xproc_task2proc, |
4567 | _Xproc_proc2task, |
4568 | _Xproc_pid2proc, |
4569 | _Xproc_getprocinfo, |
4570 | _Xproc_getprocargs, |
4571 | _Xproc_getprocenv, |
4572 | _Xproc_make_login_coll, |
4573 | _Xproc_getloginid, |
4574 | _Xproc_getloginpids, |
4575 | _Xproc_setlogin, |
4576 | _Xproc_getlogin, |
4577 | _Xproc_setsid, |
4578 | _Xproc_getsid, |
4579 | _Xproc_getsessionpgids, |
4580 | _Xproc_getsessionpids, |
4581 | _Xproc_getsidport, |
4582 | _Xproc_setpgrp, |
4583 | _Xproc_getpgrp, |
4584 | _Xproc_getpgrppids, |
4585 | _Xproc_get_tty, |
4586 | _Xproc_getnports, |
4587 | _Xproc_set_init_task, |
4588 | _Xproc_mark_important, |
4589 | _Xproc_is_important, |
4590 | _Xproc_set_code, |
4591 | _Xproc_get_code, |
4592 | _Xproc_make_task_namespace, |
4593 | }; |
4594 | |
4595 | mig_external boolean_t process_server |
4596 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
4597 | { |
4598 | mach_msg_header_t *InP = InHeadP; |
4599 | mig_reply_header_t *OutP = (mig_reply_header_t *) OutHeadP; |
4600 | |
4601 | const mach_msg_type_t RetCodeType = { |
4602 | /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322, |
4603 | /* msgt_size = */ 32, |
4604 | /* msgt_number = */ 1, |
4605 | /* msgt_inline = */ TRUE((boolean_t) 1), |
4606 | /* msgt_longform = */ FALSE((boolean_t) 0), |
4607 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
4608 | /* msgt_unused = */ 0 |
4609 | }; |
4610 | |
4611 | mig_routine_t routine; |
4612 | |
4613 | OutP->Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InP->msgh_bits), 0)((((InP->msgh_bits) & 0x000000ff)) | ((0) << 8)); |
4614 | OutP->Head.msgh_size = sizeof *OutP; |
4615 | OutP->Head.msgh_remote_port = InP->msgh_reply_portmsgh_remote_port; |
4616 | OutP->Head.msgh_local_port = MACH_PORT_NULL((mach_port_t) 0); |
4617 | OutP->Head.msgh_seqno = 0; |
4618 | OutP->Head.msgh_id = InP->msgh_id + 100; |
4619 | |
4620 | OutP->RetCodeType = RetCodeType; |
4621 | |
4622 | if ((InP->msgh_id > 24057) || (InP->msgh_id < 24000) || |
4623 | ((routine = process_server_routines[InP->msgh_id - 24000]) == 0)) { |
4624 | OutP->RetCode = MIG_BAD_ID-303; |
4625 | return FALSE((boolean_t) 0); |
4626 | } |
4627 | (*routine) (InP, &OutP->Head); |
4628 | return TRUE((boolean_t) 1); |
4629 | } |
4630 | |
4631 | mig_external mig_routine_t process_server_routine |
4632 | (const mach_msg_header_t *InHeadP) |
4633 | { |
4634 | int msgh_id; |
4635 | |
4636 | msgh_id = InHeadP->msgh_id - 24000; |
4637 | |
4638 | if ((msgh_id > 57) || (msgh_id < 0)) |
4639 | return 0; |
4640 | |
4641 | return process_server_routines[msgh_id]; |
4642 | } |
4643 |