void AppleRAIDMirrorSet::free(void) { if (arRebuildThreadCall) thread_call_free(arRebuildThreadCall); arRebuildThreadCall = 0; if (arSetCompleteThreadCall) thread_call_free(arSetCompleteThreadCall); arSetCompleteThreadCall = 0; if (arLastSeek) IODelete(arLastSeek, UInt64, arLastAllocCount); if (arSkippedIOCount) IODelete(arSkippedIOCount, UInt64, arLastAllocCount); assert(queue_empty(&arFailedRequestQueue)); super::free(); }
/* * Destroy a process structure that resulted from a call to forkproc(), but * which must be returned to the system because of a subsequent failure * preventing it from becoming active. * * Parameters: p The incomplete process from forkproc() * * Returns: (void) * * Note: This function should only be used in an error handler following * a call to forkproc(). * * Operations occur in reverse order of those in forkproc(). */ void forkproc_free(proc_t p) { /* We held signal and a transition locks; drop them */ proc_signalend(p, 0); proc_transend(p, 0); /* * If we have our own copy of the resource limits structure, we * need to free it. If it's a shared copy, we need to drop our * reference on it. */ proc_limitdrop(p, 0); p->p_limit = NULL; #if SYSV_SHM /* Need to drop references to the shared memory segment(s), if any */ if (p->vm_shm) { /* * Use shmexec(): we have no address space, so no mappings * * XXX Yes, the routine is badly named. */ shmexec(p); } #endif /* Need to undo the effects of the fdcopy(), if any */ fdfree(p); /* * Drop the reference on a text vnode pointer, if any * XXX This code is broken in forkproc(); see <rdar://4256419>; * XXX if anyone ever uses this field, we will be extremely unhappy. */ if (p->p_textvp) { vnode_rele(p->p_textvp); p->p_textvp = NULL; } /* Stop the profiling clock */ stopprofclock(p); /* Release the credential reference */ kauth_cred_unref(&p->p_ucred); proc_list_lock(); /* Decrement the count of processes in the system */ nprocs--; proc_list_unlock(); thread_call_free(p->p_rcall); /* Free allocated memory */ FREE_ZONE(p->p_sigacts, sizeof *p->p_sigacts, M_SIGACTS); FREE_ZONE(p->p_stats, sizeof *p->p_stats, M_PSTATS); proc_checkdeadrefs(p); FREE_ZONE(p, sizeof *p, M_PROC); }
__private_extern__ kern_return_t chudxnu_timer_free(chud_timer_t timer) { thread_call_cancel((thread_call_t)timer); thread_call_free((thread_call_t)timer); return KERN_SUCCESS; }
void cyclic_remove(cyclic_id_t cyclic) { wrap_thread_call_t *wrapTC = (wrap_thread_call_t *)cyclic; ASSERT(cyclic != CYCLIC_NONE); while (!thread_call_cancel(wrapTC->TChdl)) { int ret = assert_wait(wrapTC, THREAD_UNINT); ASSERT(ret == THREAD_WAITING); wrapTC->when.cyt_interval = WAKEUP_REAPER; ret = thread_block(THREAD_CONTINUE_NULL); ASSERT(ret == THREAD_AWAKENED); } if (thread_call_free(wrapTC->TChdl)) _FREE(wrapTC, M_TEMP); else { /* Gut this cyclic and move on ... */ wrapTC->hdlr.cyh_func = noop_cyh_func; wrapTC->when.cyt_interval = NEARLY_FOREVER; } }
__private_extern__ void devtimer_invalidate(devtimer_ref timer) { devtimer_cancel(timer); timer->dt_arg0 = NULL; if (timer->dt_callout != NULL) { thread_call_free(timer->dt_callout); timer->dt_callout = NULL; } return; }
void cancelACStatusUpdate() { if(NULL != statusThread) { //IOLog("Battery thread cancelling...\n"); isStatusThreadCanCancel = true; while (isStatusThreadCancelled) { IOSleep(500); } thread_call_free(statusThread); statusThread = NULL; //IOLog("Battery thread cancelled...\n"); } }
void IOEthernetInterface::free() { if ( _requiredFilters ) { _requiredFilters->release(); _requiredFilters = 0; } if ( _activeFilters ) { _activeFilters->release(); _activeFilters = 0; } if ( _supportedFilters ) { _supportedFilters->release(); _supportedFilters = 0; } if ( _inputEventThreadCall ) { thread_call_free( _inputEventThreadCall ); _inputEventThreadCall = 0; } if ( _reserved ) { if (kIOPMUndefinedDriverAssertionID != _wompEnabledAssertionID) { getPMRootDomain()->releasePMAssertion(_wompEnabledAssertionID); _wompEnabledAssertionID = kIOPMUndefinedDriverAssertionID; } if (_disabledWakeFilters) { _disabledWakeFilters->release(); _disabledWakeFilters = 0; } IODelete( _reserved, ExpansionData, 1 ); _reserved = 0; } super::free(); }
void IOHIKeyboard::stop(IOService * provider) { super::stop(provider); KeyboardReserved *tempReservedStruct = GetKeyboardReservedStructEventForService(this); if (tempReservedStruct) { thread_call_cancel(tempReservedStruct->repeat_thread_call); thread_call_free(tempReservedStruct->repeat_thread_call); tempReservedStruct->repeat_thread_call = NULL; if ( tempReservedStruct->keyboardNub ) tempReservedStruct->keyboardNub->release(); tempReservedStruct->keyboardNub = NULL; RemoveKeyboardReservedStructForService(this); } }
void NoSleepExtension::stop( IOService * provider ) { #ifdef DEBUG IOLog("%s[%p]::%s(%p)\n", getName(), this, __FUNCTION__, provider); #endif stopPM(); saveState(); setSleepSuppressionState(kNoSleepStateDisabled, kNoSleepModeCurrent); clamshellStateInterestNotifier->remove(); if(delayTimer) { thread_call_cancel(delayTimer); thread_call_free(delayTimer); } setUserSleepDisabled(false); IOLog("%s: successfully stopped\n", getName()); super::stop(provider); }
void IOATABlockStorageDriver::free ( void ) { IOWorkLoop * workLoop; if ( fCommandPool != NULL ) { deallocateATACommandObjects ( ); fCommandPool->release ( ); fCommandPool = NULL; } if ( fCommandGate != NULL ) { workLoop = getWorkLoop ( ); if ( workLoop != NULL ) { workLoop->removeEventSource ( fCommandGate ); } fCommandGate->release ( ); fCommandGate = NULL; } if ( fPowerManagementThread != NULL ) { thread_call_free ( fPowerManagementThread ); } if ( reserved != NULL ) { // Release all memory/objects associated with the reserved fields. if ( fPowerDownNotifier != NULL ) { // remove() will also call release() on this object (IONotifier). // See IONotifier.h for more info. fPowerDownNotifier->remove ( ); fPowerDownNotifier = NULL; } IOFree ( reserved, sizeof ( ExpansionData ) ); reserved = NULL; } if ( fDeviceIdentifyBuffer != NULL ) { fDeviceIdentifyBuffer->complete ( ); fDeviceIdentifyBuffer->release ( ); fDeviceIdentifyBuffer = NULL; } super::free ( ); }
void IOI2CDevice::freeI2CResources(void) { if (fStateFlags & kStateFlags_TEARDOWN) return; fStateFlags |= kStateFlags_TEARDOWN; DLOG("+IOI2CDevice@%lx::freeI2CResources %x\n",fI2CAddress, fStateFlags); #ifdef kUSE_IOLOCK if(fClientLock) #else if(fClientSem) #endif I2CLOCK; fDeviceOffline = TRUE; #ifdef kUSE_IOLOCK if(fClientLock) #else if(fClientSem) #endif I2CUNLOCK; DLOG("+IOI2CDevice@%lx::freeI2CResources\n",fI2CAddress); if (fStateFlags & kStateFlags_PMInit) // Don't rely on initialized flag to identify if PMinit was called. { DLOGPWR("+IOI2CDevice@%lx::freeI2CResources requesting power OFF\n",fI2CAddress); changePowerStateTo(kIOI2CPowerState_OFF); AbsoluteTime deadline, currentTime; clock_interval_to_deadline(20, kSecondScale, &deadline); while (fCurrentPowerState != kIOI2CPowerState_OFF) { IOSleep(10); clock_get_uptime(¤tTime); if ( CMP_ABSOLUTETIME(¤tTime, &deadline) > 0 ) { ERRLOG("IOI2CDevice@%lx::freeI2CResources timed out waiting to power off\n", fI2CAddress); break; } } DLOGPWR("+IOI2CDevice@%lx::freeI2CResources calling PMStop\n",fI2CAddress); if (fStateFlags & kStateFlags_PMInit) { fStateFlags &= ~kStateFlags_PMInit; PMstop(); } } DLOG("IOI2CDevice@%lx::freeI2CResources 1\n",fI2CAddress); if (fPowerStateThreadCall) { thread_call_cancel(fPowerStateThreadCall); thread_call_free(fPowerStateThreadCall); fPowerStateThreadCall = 0; } if (fProvider) fProvider->callPlatformFunction("IOI2CPowerStateInterest", FALSE, (void *)this, (void *)false, 0, 0); DLOG("IOI2CDevice@%lx::freeI2CResources 2\n",fI2CAddress); if (symLockI2CBus) { symLockI2CBus->release(); symLockI2CBus = 0; } if (symUnlockI2CBus) { symUnlockI2CBus->release(); symUnlockI2CBus = 0; } if (symWriteI2CBus) { symWriteI2CBus->release(); symWriteI2CBus = 0; } if (symReadI2CBus) { symReadI2CBus->release(); symReadI2CBus = 0; } DLOG("IOI2CDevice@%lx::freeI2CResources 3\n",fI2CAddress); #ifdef kUSE_IOLOCK if (fClientLock) { IOLockFree(fClientLock); fClientLock = 0; } #else if (fClientSem) { semaphore_destroy(current_task(), fClientSem); fClientSem = 0; } #endif DLOG("IOI2CDevice@%lx::freeI2CResources 4\n",fI2CAddress); if (reserved) { if (symClientRead) { symClientRead->release(); symClientRead = 0; } if (symClientWrite) { symClientWrite->release(); symClientWrite = 0; } if (symPowerInterest) { symPowerInterest->release(); symPowerInterest = 0; } } DLOG("-IOI2CDevice@%lx::freeI2CResources\n",fI2CAddress); }