Date: Sat, 22 Apr 2006 23:55:58 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 95912 for review Message-ID: <200604222355.k3MNtwsB030490@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=95912 Change 95912 by jb@jb_freebsd2 on 2006/04/22 23:55:10 Fix a return value to match the data type. Silence an gcc uninitialised variable warning. Affected files ... .. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_link.c#5 edit .. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_parser.c#3 edit .. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_pid.c#4 edit .. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c#3 edit .. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_program.c#3 edit .. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_provider.c#3 edit .. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_work.c#4 edit .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_action.c#2 edit .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_buffer.c#2 edit .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_dif.c#2 edit .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_difo.c#2 edit .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_dof.c#2 edit .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_dynvar.c#2 edit .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_ecb.c#2 edit .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_enabling.c#2 edit .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_helper.c#2 edit .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_ioctl.c#3 edit .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_predicate.c#2 edit .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_probe.c#2 edit .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_probekey.c#2 edit .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_probemgmt.c#2 edit .. //depot/projects/dtrace/src/sys/cddl/dev/fasttrap/fasttrap.c#3 edit .. //depot/projects/dtrace/src/sys/cddl/dev/fasttrap/fasttrap_load.c#2 edit .. //depot/projects/dtrace/src/sys/cddl/dev/fasttrap/fasttrap_unload.c#2 edit Differences ... ==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_link.c#5 (text) ==== @@ -1348,6 +1348,7 @@ s++; } +printf("%s:%s(%d) call dt_provider_lookup\n",__FUNCTION__,__FILE__,__LINE__); if ((pvp = dt_provider_lookup(dtp, pname)) == NULL) { return (dt_link_error(dtp, elf, fd, bufs, "no such provider %s", pname)); ==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_parser.c#3 (text) ==== @@ -2526,6 +2526,7 @@ * If not, create a new provider and set its interface-only flag. This * flag may be cleared later by calls made to dt_probe_declare(). */ +printf("%s:%s(%d) call dt_provider_lookup\n",__FUNCTION__,__FILE__,__LINE__); if ((dnp->dn_provider = dt_provider_lookup(dtp, name)) != NULL) dnp->dn_provred = B_TRUE; else if ((dnp->dn_provider = dt_provider_create(dtp, name)) == NULL) ==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_pid.c#4 (text) ==== @@ -779,6 +779,7 @@ * Give DTrace a shot to the ribs to get it to check * out the newly created probes. */ +printf("%s:%s(%d) ioctl args can't be optional on FreeBSD!\n",__FUNCTION__,__FILE__,__LINE__); (void) dt_ioctl(dtp, DTRACEIOC_ENABLE, NULL); } ==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c#3 (text) ==== @@ -102,6 +102,7 @@ dnp = dnp->dn_list; part = dnp->dn_string; +printf("%s:%s(%d) call dt_provider_lookup\n",__FUNCTION__,__FILE__,__LINE__); if ((pvp = dt_provider_lookup(dtp, name)) != NULL) { if (strcmp(part, "provider") == 0) { a = &pvp->pv_desc.dtvd_attr.dtpa_provider; @@ -218,7 +219,10 @@ } if (strcmp(cnp->dn_string, "provider") == 0) +{ +printf("%s:%s(%d) call dt_provider_lookup\n",__FUNCTION__,__FILE__,__LINE__); found = dt_provider_lookup(dtp, nnp->dn_string) != NULL; +} else if (strcmp(cnp->dn_string, "module") == 0) { dt_module_t *mp = dt_module_lookup_by_name(dtp, nnp->dn_string); found = mp != NULL && dt_module_getctf(dtp, mp) != NULL; ==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_program.c#3 (text) ==== @@ -156,12 +156,16 @@ void *dof; int n, err; +printf("%s: call dtrace_program_info\n",__FUNCTION__); dtrace_program_info(dtp, pgp, pip); +printf("%s: call dtrace_dof_create\n",__FUNCTION__); if ((dof = dtrace_dof_create(dtp, pgp, DTRACE_D_STRIP)) == NULL) return (-1); - n = dt_ioctl(dtp, DTRACEIOC_ENABLE, dof); +printf("%s: ioctl DTRACEIOC_ENABLE dof %p &dof %p\n",__FUNCTION__,dof,&dof); + n = dt_ioctl(dtp, DTRACEIOC_ENABLE, &dof); +printf("%s: call dtrace_dof_destroy\n",__FUNCTION__); dtrace_dof_destroy(dtp, dof); if (n == -1) { @@ -179,12 +183,14 @@ err = errno; } +printf("%s: dtrace_dof_destroy returned an error\n",__FUNCTION__); return (dt_set_errno(dtp, err)); } if (pip != NULL) pip->dpi_matches += n; +printf("%s: returns\n",__FUNCTION__); return (0); } ==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_provider.c#3 (text) ==== @@ -65,6 +65,7 @@ dtrace_providerdesc_t desc; dt_provider_t *pvp; +printf("dt_provider_lookup '%s'\n",name); for (pvp = dtp->dt_provs[h]; pvp != NULL; pvp = pvp->pv_next) { if (strcmp(pvp->pv_desc.dtvd_name, name) == 0) return (pvp); @@ -78,16 +79,19 @@ bzero(&desc, sizeof (desc)); (void) strlcpy(desc.dtvd_name, name, DTRACE_PROVNAMELEN); +printf("Get the provider info...\n"); if (dt_ioctl(dtp, DTRACEIOC_PROVIDER, &desc) == -1) { (void) dt_set_errno(dtp, errno == ESRCH ? EDT_NOPROV : errno); return (NULL); } +printf("Create the provider object...\n"); if ((pvp = dt_provider_create(dtp, name)) == NULL) return (NULL); /* dt_errno is set for us */ bcopy(&desc, &pvp->pv_desc, sizeof (desc)); pvp->pv_flags |= DT_PROVIDER_IMPL; +printf("Return the provider object...\n"); return (pvp); } @@ -674,6 +678,7 @@ * If none is found and an explicit probe ID was specified, discover * that specific probe and cache its description and arguments. */ +printf("%s:%s(%d) call dt_provider_lookup in existing cache\n",__FUNCTION__,__FILE__,__LINE__); if ((pvp = dt_provider_lookup(dtp, pdp->dtpd_provider)) != NULL) { size_t keylen = dt_probe_keylen(pdp); char *key = dt_probe_key(pdp, alloca(keylen)); @@ -708,8 +713,10 @@ if ((m = dtrace_probe_iter(dtp, pdp, dt_probe_desc, &pd)) < 0) return (NULL); /* dt_errno is set for us */ +printf("%s:%s(%d) call dt_provider_lookup\n",__FUNCTION__,__FILE__,__LINE__); if ((pvp = dt_provider_lookup(dtp, pd.dtpd_provider)) == NULL) return (NULL); /* dt_errno is set for us */ +printf("%s:%s(%d) got a provider\n",__FUNCTION__,__FILE__,__LINE__); /* * If more than one probe was matched, then do not report probe @@ -758,9 +765,15 @@ * the real attributes. Otherwise grab the static declaration. */ if (pd.dtpd_id != DTRACE_IDNONE) +{ +printf("%s:%s(%d) call dt_probe_discover\n",__FUNCTION__,__FILE__,__LINE__); prp = dt_probe_discover(pvp, &pd); +} else +{ +printf("%s:%s(%d) call dt_probe_lookup\n",__FUNCTION__,__FILE__,__LINE__); prp = dt_probe_lookup(pvp, pd.dtpd_name); +} if (prp == NULL) return (NULL); /* dt_errno is set for us */ @@ -790,6 +803,7 @@ pip->dtp_arga = pap->dtpa_args; pip->dtp_argv = prp->pr_argv; pip->dtp_argc = prp->pr_argc; +printf("%s:%s(%d) return the probe pointer\n",__FUNCTION__,__FILE__,__LINE__); return (prp); } ==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_work.c#4 (text) ==== @@ -187,6 +187,7 @@ if ((dof = dtrace_getopt_dof(dtp)) == NULL) return (-1); /* dt_errno has been set for us */ +printf("%s:%s(%d) ioctl DTRACEIOC_ENABLE\n",__FUNCTION__,__FILE__,__LINE__); err = dt_ioctl(dtp, DTRACEIOC_ENABLE, dof); dtrace_dof_destroy(dtp, dof); ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_action.c#2 (text+ko) ==== @@ -58,7 +58,10 @@ c[i++] = ')'; c[i] = '\0'; +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD debug_enter(c); +#endif } static void @@ -101,6 +104,8 @@ return; } +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD /* * raise() has a queue depth of 1 -- we ignore all subsequent * invocations of the raise() action. @@ -110,6 +115,7 @@ curthread->t_sig_check = 1; aston(curthread); +#endif } static void @@ -118,16 +124,21 @@ if (dtrace_destructive_disallow) return; +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD if (!curthread->t_dtrace_stop) { curthread->t_dtrace_stop = 1; curthread->t_sig_check = 1; aston(curthread); } +#endif } static void dtrace_action_chill(dtrace_mstate_t *mstate, hrtime_t val) { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD hrtime_t now; volatile uint16_t *flags; cpu_t *cpu = CPU; @@ -168,12 +179,15 @@ */ mstate->dtms_present &= ~DTRACE_MSTATE_TIMESTAMP; cpu->cpu_dtrace_chilled += val; +#endif } static void dtrace_action_ustack(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t *buf, uint64_t arg) { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD int nframes = DTRACE_USTACK_NFRAMES(arg); int strsize = DTRACE_USTACK_STRSIZE(arg); uint64_t *pcs = &buf[1], *fps; @@ -282,4 +296,5 @@ out: mstate->dtms_scratch_ptr = old; +#endif } ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_buffer.c#2 (text+ko) ==== @@ -69,6 +69,8 @@ dtrace_buffer_alloc(dtrace_buffer_t *bufs, size_t size, int flags, processorid_t cpu) { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD cpu_t *cp; dtrace_buffer_t *buf; @@ -140,6 +142,7 @@ buf->dtb_xamot = NULL; buf->dtb_size = 0; } while ((cp = cp->cpu_next) != cpu_list); +#endif return (ENOMEM); } ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_dif.c#2 (text+ko) ==== @@ -51,6 +51,8 @@ return (mstate->dtms_arg[ndx]); case DIF_VAR_UREGS: { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD klwp_t *lwp; if (!dtrace_priv_proc(state)) @@ -63,6 +65,9 @@ } return (dtrace_getreg(lwp->lwp_regs, ndx)); +#else +return 0; +#endif } case DIF_VAR_CURTHREAD: @@ -78,8 +83,13 @@ return (mstate->dtms_timestamp); case DIF_VAR_VTIMESTAMP: +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD ASSERT(dtrace_vtime_references != 0); return (curthread->t_dtrace_vtime); +#else +return 0; +#endif case DIF_VAR_WALLTIMESTAMP: if (!(mstate->dtms_present & DTRACE_MSTATE_WALLTIMESTAMP)) { @@ -117,6 +127,8 @@ return (mstate->dtms_stackdepth); case DIF_VAR_USTACKDEPTH: +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD if (!dtrace_priv_proc(state)) return (0); if (!(mstate->dtms_present & DTRACE_MSTATE_USTACKDEPTH)) { @@ -135,6 +147,9 @@ mstate->dtms_present |= DTRACE_MSTATE_USTACKDEPTH; } return (mstate->dtms_ustackdepth); +#else +return 0; +#endif case DIF_VAR_CALLER: if (!dtrace_priv_kernel(state)) @@ -185,7 +200,7 @@ * uint64_t will contain the caller, which is what * we're after. */ - ustack[2] = NULL; + ustack[2] = 0; dtrace_getupcstack(ustack, 3); mstate->dtms_ucaller = ustack[2]; mstate->dtms_present |= DTRACE_MSTATE_UCALLER; @@ -222,8 +237,11 @@ * always due to a high-level interrupt. (And we're assuming * that there is only a single high level interrupt.) */ +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD if (DTRACE_ANCHORED(mstate->dtms_probe) && CPU_ON_INTR(CPU)) return (pid0.pid_id); +#endif /* * It is always safe to dereference one's own t_procp pointer: @@ -233,9 +251,16 @@ * threads and processes don't clean up their own state -- * they leave that task to whomever reaps them.) */ +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD return ((uint64_t)curthread->t_procp->p_pidp->pid_id); +#else +return 0; +#endif case DIF_VAR_TID: +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD /* * See comment in DIF_VAR_PID. */ @@ -243,8 +268,13 @@ return (0); return ((uint64_t)curthread->t_tid); +#else +return 0; +#endif case DIF_VAR_EXECNAME: +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD if (!dtrace_priv_proc(state)) return (0); @@ -262,8 +292,13 @@ */ return ((uint64_t)(uintptr_t) curthread->t_procp->p_user.u_comm); +#else +return 0; +#endif case DIF_VAR_ZONENAME: +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD if (!dtrace_priv_proc(state)) return (0); @@ -281,6 +316,9 @@ */ return ((uint64_t)(uintptr_t) curthread->t_procp->p_zone->zone_name); +#else +return 0; +#endif default: DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP); @@ -300,6 +338,8 @@ dtrace_key_t *tupregs, int nargs, dtrace_mstate_t *mstate, dtrace_state_t *state) { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD volatile uint16_t *flags = &cpu_core[CPU->cpu_id].cpuc_dtrace_flags; volatile uintptr_t *illval = &cpu_core[CPU->cpu_id].cpuc_dtrace_illval; @@ -1378,6 +1418,7 @@ break; } } +#endif } /* @@ -1389,6 +1430,8 @@ dtrace_dif_emulate(dtrace_difo_t *difo, dtrace_mstate_t *mstate, dtrace_vstate_t *vstate, dtrace_state_t *state) { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD const dif_instr_t *text = difo->dtdo_buf; const uint_t textlen = difo->dtdo_len; const char *strtab = difo->dtdo_strtab; @@ -2123,6 +2166,7 @@ mstate->dtms_fltoffs = opc * sizeof (dif_instr_t); mstate->dtms_present |= DTRACE_MSTATE_FLTOFFS; +#endif return (0); } ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_difo.c#2 (text+ko) ==== @@ -649,7 +649,7 @@ static void dtrace_difo_chunksize(dtrace_difo_t *dp, dtrace_vstate_t *vstate) { - uint64_t sval; + uint64_t sval = 0; dtrace_key_t tupregs[DIF_DTR_NREGS + 2]; /* +2 for thread and id */ const dif_instr_t *text = dp->dtdo_buf; uint_t pc, srd = 0; @@ -663,7 +663,7 @@ uint_t rd = DIF_INSTR_RD(instr); uint_t r1 = DIF_INSTR_R1(instr); uint_t nkeys = 0; - uchar_t scope; + uchar_t scope = 0; dtrace_key_t *key = tupregs; @@ -792,10 +792,10 @@ for (i = 0; i < dp->dtdo_varlen; i++) { dtrace_difv_t *v = &dp->dtdo_vartab[i]; - dtrace_statvar_t *svar, ***svarp; + dtrace_statvar_t *svar, ***svarp = NULL; size_t dsize = 0; uint8_t scope = v->dtdv_scope; - int *np; + int *np = NULL; if ((id = v->dtdv_id) < DIF_VAR_OTHER_UBASE) continue; @@ -947,7 +947,7 @@ for (i = 0; i < dp->dtdo_varlen; i++) { dtrace_difv_t *v = &dp->dtdo_vartab[i]; - dtrace_statvar_t *svar, **svarp; + dtrace_statvar_t *svar, **svarp = NULL; uint_t id; uint8_t scope = v->dtdv_scope; int *np; ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_dof.c#2 (text+ko) ==== @@ -123,6 +123,8 @@ static dof_hdr_t * dtrace_dof_property(const char *name) { +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD uchar_t *buf; uint64_t loadsz; unsigned int len, i; @@ -163,6 +165,9 @@ ddi_prop_free(buf); return (dof); +#else +return NULL; +#endif } static void @@ -305,7 +310,7 @@ offsetof(dtrace_difo_t, dtdo_varlen), sizeof (dtrace_difv_t), sizeof (uint_t), "multiple variable tables" }, - { DOF_SECT_NONE, 0, 0, 0, NULL } + { DOF_SECT_NONE, 0, 0, 0, 0, NULL } }; if (sec->dofs_type != DOF_SECT_DIFOHDR) { ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_dynvar.c#2 (text+ko) ==== @@ -182,6 +182,8 @@ */ bucket = hashval % dstate->dtds_hashsize; +printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); +#ifdef DOODAD if (op == DTRACE_DYNVAR_DEALLOC) { volatile uintptr_t *lockp = &hash[bucket].dtdh_lock; @@ -196,6 +198,7 @@ dtrace_membar_producer(); } +#endif top: prev = NULL; ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_ecb.c#2 (text+ko) ==== @@ -144,7 +144,7 @@ */ diff = offs + sizeof (dtrace_aggid_t); - if (diff = (diff & (sizeof (uint64_t) - 1))) + if ((diff = (diff & (sizeof (uint64_t) - 1)))) offs += sizeof (uint64_t) - diff; aggbase = offs - sizeof (dtrace_aggid_t); @@ -411,7 +411,8 @@ uint16_t format = 0; dtrace_recdesc_t *rec; dtrace_state_t *state = ecb->dte_state; - dtrace_optval_t *opt = state->dts_options, nframes, strsize; + dtrace_optval_t *opt = state->dts_options, strsize; + dtrace_optval_t nframes = 0; uint64_t arg = desc->dtad_arg; ASSERT(MUTEX_HELD(&dtrace_lock)); @@ -452,11 +453,11 @@ * We know that our arg is a string -- turn it into a * format. */ - if (arg == NULL) { + if (arg == 0) { ASSERT(desc->dtad_kind == DTRACEACT_PRINTA); format = 0; } else { - ASSERT(arg != NULL); + ASSERT(arg != 0); ASSERT(arg > KERNELBASE); format = dtrace_format_add(state, (char *)(uintptr_t)arg); @@ -894,7 +895,9 @@ static dtrace_ecb_t * dtrace_epid2ecb(dtrace_state_t *state, dtrace_epid_t id) { +#ifdef DEBUG dtrace_ecb_t *ecb; +#endif ASSERT(MUTEX_HELD(&dtrace_lock)); @@ -910,7 +913,9 @@ static dtrace_aggregation_t * dtrace_aggid2agg(dtrace_state_t *state, dtrace_aggid_t id) { +#ifdef DEBUG dtrace_aggregation_t *agg; +#endif ASSERT(MUTEX_HELD(&dtrace_lock)); ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_enabling.c#2 (text+ko) ==== @@ -288,17 +288,24 @@ int i = 0; int matched = 0; +printf("%s:%s(%d): \n",__FUNCTION__,__FILE__,__LINE__); ASSERT(MUTEX_HELD(&cpu_lock)); ASSERT(MUTEX_HELD(&dtrace_lock)); +printf("%s:%s(%d): enab %p\n",__FUNCTION__,__FILE__,__LINE__,enab); for (i = 0; i < enab->dten_ndesc; i++) { +printf("%s:%s(%d): \n",__FUNCTION__,__FILE__,__LINE__); dtrace_ecbdesc_t *ep = enab->dten_desc[i]; +printf("%s:%s(%d): \n",__FUNCTION__,__FILE__,__LINE__); enab->dten_current = ep; +printf("%s:%s(%d): \n",__FUNCTION__,__FILE__,__LINE__); enab->dten_error = 0; +printf("%s:%s(%d): \n",__FUNCTION__,__FILE__,__LINE__); matched += dtrace_probe_enable(&ep->dted_probe, enab); +printf("%s:%s(%d): \n",__FUNCTION__,__FILE__,__LINE__); if (enab->dten_error != 0) { /* * If we get an error half-way through enabling the @@ -313,20 +320,25 @@ * it would be a result of corrupted DOF in the driver * properties. */ +printf("%s:%s(%d): \n",__FUNCTION__,__FILE__,__LINE__); if (nmatched == NULL) { cmn_err(CE_WARN, "dtrace_enabling_match() " "error on %p: %d", (void *)ep, enab->dten_error); } +printf("%s:%s(%d): returns\n",__FUNCTION__,__FILE__,__LINE__); return (enab->dten_error); } } +printf("%s:%s(%d): \n",__FUNCTION__,__FILE__,__LINE__); enab->dten_probegen = dtrace_probegen; +printf("%s:%s(%d): \n",__FUNCTION__,__FILE__,__LINE__); if (nmatched != NULL) *nmatched = matched; +printf("%s:%s(%d): returns\n",__FUNCTION__,__FILE__,__LINE__); return (0); } ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_helper.c#2 (text+ko) ==== @@ -70,7 +70,7 @@ uint16_t *flags = &cpu_core[CPU->cpu_id].cpuc_dtrace_flags; uint64_t sarg0 = mstate->dtms_arg[0]; uint64_t sarg1 = mstate->dtms_arg[1]; - uint64_t rval; + uint64_t rval = 0; dtrace_helpers_t *helpers = curproc->p_dtrace_helpers; dtrace_helper_action_t *helper; dtrace_vstate_t *vstate; @@ -151,7 +151,7 @@ mstate->dtms_arg[0] = sarg0; mstate->dtms_arg[1] = sarg1; - return (NULL); + return (0); } static void ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_ioctl.c#3 (text+ko) ==== @@ -44,6 +44,7 @@ break; case DTRACEIOC_CONF: { dtrace_conf_t conf; +printf("DTRACEIOC_CONF:\n"); bzero(&conf, sizeof (conf)); conf.dtc_difversion = DIF_VERSION; conf.dtc_difintregs = DIF_DIR_NREGS; @@ -58,10 +59,76 @@ printf("DTRACEIOC_DOFGET:\n"); error = EINVAL; break; - case DTRACEIOC_ENABLE: -printf("DTRACEIOC_ENABLE:\n"); -error = EINVAL; - break; + case DTRACEIOC_ENABLE: { + dof_hdr_t *dof = NULL; +#ifdef DOODAD + dtrace_enabling_t *enab = NULL; + dtrace_vstate_t *vstate; +#endif + int err = 0; + int rval; + void **p = (void **) addr; +printf("DTRACEIOC_ENABLE: p %p *p %p\n",p,*p); + + /* + * If a NULL argument has been passed, we take this as our + * cue to reevaluate our enablings. + */ + if (*p == NULL) { + mutex_enter(&cpu_lock); + mutex_enter(&dtrace_lock); +#ifdef DOODAD + err = dtrace_enabling_matchstate(state, *p); +#endif + mutex_exit(&dtrace_lock); + mutex_exit(&cpu_lock); + + return (err); + } + + if ((dof = dtrace_dof_copyin((uintptr_t) *p, &rval)) == NULL) + return (rval); + + mutex_enter(&cpu_lock); + mutex_enter(&dtrace_lock); +#ifdef DOODAD + vstate = &state->dts_vstate; + + if (state->dts_activity != DTRACE_ACTIVITY_INACTIVE) { + mutex_exit(&dtrace_lock); + mutex_exit(&cpu_lock); + dtrace_dof_destroy(dof); + return (EBUSY); + } + + if (dtrace_dof_slurp(dof, vstate, td->td_ucred, &enab, 0, B_TRUE) != 0) { + mutex_exit(&dtrace_lock); + mutex_exit(&cpu_lock); + dtrace_dof_destroy(dof); + return (EINVAL); + } + + if ((rval = dtrace_dof_options(dof, state)) != 0) { + dtrace_enabling_destroy(enab); + mutex_exit(&dtrace_lock); + mutex_exit(&cpu_lock); + dtrace_dof_destroy(dof); + return (rval); + } + + if ((err = dtrace_enabling_match(enab, *p)) == 0) { + err = dtrace_enabling_retain(enab); + } else { + dtrace_enabling_destroy(enab); + } +#endif + + mutex_exit(&cpu_lock); + mutex_exit(&dtrace_lock); + dtrace_dof_destroy(dof); + + return (err); + } case DTRACEIOC_EPROBE: printf("DTRACEIOC_EPROBE:\n"); error = EINVAL; @@ -74,52 +141,99 @@ printf("DTRACEIOC_GO:\n"); error = EINVAL; break; - case DTRACEIOC_PROBEARG: + case DTRACEIOC_PROBEARG: { + dtrace_argdesc_t *desc = (dtrace_argdesc_t *) addr; + dtrace_probe_t *probe; + dtrace_provider_t *prov; printf("DTRACEIOC_PROBEARG:\n"); -error = EINVAL; - break; + + if (desc->dtargd_id == DTRACE_IDNONE) + return (EINVAL); + + if (desc->dtargd_ndx == DTRACE_ARGNONE) + return (EINVAL); + + mutex_enter(&dtrace_provider_lock); + mutex_enter(&mod_lock); + mutex_enter(&dtrace_lock); + + if (desc->dtargd_id > dtrace_nprobes) { + mutex_exit(&dtrace_lock); + mutex_exit(&mod_lock); + mutex_exit(&dtrace_provider_lock); + return (EINVAL); + } + + if ((probe = dtrace_probes[desc->dtargd_id - 1]) == NULL) { + mutex_exit(&dtrace_lock); + mutex_exit(&mod_lock); + mutex_exit(&dtrace_provider_lock); + return (EINVAL); + } + + mutex_exit(&dtrace_lock); + + prov = probe->dtpr_provider; + + if (prov->dtpv_pops.dtps_getargdesc == NULL) { + /* + * There isn't any typed information for this probe. + * Set the argument number to DTRACE_ARGNONE. + */ + desc->dtargd_ndx = DTRACE_ARGNONE; + } else { + desc->dtargd_native[0] = '\0'; + desc->dtargd_xlate[0] = '\0'; + desc->dtargd_mapping = desc->dtargd_ndx; + + prov->dtpv_pops.dtps_getargdesc(prov->dtpv_arg, + probe->dtpr_id, probe->dtpr_arg, desc); + } + + mutex_exit(&mod_lock); + mutex_exit(&dtrace_provider_lock); + + return (0); + } case DTRACEIOC_PROBEMATCH: case DTRACEIOC_PROBES: { -#ifdef DOODAD + dtrace_probedesc_t *p_desc = (dtrace_probedesc_t *) addr; dtrace_probe_t *probe = NULL; - dtrace_probedesc_t desc; dtrace_probekey_t pkey; dtrace_id_t i; int m = 0; - uint32_t priv; - uid_t uid; - zoneid_t zoneid; + uint32_t priv = 0; + uid_t uid = 0; + zoneid_t zoneid = 0; +printf("%s:\n",(cmd == DTRACEIOC_PROBEMATCH) ? "DTRACEIOC_PROBEMATCH":"DTRACEIOC_PROBES"); - if (copyin((void *)arg, &desc, sizeof (desc)) != 0) - return (EFAULT); - - desc.dtpd_provider[DTRACE_PROVNAMELEN - 1] = '\0'; - desc.dtpd_mod[DTRACE_MODNAMELEN - 1] = '\0'; - desc.dtpd_func[DTRACE_FUNCNAMELEN - 1] = '\0'; - desc.dtpd_name[DTRACE_NAMELEN - 1] = '\0'; + p_desc->dtpd_provider[DTRACE_PROVNAMELEN - 1] = '\0'; + p_desc->dtpd_mod[DTRACE_MODNAMELEN - 1] = '\0'; + p_desc->dtpd_func[DTRACE_FUNCNAMELEN - 1] = '\0'; + p_desc->dtpd_name[DTRACE_NAMELEN - 1] = '\0'; /* * Before we attempt to match this probe, we want to give * all providers the opportunity to provide it. */ - if (desc.dtpd_id == DTRACE_IDNONE) { + if (p_desc->dtpd_id == DTRACE_IDNONE) { mutex_enter(&dtrace_provider_lock); - dtrace_probe_provide(&desc, NULL); + dtrace_probe_provide(p_desc, NULL); mutex_exit(&dtrace_provider_lock); - desc.dtpd_id++; + p_desc->dtpd_id++; } if (cmd == DTRACEIOC_PROBEMATCH) { - dtrace_probekey(&desc, &pkey); + dtrace_probekey(p_desc, &pkey); pkey.dtpk_id = DTRACE_IDNONE; } - dtrace_cred2priv(cr, &priv, &uid, &zoneid); + dtrace_cred2priv(td->td_ucred, &priv, &uid, &zoneid); mutex_enter(&dtrace_lock); if (cmd == DTRACEIOC_PROBEMATCH) { - for (i = desc.dtpd_id; i <= dtrace_nprobes; i++) { + for (i = p_desc->dtpd_id; i <= dtrace_nprobes; i++) { if ((probe = dtrace_probes[i - 1]) != NULL && (m = dtrace_match_probe(probe, &pkey, priv, uid, zoneid)) != 0) @@ -132,7 +246,7 @@ } } else { - for (i = desc.dtpd_id; i <= dtrace_nprobes; i++) { + for (i = p_desc->dtpd_id; i <= dtrace_nprobes; i++) { if ((probe = dtrace_probes[i - 1]) != NULL && dtrace_match_priv(probe, priv, uid, zoneid)) break; @@ -144,19 +258,34 @@ return (ESRCH); } - dtrace_probe_description(probe, &desc); + dtrace_probe_description(probe, p_desc); mutex_exit(&dtrace_lock); - if (copyout(&desc, (void *)arg, sizeof (desc)) != 0) - return (EFAULT); -#endif + return (0); + } + case DTRACEIOC_PROVIDER: { + dtrace_providerdesc_t *pvd = (dtrace_providerdesc_t *) addr; + dtrace_provider_t *pvp; +printf("DTRACEIOC_PROVIDER:\n"); + + pvd->dtvd_name[DTRACE_PROVNAMELEN - 1] = '\0'; + mutex_enter(&dtrace_provider_lock); + + for (pvp = dtrace_provider; pvp != NULL; pvp = pvp->dtpv_next) { + if (strcmp(pvp->dtpv_name, pvd->dtvd_name) == 0) + break; + } + + mutex_exit(&dtrace_provider_lock); + + if (pvp == NULL) + return (ESRCH); + + bcopy(&pvp->dtpv_priv, &pvd->dtvd_priv, sizeof (dtrace_ppriv_t)); + bcopy(&pvp->dtpv_attr, &pvd->dtvd_attr, sizeof (dtrace_pattr_t)); return (0); } - case DTRACEIOC_PROVIDER: -printf("DTRACEIOC_PROVIDER:\n"); -error = EINVAL; - break; case DTRACEIOC_REPLICATE: printf("DTRACEIOC_REPLICATE:\n"); error = EINVAL; ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_predicate.c#2 (text+ko) ==== @@ -47,7 +47,9 @@ static void dtrace_predicate_release(dtrace_predicate_t *pred, dtrace_vstate_t *vstate) { +#ifdef DEBUG dtrace_difo_t *dp = pred->dtp_difo; +#endif ASSERT(MUTEX_HELD(&dtrace_lock)); ASSERT(dp != NULL && dp->dtdo_refcnt != 0); ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_probe.c#2 (text+ko) ==== @@ -8,6 +8,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4) { +#ifdef DOODAD processorid_t cpuid; dtrace_icookie_t cookie; dtrace_probe_t *probe; @@ -606,4 +607,5 @@ curthread->t_dtrace_start = dtrace_gethrtime(); dtrace_interrupt_enable(cookie); +#endif } ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_probekey.c#2 (text+ko) ==== @@ -28,7 +28,7 @@ * dtrace_match_nonzero(). */ static void -dtrace_probekey(const dtrace_probedesc_t *pdp, dtrace_probekey_t *pkp) +dtrace_probekey(dtrace_probedesc_t *pdp, dtrace_probekey_t *pkp) { >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604222355.k3MNtwsB030490>