1/* iig(DriverKit-286 Mar 29 2024 10:27:09) generated from IODispatchSource.iig */
2
3#undef IIG_IMPLEMENTATION
4#define IIG_IMPLEMENTATION IODispatchSource.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/IODispatchSource.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
22struct IODispatchSource_Cancel_Msg_Content
23{
24 IORPCMessage __hdr;
25 OSObjectRef __object;
26 IODispatchSourceCancelHandler handler;
27};
28#pragma pack(4)
29struct IODispatchSource_Cancel_Msg
30{
31 IORPCMessageMach mach;
32 mach_msg_port_descriptor_t __object__descriptor;
33 IODispatchSource_Cancel_Msg_Content content;
34};
35#pragma pack()
36#define IODispatchSource_Cancel_Msg_ObjRefs (1)
37
38struct IODispatchSource_Cancel_Rpl_Content
39{
40 IORPCMessage __hdr;
41};
42#pragma pack(4)
43struct IODispatchSource_Cancel_Rpl
44{
45 IORPCMessageMach mach;
46 IODispatchSource_Cancel_Rpl_Content content;
47};
48#pragma pack()
49#define IODispatchSource_Cancel_Rpl_ObjRefs (0)
50
51
52typedef union
53{
54 const IORPC rpc;
55 struct
56 {
57 const struct IODispatchSource_Cancel_Msg * message;
58 struct IODispatchSource_Cancel_Rpl * reply;
59 uint32_t sendSize;
60 uint32_t replySize;
61 };
62}
63IODispatchSource_Cancel_Invocation;
64struct IODispatchSource_SetEnableWithCompletion_Msg_Content
65{
66 IORPCMessage __hdr;
67 OSObjectRef __object;
68 bool enable;
69 IODispatchSourceCancelHandler handler;
70};
71#pragma pack(4)
72struct IODispatchSource_SetEnableWithCompletion_Msg
73{
74 IORPCMessageMach mach;
75 mach_msg_port_descriptor_t __object__descriptor;
76 IODispatchSource_SetEnableWithCompletion_Msg_Content content;
77};
78#pragma pack()
79#define IODispatchSource_SetEnableWithCompletion_Msg_ObjRefs (1)
80
81struct IODispatchSource_SetEnableWithCompletion_Rpl_Content
82{
83 IORPCMessage __hdr;
84};
85#pragma pack(4)
86struct IODispatchSource_SetEnableWithCompletion_Rpl
87{
88 IORPCMessageMach mach;
89 IODispatchSource_SetEnableWithCompletion_Rpl_Content content;
90};
91#pragma pack()
92#define IODispatchSource_SetEnableWithCompletion_Rpl_ObjRefs (0)
93
94
95typedef union
96{
97 const IORPC rpc;
98 struct
99 {
100 const struct IODispatchSource_SetEnableWithCompletion_Msg * message;
101 struct IODispatchSource_SetEnableWithCompletion_Rpl * reply;
102 uint32_t sendSize;
103 uint32_t replySize;
104 };
105}
106IODispatchSource_SetEnableWithCompletion_Invocation;
107struct IODispatchSource_CheckForWork_Msg_Content
108{
109 IORPCMessage __hdr;
110 OSObjectRef __object;
111 bool synchronous;
112};
113#pragma pack(4)
114struct IODispatchSource_CheckForWork_Msg
115{
116 IORPCMessageMach mach;
117 mach_msg_port_descriptor_t __object__descriptor;
118 IODispatchSource_CheckForWork_Msg_Content content;
119};
120#pragma pack()
121#define IODispatchSource_CheckForWork_Msg_ObjRefs (1)
122
123struct IODispatchSource_CheckForWork_Rpl_Content
124{
125 IORPCMessage __hdr;
126 uint64_t __replyBuffer[8];
127};
128#pragma pack(4)
129struct IODispatchSource_CheckForWork_Rpl
130{
131 IORPCMessageMach mach;
132 IODispatchSource_CheckForWork_Rpl_Content content;
133};
134#pragma pack()
135#define IODispatchSource_CheckForWork_Rpl_ObjRefs (0)
136
137
138typedef union
139{
140 const IORPC rpc;
141 struct
142 {
143 const struct IODispatchSource_CheckForWork_Msg * message;
144 struct IODispatchSource_CheckForWork_Rpl * reply;
145 uint32_t sendSize;
146 uint32_t replySize;
147 };
148}
149IODispatchSource_CheckForWork_Invocation;
150struct IODispatchSource_SetEnable_Msg_Content
151{
152 IORPCMessage __hdr;
153 OSObjectRef __object;
154 bool enable;
155};
156#pragma pack(4)
157struct IODispatchSource_SetEnable_Msg
158{
159 IORPCMessageMach mach;
160 mach_msg_port_descriptor_t __object__descriptor;
161 IODispatchSource_SetEnable_Msg_Content content;
162};
163#pragma pack()
164#define IODispatchSource_SetEnable_Msg_ObjRefs (1)
165
166struct IODispatchSource_SetEnable_Rpl_Content
167{
168 IORPCMessage __hdr;
169};
170#pragma pack(4)
171struct IODispatchSource_SetEnable_Rpl
172{
173 IORPCMessageMach mach;
174 IODispatchSource_SetEnable_Rpl_Content content;
175};
176#pragma pack()
177#define IODispatchSource_SetEnable_Rpl_ObjRefs (0)
178
179
180typedef union
181{
182 const IORPC rpc;
183 struct
184 {
185 const struct IODispatchSource_SetEnable_Msg * message;
186 struct IODispatchSource_SetEnable_Rpl * reply;
187 uint32_t sendSize;
188 uint32_t replySize;
189 };
190}
191IODispatchSource_SetEnable_Invocation;
192#if !KERNEL
193extern OSMetaClass * gOSContainerMetaClass;
194extern OSMetaClass * gOSDataMetaClass;
195extern OSMetaClass * gOSNumberMetaClass;
196extern OSMetaClass * gOSStringMetaClass;
197extern OSMetaClass * gOSBooleanMetaClass;
198extern OSMetaClass * gOSDictionaryMetaClass;
199extern OSMetaClass * gOSArrayMetaClass;
200extern OSMetaClass * gOSSetMetaClass;
201extern OSMetaClass * gOSOrderedSetMetaClass;
202extern OSMetaClass * gIODispatchQueueMetaClass;
203#endif /* !KERNEL */
204
205#if KERNEL
206OSDefineMetaClassAndStructors(IODispatchSource, OSObject);
207#endif /* KERNEL */
208
209#if !KERNEL
210
211#define IODispatchSource_QueueNames ""
212
213#define IODispatchSource_MethodNames ""
214
215#define IODispatchSourceMetaClass_MethodNames ""
216
217struct OSClassDescription_IODispatchSource_t
218{
219 OSClassDescription base;
220 uint64_t methodOptions[2 * 0];
221 uint64_t metaMethodOptions[2 * 0];
222 char queueNames[sizeof(IODispatchSource_QueueNames)];
223 char methodNames[sizeof(IODispatchSource_MethodNames)];
224 char metaMethodNames[sizeof(IODispatchSourceMetaClass_MethodNames)];
225};
226
227const struct OSClassDescription_IODispatchSource_t
228OSClassDescription_IODispatchSource =
229{
230 .base =
231 {
232 .descriptionSize = sizeof(OSClassDescription_IODispatchSource_t),
233 .name = "IODispatchSource",
234 .superName = "OSObject",
235 .methodOptionsSize = 2 * sizeof(uint64_t) * 0,
236 .methodOptionsOffset = __builtin_offsetof(struct OSClassDescription_IODispatchSource_t, methodOptions),
237 .metaMethodOptionsSize = 2 * sizeof(uint64_t) * 0,
238 .metaMethodOptionsOffset = __builtin_offsetof(struct OSClassDescription_IODispatchSource_t, metaMethodOptions),
239 .queueNamesSize = sizeof(IODispatchSource_QueueNames),
240 .queueNamesOffset = __builtin_offsetof(struct OSClassDescription_IODispatchSource_t, queueNames),
241 .methodNamesSize = sizeof(IODispatchSource_MethodNames),
242 .methodNamesOffset = __builtin_offsetof(struct OSClassDescription_IODispatchSource_t, methodNames),
243 .metaMethodNamesSize = sizeof(IODispatchSourceMetaClass_MethodNames),
244 .metaMethodNamesOffset = __builtin_offsetof(struct OSClassDescription_IODispatchSource_t, metaMethodNames),
245 .flags = 1*kOSClassCanRemote,
246 },
247 .methodOptions =
248 {
249 },
250 .metaMethodOptions =
251 {
252 },
253 .queueNames = IODispatchSource_QueueNames,
254 .methodNames = IODispatchSource_MethodNames,
255 .metaMethodNames = IODispatchSourceMetaClass_MethodNames,
256};
257
258OSMetaClass * gIODispatchSourceMetaClass;
259
260static kern_return_t
261IODispatchSource_New(OSMetaClass * instance);
262
263const OSClassLoadInformation
264IODispatchSource_Class =
265{
266 .description = &OSClassDescription_IODispatchSource.base,
267 .metaPointer = &gIODispatchSourceMetaClass,
268 .version = 1,
269 .instanceSize = sizeof(IODispatchSource),
270
271 .New = &IODispatchSource_New,
272};
273
274extern const void * const
275gIODispatchSource_Declaration;
276const void * const
277gIODispatchSource_Declaration
278__attribute__((visibility("hidden"),section("__DATA_CONST,__osclassinfo,regular,no_dead_strip"),no_sanitize("address")))
279 = &IODispatchSource_Class;
280
281static kern_return_t
282IODispatchSource_New(OSMetaClass * instance)
283{
284 if (!new(instance) IODispatchSourceMetaClass) return (kIOReturnNoMemory);
285 return (kIOReturnSuccess);
286}
287
288kern_return_t
289IODispatchSourceMetaClass::New(OSObject * instance)
290{
291 if (!new(instance) IODispatchSource) return (kIOReturnNoMemory);
292 return (kIOReturnSuccess);
293}
294
295#endif /* !KERNEL */
296
297kern_return_t
298IODispatchSource::Dispatch(const IORPC rpc)
299{
300 return _Dispatch(self: this, rpc);
301}
302
303kern_return_t
304IODispatchSource::_Dispatch(IODispatchSource * self, const IORPC rpc)
305{
306 kern_return_t ret = kIOReturnUnsupported;
307 IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false);
308
309 switch (msg->msgid)
310 {
311 case IODispatchSource_SetEnable_ID:
312 {
313 ret = IODispatchSource::SetEnable_Invoke(rpc, target: self, SimpleMemberFunctionCast(IODispatchSource::SetEnable_Handler, *self, &IODispatchSource::SetEnable_Impl));
314 break;
315 }
316
317 default:
318 ret = OSObject::_Dispatch(self, rpc);
319 break;
320 }
321
322 return (ret);
323}
324
325#if KERNEL
326kern_return_t
327IODispatchSource::MetaClass::Dispatch(const IORPC rpc)
328{
329#else /* KERNEL */
330kern_return_t
331IODispatchSourceMetaClass::Dispatch(const IORPC rpc)
332{
333#endif /* !KERNEL */
334
335 kern_return_t ret = kIOReturnUnsupported;
336 IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false);
337
338 switch (msg->msgid)
339 {
340
341 default:
342 ret = OSMetaClassBase::Dispatch(rpc);
343 break;
344 }
345
346 return (ret);
347}
348
349kern_return_t
350IODispatchSource::Cancel(
351 IODispatchSourceCancelHandler handler,
352 OSDispatchMethod supermethod)
353{
354 kern_return_t ret;
355 union
356 {
357 IODispatchSource_Cancel_Msg msg;
358 struct
359 {
360 IODispatchSource_Cancel_Rpl rpl;
361 mach_msg_max_trailer_t trailer;
362 } rpl;
363 } buf;
364 struct IODispatchSource_Cancel_Msg * msg = &buf.msg;
365 struct IODispatchSource_Cancel_Rpl * rpl = &buf.rpl.rpl;
366
367 memset(s: msg, c: 0, n: sizeof(struct IODispatchSource_Cancel_Msg));
368 msg->mach.msgh.msgh_id = kIORPCVersion190615;
369 msg->mach.msgh.msgh_size = sizeof(*msg);
370 msg->content.__hdr.flags = 0*kIORPCMessageOneway
371 | 1*kIORPCMessageSimpleReply
372 | 0*kIORPCMessageLocalHost
373 | 0*kIORPCMessageOnqueue;
374 msg->content.__hdr.msgid = IODispatchSource_Cancel_ID;
375 msg->content.__object = (OSObjectRef) this;
376 msg->content.__hdr.objectRefs = IODispatchSource_Cancel_Msg_ObjRefs;
377 msg->mach.msgh_body.msgh_descriptor_count = 1;
378
379 msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
380
381 msg->content.handler = handler;
382
383 IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) };
384 if (supermethod) ret = supermethod((OSObject *)this, rpc);
385 else ret = ((OSObject *)this)->Invoke(rpc);
386
387 if (kIOReturnSuccess == ret)
388 do {
389 {
390 if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; };
391 if (rpl->content.__hdr.msgid != IODispatchSource_Cancel_ID) { ret = kIOReturnIPCError; break; };
392 if (rpl->mach.msgh_body.msgh_descriptor_count != 0) { ret = kIOReturnIPCError; break; };
393 if (IODispatchSource_Cancel_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; };
394 }
395 }
396 while (false);
397 if (kIOReturnSuccess == ret)
398 {
399 }
400
401
402 return (ret);
403}
404
405kern_return_t
406IODispatchSource::SetEnableWithCompletion(
407 bool enable,
408 IODispatchSourceCancelHandler handler,
409 OSDispatchMethod supermethod)
410{
411 kern_return_t ret;
412 union
413 {
414 IODispatchSource_SetEnableWithCompletion_Msg msg;
415 struct
416 {
417 IODispatchSource_SetEnableWithCompletion_Rpl rpl;
418 mach_msg_max_trailer_t trailer;
419 } rpl;
420 } buf;
421 struct IODispatchSource_SetEnableWithCompletion_Msg * msg = &buf.msg;
422 struct IODispatchSource_SetEnableWithCompletion_Rpl * rpl = &buf.rpl.rpl;
423
424 memset(s: msg, c: 0, n: sizeof(struct IODispatchSource_SetEnableWithCompletion_Msg));
425 msg->mach.msgh.msgh_id = kIORPCVersion190615;
426 msg->mach.msgh.msgh_size = sizeof(*msg);
427 msg->content.__hdr.flags = 0*kIORPCMessageOneway
428 | 1*kIORPCMessageSimpleReply
429 | 0*kIORPCMessageLocalHost
430 | 0*kIORPCMessageOnqueue;
431 msg->content.__hdr.msgid = IODispatchSource_SetEnableWithCompletion_ID;
432 msg->content.__object = (OSObjectRef) this;
433 msg->content.__hdr.objectRefs = IODispatchSource_SetEnableWithCompletion_Msg_ObjRefs;
434 msg->mach.msgh_body.msgh_descriptor_count = 1;
435
436 msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
437
438 msg->content.enable = enable;
439
440 msg->content.handler = handler;
441
442 IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) };
443 if (supermethod) ret = supermethod((OSObject *)this, rpc);
444 else ret = ((OSObject *)this)->Invoke(rpc);
445
446 if (kIOReturnSuccess == ret)
447 do {
448 {
449 if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; };
450 if (rpl->content.__hdr.msgid != IODispatchSource_SetEnableWithCompletion_ID) { ret = kIOReturnIPCError; break; };
451 if (rpl->mach.msgh_body.msgh_descriptor_count != 0) { ret = kIOReturnIPCError; break; };
452 if (IODispatchSource_SetEnableWithCompletion_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; };
453 }
454 }
455 while (false);
456 if (kIOReturnSuccess == ret)
457 {
458 }
459
460
461 return (ret);
462}
463
464kern_return_t
465IODispatchSource::CheckForWork(
466 bool synchronous,
467 OSDispatchMethod supermethod)
468{
469 kern_return_t ret;
470 union
471 {
472 IODispatchSource_CheckForWork_Msg msg;
473 struct
474 {
475 IODispatchSource_CheckForWork_Rpl rpl;
476 mach_msg_max_trailer_t trailer;
477 } rpl;
478 } buf;
479 struct IODispatchSource_CheckForWork_Msg * msg = &buf.msg;
480 struct IODispatchSource_CheckForWork_Rpl * rpl = &buf.rpl.rpl;
481
482 memset(s: msg, c: 0, n: sizeof(struct IODispatchSource_CheckForWork_Msg));
483 msg->mach.msgh.msgh_id = kIORPCVersion190615;
484 msg->mach.msgh.msgh_size = sizeof(*msg);
485 msg->content.__hdr.flags = 0*kIORPCMessageOneway
486 | 1*kIORPCMessageSimpleReply
487 | 0*kIORPCMessageLocalHost
488 | 0*kIORPCMessageOnqueue;
489 msg->content.__hdr.msgid = IODispatchSource_CheckForWork_ID;
490 msg->content.__object = (OSObjectRef) this;
491 msg->content.__hdr.objectRefs = IODispatchSource_CheckForWork_Msg_ObjRefs;
492 msg->mach.msgh_body.msgh_descriptor_count = 1;
493
494 msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
495
496 msg->content.synchronous = synchronous;
497
498 IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) };
499 if (supermethod) ret = supermethod((OSObject *)this, rpc);
500 else ret = ((OSObject *)this)->Invoke(rpc);
501
502 if (kIOReturnSuccess == ret)
503 do {
504 if (rpl->mach.msgh.msgh_size < (sizeof(IORPCMessageMach) + sizeof(IORPCMessage))) { ret = kIOReturnIPCError; break; };
505 if (rpl->mach.msgh_body.msgh_descriptor_count >= 1)
506 {
507 if (rpl->mach.msgh.msgh_size < (sizeof(IORPCMessageMach) + sizeof(mach_msg_port_descriptor_t) + sizeof(IORPCMessage))) { ret = kIOReturnIPCError; break; };
508 }
509 else
510 {
511 if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; };
512 if (rpl->content.__hdr.msgid != IODispatchSource_CheckForWork_ID) { ret = kIOReturnIPCError; break; };
513 if (rpl->mach.msgh_body.msgh_descriptor_count != 0) { ret = kIOReturnIPCError; break; };
514 if (IODispatchSource_CheckForWork_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; };
515 }
516 }
517 while (false);
518 if (kIOReturnSuccess == ret)
519 {
520 if (ret == kIOReturnSuccess) {
521 IORPCMessage * message;
522 OSObject * object;
523
524 message = IORPCMessageFromMach(msg: rpc.reply, reply: false);
525 if ((rpc.reply->msgh_body.msgh_descriptor_count < 1) || !(kIORPCMessageOneway & message->flags)) {
526 ret = kIOReturnIPCError;
527 } else {
528 object = (typeof(object)) message->objects[0];
529 if (!object) ret = kIOReturnIPCError;
530 else
531 {
532 rpc.sendSize = rpc.replySize;
533 rpc.replySize = 0;
534 rpc.reply = NULL;
535
536 ret = object->Invoke(rpc);
537 }
538 }
539 }
540 }
541
542
543 return (ret);
544}
545
546kern_return_t
547IODispatchSource::SetEnable(
548 bool enable,
549 OSDispatchMethod supermethod)
550{
551 kern_return_t ret;
552 union
553 {
554 IODispatchSource_SetEnable_Msg msg;
555 struct
556 {
557 IODispatchSource_SetEnable_Rpl rpl;
558 mach_msg_max_trailer_t trailer;
559 } rpl;
560 } buf;
561 struct IODispatchSource_SetEnable_Msg * msg = &buf.msg;
562 struct IODispatchSource_SetEnable_Rpl * rpl = &buf.rpl.rpl;
563
564 memset(s: msg, c: 0, n: sizeof(struct IODispatchSource_SetEnable_Msg));
565 msg->mach.msgh.msgh_id = kIORPCVersion190615;
566 msg->mach.msgh.msgh_size = sizeof(*msg);
567 msg->content.__hdr.flags = 0*kIORPCMessageOneway
568 | 1*kIORPCMessageSimpleReply
569 | 0*kIORPCMessageLocalHost
570 | 0*kIORPCMessageOnqueue;
571 msg->content.__hdr.msgid = IODispatchSource_SetEnable_ID;
572 msg->content.__object = (OSObjectRef) this;
573 msg->content.__hdr.objectRefs = IODispatchSource_SetEnable_Msg_ObjRefs;
574 msg->mach.msgh_body.msgh_descriptor_count = 1;
575
576 msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
577
578 msg->content.enable = enable;
579
580 IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) };
581 if (supermethod) ret = supermethod((OSObject *)this, rpc);
582 else ret = ((OSObject *)this)->Invoke(rpc);
583
584 if (kIOReturnSuccess == ret)
585 do {
586 {
587 if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; };
588 if (rpl->content.__hdr.msgid != IODispatchSource_SetEnable_ID) { ret = kIOReturnIPCError; break; };
589 if (rpl->mach.msgh_body.msgh_descriptor_count != 0) { ret = kIOReturnIPCError; break; };
590 if (IODispatchSource_SetEnable_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; };
591 }
592 }
593 while (false);
594 if (kIOReturnSuccess == ret)
595 {
596 }
597
598
599 return (ret);
600}
601
602kern_return_t
603IODispatchSource::Cancel_Invoke(const IORPC _rpc,
604 OSMetaClassBase * target,
605 Cancel_Handler func)
606{
607 IODispatchSource_Cancel_Invocation rpc = { .rpc: _rpc };
608 kern_return_t ret;
609
610 if (1 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError);
611 if (IODispatchSource_Cancel_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError);
612 if (rpc.message != NULL && rpc.sendSize < sizeof(IODispatchSource_Cancel_Msg)) return (kIOReturnIPCError);
613 if (rpc.reply != NULL && rpc.replySize < sizeof(IODispatchSource_Cancel_Rpl)) return (kIOReturnIPCError);
614
615 ret = (*func)(target,
616 rpc.message->content.handler);
617
618 if (kIOReturnSuccess != ret) return (ret);
619
620 rpc.reply->content.__hdr.msgid = IODispatchSource_Cancel_ID;
621 rpc.reply->content.__hdr.flags = kIORPCMessageOneway;
622 rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply;
623 rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply);
624 rpc.reply->mach.msgh_body.msgh_descriptor_count = 0;
625 rpc.reply->content.__hdr.objectRefs = IODispatchSource_Cancel_Rpl_ObjRefs;
626
627 return (ret);
628}
629
630kern_return_t
631IODispatchSource::SetEnableWithCompletion_Invoke(const IORPC _rpc,
632 OSMetaClassBase * target,
633 SetEnableWithCompletion_Handler func)
634{
635 IODispatchSource_SetEnableWithCompletion_Invocation rpc = { .rpc: _rpc };
636 kern_return_t ret;
637
638 if (1 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError);
639 if (IODispatchSource_SetEnableWithCompletion_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError);
640 if (rpc.message != NULL && rpc.sendSize < sizeof(IODispatchSource_SetEnableWithCompletion_Msg)) return (kIOReturnIPCError);
641 if (rpc.reply != NULL && rpc.replySize < sizeof(IODispatchSource_SetEnableWithCompletion_Rpl)) return (kIOReturnIPCError);
642
643 ret = (*func)(target,
644 rpc.message->content.enable,
645 rpc.message->content.handler);
646
647 if (kIOReturnSuccess != ret) return (ret);
648
649 rpc.reply->content.__hdr.msgid = IODispatchSource_SetEnableWithCompletion_ID;
650 rpc.reply->content.__hdr.flags = kIORPCMessageOneway;
651 rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply;
652 rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply);
653 rpc.reply->mach.msgh_body.msgh_descriptor_count = 0;
654 rpc.reply->content.__hdr.objectRefs = IODispatchSource_SetEnableWithCompletion_Rpl_ObjRefs;
655
656 return (ret);
657}
658
659kern_return_t
660IODispatchSource::CheckForWork_Invoke(const IORPC _rpc,
661 OSMetaClassBase * target,
662 CheckForWork_Handler func)
663{
664 IODispatchSource_CheckForWork_Invocation rpc = { .rpc: _rpc };
665 kern_return_t ret;
666
667 if (1 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError);
668 if (IODispatchSource_CheckForWork_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError);
669 if (rpc.message != NULL && rpc.sendSize < sizeof(IODispatchSource_CheckForWork_Msg)) return (kIOReturnIPCError);
670 if (rpc.reply != NULL && rpc.replySize < sizeof(IODispatchSource_CheckForWork_Rpl)) return (kIOReturnIPCError);
671
672 ret = (*func)(target,
673 rpc.rpc,
674 rpc.message->content.synchronous);
675
676 if (kIOReturnSuccess != ret) return (ret);
677
678 IORPCMessage * message;
679
680 message = IORPCMessageFromMach(msg: rpc.rpc.reply, reply: false);
681 if ((rpc.rpc.reply->msgh_body.msgh_descriptor_count < 1) || !(kIORPCMessageOneway & message->flags)) ret = kIOReturnIPCError;
682
683 return (ret);
684}
685
686kern_return_t
687IODispatchSource::SetEnable_Invoke(const IORPC _rpc,
688 OSMetaClassBase * target,
689 SetEnable_Handler func)
690{
691 IODispatchSource_SetEnable_Invocation rpc = { .rpc: _rpc };
692 kern_return_t ret;
693
694 if (1 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError);
695 if (IODispatchSource_SetEnable_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError);
696 if (rpc.message != NULL && rpc.sendSize < sizeof(IODispatchSource_SetEnable_Msg)) return (kIOReturnIPCError);
697 if (rpc.reply != NULL && rpc.replySize < sizeof(IODispatchSource_SetEnable_Rpl)) return (kIOReturnIPCError);
698
699 ret = (*func)(target,
700 rpc.message->content.enable);
701
702 if (kIOReturnSuccess != ret) return (ret);
703
704 rpc.reply->content.__hdr.msgid = IODispatchSource_SetEnable_ID;
705 rpc.reply->content.__hdr.flags = kIORPCMessageOneway;
706 rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply;
707 rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply);
708 rpc.reply->mach.msgh_body.msgh_descriptor_count = 0;
709 rpc.reply->content.__hdr.objectRefs = IODispatchSource_SetEnable_Rpl_ObjRefs;
710
711 return (ret);
712}
713
714
715
716