- IOTimeStampConstant(IODBG_CMDQ(IOCMDQ_ACTION),
- (unsigned int) inAction, (unsigned int) owner);
+ // If the command gate is disabled then sleep until we get a wakeup
+ if (!wl->onThread() && !enabled)
+ res = kIOReturnNotPermitted;
+ else {
+
+ bool trace = ( gIOKitTrace & kIOTraceCommandGates ) ? true : false;
+
+ if (trace)
+ IOTimeStampStartConstant(IODBG_CMDQ(IOCMDQ_ACTION),
+ VM_KERNEL_UNSLIDE(inAction), (uintptr_t) owner);
+
+ IOStatisticsActionCall();
+
+ res = (*inAction)(owner, arg0, arg1, arg2, arg3);
+
+ if (trace)
+ IOTimeStampEndConstant(IODBG_CMDQ(IOCMDQ_ACTION),
+ VM_KERNEL_UNSLIDE(inAction), (uintptr_t) owner);
+ }