File: | obj-scan-build/boot/termServer.c |
Location: | line 74, column 2 |
Description: | Assigned value is garbage or undefined |
1 | /* Module term */ |
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 <mach/std_types.h> |
43 | #include <mach/mach_types.h> |
44 | #include <device/device_types.h> |
45 | #include <device/net_status.h> |
46 | #include <sys/types.h> |
47 | #include <sys/stat.h> |
48 | #include <sys/statfs.h> |
49 | #include <sys/resource.h> |
50 | #include <sys/utsname.h> |
51 | #include <hurd/hurd_types.h> |
52 | |
53 | /* Routine term_getctty */ |
54 | mig_internalstatic void _Xterm_getctty |
55 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
56 | { |
57 | typedef struct { |
58 | mach_msg_header_t Head; |
59 | } Request; |
60 | |
61 | typedef struct { |
62 | mach_msg_header_t Head; |
63 | mach_msg_type_t RetCodeType; |
64 | kern_return_t RetCode; |
65 | mach_msg_type_t cttyType; |
66 | mach_port_t ctty; |
67 | } Reply; |
68 | |
69 | Request *In0P = (Request *) InHeadP; |
70 | Reply *OutP = (Reply *) OutHeadP; |
71 | mig_external kern_return_t S_term_getctty |
72 | (io_t terminal, mach_port_t *ctty, mach_msg_type_name_t *cttyPoly); |
73 | |
74 | boolean_t msgh_simple = msgh_simple; |
Assigned value is garbage or undefined | |
75 | const mach_msg_type_t cttyType = { |
76 | /* msgt_name = */ -1, |
77 | /* msgt_size = */ 32, |
78 | /* msgt_number = */ 1, |
79 | /* msgt_inline = */ TRUE((boolean_t) 1), |
80 | /* msgt_longform = */ FALSE((boolean_t) 0), |
81 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
82 | /* msgt_unused = */ 0 |
83 | }; |
84 | |
85 | mach_msg_type_name_t cttyPoly; |
86 | |
87 | #if TypeCheck1 |
88 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
89 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
90 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
91 | #endif /* TypeCheck */ |
92 | |
93 | OutP->RetCode = S_term_getctty(In0P->Head.msgh_request_portmsgh_local_port, &OutP->ctty, &cttyPoly); |
94 | if (OutP->RetCode != KERN_SUCCESS0) |
95 | return; |
96 | |
97 | msgh_simple = TRUE((boolean_t) 1); |
98 | OutP->Head.msgh_size = 40; |
99 | |
100 | OutP->cttyType = cttyType; |
101 | |
102 | if (MACH_MSG_TYPE_PORT_ANY(cttyPoly)(((cttyPoly) >= 16) && ((cttyPoly) <= 21))) |
103 | msgh_simple = FALSE((boolean_t) 0); |
104 | |
105 | OutP->cttyType.msgt_name = cttyPoly; |
106 | |
107 | if (!msgh_simple) |
108 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
109 | } |
110 | |
111 | /* Default implementation of S_term_getctty */ |
112 | #ifdef MIG_EOPNOTSUPP |
113 | kern_return_t __attribute__ ((weak)) |
114 | S_term_getctty |
115 | ( |
116 | io_t terminal, |
117 | mach_port_t *ctty, |
118 | mach_msg_type_name_t *cttyPoly |
119 | ) { return MIG_EOPNOTSUPP; } |
120 | #endif /* MIG_EOPNOTSUPP */ |
121 | |
122 | /* Routine term_open_ctty */ |
123 | mig_internalstatic void _Xterm_open_ctty |
124 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
125 | { |
126 | typedef struct { |
127 | mach_msg_header_t Head; |
128 | mach_msg_type_t pidType; |
129 | pid_t pid; |
130 | mach_msg_type_t pgrpType; |
131 | pid_t pgrp; |
132 | } Request; |
133 | |
134 | typedef struct { |
135 | mach_msg_header_t Head; |
136 | mach_msg_type_t RetCodeType; |
137 | kern_return_t RetCode; |
138 | mach_msg_type_t newttyType; |
139 | mach_port_t newtty; |
140 | } Reply; |
141 | |
142 | Request *In0P = (Request *) InHeadP; |
143 | Reply *OutP = (Reply *) OutHeadP; |
144 | mig_external kern_return_t S_term_open_ctty |
145 | (io_t terminal, pid_t pid, pid_t pgrp, mach_port_t *newtty, mach_msg_type_name_t *newttyPoly); |
146 | |
147 | boolean_t msgh_simple = msgh_simple; |
148 | const mach_msg_type_t pidCheck = { |
149 | /* msgt_name = */ 2, |
150 | /* msgt_size = */ 32, |
151 | /* msgt_number = */ 1, |
152 | /* msgt_inline = */ TRUE((boolean_t) 1), |
153 | /* msgt_longform = */ FALSE((boolean_t) 0), |
154 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
155 | /* msgt_unused = */ 0 |
156 | }; |
157 | |
158 | const mach_msg_type_t pgrpCheck = { |
159 | /* msgt_name = */ 2, |
160 | /* msgt_size = */ 32, |
161 | /* msgt_number = */ 1, |
162 | /* msgt_inline = */ TRUE((boolean_t) 1), |
163 | /* msgt_longform = */ FALSE((boolean_t) 0), |
164 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
165 | /* msgt_unused = */ 0 |
166 | }; |
167 | |
168 | const mach_msg_type_t newttyType = { |
169 | /* msgt_name = */ -1, |
170 | /* msgt_size = */ 32, |
171 | /* msgt_number = */ 1, |
172 | /* msgt_inline = */ TRUE((boolean_t) 1), |
173 | /* msgt_longform = */ FALSE((boolean_t) 0), |
174 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
175 | /* msgt_unused = */ 0 |
176 | }; |
177 | |
178 | mach_msg_type_name_t newttyPoly; |
179 | |
180 | #if TypeCheck1 |
181 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
182 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
183 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
184 | #endif /* TypeCheck */ |
185 | |
186 | #if TypeCheck1 |
187 | 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)) |
188 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
189 | #endif /* TypeCheck */ |
190 | |
191 | #if TypeCheck1 |
192 | 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)) |
193 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
194 | #endif /* TypeCheck */ |
195 | |
196 | OutP->RetCode = S_term_open_ctty(In0P->Head.msgh_request_portmsgh_local_port, In0P->pid, In0P->pgrp, &OutP->newtty, &newttyPoly); |
197 | if (OutP->RetCode != KERN_SUCCESS0) |
198 | return; |
199 | |
200 | msgh_simple = TRUE((boolean_t) 1); |
201 | OutP->Head.msgh_size = 40; |
202 | |
203 | OutP->newttyType = newttyType; |
204 | |
205 | if (MACH_MSG_TYPE_PORT_ANY(newttyPoly)(((newttyPoly) >= 16) && ((newttyPoly) <= 21))) |
206 | msgh_simple = FALSE((boolean_t) 0); |
207 | |
208 | OutP->newttyType.msgt_name = newttyPoly; |
209 | |
210 | if (!msgh_simple) |
211 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
212 | } |
213 | |
214 | /* Default implementation of S_term_open_ctty */ |
215 | #ifdef MIG_EOPNOTSUPP |
216 | kern_return_t __attribute__ ((weak)) |
217 | S_term_open_ctty |
218 | ( |
219 | io_t terminal, |
220 | pid_t pid, |
221 | pid_t pgrp, |
222 | mach_port_t *newtty, |
223 | mach_msg_type_name_t *newttyPoly |
224 | ) { return MIG_EOPNOTSUPP; } |
225 | #endif /* MIG_EOPNOTSUPP */ |
226 | |
227 | /* Routine term_set_nodename */ |
228 | mig_internalstatic void _Xterm_set_nodename |
229 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
230 | { |
231 | typedef struct { |
232 | mach_msg_header_t Head; |
233 | mach_msg_type_t nameType; |
234 | string_t name; |
235 | } Request; |
236 | |
237 | typedef struct { |
238 | mach_msg_header_t Head; |
239 | mach_msg_type_t RetCodeType; |
240 | kern_return_t RetCode; |
241 | } Reply; |
242 | |
243 | Request *In0P = (Request *) InHeadP; |
244 | Reply *OutP = (Reply *) OutHeadP; |
245 | mig_external kern_return_t S_term_set_nodename |
246 | (io_t terminal, string_t name); |
247 | |
248 | const mach_msg_type_t nameCheck = { |
249 | /* msgt_name = */ MACH_MSG_TYPE_STRING_C12, |
250 | /* msgt_size = */ 8, |
251 | /* msgt_number = */ 1024, |
252 | /* msgt_inline = */ TRUE((boolean_t) 1), |
253 | /* msgt_longform = */ FALSE((boolean_t) 0), |
254 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
255 | /* msgt_unused = */ 0 |
256 | }; |
257 | |
258 | #if TypeCheck1 |
259 | if (mig_unlikely ((In0P->Head.msgh_size != 1052) ||__builtin_expect (!! ((In0P->Head.msgh_size != 1052) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
260 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 1052) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
261 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
262 | #endif /* TypeCheck */ |
263 | |
264 | #if TypeCheck1 |
265 | 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)) |
266 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
267 | #endif /* TypeCheck */ |
268 | |
269 | OutP->RetCode = S_term_set_nodename(In0P->Head.msgh_request_portmsgh_local_port, In0P->name); |
270 | } |
271 | |
272 | /* Default implementation of S_term_set_nodename */ |
273 | #ifdef MIG_EOPNOTSUPP |
274 | kern_return_t __attribute__ ((weak)) |
275 | S_term_set_nodename |
276 | ( |
277 | io_t terminal, |
278 | string_t name |
279 | ) { return MIG_EOPNOTSUPP; } |
280 | #endif /* MIG_EOPNOTSUPP */ |
281 | |
282 | /* Routine term_get_nodename */ |
283 | mig_internalstatic void _Xterm_get_nodename |
284 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
285 | { |
286 | typedef struct { |
287 | mach_msg_header_t Head; |
288 | } Request; |
289 | |
290 | typedef struct { |
291 | mach_msg_header_t Head; |
292 | mach_msg_type_t RetCodeType; |
293 | kern_return_t RetCode; |
294 | mach_msg_type_t nameType; |
295 | string_t name; |
296 | } Reply; |
297 | |
298 | Request *In0P = (Request *) InHeadP; |
299 | Reply *OutP = (Reply *) OutHeadP; |
300 | mig_external kern_return_t S_term_get_nodename |
301 | (io_t terminal, string_t name); |
302 | |
303 | const mach_msg_type_t nameType = { |
304 | /* msgt_name = */ MACH_MSG_TYPE_STRING_C12, |
305 | /* msgt_size = */ 8, |
306 | /* msgt_number = */ 1024, |
307 | /* msgt_inline = */ TRUE((boolean_t) 1), |
308 | /* msgt_longform = */ FALSE((boolean_t) 0), |
309 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
310 | /* msgt_unused = */ 0 |
311 | }; |
312 | |
313 | #if TypeCheck1 |
314 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
315 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
316 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
317 | #endif /* TypeCheck */ |
318 | |
319 | OutP->RetCode = S_term_get_nodename(In0P->Head.msgh_request_portmsgh_local_port, OutP->name); |
320 | if (OutP->RetCode != KERN_SUCCESS0) |
321 | return; |
322 | |
323 | OutP->Head.msgh_size = 1060; |
324 | |
325 | OutP->nameType = nameType; |
326 | } |
327 | |
328 | /* Default implementation of S_term_get_nodename */ |
329 | #ifdef MIG_EOPNOTSUPP |
330 | kern_return_t __attribute__ ((weak)) |
331 | S_term_get_nodename |
332 | ( |
333 | io_t terminal, |
334 | string_t name |
335 | ) { return MIG_EOPNOTSUPP; } |
336 | #endif /* MIG_EOPNOTSUPP */ |
337 | |
338 | /* Routine term_set_filenode */ |
339 | mig_internalstatic void _Xterm_set_filenode |
340 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
341 | { |
342 | typedef struct { |
343 | mach_msg_header_t Head; |
344 | mach_msg_type_t filenodeType; |
345 | file_t filenode; |
346 | } Request; |
347 | |
348 | typedef struct { |
349 | mach_msg_header_t Head; |
350 | mach_msg_type_t RetCodeType; |
351 | kern_return_t RetCode; |
352 | } Reply; |
353 | |
354 | Request *In0P = (Request *) InHeadP; |
355 | Reply *OutP = (Reply *) OutHeadP; |
356 | mig_external kern_return_t S_term_set_filenode |
357 | (io_t terminal, file_t filenode); |
358 | |
359 | const mach_msg_type_t filenodeCheck = { |
360 | /* msgt_name = */ 17, |
361 | /* msgt_size = */ 32, |
362 | /* msgt_number = */ 1, |
363 | /* msgt_inline = */ TRUE((boolean_t) 1), |
364 | /* msgt_longform = */ FALSE((boolean_t) 0), |
365 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
366 | /* msgt_unused = */ 0 |
367 | }; |
368 | |
369 | #if TypeCheck1 |
370 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
371 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
372 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
373 | #endif /* TypeCheck */ |
374 | |
375 | #if TypeCheck1 |
376 | if (BAD_TYPECHECK(&In0P->filenodeType, &filenodeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->filenodeType); _c.t = *( &filenodeCheck);_t.w != _c.w; })), 0)) |
377 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
378 | #endif /* TypeCheck */ |
379 | |
380 | OutP->RetCode = S_term_set_filenode(In0P->Head.msgh_request_portmsgh_local_port, In0P->filenode); |
381 | } |
382 | |
383 | /* Default implementation of S_term_set_filenode */ |
384 | #ifdef MIG_EOPNOTSUPP |
385 | kern_return_t __attribute__ ((weak)) |
386 | S_term_set_filenode |
387 | ( |
388 | io_t terminal, |
389 | file_t filenode |
390 | ) { return MIG_EOPNOTSUPP; } |
391 | #endif /* MIG_EOPNOTSUPP */ |
392 | |
393 | /* Routine term_get_bottom_type */ |
394 | mig_internalstatic void _Xterm_get_bottom_type |
395 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
396 | { |
397 | typedef struct { |
398 | mach_msg_header_t Head; |
399 | } Request; |
400 | |
401 | typedef struct { |
402 | mach_msg_header_t Head; |
403 | mach_msg_type_t RetCodeType; |
404 | kern_return_t RetCode; |
405 | mach_msg_type_t ttypeType; |
406 | int ttype; |
407 | } Reply; |
408 | |
409 | Request *In0P = (Request *) InHeadP; |
410 | Reply *OutP = (Reply *) OutHeadP; |
411 | mig_external kern_return_t S_term_get_bottom_type |
412 | (io_t terminal, int *ttype); |
413 | |
414 | const mach_msg_type_t ttypeType = { |
415 | /* msgt_name = */ 2, |
416 | /* msgt_size = */ 32, |
417 | /* msgt_number = */ 1, |
418 | /* msgt_inline = */ TRUE((boolean_t) 1), |
419 | /* msgt_longform = */ FALSE((boolean_t) 0), |
420 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
421 | /* msgt_unused = */ 0 |
422 | }; |
423 | |
424 | #if TypeCheck1 |
425 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
426 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
427 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
428 | #endif /* TypeCheck */ |
429 | |
430 | OutP->RetCode = S_term_get_bottom_type(In0P->Head.msgh_request_portmsgh_local_port, &OutP->ttype); |
431 | if (OutP->RetCode != KERN_SUCCESS0) |
432 | return; |
433 | |
434 | OutP->Head.msgh_size = 40; |
435 | |
436 | OutP->ttypeType = ttypeType; |
437 | } |
438 | |
439 | /* Default implementation of S_term_get_bottom_type */ |
440 | #ifdef MIG_EOPNOTSUPP |
441 | kern_return_t __attribute__ ((weak)) |
442 | S_term_get_bottom_type |
443 | ( |
444 | io_t terminal, |
445 | int *ttype |
446 | ) { return MIG_EOPNOTSUPP; } |
447 | #endif /* MIG_EOPNOTSUPP */ |
448 | |
449 | /* Routine term_on_machdev */ |
450 | mig_internalstatic void _Xterm_on_machdev |
451 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
452 | { |
453 | typedef struct { |
454 | mach_msg_header_t Head; |
455 | mach_msg_type_t machdevType; |
456 | mach_port_t machdev; |
457 | } Request; |
458 | |
459 | typedef struct { |
460 | mach_msg_header_t Head; |
461 | mach_msg_type_t RetCodeType; |
462 | kern_return_t RetCode; |
463 | } Reply; |
464 | |
465 | Request *In0P = (Request *) InHeadP; |
466 | Reply *OutP = (Reply *) OutHeadP; |
467 | mig_external kern_return_t S_term_on_machdev |
468 | (io_t terminal, mach_port_t machdev); |
469 | |
470 | const mach_msg_type_t machdevCheck = { |
471 | /* msgt_name = */ 17, |
472 | /* msgt_size = */ 32, |
473 | /* msgt_number = */ 1, |
474 | /* msgt_inline = */ TRUE((boolean_t) 1), |
475 | /* msgt_longform = */ FALSE((boolean_t) 0), |
476 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
477 | /* msgt_unused = */ 0 |
478 | }; |
479 | |
480 | #if TypeCheck1 |
481 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
482 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
483 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
484 | #endif /* TypeCheck */ |
485 | |
486 | #if TypeCheck1 |
487 | if (BAD_TYPECHECK(&In0P->machdevType, &machdevCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->machdevType); _c.t = *(& machdevCheck);_t.w != _c.w; })), 0)) |
488 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
489 | #endif /* TypeCheck */ |
490 | |
491 | OutP->RetCode = S_term_on_machdev(In0P->Head.msgh_request_portmsgh_local_port, In0P->machdev); |
492 | } |
493 | |
494 | /* Default implementation of S_term_on_machdev */ |
495 | #ifdef MIG_EOPNOTSUPP |
496 | kern_return_t __attribute__ ((weak)) |
497 | S_term_on_machdev |
498 | ( |
499 | io_t terminal, |
500 | mach_port_t machdev |
501 | ) { return MIG_EOPNOTSUPP; } |
502 | #endif /* MIG_EOPNOTSUPP */ |
503 | |
504 | /* Routine term_on_hurddev */ |
505 | mig_internalstatic void _Xterm_on_hurddev |
506 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
507 | { |
508 | typedef struct { |
509 | mach_msg_header_t Head; |
510 | mach_msg_type_t hurddevType; |
511 | io_t hurddev; |
512 | } Request; |
513 | |
514 | typedef struct { |
515 | mach_msg_header_t Head; |
516 | mach_msg_type_t RetCodeType; |
517 | kern_return_t RetCode; |
518 | } Reply; |
519 | |
520 | Request *In0P = (Request *) InHeadP; |
521 | Reply *OutP = (Reply *) OutHeadP; |
522 | mig_external kern_return_t S_term_on_hurddev |
523 | (io_t terminal, io_t hurddev); |
524 | |
525 | const mach_msg_type_t hurddevCheck = { |
526 | /* msgt_name = */ 17, |
527 | /* msgt_size = */ 32, |
528 | /* msgt_number = */ 1, |
529 | /* msgt_inline = */ TRUE((boolean_t) 1), |
530 | /* msgt_longform = */ FALSE((boolean_t) 0), |
531 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
532 | /* msgt_unused = */ 0 |
533 | }; |
534 | |
535 | #if TypeCheck1 |
536 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
537 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
538 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
539 | #endif /* TypeCheck */ |
540 | |
541 | #if TypeCheck1 |
542 | if (BAD_TYPECHECK(&In0P->hurddevType, &hurddevCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->hurddevType); _c.t = *(& hurddevCheck);_t.w != _c.w; })), 0)) |
543 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
544 | #endif /* TypeCheck */ |
545 | |
546 | OutP->RetCode = S_term_on_hurddev(In0P->Head.msgh_request_portmsgh_local_port, In0P->hurddev); |
547 | } |
548 | |
549 | /* Default implementation of S_term_on_hurddev */ |
550 | #ifdef MIG_EOPNOTSUPP |
551 | kern_return_t __attribute__ ((weak)) |
552 | S_term_on_hurddev |
553 | ( |
554 | io_t terminal, |
555 | io_t hurddev |
556 | ) { return MIG_EOPNOTSUPP; } |
557 | #endif /* MIG_EOPNOTSUPP */ |
558 | |
559 | /* Routine term_on_pty */ |
560 | mig_internalstatic void _Xterm_on_pty |
561 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
562 | { |
563 | typedef struct { |
564 | mach_msg_header_t Head; |
565 | } Request; |
566 | |
567 | typedef struct { |
568 | mach_msg_header_t Head; |
569 | mach_msg_type_t RetCodeType; |
570 | kern_return_t RetCode; |
571 | mach_msg_type_t ptymasterType; |
572 | io_t ptymaster; |
573 | } Reply; |
574 | |
575 | Request *In0P = (Request *) InHeadP; |
576 | Reply *OutP = (Reply *) OutHeadP; |
577 | mig_external kern_return_t S_term_on_pty |
578 | (io_t terminal, io_t *ptymaster); |
579 | |
580 | const mach_msg_type_t ptymasterType = { |
581 | /* msgt_name = */ 19, |
582 | /* msgt_size = */ 32, |
583 | /* msgt_number = */ 1, |
584 | /* msgt_inline = */ TRUE((boolean_t) 1), |
585 | /* msgt_longform = */ FALSE((boolean_t) 0), |
586 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
587 | /* msgt_unused = */ 0 |
588 | }; |
589 | |
590 | #if TypeCheck1 |
591 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
592 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
593 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
594 | #endif /* TypeCheck */ |
595 | |
596 | OutP->RetCode = S_term_on_pty(In0P->Head.msgh_request_portmsgh_local_port, &OutP->ptymaster); |
597 | if (OutP->RetCode != KERN_SUCCESS0) |
598 | return; |
599 | |
600 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
601 | OutP->Head.msgh_size = 40; |
602 | |
603 | OutP->ptymasterType = ptymasterType; |
604 | } |
605 | |
606 | /* Default implementation of S_term_on_pty */ |
607 | #ifdef MIG_EOPNOTSUPP |
608 | kern_return_t __attribute__ ((weak)) |
609 | S_term_on_pty |
610 | ( |
611 | io_t terminal, |
612 | io_t *ptymaster |
613 | ) { return MIG_EOPNOTSUPP; } |
614 | #endif /* MIG_EOPNOTSUPP */ |
615 | |
616 | /* Routine termctty_open_terminal */ |
617 | mig_internalstatic void _Xtermctty_open_terminal |
618 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
619 | { |
620 | typedef struct { |
621 | mach_msg_header_t Head; |
622 | mach_msg_type_t flagsType; |
623 | int flags; |
624 | } Request; |
625 | |
626 | typedef struct { |
627 | mach_msg_header_t Head; |
628 | mach_msg_type_t RetCodeType; |
629 | kern_return_t RetCode; |
630 | mach_msg_type_t terminalType; |
631 | mach_port_t terminal; |
632 | } Reply; |
633 | |
634 | Request *In0P = (Request *) InHeadP; |
635 | Reply *OutP = (Reply *) OutHeadP; |
636 | mig_external kern_return_t S_termctty_open_terminal |
637 | (ctty_t ctty, int flags, mach_port_t *terminal, mach_msg_type_name_t *terminalPoly); |
638 | |
639 | boolean_t msgh_simple = msgh_simple; |
640 | const mach_msg_type_t flagsCheck = { |
641 | /* msgt_name = */ 2, |
642 | /* msgt_size = */ 32, |
643 | /* msgt_number = */ 1, |
644 | /* msgt_inline = */ TRUE((boolean_t) 1), |
645 | /* msgt_longform = */ FALSE((boolean_t) 0), |
646 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
647 | /* msgt_unused = */ 0 |
648 | }; |
649 | |
650 | const mach_msg_type_t terminalType = { |
651 | /* msgt_name = */ -1, |
652 | /* msgt_size = */ 32, |
653 | /* msgt_number = */ 1, |
654 | /* msgt_inline = */ TRUE((boolean_t) 1), |
655 | /* msgt_longform = */ FALSE((boolean_t) 0), |
656 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
657 | /* msgt_unused = */ 0 |
658 | }; |
659 | |
660 | mach_msg_type_name_t terminalPoly; |
661 | |
662 | #if TypeCheck1 |
663 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
664 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
665 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
666 | #endif /* TypeCheck */ |
667 | |
668 | #if TypeCheck1 |
669 | 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)) |
670 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
671 | #endif /* TypeCheck */ |
672 | |
673 | OutP->RetCode = S_termctty_open_terminal(In0P->Head.msgh_request_portmsgh_local_port, In0P->flags, &OutP->terminal, &terminalPoly); |
674 | if (OutP->RetCode != KERN_SUCCESS0) |
675 | return; |
676 | |
677 | msgh_simple = TRUE((boolean_t) 1); |
678 | OutP->Head.msgh_size = 40; |
679 | |
680 | OutP->terminalType = terminalType; |
681 | |
682 | if (MACH_MSG_TYPE_PORT_ANY(terminalPoly)(((terminalPoly) >= 16) && ((terminalPoly) <= 21 ))) |
683 | msgh_simple = FALSE((boolean_t) 0); |
684 | |
685 | OutP->terminalType.msgt_name = terminalPoly; |
686 | |
687 | if (!msgh_simple) |
688 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
689 | } |
690 | |
691 | /* Default implementation of S_termctty_open_terminal */ |
692 | #ifdef MIG_EOPNOTSUPP |
693 | kern_return_t __attribute__ ((weak)) |
694 | S_termctty_open_terminal |
695 | ( |
696 | ctty_t ctty, |
697 | int flags, |
698 | mach_port_t *terminal, |
699 | mach_msg_type_name_t *terminalPoly |
700 | ) { return MIG_EOPNOTSUPP; } |
701 | #endif /* MIG_EOPNOTSUPP */ |
702 | |
703 | /* Routine term_get_peername */ |
704 | mig_internalstatic void _Xterm_get_peername |
705 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
706 | { |
707 | typedef struct { |
708 | mach_msg_header_t Head; |
709 | } Request; |
710 | |
711 | typedef struct { |
712 | mach_msg_header_t Head; |
713 | mach_msg_type_t RetCodeType; |
714 | kern_return_t RetCode; |
715 | mach_msg_type_t nameType; |
716 | string_t name; |
717 | } Reply; |
718 | |
719 | Request *In0P = (Request *) InHeadP; |
720 | Reply *OutP = (Reply *) OutHeadP; |
721 | mig_external kern_return_t S_term_get_peername |
722 | (io_t terminal, string_t name); |
723 | |
724 | const mach_msg_type_t nameType = { |
725 | /* msgt_name = */ MACH_MSG_TYPE_STRING_C12, |
726 | /* msgt_size = */ 8, |
727 | /* msgt_number = */ 1024, |
728 | /* msgt_inline = */ TRUE((boolean_t) 1), |
729 | /* msgt_longform = */ FALSE((boolean_t) 0), |
730 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
731 | /* msgt_unused = */ 0 |
732 | }; |
733 | |
734 | #if TypeCheck1 |
735 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
736 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
737 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
738 | #endif /* TypeCheck */ |
739 | |
740 | OutP->RetCode = S_term_get_peername(In0P->Head.msgh_request_portmsgh_local_port, OutP->name); |
741 | if (OutP->RetCode != KERN_SUCCESS0) |
742 | return; |
743 | |
744 | OutP->Head.msgh_size = 1060; |
745 | |
746 | OutP->nameType = nameType; |
747 | } |
748 | |
749 | /* Default implementation of S_term_get_peername */ |
750 | #ifdef MIG_EOPNOTSUPP |
751 | kern_return_t __attribute__ ((weak)) |
752 | S_term_get_peername |
753 | ( |
754 | io_t terminal, |
755 | string_t name |
756 | ) { return MIG_EOPNOTSUPP; } |
757 | #endif /* MIG_EOPNOTSUPP */ |
758 | |
759 | mig_routine_t term_server_routines[] = { |
760 | _Xterm_getctty, |
761 | _Xterm_open_ctty, |
762 | _Xterm_set_nodename, |
763 | _Xterm_get_nodename, |
764 | _Xterm_set_filenode, |
765 | _Xterm_get_bottom_type, |
766 | _Xterm_on_machdev, |
767 | _Xterm_on_hurddev, |
768 | _Xterm_on_pty, |
769 | _Xtermctty_open_terminal, |
770 | _Xterm_get_peername, |
771 | }; |
772 | |
773 | mig_external boolean_t term_server |
774 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
775 | { |
776 | mach_msg_header_t *InP = InHeadP; |
777 | mig_reply_header_t *OutP = (mig_reply_header_t *) OutHeadP; |
778 | |
779 | const mach_msg_type_t RetCodeType = { |
780 | /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322, |
781 | /* msgt_size = */ 32, |
782 | /* msgt_number = */ 1, |
783 | /* msgt_inline = */ TRUE((boolean_t) 1), |
784 | /* msgt_longform = */ FALSE((boolean_t) 0), |
785 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
786 | /* msgt_unused = */ 0 |
787 | }; |
788 | |
789 | mig_routine_t routine; |
790 | |
791 | OutP->Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InP->msgh_bits), 0)((((InP->msgh_bits) & 0x000000ff)) | ((0) << 8)); |
792 | OutP->Head.msgh_size = sizeof *OutP; |
793 | OutP->Head.msgh_remote_port = InP->msgh_reply_portmsgh_remote_port; |
794 | OutP->Head.msgh_local_port = MACH_PORT_NULL((mach_port_t) 0); |
795 | OutP->Head.msgh_seqno = 0; |
796 | OutP->Head.msgh_id = InP->msgh_id + 100; |
797 | |
798 | OutP->RetCodeType = RetCodeType; |
799 | |
800 | if ((InP->msgh_id > 28010) || (InP->msgh_id < 28000) || |
801 | ((routine = term_server_routines[InP->msgh_id - 28000]) == 0)) { |
802 | OutP->RetCode = MIG_BAD_ID-303; |
803 | return FALSE((boolean_t) 0); |
804 | } |
805 | (*routine) (InP, &OutP->Head); |
806 | return TRUE((boolean_t) 1); |
807 | } |
808 | |
809 | mig_external mig_routine_t term_server_routine |
810 | (const mach_msg_header_t *InHeadP) |
811 | { |
812 | int msgh_id; |
813 | |
814 | msgh_id = InHeadP->msgh_id - 28000; |
815 | |
816 | if ((msgh_id > 10) || (msgh_id < 0)) |
817 | return 0; |
818 | |
819 | return term_server_routines[msgh_id]; |
820 | } |
821 |