/*ARGSUSED*/ static int sdt_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) { sdt_provider_t *prov; switch (cmd) { case DDI_DETACH: break; case DDI_SUSPEND: return (DDI_SUCCESS); default: return (DDI_FAILURE); } for (prov = sdt_providers; prov->sdtp_name != NULL; prov++) { if (prov->sdtp_id != DTRACE_PROVNONE) { if (dtrace_unregister(prov->sdtp_id) != 0) return (DDI_FAILURE); prov->sdtp_id = DTRACE_PROVNONE; } } dtrace_invop_remove(sdt_invop); kmem_free(sdt_probetab, sdt_probetab_size * sizeof (sdt_probe_t *)); return (DDI_SUCCESS); }
static int sdt_detach(dev_info_t *devi, ddi_detach_cmd_t cmd) { sdt_provider_t *prov; switch (cmd) { case DDI_DETACH: break; case DDI_SUSPEND: return (DDI_SUCCESS); default: return (DDI_FAILURE); } for (prov = sdt_providers; prov->sdtp_name != NULL; prov++) { if (prov->sdtp_id != DTRACE_PROVNONE) { if (dtrace_unregister(prov->sdtp_id) != 0) return (DDI_FAILURE); prov->sdtp_id = DTRACE_PROVNONE; } } ddi_remove_minor_node(devi, NULL); return (DDI_SUCCESS); }
int sdt_unregister(sdt_provider_t *prov) { int ind; int res; /* find the provider reference */ for (ind = 0; ind < sdt_count; ind++) { if (sdt_list[ind] == prov) { res = dtrace_unregister(sdt_list[ind]->id); if (res != 0) { printf( "sdt: failed to unregister provider %s\n", sdt_list[ind]->name); } /* remove provider from list */ sdt_list[ind] = sdt_list[--sdt_count]; return 0; } } /* provider not found */ printf("sdt: provider %s not found\n", prov->name); return 0; }
static int sdt_unload(void) { int error = 0; int res = 0; int ind; #ifdef SDT_DEBUG printf("sdt: %s\n", __func__); #endif for (ind = 0; ind < sdt_count; ind++) { if ((res = dtrace_unregister(sdt_list[ind]->id)) != 0) { #ifdef SDT_DEBUG printf("%s: failed to unregister %s error = %d\n", sdt_list[ind]->name, res); #endif error = res; } else { #ifdef SDT_DEBUG printf("sdt: unregistered %s id = %d\n", sdt_list[ind]->name, sdt_list[ind]->id); #endif } } kmem_free(sdt_list, sizeof(sdt_provider_t *) * SDT_MAX_PROVIDER); mutex_destroy(&sdt_mutex); sdt_exit(); return (error); }
static int profile_detach(void) { if (dtrace_unregister(profile_id) != 0) return (DDI_FAILURE); return (DDI_SUCCESS); }
static int dtnfsclient_unload() { dtrace_nfsclient_nfs23_start_probe = NULL; dtrace_nfsclient_nfs23_done_probe = NULL; return (dtrace_unregister(dtnfsclient_id)); }
static int systrace_unload() { int error; if ((error = dtrace_unregister(systrace_id)) != 0) return (error); EMUL.e_dtrace_syscall = NULL; return error; }
static int prototype_unload() { int error = 0; if ((error = dtrace_unregister(prototype_id)) != 0) return (error); destroy_dev(prototype_cdev); return (error); }
static void instr_cleanup(dev_info_t *devi) { dtrace_invop_remove(instr_invop); if (instr_id) dtrace_unregister(instr_id); // ddi_remove_minor_node(devi, NULL); if (instr_probetab) kmem_free(instr_probetab, instr_probetab_size * sizeof (instr_probe_t *)); instr_probetab = NULL; instr_probetab_mask = 0; }
static void fbt_cleanup(dev_info_t *devi) { if (invop_loaded) dtrace_invop_remove(fbt_invop); if (fbt_id) dtrace_unregister(fbt_id); // ddi_remove_minor_node(devi, NULL); if (fbt_probetab) kmem_free(fbt_probetab, fbt_probetab_size * sizeof (fbt_probe_t *)); fbt_probetab = NULL; fbt_probetab_mask = 0; }
static int systrace_unload() { int error = 0; if ((error = dtrace_unregister(systrace_id)) != 0) return (error); #if !defined(LINUX_SYSTRACE) systrace_probe_func = NULL; #endif destroy_dev(systrace_cdev); return (error); }
static int lockstat_detach(dev_info_t *devi, ddi_detach_cmd_t cmd) { switch (cmd) { case DDI_DETACH: break; case DDI_SUSPEND: return (DDI_SUCCESS); default: return (DDI_FAILURE); } if (dtrace_unregister(lockstat_id) != 0) return (DDI_FAILURE); ddi_remove_minor_node(devi, NULL); return (DDI_SUCCESS); }
/*ARGSUSED*/ static int sdt_detach(void) { sdt_provider_t *prov; for (prov = sdt_providers; prov->sdtp_name != NULL; prov++) { if (prov->sdtp_id != DTRACE_PROVNONE) { if (dtrace_unregister(prov->sdtp_id) != 0) return (DDI_FAILURE); prov->sdtp_id = DTRACE_PROVNONE; } } dtrace_invop_remove(sdt_invop); kmem_free(sdt_probetab, sdt_probetab_size * sizeof (sdt_probe_t *)); return (DDI_SUCCESS); }
static int fbt_detach(dev_info_t *devi, ddi_detach_cmd_t cmd) { switch (cmd) { case DDI_DETACH: break; case DDI_SUSPEND: return (DDI_SUCCESS); default: return (DDI_FAILURE); } if (dtrace_unregister(fbt_id) != 0) return (DDI_FAILURE); fbt_cleanup(devi); return (DDI_SUCCESS); }
/** * interface_method_impl{SUPDRVTRACERREG,pfnProviderDeregisterZombie} */ static DECLCALLBACK(int) vboxDtTOps_ProviderDeregisterZombie(PCSUPDRVTRACERREG pThis, PSUPDRVVDTPROVIDERCORE pCore) { uintptr_t idProvider = pCore->TracerData.DTrace.idProvider; LOG_DTRACE(("%s: %p / %p\n", __FUNCTION__, pThis, idProvider)); AssertPtrReturn(idProvider, VERR_INTERNAL_ERROR_3); Assert(pCore->TracerData.DTrace.fZombie); int rc = dtrace_unregister(idProvider); if (!rc) { pCore->TracerData.DTrace.idProvider = 0; rc = VINF_SUCCESS; } else { AssertMsg(FIX_UEK_RC(rc) == EBUSY, ("%d\n", rc)); rc = VERR_TRY_AGAIN; } LOG_DTRACE(("%s: returns %Rrc\n", __FUNCTION__, rc)); return rc; }
static int dtrace_unload() { dtrace_state_t *state; int error = 0; #if __FreeBSD_version < 800039 /* * Check if there is still an event handler callback * registered. */ if (eh_tag != 0) { /* De-register the device cloning event handler. */ EVENTHANDLER_DEREGISTER(dev_clone, eh_tag); eh_tag = 0; /* Stop device cloning. */ clone_cleanup(&dtrace_clones); } #else destroy_dev(dtrace_dev); destroy_dev(helper_dev); #endif mutex_enter(&dtrace_provider_lock); mutex_enter(&dtrace_lock); mutex_enter(&cpu_lock); ASSERT(dtrace_opens == 0); if (dtrace_helpers > 0) { mutex_exit(&cpu_lock); mutex_exit(&dtrace_lock); mutex_exit(&dtrace_provider_lock); return (EBUSY); } if (dtrace_unregister((dtrace_provider_id_t)dtrace_provider) != 0) { mutex_exit(&cpu_lock); mutex_exit(&dtrace_lock); mutex_exit(&dtrace_provider_lock); return (EBUSY); } dtrace_provider = NULL; if ((state = dtrace_anon_grab()) != NULL) { /* * If there were ECBs on this state, the provider should * have not been allowed to detach; assert that there is * none. */ ASSERT(state->dts_necbs == 0); dtrace_state_destroy(state); } bzero(&dtrace_anon, sizeof (dtrace_anon_t)); mutex_exit(&cpu_lock); if (dtrace_helptrace_enabled) { kmem_free(dtrace_helptrace_buffer, 0); dtrace_helptrace_buffer = NULL; } if (dtrace_probes != NULL) { kmem_free(dtrace_probes, 0); dtrace_probes = NULL; dtrace_nprobes = 0; } dtrace_hash_destroy(dtrace_bymod); dtrace_hash_destroy(dtrace_byfunc); dtrace_hash_destroy(dtrace_byname); dtrace_bymod = NULL; dtrace_byfunc = NULL; dtrace_byname = NULL; kmem_cache_destroy(dtrace_state_cache); delete_unrhdr(dtrace_arena); if (dtrace_toxrange != NULL) { kmem_free(dtrace_toxrange, 0); dtrace_toxrange = NULL; dtrace_toxranges = 0; dtrace_toxranges_max = 0; } ASSERT(dtrace_vtime_references == 0); ASSERT(dtrace_opens == 0); ASSERT(dtrace_retained == NULL); mutex_exit(&dtrace_lock); mutex_exit(&dtrace_provider_lock); mutex_destroy(&dtrace_meta_lock); mutex_destroy(&dtrace_provider_lock); mutex_destroy(&dtrace_lock); mutex_destroy(&dtrace_errlock); /* XXX Hack */ mutex_destroy(&mod_lock); /* Reset our hook for exceptions. */ dtrace_invop_uninit(); /* * Reset our hook for thread switches, but ensure that vtime isn't * active first. */ dtrace_vtime_active = 0; dtrace_vtime_switch_func = NULL; /* Unhook from the trap handler. */ dtrace_trap_func = NULL; return (error); }