1 | /* iig(DriverKit-286 Mar 29 2024 10:27:09) generated from IOEventLink.iig */ |
2 | |
3 | #undef IIG_IMPLEMENTATION |
4 | #define IIG_IMPLEMENTATION IOEventLink.iig |
5 | |
6 | #if KERNEL |
7 | #include <libkern/c++/OSString.h> |
8 | #else |
9 | #include <DriverKit/DriverKit.h> |
10 | #endif /* KERNEL */ |
11 | #include <DriverKit/IOReturn.h> |
12 | #include <DriverKit/IOEventLink.h> |
13 | |
14 | |
15 | #if __has_builtin(__builtin_load_member_function_pointer) |
16 | #define SimpleMemberFunctionCast(cfnty, self, func) (cfnty)__builtin_load_member_function_pointer(self, func) |
17 | #else |
18 | #define SimpleMemberFunctionCast(cfnty, self, func) ({ union { typeof(func) memfun; cfnty cfun; } pair; pair.memfun = func; pair.cfun; }) |
19 | #endif |
20 | |
21 | |
22 | struct IOEventLink_Create_Msg_Content |
23 | { |
24 | IORPCMessage __hdr; |
25 | OSObjectRef __object; |
26 | OSString * name; |
27 | #if !defined(__LP64__) |
28 | uint32_t __namePad; |
29 | #endif /* !defined(__LP64__) */ |
30 | OSObjectRef userClient; |
31 | }; |
32 | #pragma pack(4) |
33 | struct IOEventLink_Create_Msg |
34 | { |
35 | IORPCMessageMach mach; |
36 | mach_msg_port_descriptor_t __object__descriptor; |
37 | mach_msg_ool_descriptor_t name__descriptor; |
38 | mach_msg_port_descriptor_t userClient__descriptor; |
39 | IOEventLink_Create_Msg_Content content; |
40 | }; |
41 | #pragma pack() |
42 | #define IOEventLink_Create_Msg_ObjRefs (3) |
43 | |
44 | struct IOEventLink_Create_Rpl_Content |
45 | { |
46 | IORPCMessage __hdr; |
47 | OSObjectRef eventLink; |
48 | }; |
49 | #pragma pack(4) |
50 | struct IOEventLink_Create_Rpl |
51 | { |
52 | IORPCMessageMach mach; |
53 | mach_msg_port_descriptor_t eventLink__descriptor; |
54 | IOEventLink_Create_Rpl_Content content; |
55 | }; |
56 | #pragma pack() |
57 | #define IOEventLink_Create_Rpl_ObjRefs (1) |
58 | |
59 | |
60 | typedef union |
61 | { |
62 | const IORPC rpc; |
63 | struct |
64 | { |
65 | const struct IOEventLink_Create_Msg * message; |
66 | struct IOEventLink_Create_Rpl * reply; |
67 | uint32_t sendSize; |
68 | uint32_t replySize; |
69 | }; |
70 | } |
71 | IOEventLink_Create_Invocation; |
72 | struct IOEventLink_SetEventlinkPort_Msg_Content |
73 | { |
74 | IORPCMessage __hdr; |
75 | OSObjectRef __object; |
76 | }; |
77 | #pragma pack(4) |
78 | struct IOEventLink_SetEventlinkPort_Msg |
79 | { |
80 | IORPCMessageMach mach; |
81 | mach_msg_port_descriptor_t __object__descriptor; |
82 | mach_msg_port_descriptor_t port__descriptor; |
83 | IOEventLink_SetEventlinkPort_Msg_Content content; |
84 | }; |
85 | #pragma pack() |
86 | #define IOEventLink_SetEventlinkPort_Msg_ObjRefs (1) |
87 | |
88 | struct IOEventLink_SetEventlinkPort_Rpl_Content |
89 | { |
90 | IORPCMessage __hdr; |
91 | }; |
92 | #pragma pack(4) |
93 | struct IOEventLink_SetEventlinkPort_Rpl |
94 | { |
95 | IORPCMessageMach mach; |
96 | IOEventLink_SetEventlinkPort_Rpl_Content content; |
97 | }; |
98 | #pragma pack() |
99 | #define IOEventLink_SetEventlinkPort_Rpl_ObjRefs (0) |
100 | |
101 | |
102 | typedef union |
103 | { |
104 | const IORPC rpc; |
105 | struct |
106 | { |
107 | const struct IOEventLink_SetEventlinkPort_Msg * message; |
108 | struct IOEventLink_SetEventlinkPort_Rpl * reply; |
109 | uint32_t sendSize; |
110 | uint32_t replySize; |
111 | }; |
112 | } |
113 | IOEventLink_SetEventlinkPort_Invocation; |
114 | struct IOEventLink_InvalidateKernel_Msg_Content |
115 | { |
116 | IORPCMessage __hdr; |
117 | OSObjectRef __object; |
118 | OSObjectRef client; |
119 | }; |
120 | #pragma pack(4) |
121 | struct IOEventLink_InvalidateKernel_Msg |
122 | { |
123 | IORPCMessageMach mach; |
124 | mach_msg_port_descriptor_t __object__descriptor; |
125 | mach_msg_port_descriptor_t client__descriptor; |
126 | IOEventLink_InvalidateKernel_Msg_Content content; |
127 | }; |
128 | #pragma pack() |
129 | #define IOEventLink_InvalidateKernel_Msg_ObjRefs (2) |
130 | |
131 | struct IOEventLink_InvalidateKernel_Rpl_Content |
132 | { |
133 | IORPCMessage __hdr; |
134 | }; |
135 | #pragma pack(4) |
136 | struct IOEventLink_InvalidateKernel_Rpl |
137 | { |
138 | IORPCMessageMach mach; |
139 | IOEventLink_InvalidateKernel_Rpl_Content content; |
140 | }; |
141 | #pragma pack() |
142 | #define IOEventLink_InvalidateKernel_Rpl_ObjRefs (0) |
143 | |
144 | |
145 | typedef union |
146 | { |
147 | const IORPC rpc; |
148 | struct |
149 | { |
150 | const struct IOEventLink_InvalidateKernel_Msg * message; |
151 | struct IOEventLink_InvalidateKernel_Rpl * reply; |
152 | uint32_t sendSize; |
153 | uint32_t replySize; |
154 | }; |
155 | } |
156 | IOEventLink_InvalidateKernel_Invocation; |
157 | #if !KERNEL |
158 | extern OSMetaClass * gOSContainerMetaClass; |
159 | extern OSMetaClass * gOSDataMetaClass; |
160 | extern OSMetaClass * gOSNumberMetaClass; |
161 | extern OSMetaClass * gOSBooleanMetaClass; |
162 | extern OSMetaClass * gOSDictionaryMetaClass; |
163 | extern OSMetaClass * gOSArrayMetaClass; |
164 | extern OSMetaClass * gOSSetMetaClass; |
165 | extern OSMetaClass * gOSOrderedSetMetaClass; |
166 | extern OSMetaClass * gOSStringMetaClass; |
167 | extern OSMetaClass * gIOServiceStateNotificationDispatchSourceMetaClass; |
168 | extern OSMetaClass * gIOMemoryMapMetaClass; |
169 | extern OSMetaClass * gOSAction_IOUserClient_KernelCompletionMetaClass; |
170 | #endif /* !KERNEL */ |
171 | |
172 | #if KERNEL |
173 | OSDefineMetaClassAndStructors(IOEventLink, OSObject); |
174 | #endif /* KERNEL */ |
175 | |
176 | #if !KERNEL |
177 | |
178 | #define IOEventLink_QueueNames "" |
179 | |
180 | #define IOEventLink_MethodNames "" |
181 | |
182 | #define IOEventLinkMetaClass_MethodNames "" |
183 | |
184 | struct OSClassDescription_IOEventLink_t |
185 | { |
186 | OSClassDescription base; |
187 | uint64_t methodOptions[2 * 0]; |
188 | uint64_t metaMethodOptions[2 * 0]; |
189 | char queueNames[sizeof(IOEventLink_QueueNames)]; |
190 | char methodNames[sizeof(IOEventLink_MethodNames)]; |
191 | char metaMethodNames[sizeof(IOEventLinkMetaClass_MethodNames)]; |
192 | }; |
193 | |
194 | const struct OSClassDescription_IOEventLink_t |
195 | OSClassDescription_IOEventLink = |
196 | { |
197 | .base = |
198 | { |
199 | .descriptionSize = sizeof(OSClassDescription_IOEventLink_t), |
200 | .name = "IOEventLink" , |
201 | .superName = "OSObject" , |
202 | .methodOptionsSize = 2 * sizeof(uint64_t) * 0, |
203 | .methodOptionsOffset = __builtin_offsetof(struct OSClassDescription_IOEventLink_t, methodOptions), |
204 | .metaMethodOptionsSize = 2 * sizeof(uint64_t) * 0, |
205 | .metaMethodOptionsOffset = __builtin_offsetof(struct OSClassDescription_IOEventLink_t, metaMethodOptions), |
206 | .queueNamesSize = sizeof(IOEventLink_QueueNames), |
207 | .queueNamesOffset = __builtin_offsetof(struct OSClassDescription_IOEventLink_t, queueNames), |
208 | .methodNamesSize = sizeof(IOEventLink_MethodNames), |
209 | .methodNamesOffset = __builtin_offsetof(struct OSClassDescription_IOEventLink_t, methodNames), |
210 | .metaMethodNamesSize = sizeof(IOEventLinkMetaClass_MethodNames), |
211 | .metaMethodNamesOffset = __builtin_offsetof(struct OSClassDescription_IOEventLink_t, metaMethodNames), |
212 | .flags = 1*kOSClassCanRemote, |
213 | }, |
214 | .methodOptions = |
215 | { |
216 | }, |
217 | .metaMethodOptions = |
218 | { |
219 | }, |
220 | .queueNames = IOEventLink_QueueNames, |
221 | .methodNames = IOEventLink_MethodNames, |
222 | .metaMethodNames = IOEventLinkMetaClass_MethodNames, |
223 | }; |
224 | |
225 | OSMetaClass * gIOEventLinkMetaClass; |
226 | |
227 | static kern_return_t |
228 | IOEventLink_New(OSMetaClass * instance); |
229 | |
230 | const OSClassLoadInformation |
231 | IOEventLink_Class = |
232 | { |
233 | .description = &OSClassDescription_IOEventLink.base, |
234 | .metaPointer = &gIOEventLinkMetaClass, |
235 | .version = 1, |
236 | .instanceSize = sizeof(IOEventLink), |
237 | |
238 | .New = &IOEventLink_New, |
239 | }; |
240 | |
241 | extern const void * const |
242 | gIOEventLink_Declaration; |
243 | const void * const |
244 | gIOEventLink_Declaration |
245 | __attribute__((visibility("hidden" ),section("__DATA_CONST,__osclassinfo,regular,no_dead_strip" ),no_sanitize("address" ))) |
246 | = &IOEventLink_Class; |
247 | |
248 | static kern_return_t |
249 | IOEventLink_New(OSMetaClass * instance) |
250 | { |
251 | if (!new(instance) IOEventLinkMetaClass) return (kIOReturnNoMemory); |
252 | return (kIOReturnSuccess); |
253 | } |
254 | |
255 | kern_return_t |
256 | IOEventLinkMetaClass::New(OSObject * instance) |
257 | { |
258 | if (!new(instance) IOEventLink) return (kIOReturnNoMemory); |
259 | return (kIOReturnSuccess); |
260 | } |
261 | |
262 | #endif /* !KERNEL */ |
263 | |
264 | kern_return_t |
265 | IOEventLink::Dispatch(const IORPC rpc) |
266 | { |
267 | return _Dispatch(self: this, rpc); |
268 | } |
269 | |
270 | kern_return_t |
271 | IOEventLink::_Dispatch(IOEventLink * self, const IORPC rpc) |
272 | { |
273 | kern_return_t ret = kIOReturnUnsupported; |
274 | IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false); |
275 | |
276 | switch (msg->msgid) |
277 | { |
278 | case IOEventLink_SetEventlinkPort_ID: |
279 | { |
280 | ret = IOEventLink::SetEventlinkPort_Invoke(rpc, target: self, SimpleMemberFunctionCast(IOEventLink::SetEventlinkPort_Handler, *self, &IOEventLink::SetEventlinkPort_Impl)); |
281 | break; |
282 | } |
283 | #if KERNEL |
284 | case IOEventLink_InvalidateKernel_ID: |
285 | { |
286 | ret = IOEventLink::InvalidateKernel_Invoke(rpc, target: self, SimpleMemberFunctionCast(IOEventLink::InvalidateKernel_Handler, *self, &IOEventLink::InvalidateKernel_Impl)); |
287 | break; |
288 | } |
289 | #endif /* !KERNEL */ |
290 | |
291 | default: |
292 | ret = OSObject::_Dispatch(self, rpc); |
293 | break; |
294 | } |
295 | |
296 | return (ret); |
297 | } |
298 | |
299 | #if KERNEL |
300 | kern_return_t |
301 | IOEventLink::MetaClass::Dispatch(const IORPC rpc) |
302 | { |
303 | #else /* KERNEL */ |
304 | kern_return_t |
305 | IOEventLinkMetaClass::Dispatch(const IORPC rpc) |
306 | { |
307 | #endif /* !KERNEL */ |
308 | |
309 | kern_return_t ret = kIOReturnUnsupported; |
310 | IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false); |
311 | |
312 | switch (msg->msgid) |
313 | { |
314 | #if KERNEL |
315 | case IOEventLink_Create_ID: |
316 | ret = IOEventLink::Create_Invoke(rpc, func: &IOEventLink::Create_Impl); |
317 | break; |
318 | #endif /* !KERNEL */ |
319 | |
320 | default: |
321 | ret = OSMetaClassBase::Dispatch(rpc); |
322 | break; |
323 | } |
324 | |
325 | return (ret); |
326 | } |
327 | |
328 | kern_return_t |
329 | IOEventLink::Create_Call( |
330 | OSString * name, |
331 | IOUserClient * userClient, |
332 | IOEventLink ** eventLink) |
333 | { |
334 | kern_return_t ret; |
335 | union |
336 | { |
337 | IOEventLink_Create_Msg msg; |
338 | struct |
339 | { |
340 | IOEventLink_Create_Rpl rpl; |
341 | mach_msg_max_trailer_t trailer; |
342 | } rpl; |
343 | } buf; |
344 | struct IOEventLink_Create_Msg * msg = &buf.msg; |
345 | struct IOEventLink_Create_Rpl * rpl = &buf.rpl.rpl; |
346 | |
347 | memset(s: msg, c: 0, n: sizeof(struct IOEventLink_Create_Msg)); |
348 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
349 | msg->mach.msgh.msgh_size = sizeof(*msg); |
350 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
351 | | 0*kIORPCMessageSimpleReply |
352 | | 0*kIORPCMessageLocalHost |
353 | | 0*kIORPCMessageOnqueue; |
354 | msg->content.__hdr.msgid = IOEventLink_Create_ID; |
355 | msg->content.__object = (OSObjectRef) OSTypeID(IOEventLink); |
356 | msg->content.__hdr.objectRefs = IOEventLink_Create_Msg_ObjRefs; |
357 | msg->mach.msgh_body.msgh_descriptor_count = 3; |
358 | |
359 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
360 | |
361 | msg->name__descriptor.type = MACH_MSG_OOL_DESCRIPTOR; |
362 | msg->name__descriptor.copy = MACH_MSG_VIRTUAL_COPY; |
363 | msg->name__descriptor.address = (void *) __builtin_offsetof(IOEventLink_Create_Msg_Content, name); |
364 | msg->content.name = name; |
365 | |
366 | msg->userClient__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
367 | msg->content.userClient = (OSObjectRef) userClient; |
368 | |
369 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
370 | ret = OSMTypeID(IOEventLink)->Invoke(rpc); |
371 | |
372 | if (kIOReturnSuccess == ret) |
373 | do { |
374 | { |
375 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
376 | if (rpl->content.__hdr.msgid != IOEventLink_Create_ID) { ret = kIOReturnIPCError; break; }; |
377 | if (rpl->mach.msgh_body.msgh_descriptor_count != 1) { ret = kIOReturnIPCError; break; }; |
378 | if (IOEventLink_Create_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
379 | } |
380 | } |
381 | while (false); |
382 | if (kIOReturnSuccess == ret) |
383 | { |
384 | *eventLink = OSDynamicCast(IOEventLink, (OSObject *) rpl->content.eventLink); |
385 | if (rpl->content.eventLink && !*eventLink) ret = kIOReturnBadArgument; |
386 | } |
387 | |
388 | |
389 | return (ret); |
390 | } |
391 | |
392 | kern_return_t |
393 | IOEventLink::SetEventlinkPort( |
394 | mach_port_t port, |
395 | OSDispatchMethod supermethod) |
396 | { |
397 | kern_return_t ret; |
398 | union |
399 | { |
400 | IOEventLink_SetEventlinkPort_Msg msg; |
401 | struct |
402 | { |
403 | IOEventLink_SetEventlinkPort_Rpl rpl; |
404 | mach_msg_max_trailer_t trailer; |
405 | } rpl; |
406 | } buf; |
407 | struct IOEventLink_SetEventlinkPort_Msg * msg = &buf.msg; |
408 | struct IOEventLink_SetEventlinkPort_Rpl * rpl = &buf.rpl.rpl; |
409 | |
410 | memset(s: msg, c: 0, n: sizeof(struct IOEventLink_SetEventlinkPort_Msg)); |
411 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
412 | msg->mach.msgh.msgh_size = sizeof(*msg); |
413 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
414 | | 1*kIORPCMessageSimpleReply |
415 | | 0*kIORPCMessageLocalHost |
416 | | 0*kIORPCMessageOnqueue; |
417 | msg->content.__hdr.msgid = IOEventLink_SetEventlinkPort_ID; |
418 | msg->content.__object = (OSObjectRef) this; |
419 | msg->content.__hdr.objectRefs = IOEventLink_SetEventlinkPort_Msg_ObjRefs; |
420 | msg->mach.msgh_body.msgh_descriptor_count = 2; |
421 | |
422 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
423 | |
424 | msg->port__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
425 | msg->port__descriptor.disposition = MACH_MSG_TYPE_COPY_SEND; |
426 | msg->port__descriptor.name = port; |
427 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
428 | if (supermethod) ret = supermethod((OSObject *)this, rpc); |
429 | else ret = ((OSObject *)this)->Invoke(rpc); |
430 | |
431 | if (kIOReturnSuccess == ret) |
432 | do { |
433 | { |
434 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
435 | if (rpl->content.__hdr.msgid != IOEventLink_SetEventlinkPort_ID) { ret = kIOReturnIPCError; break; }; |
436 | if (rpl->mach.msgh_body.msgh_descriptor_count != 0) { ret = kIOReturnIPCError; break; }; |
437 | if (IOEventLink_SetEventlinkPort_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
438 | } |
439 | } |
440 | while (false); |
441 | if (kIOReturnSuccess == ret) |
442 | { |
443 | } |
444 | |
445 | |
446 | return (ret); |
447 | } |
448 | |
449 | kern_return_t |
450 | IOEventLink::InvalidateKernel( |
451 | IOUserClient * client, |
452 | OSDispatchMethod supermethod) |
453 | { |
454 | kern_return_t ret; |
455 | union |
456 | { |
457 | IOEventLink_InvalidateKernel_Msg msg; |
458 | struct |
459 | { |
460 | IOEventLink_InvalidateKernel_Rpl rpl; |
461 | mach_msg_max_trailer_t trailer; |
462 | } rpl; |
463 | } buf; |
464 | struct IOEventLink_InvalidateKernel_Msg * msg = &buf.msg; |
465 | struct IOEventLink_InvalidateKernel_Rpl * rpl = &buf.rpl.rpl; |
466 | |
467 | memset(s: msg, c: 0, n: sizeof(struct IOEventLink_InvalidateKernel_Msg)); |
468 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
469 | msg->mach.msgh.msgh_size = sizeof(*msg); |
470 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
471 | | 1*kIORPCMessageSimpleReply |
472 | | 0*kIORPCMessageLocalHost |
473 | | 0*kIORPCMessageOnqueue; |
474 | msg->content.__hdr.msgid = IOEventLink_InvalidateKernel_ID; |
475 | msg->content.__object = (OSObjectRef) this; |
476 | msg->content.__hdr.objectRefs = IOEventLink_InvalidateKernel_Msg_ObjRefs; |
477 | msg->mach.msgh_body.msgh_descriptor_count = 2; |
478 | |
479 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
480 | |
481 | msg->client__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
482 | msg->content.client = (OSObjectRef) client; |
483 | |
484 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
485 | if (supermethod) ret = supermethod((OSObject *)this, rpc); |
486 | else ret = ((OSObject *)this)->Invoke(rpc); |
487 | |
488 | if (kIOReturnSuccess == ret) |
489 | do { |
490 | { |
491 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
492 | if (rpl->content.__hdr.msgid != IOEventLink_InvalidateKernel_ID) { ret = kIOReturnIPCError; break; }; |
493 | if (rpl->mach.msgh_body.msgh_descriptor_count != 0) { ret = kIOReturnIPCError; break; }; |
494 | if (IOEventLink_InvalidateKernel_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
495 | } |
496 | } |
497 | while (false); |
498 | if (kIOReturnSuccess == ret) |
499 | { |
500 | } |
501 | |
502 | |
503 | return (ret); |
504 | } |
505 | |
506 | kern_return_t |
507 | IOEventLink::Create_Invoke(const IORPC _rpc, |
508 | Create_Handler func) |
509 | { |
510 | IOEventLink_Create_Invocation rpc = { .rpc: _rpc }; |
511 | kern_return_t ret; |
512 | IOUserClient * userClient; |
513 | |
514 | if (3 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
515 | if (IOEventLink_Create_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
516 | if (rpc.message != NULL && rpc.sendSize < sizeof(IOEventLink_Create_Msg)) return (kIOReturnIPCError); |
517 | if (rpc.reply != NULL && rpc.replySize < sizeof(IOEventLink_Create_Rpl)) return (kIOReturnIPCError); |
518 | if (((OSObject *) rpc.message->content.name) != NULL && OSDynamicCast(OSString, (OSObject *) rpc.message->content.name) == NULL) { return kIOReturnBadArgument; } |
519 | userClient = OSDynamicCast(IOUserClient, (OSObject *) rpc.message->content.userClient); |
520 | if (!userClient && rpc.message->content.userClient) return (kIOReturnBadArgument); |
521 | |
522 | ret = (*func)( rpc.message->content.name, |
523 | userClient, |
524 | (IOEventLink **)&rpc.reply->content.eventLink); |
525 | |
526 | if (kIOReturnSuccess != ret) return (ret); |
527 | |
528 | rpc.reply->content.__hdr.msgid = IOEventLink_Create_ID; |
529 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
530 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
531 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
532 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 1; |
533 | rpc.reply->content.__hdr.objectRefs = IOEventLink_Create_Rpl_ObjRefs; |
534 | rpc.reply->eventLink__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
535 | |
536 | return (ret); |
537 | } |
538 | |
539 | kern_return_t |
540 | IOEventLink::SetEventlinkPort_Invoke(const IORPC _rpc, |
541 | OSMetaClassBase * target, |
542 | SetEventlinkPort_Handler func) |
543 | { |
544 | IOEventLink_SetEventlinkPort_Invocation rpc = { .rpc: _rpc }; |
545 | kern_return_t ret; |
546 | |
547 | if (2 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
548 | if (IOEventLink_SetEventlinkPort_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
549 | if (rpc.message != NULL && rpc.sendSize < sizeof(IOEventLink_SetEventlinkPort_Msg)) return (kIOReturnIPCError); |
550 | if (rpc.reply != NULL && rpc.replySize < sizeof(IOEventLink_SetEventlinkPort_Rpl)) return (kIOReturnIPCError); |
551 | |
552 | ret = (*func)(target, |
553 | rpc.message->port__descriptor.name); |
554 | |
555 | if (kIOReturnSuccess != ret) return (ret); |
556 | |
557 | rpc.reply->content.__hdr.msgid = IOEventLink_SetEventlinkPort_ID; |
558 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
559 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
560 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
561 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 0; |
562 | rpc.reply->content.__hdr.objectRefs = IOEventLink_SetEventlinkPort_Rpl_ObjRefs; |
563 | |
564 | return (ret); |
565 | } |
566 | |
567 | kern_return_t |
568 | IOEventLink::InvalidateKernel_Invoke(const IORPC _rpc, |
569 | OSMetaClassBase * target, |
570 | InvalidateKernel_Handler func) |
571 | { |
572 | IOEventLink_InvalidateKernel_Invocation rpc = { .rpc: _rpc }; |
573 | kern_return_t ret; |
574 | IOUserClient * client; |
575 | |
576 | if (2 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
577 | if (IOEventLink_InvalidateKernel_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
578 | if (rpc.message != NULL && rpc.sendSize < sizeof(IOEventLink_InvalidateKernel_Msg)) return (kIOReturnIPCError); |
579 | if (rpc.reply != NULL && rpc.replySize < sizeof(IOEventLink_InvalidateKernel_Rpl)) return (kIOReturnIPCError); |
580 | client = OSDynamicCast(IOUserClient, (OSObject *) rpc.message->content.client); |
581 | if (!client && rpc.message->content.client) return (kIOReturnBadArgument); |
582 | |
583 | ret = (*func)(target, |
584 | client); |
585 | |
586 | if (kIOReturnSuccess != ret) return (ret); |
587 | |
588 | rpc.reply->content.__hdr.msgid = IOEventLink_InvalidateKernel_ID; |
589 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
590 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
591 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
592 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 0; |
593 | rpc.reply->content.__hdr.objectRefs = IOEventLink_InvalidateKernel_Rpl_ObjRefs; |
594 | |
595 | return (ret); |
596 | } |
597 | |
598 | |
599 | |
600 | |