4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
26 * DTrace Anonymous Enabling Functions
29 dtrace_anon_init(void *dummy)
31 dtrace_state_t *state = NULL;
32 dtrace_enabling_t *enab;
34 mutex_enter(&cpu_lock);
35 mutex_enter(&dtrace_provider_lock);
36 mutex_enter(&dtrace_lock);
38 dtrace_anon_property();
40 mutex_exit(&cpu_lock);
43 * If there are already providers, we must ask them to provide their
44 * probes, and then match any anonymous enabling against them. Note
45 * that there should be no other retained enablings at this time:
46 * the only retained enablings at this time should be the anonymous
49 if (dtrace_anon.dta_enabling != NULL) {
50 ASSERT(dtrace_retained == dtrace_anon.dta_enabling);
52 dtrace_enabling_provide(NULL);
53 state = dtrace_anon.dta_state;
56 * We couldn't hold cpu_lock across the above call to
57 * dtrace_enabling_provide(), but we must hold it to actually
58 * enable the probes. We have to drop all of our locks, pick
59 * up cpu_lock, and regain our locks before matching the
60 * retained anonymous enabling.
62 mutex_exit(&dtrace_lock);
63 mutex_exit(&dtrace_provider_lock);
65 mutex_enter(&cpu_lock);
66 mutex_enter(&dtrace_provider_lock);
67 mutex_enter(&dtrace_lock);
69 if ((enab = dtrace_anon.dta_enabling) != NULL)
70 (void) dtrace_enabling_match(enab, NULL);
72 mutex_exit(&cpu_lock);
75 mutex_exit(&dtrace_provider_lock);
76 mutex_exit(&dtrace_lock);
80 * If we created any anonymous state, set it going now.
82 (void) dtrace_state_go(state, &dtrace_anon.dta_beganon);