fasttrap_impl.h revision ac448965596bc1c42f7accb3023f48d5fa9b8180
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#pragma ident "%Z%%M% %I% %E% SMI"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Fasttrap Providers, Probes and Tracepoints
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Each Solaris process can have multiple providers -- the pid provider as
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * well as any number of user-level statically defined tracing (USDT)
a1e9eea083a8f257157edb8a1efb5bbd300eb4bfSrikanth, Ramana * providers. Those providers are each represented by a fasttrap_provider_t.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * All providers for a given process have a pointer to a shared
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fasttrap_proc_t. The fasttrap_proc_t has two states: active or defunct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * It becomes defunct when the process performs an exit or an exec.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Each probe is represented by a fasttrap_probe_t which has a pointer to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * its associated provider as well as a list of fasttrap_id_tp_t structures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * which are tuples combining a fasttrap_id_t and a fasttrap_tracepoint_t.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * A fasttrap_tracepoint_t represents the actual point of instrumentation
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and it contains two lists of fasttrap_id_t structures (to be fired pre-
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and post-instruction emulation) that identify the probes attached to the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * tracepoint. Tracepoints also have a pointer to the fasttrap_proc_t for the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * process they trace which is used when looking up a tracepoint both at
a1e9eea083a8f257157edb8a1efb5bbd300eb4bfSrikanth, Ramana * probe fire time and when enabling and disabling probes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * It's important to note that probes are preallocated with the necessary
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * number of tracepoints, but that tracepoints can be shared by probes and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * swapped between probes. If a probe's preallocated tracepoint is enabled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * (and, therefore, the associated probe is enabled), and that probe is
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * then disabled, ownership of that tracepoint may be exchanged for an
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * unused tracepoint belonging to another probe that was attached to the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * enabled tracepoint.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fasttrap_proc {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t ftpc_defunct; /* denotes a lame duck proc */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct fasttrap_proc *ftpc_next; /* next proc in hash chain */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fasttrap_provider {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char ftp_name[DTRACE_PROVNAMELEN]; /* prov name (w/o the pid) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dtrace_provider_id_t ftp_provid; /* DTrace provider handle */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t ftp_marked; /* mark for possible removal */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint64_t ftp_rcount; /* enabled probes ref count */
a1e9eea083a8f257157edb8a1efb5bbd300eb4bfSrikanth, Ramana uint64_t ftp_ccount; /* consumers creating probes */
a1e9eea083a8f257157edb8a1efb5bbd300eb4bfSrikanth, Ramana fasttrap_proc_t *ftp_proc; /* shared proc for all provs */
a1e9eea083a8f257157edb8a1efb5bbd300eb4bfSrikanth, Ramana struct fasttrap_provider *ftp_next; /* next prov in hash chain */
struct fasttrap_id {
typedef struct fasttrap_id_tp {
struct fasttrap_probe {
struct fasttrap_tracepoint {
typedef struct fasttrap_bucket {
typedef struct fasttrap_hash {
* Must be implemented by fasttrap_isa.c
#ifdef __cplusplus