/*1* CDDL HEADER START2*3* The contents of this file are subject to the terms of the4* Common Development and Distribution License, Version 1.0 only5* (the "License"). You may not use this file except in compliance6* with the License.7*8* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE9* or http://www.opensolaris.org/os/licensing.10* See the License for the specific language governing permissions11* and limitations under the License.12*13* When distributing Covered Code, include this CDDL HEADER in each14* file and include the License file at usr/src/OPENSOLARIS.LICENSE.15* If applicable, add the following below this CDDL HEADER, with the16* fields enclosed by brackets "[]" replaced with your own identifying17* information: Portions Copyright [yyyy] [name of copyright owner]18*19* CDDL HEADER END20*/2122/*23* DTrace Anonymous Enabling Functions24*/25static void26dtrace_anon_init(void *dummy)27{28dtrace_state_t *state = NULL;29dtrace_enabling_t *enab;3031mutex_enter(&cpu_lock);32mutex_enter(&dtrace_provider_lock);33mutex_enter(&dtrace_lock);3435dtrace_anon_property();3637mutex_exit(&cpu_lock);3839/*40* If there are already providers, we must ask them to provide their41* probes, and then match any anonymous enabling against them. Note42* that there should be no other retained enablings at this time:43* the only retained enablings at this time should be the anonymous44* enabling.45*/46if (dtrace_anon.dta_enabling != NULL) {47ASSERT(dtrace_retained == dtrace_anon.dta_enabling);4849dtrace_enabling_provide(NULL);50state = dtrace_anon.dta_state;5152/*53* We couldn't hold cpu_lock across the above call to54* dtrace_enabling_provide(), but we must hold it to actually55* enable the probes. We have to drop all of our locks, pick56* up cpu_lock, and regain our locks before matching the57* retained anonymous enabling.58*/59mutex_exit(&dtrace_lock);60mutex_exit(&dtrace_provider_lock);6162mutex_enter(&cpu_lock);63mutex_enter(&dtrace_provider_lock);64mutex_enter(&dtrace_lock);6566if ((enab = dtrace_anon.dta_enabling) != NULL)67(void) dtrace_enabling_match(enab, NULL);6869mutex_exit(&cpu_lock);70}7172mutex_exit(&dtrace_provider_lock);73mutex_exit(&dtrace_lock);7475if (state != NULL) {76/*77* If we created any anonymous state, set it going now.78*/79(void) dtrace_state_go(state, &dtrace_anon.dta_beganon);80}81}828384