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 212357 2010-09-09 09:58:05Z 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
9221static dtrace_difo_t *
9222dtrace_difo_duplicate(dtrace_difo_t *dp, dtrace_vstate_t *vstate)
9223{
9224 dtrace_difo_t *new;
9225 size_t sz;
9226
9227 ASSERT(dp->dtdo_buf != NULL);
9228 ASSERT(dp->dtdo_refcnt != 0);
--- 27 unchanged lines hidden (view full) ---
9256 new->dtdo_vartab = kmem_alloc(sz, KM_SLEEP);
9257 bcopy(dp->dtdo_vartab, new->dtdo_vartab, sz);
9258 new->dtdo_varlen = dp->dtdo_varlen;
9259 }
9260
9261 dtrace_difo_init(new, vstate);
9262 return (new);
9263}
9264
9265static void
9266dtrace_difo_destroy(dtrace_difo_t *dp, dtrace_vstate_t *vstate)
9267{
9268 int i;
9269
9270 ASSERT(dp->dtdo_refcnt == 0);
9271
--- 5336 unchanged lines hidden (view full) ---
14608
14609 p->p_dtrace_helpers = help;
14610 dtrace_helpers++;
14611
14612 return (help);
14613}
14614
14615#if defined(sun)
14616static
14617#endif
14618void
14619dtrace_helpers_destroy(proc_t *p)
14620{
14621 dtrace_helpers_t *help;
14622 dtrace_vstate_t *vstate;
14623#if defined(sun)
14624 proc_t *p = curproc;
14625#endif
14626 int i;
14627
14628 mutex_enter(&dtrace_lock);
14629
14630 ASSERT(p->p_dtrace_helpers != NULL);
14631 ASSERT(dtrace_helpers > 0);
14632
14633 help = p->p_dtrace_helpers;
--- 70 unchanged lines hidden (view full) ---
14704 kmem_free(help->dthps_actions,
14705 sizeof (dtrace_helper_action_t *) * DTRACE_NHELPER_ACTIONS);
14706 kmem_free(help, sizeof (dtrace_helpers_t));
14707
14708 --dtrace_helpers;
14709 mutex_exit(&dtrace_lock);
14710}
14711
14712#if defined(sun)
14713static
14714#endif
14715void
14716dtrace_helpers_duplicate(proc_t *from, proc_t *to)
14717{
14718 dtrace_helpers_t *help, *newhelp;
14719 dtrace_helper_action_t *helper, *new, *last;
14720 dtrace_difo_t *dp;
14721 dtrace_vstate_t *vstate;
14722 int i, j, sz, hasprovs = 0;
14723
--- 64 unchanged lines hidden (view full) ---
14788 hasprovs = 1;
14789 }
14790
14791 mutex_exit(&dtrace_lock);
14792
14793 if (hasprovs)
14794 dtrace_helper_provider_register(to, newhelp, NULL);
14795}
14796
14797#if defined(sun)
14798/*
14799 * DTrace Hook Functions
14800 */
14801static void
14802dtrace_module_loaded(modctl_t *ctl)
14803{
--- 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 212357 2010-09-09 09:58:05Z 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
9221static dtrace_difo_t *
9222dtrace_difo_duplicate(dtrace_difo_t *dp, dtrace_vstate_t *vstate)
9223{
9224 dtrace_difo_t *new;
9225 size_t sz;
9226
9227 ASSERT(dp->dtdo_buf != NULL);
9228 ASSERT(dp->dtdo_refcnt != 0);
--- 27 unchanged lines hidden (view full) ---
9256 new->dtdo_vartab = kmem_alloc(sz, KM_SLEEP);
9257 bcopy(dp->dtdo_vartab, new->dtdo_vartab, sz);
9258 new->dtdo_varlen = dp->dtdo_varlen;
9259 }
9260
9261 dtrace_difo_init(new, vstate);
9262 return (new);
9263}
9264
9265static void
9266dtrace_difo_destroy(dtrace_difo_t *dp, dtrace_vstate_t *vstate)
9267{
9268 int i;
9269
9270 ASSERT(dp->dtdo_refcnt == 0);
9271
--- 5336 unchanged lines hidden (view full) ---
14608
14609 p->p_dtrace_helpers = help;
14610 dtrace_helpers++;
14611
14612 return (help);
14613}
14614
14615#if defined(sun)
14616static
14617#endif
14618void
14619dtrace_helpers_destroy(proc_t *p)
14620{
14621 dtrace_helpers_t *help;
14622 dtrace_vstate_t *vstate;
14623#if defined(sun)
14624 proc_t *p = curproc;
14625#endif
14626 int i;
14627
14628 mutex_enter(&dtrace_lock);
14629
14630 ASSERT(p->p_dtrace_helpers != NULL);
14631 ASSERT(dtrace_helpers > 0);
14632
14633 help = p->p_dtrace_helpers;
--- 70 unchanged lines hidden (view full) ---
14704 kmem_free(help->dthps_actions,
14705 sizeof (dtrace_helper_action_t *) * DTRACE_NHELPER_ACTIONS);
14706 kmem_free(help, sizeof (dtrace_helpers_t));
14707
14708 --dtrace_helpers;
14709 mutex_exit(&dtrace_lock);
14710}
14711
14712#if defined(sun)
14713static
14714#endif
14715void
14716dtrace_helpers_duplicate(proc_t *from, proc_t *to)
14717{
14718 dtrace_helpers_t *help, *newhelp;
14719 dtrace_helper_action_t *helper, *new, *last;
14720 dtrace_difo_t *dp;
14721 dtrace_vstate_t *vstate;
14722 int i, j, sz, hasprovs = 0;
14723
--- 64 unchanged lines hidden (view full) ---
14788 hasprovs = 1;
14789 }
14790
14791 mutex_exit(&dtrace_lock);
14792
14793 if (hasprovs)
14794 dtrace_helper_provider_register(to, newhelp, NULL);
14795}
14796
14797#if defined(sun)
14798/*
14799 * DTrace Hook Functions
14800 */
14801static void
14802dtrace_module_loaded(modctl_t *ctl)
14803{
--- 1715 unchanged lines hidden ---