1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
--- 4 unchanged lines hidden (view full) ---
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 *
21 * $FreeBSD: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c 211608 2010-08-22 10:53:32Z rpaulo $
22 */
23
24/*
25 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
27 */
28
29#pragma ident "%Z%%M% %I% %E% SMI"
--- 9183 unchanged lines hidden (view full) ---
9213
9214 svar->dtsv_refcnt++;
9215 }
9216
9217 dtrace_difo_chunksize(dp, vstate);
9218 dtrace_difo_hold(dp);
9219}
9220
9221#if defined(sun)
9222static dtrace_difo_t *
9223dtrace_difo_duplicate(dtrace_difo_t *dp, dtrace_vstate_t *vstate)
9224{
9225 dtrace_difo_t *new;
9226 size_t sz;
9227
9228 ASSERT(dp->dtdo_buf != NULL);
9229 ASSERT(dp->dtdo_refcnt != 0);
--- 27 unchanged lines hidden (view full) ---
9257 new->dtdo_vartab = kmem_alloc(sz, KM_SLEEP);
9258 bcopy(dp->dtdo_vartab, new->dtdo_vartab, sz);
9259 new->dtdo_varlen = dp->dtdo_varlen;
9260 }
9261
9262 dtrace_difo_init(new, vstate);
9263 return (new);
9264}
9265#endif
9266
9267static void
9268dtrace_difo_destroy(dtrace_difo_t *dp, dtrace_vstate_t *vstate)
9269{
9270 int i;
9271
9272 ASSERT(dp->dtdo_refcnt == 0);
9273
--- 5336 unchanged lines hidden (view full) ---
14610
14611 p->p_dtrace_helpers = help;
14612 dtrace_helpers++;
14613
14614 return (help);
14615}
14616
14617#if defined(sun)
14618static void
14619dtrace_helpers_destroy(void)
14620{
14621 dtrace_helpers_t *help;
14622 dtrace_vstate_t *vstate;
14623 proc_t *p = curproc;
14624 int i;
14625
14626 mutex_enter(&dtrace_lock);
14627
14628 ASSERT(p->p_dtrace_helpers != NULL);
14629 ASSERT(dtrace_helpers > 0);
14630
14631 help = p->p_dtrace_helpers;
--- 70 unchanged lines hidden (view full) ---
14702 kmem_free(help->dthps_actions,
14703 sizeof (dtrace_helper_action_t *) * DTRACE_NHELPER_ACTIONS);
14704 kmem_free(help, sizeof (dtrace_helpers_t));
14705
14706 --dtrace_helpers;
14707 mutex_exit(&dtrace_lock);
14708}
14709
14710static void
14711dtrace_helpers_duplicate(proc_t *from, proc_t *to)
14712{
14713 dtrace_helpers_t *help, *newhelp;
14714 dtrace_helper_action_t *helper, *new, *last;
14715 dtrace_difo_t *dp;
14716 dtrace_vstate_t *vstate;
14717 int i, j, sz, hasprovs = 0;
14718
--- 64 unchanged lines hidden (view full) ---
14783 hasprovs = 1;
14784 }
14785
14786 mutex_exit(&dtrace_lock);
14787
14788 if (hasprovs)
14789 dtrace_helper_provider_register(to, newhelp, NULL);
14790}
14791#endif
14792
14793#if defined(sun)
14794/*
14795 * DTrace Hook Functions
14796 */
14797static void
14798dtrace_module_loaded(modctl_t *ctl)
14799{
--- 1715 unchanged lines hidden ---
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
--- 4 unchanged lines hidden (view full) ---
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 *
21 * $FreeBSD: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c 211608 2010-08-22 10:53:32Z rpaulo $
22 */
23
24/*
25 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
27 */
28
29#pragma ident "%Z%%M% %I% %E% SMI"
--- 9183 unchanged lines hidden (view full) ---
9213
9214 svar->dtsv_refcnt++;
9215 }
9216
9217 dtrace_difo_chunksize(dp, vstate);
9218 dtrace_difo_hold(dp);
9219}
9220
9221#if defined(sun)
9222static dtrace_difo_t *
9223dtrace_difo_duplicate(dtrace_difo_t *dp, dtrace_vstate_t *vstate)
9224{
9225 dtrace_difo_t *new;
9226 size_t sz;
9227
9228 ASSERT(dp->dtdo_buf != NULL);
9229 ASSERT(dp->dtdo_refcnt != 0);
--- 27 unchanged lines hidden (view full) ---
9257 new->dtdo_vartab = kmem_alloc(sz, KM_SLEEP);
9258 bcopy(dp->dtdo_vartab, new->dtdo_vartab, sz);
9259 new->dtdo_varlen = dp->dtdo_varlen;
9260 }
9261
9262 dtrace_difo_init(new, vstate);
9263 return (new);
9264}
9265#endif
9266
9267static void
9268dtrace_difo_destroy(dtrace_difo_t *dp, dtrace_vstate_t *vstate)
9269{
9270 int i;
9271
9272 ASSERT(dp->dtdo_refcnt == 0);
9273
--- 5336 unchanged lines hidden (view full) ---
14610
14611 p->p_dtrace_helpers = help;
14612 dtrace_helpers++;
14613
14614 return (help);
14615}
14616
14617#if defined(sun)
14618static void
14619dtrace_helpers_destroy(void)
14620{
14621 dtrace_helpers_t *help;
14622 dtrace_vstate_t *vstate;
14623 proc_t *p = curproc;
14624 int i;
14625
14626 mutex_enter(&dtrace_lock);
14627
14628 ASSERT(p->p_dtrace_helpers != NULL);
14629 ASSERT(dtrace_helpers > 0);
14630
14631 help = p->p_dtrace_helpers;
--- 70 unchanged lines hidden (view full) ---
14702 kmem_free(help->dthps_actions,
14703 sizeof (dtrace_helper_action_t *) * DTRACE_NHELPER_ACTIONS);
14704 kmem_free(help, sizeof (dtrace_helpers_t));
14705
14706 --dtrace_helpers;
14707 mutex_exit(&dtrace_lock);
14708}
14709
14710static void
14711dtrace_helpers_duplicate(proc_t *from, proc_t *to)
14712{
14713 dtrace_helpers_t *help, *newhelp;
14714 dtrace_helper_action_t *helper, *new, *last;
14715 dtrace_difo_t *dp;
14716 dtrace_vstate_t *vstate;
14717 int i, j, sz, hasprovs = 0;
14718
--- 64 unchanged lines hidden (view full) ---
14783 hasprovs = 1;
14784 }
14785
14786 mutex_exit(&dtrace_lock);
14787
14788 if (hasprovs)
14789 dtrace_helper_provider_register(to, newhelp, NULL);
14790}
14791#endif
14792
14793#if defined(sun)
14794/*
14795 * DTrace Hook Functions
14796 */
14797static void
14798dtrace_module_loaded(modctl_t *ctl)
14799{
--- 1715 unchanged lines hidden ---