X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/6d2010ae8f7a6078e10b361c6962983bab233e0f..e8c3f78193f1895ea514044358b93b1add9322f3:/iokit/Kernel/IOEventSource.cpp?ds=inline diff --git a/iokit/Kernel/IOEventSource.cpp b/iokit/Kernel/IOEventSource.cpp index 95046dacd..76c2d5032 100644 --- a/iokit/Kernel/IOEventSource.cpp +++ b/iokit/Kernel/IOEventSource.cpp @@ -36,6 +36,7 @@ HISTORY #include #include +#include #define super OSObject @@ -114,7 +115,7 @@ bool IOEventSource::tryCloseGate() int IOEventSource::sleepGate(void *event, UInt32 type) { - bool res; + int res; IOStatisticsOpenGate(); res = workLoop->sleepGate(event, type); IOStatisticsCloseGate(); @@ -123,7 +124,7 @@ int IOEventSource::sleepGate(void *event, UInt32 type) int IOEventSource::sleepGate(void *event, AbsoluteTime deadline, UInt32 type) { - bool res; + int res; IOStatisticsOpenGate(); res = workLoop->sleepGate(event, deadline, type); IOStatisticsCloseGate(); @@ -162,6 +163,8 @@ bool IOEventSource::init(OSObject *inOwner, void IOEventSource::free( void ) { IOStatisticsUnregisterCounter(); + + if ((kActionBlock & flags) && actionBlock) Block_release(actionBlock); if (reserved) IODelete(reserved, ExpansionData, 1); @@ -169,13 +172,41 @@ void IOEventSource::free( void ) super::free(); } -IOEventSource::Action IOEventSource::getAction () const { return action; }; +void IOEventSource::setRefcon(void *newrefcon) +{ + refcon = newrefcon; +} + +void * IOEventSource::getRefcon() const +{ + return refcon; +} + +IOEventSource::Action IOEventSource::getAction() const +{ + if (kActionBlock & flags) return NULL; + return (action); +} + +IOEventSource::ActionBlock IOEventSource::getActionBlock(ActionBlock) const +{ + if (kActionBlock & flags) return actionBlock; + return (NULL); +} void IOEventSource::setAction(Action inAction) { + if ((kActionBlock & flags) && actionBlock) Block_release(actionBlock); action = inAction; } +void IOEventSource::setActionBlock(ActionBlock block) +{ + if ((kActionBlock & flags) && actionBlock) Block_release(actionBlock); + actionBlock = Block_copy(block); + flags |= kActionBlock; +} + IOEventSource *IOEventSource::getNext() const { return eventChainNext; }; void IOEventSource::setNext(IOEventSource *inNext)