1/* iig(DriverKit-286 Mar 29 2024 10:27:09) generated from IOUserClient.iig */
2
3#undef IIG_IMPLEMENTATION
4#define IIG_IMPLEMENTATION IOUserClient.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/IOUserClient.h>
13
14/* @iig implementation */
15#include <DriverKit/IOBufferMemoryDescriptor.h>
16/* @iig end */
17
18
19#if __has_builtin(__builtin_load_member_function_pointer)
20#define SimpleMemberFunctionCast(cfnty, self, func) (cfnty)__builtin_load_member_function_pointer(self, func)
21#else
22#define SimpleMemberFunctionCast(cfnty, self, func) ({ union { typeof(func) memfun; cfnty cfun; } pair; pair.memfun = func; pair.cfun; })
23#endif
24
25
26struct IOUserClient_AsyncCompletion_Msg_Content
27{
28 IORPCMessage __hdr;
29 OSObjectRef __object;
30 OSObjectRef action;
31 IOReturn status;
32 const unsigned long long * asyncData;
33#if !defined(__LP64__)
34 uint32_t __asyncDataPad;
35#endif /* !defined(__LP64__) */
36 unsigned long long __asyncData[16];
37 uint32_t asyncDataCount;
38};
39#pragma pack(4)
40struct IOUserClient_AsyncCompletion_Msg
41{
42 IORPCMessageMach mach;
43 mach_msg_port_descriptor_t __object__descriptor;
44 mach_msg_port_descriptor_t action__descriptor;
45 IOUserClient_AsyncCompletion_Msg_Content content;
46};
47#pragma pack()
48#define IOUserClient_AsyncCompletion_Msg_ObjRefs (2)
49
50struct IOUserClient_AsyncCompletion_Rpl_Content
51{
52 IORPCMessage __hdr;
53};
54#pragma pack(4)
55struct IOUserClient_AsyncCompletion_Rpl
56{
57 IORPCMessageMach mach;
58 IOUserClient_AsyncCompletion_Rpl_Content content;
59};
60#pragma pack()
61#define IOUserClient_AsyncCompletion_Rpl_ObjRefs (0)
62
63
64typedef union
65{
66 const IORPC rpc;
67 struct
68 {
69 const struct IOUserClient_AsyncCompletion_Msg * message;
70 struct IOUserClient_AsyncCompletion_Rpl * reply;
71 uint32_t sendSize;
72 uint32_t replySize;
73 };
74}
75IOUserClient_AsyncCompletion_Invocation;
76struct IOUserClient_CopyClientMemoryForType_Msg_Content
77{
78 IORPCMessage __hdr;
79 OSObjectRef __object;
80 uint64_t type;
81};
82#pragma pack(4)
83struct IOUserClient_CopyClientMemoryForType_Msg
84{
85 IORPCMessageMach mach;
86 mach_msg_port_descriptor_t __object__descriptor;
87 IOUserClient_CopyClientMemoryForType_Msg_Content content;
88};
89#pragma pack()
90#define IOUserClient_CopyClientMemoryForType_Msg_ObjRefs (1)
91
92struct IOUserClient_CopyClientMemoryForType_Rpl_Content
93{
94 IORPCMessage __hdr;
95 OSObjectRef memory;
96 unsigned long long options;
97};
98#pragma pack(4)
99struct IOUserClient_CopyClientMemoryForType_Rpl
100{
101 IORPCMessageMach mach;
102 mach_msg_port_descriptor_t memory__descriptor;
103 IOUserClient_CopyClientMemoryForType_Rpl_Content content;
104};
105#pragma pack()
106#define IOUserClient_CopyClientMemoryForType_Rpl_ObjRefs (1)
107
108
109typedef union
110{
111 const IORPC rpc;
112 struct
113 {
114 const struct IOUserClient_CopyClientMemoryForType_Msg * message;
115 struct IOUserClient_CopyClientMemoryForType_Rpl * reply;
116 uint32_t sendSize;
117 uint32_t replySize;
118 };
119}
120IOUserClient_CopyClientMemoryForType_Invocation;
121struct IOUserClient_CreateMemoryDescriptorFromClient_Msg_Content
122{
123 IORPCMessage __hdr;
124 OSObjectRef __object;
125 uint64_t memoryDescriptorCreateOptions;
126 uint32_t segmentsCount;
127 const IOAddressSegment * segments;
128#if !defined(__LP64__)
129 uint32_t __segmentsPad;
130#endif /* !defined(__LP64__) */
131 IOAddressSegment __segments[32];
132};
133#pragma pack(4)
134struct IOUserClient_CreateMemoryDescriptorFromClient_Msg
135{
136 IORPCMessageMach mach;
137 mach_msg_port_descriptor_t __object__descriptor;
138 IOUserClient_CreateMemoryDescriptorFromClient_Msg_Content content;
139};
140#pragma pack()
141#define IOUserClient_CreateMemoryDescriptorFromClient_Msg_ObjRefs (1)
142
143struct IOUserClient_CreateMemoryDescriptorFromClient_Rpl_Content
144{
145 IORPCMessage __hdr;
146 OSObjectRef memory;
147};
148#pragma pack(4)
149struct IOUserClient_CreateMemoryDescriptorFromClient_Rpl
150{
151 IORPCMessageMach mach;
152 mach_msg_port_descriptor_t memory__descriptor;
153 IOUserClient_CreateMemoryDescriptorFromClient_Rpl_Content content;
154};
155#pragma pack()
156#define IOUserClient_CreateMemoryDescriptorFromClient_Rpl_ObjRefs (1)
157
158
159typedef union
160{
161 const IORPC rpc;
162 struct
163 {
164 const struct IOUserClient_CreateMemoryDescriptorFromClient_Msg * message;
165 struct IOUserClient_CreateMemoryDescriptorFromClient_Rpl * reply;
166 uint32_t sendSize;
167 uint32_t replySize;
168 };
169}
170IOUserClient_CreateMemoryDescriptorFromClient_Invocation;
171struct IOUserClient_CopyClientEntitlements_Msg_Content
172{
173 IORPCMessage __hdr;
174 OSObjectRef __object;
175};
176#pragma pack(4)
177struct IOUserClient_CopyClientEntitlements_Msg
178{
179 IORPCMessageMach mach;
180 mach_msg_port_descriptor_t __object__descriptor;
181 IOUserClient_CopyClientEntitlements_Msg_Content content;
182};
183#pragma pack()
184#define IOUserClient_CopyClientEntitlements_Msg_ObjRefs (1)
185
186struct IOUserClient_CopyClientEntitlements_Rpl_Content
187{
188 IORPCMessage __hdr;
189 OSDictionary * entitlements;
190#if !defined(__LP64__)
191 uint32_t __entitlementsPad;
192#endif /* !defined(__LP64__) */
193};
194#pragma pack(4)
195struct IOUserClient_CopyClientEntitlements_Rpl
196{
197 IORPCMessageMach mach;
198 mach_msg_ool_descriptor_t entitlements__descriptor;
199 IOUserClient_CopyClientEntitlements_Rpl_Content content;
200};
201#pragma pack()
202#define IOUserClient_CopyClientEntitlements_Rpl_ObjRefs (1)
203
204
205typedef union
206{
207 const IORPC rpc;
208 struct
209 {
210 const struct IOUserClient_CopyClientEntitlements_Msg * message;
211 struct IOUserClient_CopyClientEntitlements_Rpl * reply;
212 uint32_t sendSize;
213 uint32_t replySize;
214 };
215}
216IOUserClient_CopyClientEntitlements_Invocation;
217struct IOUserClient__ExternalMethod_Msg_Content
218{
219 IORPCMessage __hdr;
220 OSObjectRef __object;
221 OSData * structureInput;
222#if !defined(__LP64__)
223 uint32_t __structureInputPad;
224#endif /* !defined(__LP64__) */
225 OSObjectRef structureInputDescriptor;
226 OSObjectRef structureOutputDescriptor;
227 OSObjectRef completion;
228 uint64_t selector;
229 const unsigned long long * scalarInput;
230#if !defined(__LP64__)
231 uint32_t __scalarInputPad;
232#endif /* !defined(__LP64__) */
233 unsigned long long __scalarInput[16];
234 uint32_t scalarInputCount;
235 unsigned int scalarOutputCount;
236 uint64_t structureOutputMaximumSize;
237};
238#pragma pack(4)
239struct IOUserClient__ExternalMethod_Msg
240{
241 IORPCMessageMach mach;
242 mach_msg_port_descriptor_t __object__descriptor;
243 mach_msg_ool_descriptor_t structureInput__descriptor;
244 mach_msg_port_descriptor_t structureInputDescriptor__descriptor;
245 mach_msg_port_descriptor_t structureOutputDescriptor__descriptor;
246 mach_msg_port_descriptor_t completion__descriptor;
247 IOUserClient__ExternalMethod_Msg_Content content;
248};
249#pragma pack()
250#define IOUserClient__ExternalMethod_Msg_ObjRefs (5)
251
252struct IOUserClient__ExternalMethod_Rpl_Content
253{
254 IORPCMessage __hdr;
255 OSData * structureOutput;
256#if !defined(__LP64__)
257 uint32_t __structureOutputPad;
258#endif /* !defined(__LP64__) */
259 unsigned long long * scalarOutput;
260#if !defined(__LP64__)
261 uint32_t __scalarOutputPad;
262#endif /* !defined(__LP64__) */
263 unsigned long long __scalarOutput[16];
264 unsigned int scalarOutputCount;
265};
266#pragma pack(4)
267struct IOUserClient__ExternalMethod_Rpl
268{
269 IORPCMessageMach mach;
270 mach_msg_ool_descriptor_t structureOutput__descriptor;
271 IOUserClient__ExternalMethod_Rpl_Content content;
272};
273#pragma pack()
274#define IOUserClient__ExternalMethod_Rpl_ObjRefs (1)
275
276
277typedef union
278{
279 const IORPC rpc;
280 struct
281 {
282 const struct IOUserClient__ExternalMethod_Msg * message;
283 struct IOUserClient__ExternalMethod_Rpl * reply;
284 uint32_t sendSize;
285 uint32_t replySize;
286 };
287}
288IOUserClient__ExternalMethod_Invocation;
289#if !KERNEL
290extern OSMetaClass * gOSContainerMetaClass;
291extern OSMetaClass * gOSDataMetaClass;
292extern OSMetaClass * gOSNumberMetaClass;
293extern OSMetaClass * gOSBooleanMetaClass;
294extern OSMetaClass * gOSDictionaryMetaClass;
295extern OSMetaClass * gOSArrayMetaClass;
296extern OSMetaClass * gOSSetMetaClass;
297extern OSMetaClass * gOSOrderedSetMetaClass;
298extern OSMetaClass * gIODispatchQueueMetaClass;
299extern OSMetaClass * gOSStringMetaClass;
300extern OSMetaClass * gIOServiceStateNotificationDispatchSourceMetaClass;
301extern OSMetaClass * gIOMemoryMapMetaClass;
302extern OSMetaClass * gOSAction_IOUserClient_KernelCompletionMetaClass;
303#endif /* !KERNEL */
304
305#if !KERNEL
306
307#define IOUserClient_QueueNames "" \
308 "\037IOUserClientQueueExternalMethod"
309
310#define IOUserClient_MethodNames "" \
311 "\017_ExternalMethod"
312
313#define IOUserClientMetaClass_MethodNames ""
314
315struct OSClassDescription_IOUserClient_t
316{
317 OSClassDescription base;
318 uint64_t methodOptions[2 * 1];
319 uint64_t metaMethodOptions[2 * 0];
320 char queueNames[sizeof(IOUserClient_QueueNames)];
321 char methodNames[sizeof(IOUserClient_MethodNames)];
322 char metaMethodNames[sizeof(IOUserClientMetaClass_MethodNames)];
323};
324
325const struct OSClassDescription_IOUserClient_t
326OSClassDescription_IOUserClient =
327{
328 .base =
329 {
330 .descriptionSize = sizeof(OSClassDescription_IOUserClient_t),
331 .name = "IOUserClient",
332 .superName = "IOService",
333 .methodOptionsSize = 2 * sizeof(uint64_t) * 1,
334 .methodOptionsOffset = __builtin_offsetof(struct OSClassDescription_IOUserClient_t, methodOptions),
335 .metaMethodOptionsSize = 2 * sizeof(uint64_t) * 0,
336 .metaMethodOptionsOffset = __builtin_offsetof(struct OSClassDescription_IOUserClient_t, metaMethodOptions),
337 .queueNamesSize = sizeof(IOUserClient_QueueNames),
338 .queueNamesOffset = __builtin_offsetof(struct OSClassDescription_IOUserClient_t, queueNames),
339 .methodNamesSize = sizeof(IOUserClient_MethodNames),
340 .methodNamesOffset = __builtin_offsetof(struct OSClassDescription_IOUserClient_t, methodNames),
341 .metaMethodNamesSize = sizeof(IOUserClientMetaClass_MethodNames),
342 .metaMethodNamesOffset = __builtin_offsetof(struct OSClassDescription_IOUserClient_t, metaMethodNames),
343 .flags = 1*kOSClassCanRemote,
344 },
345 .methodOptions =
346 {
347 IOUserClient__ExternalMethod_ID,
348 0x0000000000000000,
349 },
350 .metaMethodOptions =
351 {
352 },
353 .queueNames = IOUserClient_QueueNames,
354 .methodNames = IOUserClient_MethodNames,
355 .metaMethodNames = IOUserClientMetaClass_MethodNames,
356};
357
358OSMetaClass * gIOUserClientMetaClass;
359
360static kern_return_t
361IOUserClient_New(OSMetaClass * instance);
362
363const OSClassLoadInformation
364IOUserClient_Class =
365{
366 .description = &OSClassDescription_IOUserClient.base,
367 .metaPointer = &gIOUserClientMetaClass,
368 .version = 1,
369 .instanceSize = sizeof(IOUserClient),
370
371 .New = &IOUserClient_New,
372};
373
374extern const void * const
375gIOUserClient_Declaration;
376const void * const
377gIOUserClient_Declaration
378__attribute__((visibility("hidden"),section("__DATA_CONST,__osclassinfo,regular,no_dead_strip"),no_sanitize("address")))
379 = &IOUserClient_Class;
380
381static kern_return_t
382IOUserClient_New(OSMetaClass * instance)
383{
384 if (!new(instance) IOUserClientMetaClass) return (kIOReturnNoMemory);
385 return (kIOReturnSuccess);
386}
387
388kern_return_t
389IOUserClientMetaClass::New(OSObject * instance)
390{
391 if (!new(instance) IOUserClient) return (kIOReturnNoMemory);
392 return (kIOReturnSuccess);
393}
394
395#endif /* !KERNEL */
396
397kern_return_t
398IOUserClient::Dispatch(const IORPC rpc)
399{
400 return _Dispatch(self: this, rpc);
401}
402
403kern_return_t
404IOUserClient::_Dispatch(IOUserClient * self, const IORPC rpc)
405{
406 kern_return_t ret = kIOReturnUnsupported;
407 IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false);
408
409 switch (msg->msgid)
410 {
411#if KERNEL
412 case IOUserClient_CreateMemoryDescriptorFromClient_ID:
413 {
414 ret = IOUserClient::CreateMemoryDescriptorFromClient_Invoke(rpc, target: self, SimpleMemberFunctionCast(IOUserClient::CreateMemoryDescriptorFromClient_Handler, *self, &IOUserClient::CreateMemoryDescriptorFromClient_Impl));
415 break;
416 }
417#endif /* !KERNEL */
418 case IOUserClient_CopyClientEntitlements_ID:
419 {
420 ret = IOUserClient::CopyClientEntitlements_Invoke(rpc, target: self, SimpleMemberFunctionCast(IOUserClient::CopyClientEntitlements_Handler, *self, &IOUserClient::CopyClientEntitlements_Impl));
421 break;
422 }
423 case IOUserClient__ExternalMethod_ID:
424 {
425 ret = IOUserClient::_ExternalMethod_Invoke(rpc, target: self, SimpleMemberFunctionCast(IOUserClient::_ExternalMethod_Handler, *self, &IOUserClient::_ExternalMethod_Impl));
426 break;
427 }
428#if KERNEL
429 case IOUserClient_KernelCompletion_ID:
430 {
431 ret = IOUserClient::AsyncCompletion_Invoke(rpc, target: self, SimpleMemberFunctionCast(IOUserClient::AsyncCompletion_Handler, *self, &IOUserClient::KernelCompletion_Impl), OSTypeID(OSAction_IOUserClient_KernelCompletion));
432 break;
433 }
434#endif /* !KERNEL */
435
436 default:
437 ret = IOService::_Dispatch(self, rpc);
438 break;
439 }
440
441 return (ret);
442}
443
444#if KERNEL
445kern_return_t
446IOUserClient::MetaClass::Dispatch(const IORPC rpc)
447{
448#else /* KERNEL */
449kern_return_t
450IOUserClientMetaClass::Dispatch(const IORPC rpc)
451{
452#endif /* !KERNEL */
453
454 kern_return_t ret = kIOReturnUnsupported;
455 IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false);
456
457 switch (msg->msgid)
458 {
459
460 default:
461 ret = OSMetaClassBase::Dispatch(rpc);
462 break;
463 }
464
465 return (ret);
466}
467
468void
469IOUserClient::AsyncCompletion(
470 OSAction * action,
471 IOReturn status,
472 const unsigned long long * asyncData,
473 uint32_t asyncDataCount,
474 OSDispatchMethod supermethod)
475{
476 kern_return_t ret;
477 union
478 {
479 IOUserClient_AsyncCompletion_Msg msg;
480 } buf;
481 struct IOUserClient_AsyncCompletion_Msg * msg = &buf.msg;
482
483 memset(s: msg, c: 0, n: sizeof(struct IOUserClient_AsyncCompletion_Msg));
484 msg->mach.msgh.msgh_id = kIORPCVersion190615;
485 msg->mach.msgh.msgh_size = sizeof(*msg);
486 msg->content.__hdr.flags = 1*kIORPCMessageOneway
487 | 1*kIORPCMessageSimpleReply
488 | 0*kIORPCMessageLocalHost
489 | 0*kIORPCMessageOnqueue;
490 msg->content.__hdr.msgid = IOUserClient_AsyncCompletion_ID;
491 msg->content.__object = (OSObjectRef) action;
492 msg->content.__hdr.objectRefs = IOUserClient_AsyncCompletion_Msg_ObjRefs;
493 msg->mach.msgh_body.msgh_descriptor_count = 2;
494
495 msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
496
497 msg->action__descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
498 msg->content.action = (OSObjectRef) action;
499
500 msg->content.status = status;
501
502 msg->content.asyncData = NULL;
503
504 if (asyncDataCount > (sizeof(msg->content.__asyncData) / sizeof(msg->content.__asyncData[0]))) return;
505 bcopy(src: asyncData, dst: &msg->content.__asyncData[0], n: asyncDataCount * sizeof(msg->content.__asyncData[0]));
506
507 msg->content.asyncDataCount = asyncDataCount;
508
509 IORPC rpc = { .message = &buf.msg.mach, .reply = NULL, .sendSize = sizeof(*msg), .replySize = 0 };
510 ret = action->Invoke(rpc);
511
512}
513
514kern_return_t
515IOUserClient::CopyClientMemoryForType(
516 uint64_t type,
517 uint64_t * options,
518 IOMemoryDescriptor ** memory,
519 OSDispatchMethod supermethod)
520{
521 kern_return_t ret;
522 union
523 {
524 IOUserClient_CopyClientMemoryForType_Msg msg;
525 struct
526 {
527 IOUserClient_CopyClientMemoryForType_Rpl rpl;
528 mach_msg_max_trailer_t trailer;
529 } rpl;
530 } buf;
531 struct IOUserClient_CopyClientMemoryForType_Msg * msg = &buf.msg;
532 struct IOUserClient_CopyClientMemoryForType_Rpl * rpl = &buf.rpl.rpl;
533
534 memset(s: msg, c: 0, n: sizeof(struct IOUserClient_CopyClientMemoryForType_Msg));
535 msg->mach.msgh.msgh_id = kIORPCVersion190615;
536 msg->mach.msgh.msgh_size = sizeof(*msg);
537 msg->content.__hdr.flags = 0*kIORPCMessageOneway
538 | 0*kIORPCMessageSimpleReply
539 | 0*kIORPCMessageLocalHost
540 | 0*kIORPCMessageOnqueue;
541 msg->content.__hdr.msgid = IOUserClient_CopyClientMemoryForType_ID;
542 msg->content.__object = (OSObjectRef) this;
543 msg->content.__hdr.objectRefs = IOUserClient_CopyClientMemoryForType_Msg_ObjRefs;
544 msg->mach.msgh_body.msgh_descriptor_count = 1;
545
546 msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
547
548 msg->content.type = type;
549
550 IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) };
551 if (supermethod) ret = supermethod((OSObject *)this, rpc);
552 else ret = ((OSObject *)this)->Invoke(rpc);
553
554 if (kIOReturnSuccess == ret)
555 do {
556 {
557 if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; };
558 if (rpl->content.__hdr.msgid != IOUserClient_CopyClientMemoryForType_ID) { ret = kIOReturnIPCError; break; };
559 if (rpl->mach.msgh_body.msgh_descriptor_count != 1) { ret = kIOReturnIPCError; break; };
560 if (IOUserClient_CopyClientMemoryForType_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; };
561 }
562 }
563 while (false);
564 if (kIOReturnSuccess == ret)
565 {
566 if (options) *options = rpl->content.options;
567 *memory = OSDynamicCast(IOMemoryDescriptor, (OSObject *) rpl->content.memory);
568 if (rpl->content.memory && !*memory) ret = kIOReturnBadArgument;
569 }
570
571
572 return (ret);
573}
574
575kern_return_t
576IOUserClient::CreateMemoryDescriptorFromClient(
577 uint64_t memoryDescriptorCreateOptions,
578 uint32_t segmentsCount,
579 const IOAddressSegment * segments,
580 IOMemoryDescriptor ** memory,
581 OSDispatchMethod supermethod)
582{
583 kern_return_t ret;
584 union
585 {
586 IOUserClient_CreateMemoryDescriptorFromClient_Msg msg;
587 struct
588 {
589 IOUserClient_CreateMemoryDescriptorFromClient_Rpl rpl;
590 mach_msg_max_trailer_t trailer;
591 } rpl;
592 } buf;
593 struct IOUserClient_CreateMemoryDescriptorFromClient_Msg * msg = &buf.msg;
594 struct IOUserClient_CreateMemoryDescriptorFromClient_Rpl * rpl = &buf.rpl.rpl;
595
596 memset(s: msg, c: 0, n: sizeof(struct IOUserClient_CreateMemoryDescriptorFromClient_Msg));
597 msg->mach.msgh.msgh_id = kIORPCVersion190615;
598 msg->mach.msgh.msgh_size = sizeof(*msg);
599 msg->content.__hdr.flags = 0*kIORPCMessageOneway
600 | 0*kIORPCMessageSimpleReply
601 | 0*kIORPCMessageLocalHost
602 | 0*kIORPCMessageOnqueue;
603 msg->content.__hdr.msgid = IOUserClient_CreateMemoryDescriptorFromClient_ID;
604 msg->content.__object = (OSObjectRef) this;
605 msg->content.__hdr.objectRefs = IOUserClient_CreateMemoryDescriptorFromClient_Msg_ObjRefs;
606 msg->mach.msgh_body.msgh_descriptor_count = 1;
607
608 msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
609
610 msg->content.memoryDescriptorCreateOptions = memoryDescriptorCreateOptions;
611
612 msg->content.segmentsCount = segmentsCount;
613
614 msg->content.segments = NULL;
615
616 if (segmentsCount > (sizeof(msg->content.__segments) / sizeof(msg->content.__segments[0]))) return kIOReturnOverrun;
617 bcopy(src: segments, dst: &msg->content.__segments[0], n: segmentsCount * sizeof(msg->content.__segments[0]));
618
619 IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) };
620 if (supermethod) ret = supermethod((OSObject *)this, rpc);
621 else ret = ((OSObject *)this)->Invoke(rpc);
622
623 if (kIOReturnSuccess == ret)
624 do {
625 {
626 if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; };
627 if (rpl->content.__hdr.msgid != IOUserClient_CreateMemoryDescriptorFromClient_ID) { ret = kIOReturnIPCError; break; };
628 if (rpl->mach.msgh_body.msgh_descriptor_count != 1) { ret = kIOReturnIPCError; break; };
629 if (IOUserClient_CreateMemoryDescriptorFromClient_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; };
630 }
631 }
632 while (false);
633 if (kIOReturnSuccess == ret)
634 {
635 *memory = OSDynamicCast(IOMemoryDescriptor, (OSObject *) rpl->content.memory);
636 if (rpl->content.memory && !*memory) ret = kIOReturnBadArgument;
637 }
638
639
640 return (ret);
641}
642
643kern_return_t
644IOUserClient::CopyClientEntitlements(
645 OSDictionary ** entitlements,
646 OSDispatchMethod supermethod)
647{
648 kern_return_t ret;
649 union
650 {
651 IOUserClient_CopyClientEntitlements_Msg msg;
652 struct
653 {
654 IOUserClient_CopyClientEntitlements_Rpl rpl;
655 mach_msg_max_trailer_t trailer;
656 } rpl;
657 } buf;
658 struct IOUserClient_CopyClientEntitlements_Msg * msg = &buf.msg;
659 struct IOUserClient_CopyClientEntitlements_Rpl * rpl = &buf.rpl.rpl;
660
661 memset(s: msg, c: 0, n: sizeof(struct IOUserClient_CopyClientEntitlements_Msg));
662 msg->mach.msgh.msgh_id = kIORPCVersion190615;
663 msg->mach.msgh.msgh_size = sizeof(*msg);
664 msg->content.__hdr.flags = 0*kIORPCMessageOneway
665 | 0*kIORPCMessageSimpleReply
666 | 0*kIORPCMessageLocalHost
667 | 0*kIORPCMessageOnqueue;
668 msg->content.__hdr.msgid = IOUserClient_CopyClientEntitlements_ID;
669 msg->content.__object = (OSObjectRef) this;
670 msg->content.__hdr.objectRefs = IOUserClient_CopyClientEntitlements_Msg_ObjRefs;
671 msg->mach.msgh_body.msgh_descriptor_count = 1;
672
673 msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
674
675 IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) };
676 if (supermethod) ret = supermethod((OSObject *)this, rpc);
677 else ret = ((OSObject *)this)->Invoke(rpc);
678
679 if (kIOReturnSuccess == ret)
680 do {
681 {
682 if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; };
683 if (rpl->content.__hdr.msgid != IOUserClient_CopyClientEntitlements_ID) { ret = kIOReturnIPCError; break; };
684 if (rpl->mach.msgh_body.msgh_descriptor_count != 1) { ret = kIOReturnIPCError; break; };
685 if (IOUserClient_CopyClientEntitlements_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; };
686 }
687 }
688 while (false);
689 if (kIOReturnSuccess == ret)
690 {
691 *entitlements = OSDynamicCast(OSDictionary, (OSObject *) rpl->content.entitlements);
692 if (rpl->content.entitlements && !*entitlements) ret = kIOReturnBadArgument;
693 }
694
695
696 return (ret);
697}
698
699kern_return_t
700IOUserClient::_ExternalMethod(
701 uint64_t selector,
702 const unsigned long long * scalarInput,
703 uint32_t scalarInputCount,
704 OSData * structureInput,
705 IOMemoryDescriptor * structureInputDescriptor,
706 unsigned long long * scalarOutput,
707 uint32_t * scalarOutputCount,
708 uint64_t structureOutputMaximumSize,
709 OSData ** structureOutput,
710 IOMemoryDescriptor * structureOutputDescriptor,
711 OSAction * completion,
712 OSDispatchMethod supermethod)
713{
714 kern_return_t ret;
715 union
716 {
717 IOUserClient__ExternalMethod_Msg msg;
718 struct
719 {
720 IOUserClient__ExternalMethod_Rpl rpl;
721 mach_msg_max_trailer_t trailer;
722 } rpl;
723 } buf;
724 struct IOUserClient__ExternalMethod_Msg * msg = &buf.msg;
725 struct IOUserClient__ExternalMethod_Rpl * rpl = &buf.rpl.rpl;
726
727 memset(s: msg, c: 0, n: sizeof(struct IOUserClient__ExternalMethod_Msg));
728 msg->mach.msgh.msgh_id = kIORPCVersion190615;
729 msg->mach.msgh.msgh_size = sizeof(*msg);
730 msg->content.__hdr.flags = 0*kIORPCMessageOneway
731 | 0*kIORPCMessageSimpleReply
732 | 0*kIORPCMessageLocalHost
733 | 0*kIORPCMessageOnqueue;
734 msg->content.__hdr.msgid = IOUserClient__ExternalMethod_ID;
735 msg->content.__object = (OSObjectRef) this;
736 msg->content.__hdr.objectRefs = IOUserClient__ExternalMethod_Msg_ObjRefs;
737 msg->mach.msgh_body.msgh_descriptor_count = 5;
738
739 msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
740
741 msg->content.selector = selector;
742
743 msg->content.scalarInput = NULL;
744
745 if (scalarInputCount > (sizeof(msg->content.__scalarInput) / sizeof(msg->content.__scalarInput[0]))) return kIOReturnOverrun;
746 bcopy(src: scalarInput, dst: &msg->content.__scalarInput[0], n: scalarInputCount * sizeof(msg->content.__scalarInput[0]));
747
748 msg->content.scalarInputCount = scalarInputCount;
749
750 msg->structureInput__descriptor.type = MACH_MSG_OOL_DESCRIPTOR;
751 msg->structureInput__descriptor.copy = MACH_MSG_VIRTUAL_COPY;
752 msg->structureInput__descriptor.address = (void *) __builtin_offsetof(IOUserClient__ExternalMethod_Msg_Content, structureInput);
753 msg->content.structureInput = structureInput;
754
755 msg->structureInputDescriptor__descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
756 msg->content.structureInputDescriptor = (OSObjectRef) structureInputDescriptor;
757
758 if (*scalarOutputCount > (sizeof(rpl->content.__scalarOutput) / sizeof(rpl->content.__scalarOutput[0]))) return kIOReturnOverrun;
759 msg->content.scalarOutputCount = *scalarOutputCount;
760
761 msg->content.structureOutputMaximumSize = structureOutputMaximumSize;
762
763 msg->structureOutputDescriptor__descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
764 msg->content.structureOutputDescriptor = (OSObjectRef) structureOutputDescriptor;
765
766 msg->completion__descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
767 msg->content.completion = (OSObjectRef) completion;
768
769 IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) };
770 if (supermethod) ret = supermethod((OSObject *)this, rpc);
771 else ret = ((OSObject *)this)->Invoke(rpc);
772
773 if (kIOReturnSuccess == ret)
774 do {
775 {
776 if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; };
777 if (rpl->content.__hdr.msgid != IOUserClient__ExternalMethod_ID) { ret = kIOReturnIPCError; break; };
778 if (rpl->mach.msgh_body.msgh_descriptor_count != 1) { ret = kIOReturnIPCError; break; };
779 if (IOUserClient__ExternalMethod_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; };
780 }
781 }
782 while (false);
783 if (kIOReturnSuccess == ret)
784 {
785 if (rpl->content.scalarOutputCount < *scalarOutputCount) *scalarOutputCount = rpl->content.scalarOutputCount;
786 bcopy(src: &rpl->content.__scalarOutput[0], dst: scalarOutput, n: *scalarOutputCount * sizeof(rpl->content.__scalarOutput[0]));
787 *structureOutput = OSDynamicCast(OSData, (OSObject *) rpl->content.structureOutput);
788 if (rpl->content.structureOutput && !*structureOutput) ret = kIOReturnBadArgument;
789 }
790
791
792 return (ret);
793}
794
795kern_return_t
796IOUserClient::CreateActionKernelCompletion(size_t referenceSize, OSAction ** action)
797{
798 kern_return_t ret;
799
800#if defined(IOKIT_ENABLE_SHARED_PTR)
801 OSSharedPtr<OSString>
802#else /* defined(IOKIT_ENABLE_SHARED_PTR) */
803 OSString *
804#endif /* !defined(IOKIT_ENABLE_SHARED_PTR) */
805 typeName = OSString::withCString(cString: "OSAction_IOUserClient_KernelCompletion");
806 if (!typeName) {
807 return kIOReturnNoMemory;
808 }
809 ret = OSAction_IOUserClient_KernelCompletion::CreateWithTypeName(target: this,
810 IOUserClient_KernelCompletion_ID,
811 IOUserClient_AsyncCompletion_ID,
812 referenceSize,
813#if defined(IOKIT_ENABLE_SHARED_PTR)
814 typeName.get(),
815#else /* defined(IOKIT_ENABLE_SHARED_PTR) */
816 typeName,
817#endif /* !defined(IOKIT_ENABLE_SHARED_PTR) */
818 action);
819
820#if !defined(IOKIT_ENABLE_SHARED_PTR)
821 typeName->release();
822#endif /* !defined(IOKIT_ENABLE_SHARED_PTR) */
823 return (ret);
824}
825
826kern_return_t
827IOUserClient::AsyncCompletion_Invoke(const IORPC _rpc,
828 OSMetaClassBase * target,
829 AsyncCompletion_Handler func)
830{
831 return IOUserClient::AsyncCompletion_Invoke(rpc: _rpc, target, func, NULL);
832}
833
834kern_return_t
835IOUserClient::AsyncCompletion_Invoke(const IORPC _rpc,
836 OSMetaClassBase * target,
837 AsyncCompletion_Handler func,
838 const OSMetaClass * targetActionClass)
839{
840 IOUserClient_AsyncCompletion_Invocation rpc = { .rpc: _rpc };
841 OSAction * action;
842 uint32_t asyncDataCount = (sizeof(rpc.message->content.__asyncData) / sizeof(rpc.message->content.__asyncData[0]));
843 if (asyncDataCount > rpc.message->content.asyncDataCount) asyncDataCount = rpc.message->content.asyncDataCount;
844
845 if (2 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError);
846 if (IOUserClient_AsyncCompletion_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError);
847 if (rpc.message != NULL && rpc.sendSize < sizeof(IOUserClient_AsyncCompletion_Msg)) return (kIOReturnIPCError);
848 if (rpc.reply != NULL && rpc.replySize < sizeof(IOUserClient_AsyncCompletion_Rpl)) return (kIOReturnIPCError);
849 if (targetActionClass) {
850 action = (OSAction *) OSMetaClassBase::safeMetaCast(anObject: (OSObject *) rpc.message->content.action, toMeta: targetActionClass);
851 } else {
852 action = OSDynamicCast(OSAction, (OSObject *) rpc.message->content.action);
853 }
854 if (!action && rpc.message->content.action) return (kIOReturnBadArgument);
855
856 (*func)(target,
857 action,
858 rpc.message->content.status,
859 &rpc.message->content.__asyncData[0],
860 asyncDataCount);
861
862
863 return (kIOReturnSuccess);
864}
865
866kern_return_t
867IOUserClient::CopyClientMemoryForType_Invoke(const IORPC _rpc,
868 OSMetaClassBase * target,
869 CopyClientMemoryForType_Handler func)
870{
871 IOUserClient_CopyClientMemoryForType_Invocation rpc = { .rpc: _rpc };
872 kern_return_t ret;
873
874 if (1 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError);
875 if (IOUserClient_CopyClientMemoryForType_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError);
876 if (rpc.message != NULL && rpc.sendSize < sizeof(IOUserClient_CopyClientMemoryForType_Msg)) return (kIOReturnIPCError);
877 if (rpc.reply != NULL && rpc.replySize < sizeof(IOUserClient_CopyClientMemoryForType_Rpl)) return (kIOReturnIPCError);
878
879 ret = (*func)(target,
880 rpc.message->content.type,
881 &rpc.reply->content.options,
882 (IOMemoryDescriptor **)&rpc.reply->content.memory);
883
884 if (kIOReturnSuccess != ret) return (ret);
885
886 rpc.reply->content.__hdr.msgid = IOUserClient_CopyClientMemoryForType_ID;
887 rpc.reply->content.__hdr.flags = kIORPCMessageOneway;
888 rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply;
889 rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply);
890 rpc.reply->mach.msgh_body.msgh_descriptor_count = 1;
891 rpc.reply->content.__hdr.objectRefs = IOUserClient_CopyClientMemoryForType_Rpl_ObjRefs;
892 rpc.reply->memory__descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
893
894 return (ret);
895}
896
897kern_return_t
898IOUserClient::CreateMemoryDescriptorFromClient_Invoke(const IORPC _rpc,
899 OSMetaClassBase * target,
900 CreateMemoryDescriptorFromClient_Handler func)
901{
902 IOUserClient_CreateMemoryDescriptorFromClient_Invocation rpc = { .rpc: _rpc };
903 kern_return_t ret;
904 uint32_t segmentsCount = (sizeof(rpc.message->content.__segments) / sizeof(rpc.message->content.__segments[0]));
905 if (segmentsCount > rpc.message->content.segmentsCount) segmentsCount = rpc.message->content.segmentsCount;
906
907 if (1 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError);
908 if (IOUserClient_CreateMemoryDescriptorFromClient_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError);
909 if (rpc.message != NULL && rpc.sendSize < sizeof(IOUserClient_CreateMemoryDescriptorFromClient_Msg)) return (kIOReturnIPCError);
910 if (rpc.reply != NULL && rpc.replySize < sizeof(IOUserClient_CreateMemoryDescriptorFromClient_Rpl)) return (kIOReturnIPCError);
911
912 ret = (*func)(target,
913 rpc.message->content.memoryDescriptorCreateOptions,
914 segmentsCount,
915 &rpc.message->content.__segments[0],
916 (IOMemoryDescriptor **)&rpc.reply->content.memory);
917
918 if (kIOReturnSuccess != ret) return (ret);
919
920 rpc.reply->content.__hdr.msgid = IOUserClient_CreateMemoryDescriptorFromClient_ID;
921 rpc.reply->content.__hdr.flags = kIORPCMessageOneway;
922 rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply;
923 rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply);
924 rpc.reply->mach.msgh_body.msgh_descriptor_count = 1;
925 rpc.reply->content.__hdr.objectRefs = IOUserClient_CreateMemoryDescriptorFromClient_Rpl_ObjRefs;
926 rpc.reply->memory__descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
927
928 return (ret);
929}
930
931kern_return_t
932IOUserClient::CopyClientEntitlements_Invoke(const IORPC _rpc,
933 OSMetaClassBase * target,
934 CopyClientEntitlements_Handler func)
935{
936 IOUserClient_CopyClientEntitlements_Invocation rpc = { .rpc: _rpc };
937 kern_return_t ret;
938
939 if (1 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError);
940 if (IOUserClient_CopyClientEntitlements_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError);
941 if (rpc.message != NULL && rpc.sendSize < sizeof(IOUserClient_CopyClientEntitlements_Msg)) return (kIOReturnIPCError);
942 if (rpc.reply != NULL && rpc.replySize < sizeof(IOUserClient_CopyClientEntitlements_Rpl)) return (kIOReturnIPCError);
943
944 ret = (*func)(target,
945 &rpc.reply->content.entitlements);
946
947 if (kIOReturnSuccess != ret) return (ret);
948
949 rpc.reply->content.__hdr.msgid = IOUserClient_CopyClientEntitlements_ID;
950 rpc.reply->content.__hdr.flags = kIORPCMessageOneway;
951 rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply;
952 rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply);
953 rpc.reply->mach.msgh_body.msgh_descriptor_count = 1;
954 rpc.reply->content.__hdr.objectRefs = IOUserClient_CopyClientEntitlements_Rpl_ObjRefs;
955 rpc.reply->entitlements__descriptor.type = MACH_MSG_OOL_DESCRIPTOR;
956 rpc.reply->entitlements__descriptor.copy = MACH_MSG_VIRTUAL_COPY;
957 rpc.reply->entitlements__descriptor.address = (void *) __builtin_offsetof(IOUserClient_CopyClientEntitlements_Rpl_Content, entitlements);
958 rpc.reply->entitlements__descriptor.size = 0;
959
960 return (ret);
961}
962
963kern_return_t
964IOUserClient::_ExternalMethod_Invoke(const IORPC _rpc,
965 OSMetaClassBase * target,
966 _ExternalMethod_Handler func)
967{
968 IOUserClient__ExternalMethod_Invocation rpc = { .rpc: _rpc };
969 kern_return_t ret;
970 uint32_t scalarInputCount = (sizeof(rpc.message->content.__scalarInput) / sizeof(rpc.message->content.__scalarInput[0]));
971 if (scalarInputCount > rpc.message->content.scalarInputCount) scalarInputCount = rpc.message->content.scalarInputCount;
972 IOMemoryDescriptor * structureInputDescriptor;
973 unsigned int scalarOutputCount = (sizeof(rpc.reply->content.__scalarOutput) / sizeof(rpc.reply->content.__scalarOutput[0]));
974 if (scalarOutputCount > rpc.message->content.scalarOutputCount) scalarOutputCount = rpc.message->content.scalarOutputCount;
975 IOMemoryDescriptor * structureOutputDescriptor;
976 OSAction * completion;
977
978 if (5 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError);
979 if (IOUserClient__ExternalMethod_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError);
980 if (rpc.message != NULL && rpc.sendSize < sizeof(IOUserClient__ExternalMethod_Msg)) return (kIOReturnIPCError);
981 if (rpc.reply != NULL && rpc.replySize < sizeof(IOUserClient__ExternalMethod_Rpl)) return (kIOReturnIPCError);
982 if (((OSObject *) rpc.message->content.structureInput) != NULL && OSDynamicCast(OSData, (OSObject *) rpc.message->content.structureInput) == NULL) { return kIOReturnBadArgument; }
983 structureInputDescriptor = OSDynamicCast(IOMemoryDescriptor, (OSObject *) rpc.message->content.structureInputDescriptor);
984 if (!structureInputDescriptor && rpc.message->content.structureInputDescriptor) return (kIOReturnBadArgument);
985 structureOutputDescriptor = OSDynamicCast(IOMemoryDescriptor, (OSObject *) rpc.message->content.structureOutputDescriptor);
986 if (!structureOutputDescriptor && rpc.message->content.structureOutputDescriptor) return (kIOReturnBadArgument);
987 completion = OSDynamicCast(OSAction, (OSObject *) rpc.message->content.completion);
988 if (!completion && rpc.message->content.completion) return (kIOReturnBadArgument);
989
990 ret = (*func)(target,
991 rpc.message->content.selector,
992 &rpc.message->content.__scalarInput[0],
993 scalarInputCount,
994 rpc.message->content.structureInput,
995 structureInputDescriptor,
996 &rpc.reply->content.__scalarOutput[0],
997 &scalarOutputCount,
998 rpc.message->content.structureOutputMaximumSize,
999 &rpc.reply->content.structureOutput,
1000 structureOutputDescriptor,
1001 completion);
1002
1003 if (kIOReturnSuccess != ret) return (ret);
1004
1005 rpc.reply->content.__hdr.msgid = IOUserClient__ExternalMethod_ID;
1006 rpc.reply->content.__hdr.flags = kIORPCMessageOneway;
1007 rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply;
1008 rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply);
1009 rpc.reply->mach.msgh_body.msgh_descriptor_count = 1;
1010 rpc.reply->content.__hdr.objectRefs = IOUserClient__ExternalMethod_Rpl_ObjRefs;
1011 rpc.reply->content.scalarOutputCount = scalarOutputCount;
1012 rpc.reply->structureOutput__descriptor.type = MACH_MSG_OOL_DESCRIPTOR;
1013 rpc.reply->structureOutput__descriptor.copy = MACH_MSG_VIRTUAL_COPY;
1014 rpc.reply->structureOutput__descriptor.address = (void *) __builtin_offsetof(IOUserClient__ExternalMethod_Rpl_Content, structureOutput);
1015 rpc.reply->structureOutput__descriptor.size = 0;
1016
1017 return (ret);
1018}
1019
1020#if KERNEL
1021OSDefineMetaClassAndStructors(OSAction_IOUserClient_KernelCompletion, OSAction);
1022#endif /* KERNEL */
1023
1024#if !KERNEL
1025
1026#define OSAction_IOUserClient_KernelCompletion_QueueNames ""
1027
1028#define OSAction_IOUserClient_KernelCompletion_MethodNames ""
1029
1030#define OSAction_IOUserClient_KernelCompletionMetaClass_MethodNames ""
1031
1032struct OSClassDescription_OSAction_IOUserClient_KernelCompletion_t
1033{
1034 OSClassDescription base;
1035 uint64_t methodOptions[2 * 0];
1036 uint64_t metaMethodOptions[2 * 0];
1037 char queueNames[sizeof(OSAction_IOUserClient_KernelCompletion_QueueNames)];
1038 char methodNames[sizeof(OSAction_IOUserClient_KernelCompletion_MethodNames)];
1039 char metaMethodNames[sizeof(OSAction_IOUserClient_KernelCompletionMetaClass_MethodNames)];
1040};
1041
1042 __attribute__((availability(driverkit,introduced=20,message="Type-safe OSAction factory methods are available in DriverKit 20 and newer")))
1043const struct OSClassDescription_OSAction_IOUserClient_KernelCompletion_t
1044OSClassDescription_OSAction_IOUserClient_KernelCompletion =
1045{
1046 .base =
1047 {
1048 .descriptionSize = sizeof(OSClassDescription_OSAction_IOUserClient_KernelCompletion_t),
1049 .name = "OSAction_IOUserClient_KernelCompletion",
1050 .superName = "OSAction",
1051 .methodOptionsSize = 2 * sizeof(uint64_t) * 0,
1052 .methodOptionsOffset = __builtin_offsetof(struct OSClassDescription_OSAction_IOUserClient_KernelCompletion_t, methodOptions),
1053 .metaMethodOptionsSize = 2 * sizeof(uint64_t) * 0,
1054 .metaMethodOptionsOffset = __builtin_offsetof(struct OSClassDescription_OSAction_IOUserClient_KernelCompletion_t, metaMethodOptions),
1055 .queueNamesSize = sizeof(OSAction_IOUserClient_KernelCompletion_QueueNames),
1056 .queueNamesOffset = __builtin_offsetof(struct OSClassDescription_OSAction_IOUserClient_KernelCompletion_t, queueNames),
1057 .methodNamesSize = sizeof(OSAction_IOUserClient_KernelCompletion_MethodNames),
1058 .methodNamesOffset = __builtin_offsetof(struct OSClassDescription_OSAction_IOUserClient_KernelCompletion_t, methodNames),
1059 .metaMethodNamesSize = sizeof(OSAction_IOUserClient_KernelCompletionMetaClass_MethodNames),
1060 .metaMethodNamesOffset = __builtin_offsetof(struct OSClassDescription_OSAction_IOUserClient_KernelCompletion_t, metaMethodNames),
1061 .flags = 0*kOSClassCanRemote,
1062 },
1063 .methodOptions =
1064 {
1065 },
1066 .metaMethodOptions =
1067 {
1068 },
1069 .queueNames = OSAction_IOUserClient_KernelCompletion_QueueNames,
1070 .methodNames = OSAction_IOUserClient_KernelCompletion_MethodNames,
1071 .metaMethodNames = OSAction_IOUserClient_KernelCompletionMetaClass_MethodNames,
1072};
1073
1074 __attribute__((availability(driverkit,introduced=20,message="Type-safe OSAction factory methods are available in DriverKit 20 and newer")))
1075OSMetaClass * gOSAction_IOUserClient_KernelCompletionMetaClass;
1076
1077 __attribute__((availability(driverkit,introduced=20,message="Type-safe OSAction factory methods are available in DriverKit 20 and newer")))
1078static kern_return_t
1079OSAction_IOUserClient_KernelCompletion_New(OSMetaClass * instance);
1080
1081 __attribute__((availability(driverkit,introduced=20,message="Type-safe OSAction factory methods are available in DriverKit 20 and newer")))
1082const OSClassLoadInformation
1083OSAction_IOUserClient_KernelCompletion_Class =
1084{
1085 .description = &OSClassDescription_OSAction_IOUserClient_KernelCompletion.base,
1086 .metaPointer = &gOSAction_IOUserClient_KernelCompletionMetaClass,
1087 .version = 1,
1088 .instanceSize = sizeof(OSAction_IOUserClient_KernelCompletion),
1089
1090 .New = &OSAction_IOUserClient_KernelCompletion_New,
1091};
1092
1093 __attribute__((availability(driverkit,introduced=20,message="Type-safe OSAction factory methods are available in DriverKit 20 and newer")))
1094extern const void * const
1095gOSAction_IOUserClient_KernelCompletion_Declaration;
1096 __attribute__((availability(driverkit,introduced=20,message="Type-safe OSAction factory methods are available in DriverKit 20 and newer")))
1097const void * const
1098gOSAction_IOUserClient_KernelCompletion_Declaration
1099 __attribute__((availability(driverkit,introduced=20,message="Type-safe OSAction factory methods are available in DriverKit 20 and newer")))
1100__attribute__((visibility("hidden"),section("__DATA_CONST,__osclassinfo,regular,no_dead_strip"),no_sanitize("address")))
1101 = &OSAction_IOUserClient_KernelCompletion_Class;
1102
1103 __attribute__((availability(driverkit,introduced=20,message="Type-safe OSAction factory methods are available in DriverKit 20 and newer")))
1104static kern_return_t
1105OSAction_IOUserClient_KernelCompletion_New(OSMetaClass * instance)
1106{
1107 if (!new(instance) OSAction_IOUserClient_KernelCompletionMetaClass) return (kIOReturnNoMemory);
1108 return (kIOReturnSuccess);
1109}
1110
1111 __attribute__((availability(driverkit,introduced=20,message="Type-safe OSAction factory methods are available in DriverKit 20 and newer")))
1112kern_return_t
1113OSAction_IOUserClient_KernelCompletionMetaClass::New(OSObject * instance)
1114{
1115 if (!new(instance) OSAction_IOUserClient_KernelCompletion) return (kIOReturnNoMemory);
1116 return (kIOReturnSuccess);
1117}
1118
1119#endif /* !KERNEL */
1120
1121kern_return_t
1122OSAction_IOUserClient_KernelCompletion::Dispatch(const IORPC rpc)
1123{
1124 return _Dispatch(self: this, rpc);
1125}
1126
1127kern_return_t
1128OSAction_IOUserClient_KernelCompletion::_Dispatch(OSAction_IOUserClient_KernelCompletion * self, const IORPC rpc)
1129{
1130 kern_return_t ret = kIOReturnUnsupported;
1131 IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false);
1132
1133 switch (msg->msgid)
1134 {
1135
1136 default:
1137 ret = OSAction::_Dispatch(self, rpc);
1138 break;
1139 }
1140
1141 return (ret);
1142}
1143
1144#if KERNEL
1145kern_return_t
1146OSAction_IOUserClient_KernelCompletion::MetaClass::Dispatch(const IORPC rpc)
1147{
1148#else /* KERNEL */
1149kern_return_t
1150OSAction_IOUserClient_KernelCompletionMetaClass::Dispatch(const IORPC rpc)
1151{
1152#endif /* !KERNEL */
1153
1154 kern_return_t ret = kIOReturnUnsupported;
1155 IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false);
1156
1157 switch (msg->msgid)
1158 {
1159
1160 default:
1161 ret = OSMetaClassBase::Dispatch(rpc);
1162 break;
1163 }
1164
1165 return (ret);
1166}
1167
1168
1169
1170