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.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
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]
25 static int dtrace_verbose_ioctl;
26 SYSCTL_INT(_debug_dtrace, OID_AUTO, verbose_ioctl, CTLFLAG_RW, &dtrace_verbose_ioctl, 0, "");
28 #define DTRACE_IOCTL_PRINTF(fmt, ...) if (dtrace_verbose_ioctl) printf(fmt, ## __VA_ARGS__ )
31 dtrace_ioctl_helper(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
35 dof_helper_t *dhp = NULL;
36 dof_hdr_t *dof = NULL;
39 case DTRACEHIOC_ADDDOF:
40 dhp = (dof_helper_t *)addr;
41 /* XXX all because dofhp_dof is 64 bit */
43 addr = (caddr_t)(uint32_t)dhp->dofhp_dof;
45 addr = (caddr_t)dhp->dofhp_dof;
49 dof = dtrace_dof_copyin((intptr_t)addr, &rval);
54 mutex_enter(&dtrace_lock);
55 if ((rval = dtrace_helper_slurp((dof_hdr_t *)dof, dhp)) != -1) {
58 copyout(dhp, addr, sizeof(*dhp));
64 mutex_exit(&dtrace_lock);
66 case DTRACEHIOC_REMOVE:
67 mutex_enter(&dtrace_lock);
68 rval = dtrace_helper_destroygen((int)*addr);
69 mutex_exit(&dtrace_lock);
81 dtrace_ioctl(struct cdev *dev, u_long cmd, caddr_t addr,
82 int flags __unused, struct thread *td)
84 #if __FreeBSD_version < 800039
85 dtrace_state_t *state = dev->si_drv1;
87 dtrace_state_t *state;
88 devfs_get_cdevpriv((void **) &state);
94 if (state->dts_anon) {
95 ASSERT(dtrace_anon.dta_state == NULL);
96 state = state->dts_anon;
100 case DTRACEIOC_AGGDESC: {
101 dtrace_aggdesc_t **paggdesc = (dtrace_aggdesc_t **) addr;
102 dtrace_aggdesc_t aggdesc;
103 dtrace_action_t *act;
104 dtrace_aggregation_t *agg;
107 dtrace_recdesc_t *lrec;
112 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_AGGDESC\n",__func__,__LINE__);
114 if (copyin((void *) *paggdesc, &aggdesc, sizeof (aggdesc)) != 0)
117 mutex_enter(&dtrace_lock);
119 if ((agg = dtrace_aggid2agg(state, aggdesc.dtagd_id)) == NULL) {
120 mutex_exit(&dtrace_lock);
124 aggdesc.dtagd_epid = agg->dtag_ecb->dte_epid;
126 nrecs = aggdesc.dtagd_nrecs;
127 aggdesc.dtagd_nrecs = 0;
129 offs = agg->dtag_base;
130 lrec = &agg->dtag_action.dta_rec;
131 aggdesc.dtagd_size = lrec->dtrd_offset + lrec->dtrd_size - offs;
133 for (act = agg->dtag_first; ; act = act->dta_next) {
134 ASSERT(act->dta_intuple ||
135 DTRACEACT_ISAGG(act->dta_kind));
138 * If this action has a record size of zero, it
139 * denotes an argument to the aggregating action.
140 * Because the presence of this record doesn't (or
141 * shouldn't) affect the way the data is interpreted,
142 * we don't copy it out to save user-level the
143 * confusion of dealing with a zero-length record.
145 if (act->dta_rec.dtrd_size == 0) {
146 ASSERT(agg->dtag_hasarg);
150 aggdesc.dtagd_nrecs++;
152 if (act == &agg->dtag_action)
157 * Now that we have the size, we need to allocate a temporary
158 * buffer in which to store the complete description. We need
159 * the temporary buffer to be able to drop dtrace_lock()
160 * across the copyout(), below.
162 size = sizeof (dtrace_aggdesc_t) +
163 (aggdesc.dtagd_nrecs * sizeof (dtrace_recdesc_t));
165 buf = kmem_alloc(size, KM_SLEEP);
166 dest = (uintptr_t)buf;
168 bcopy(&aggdesc, (void *)dest, sizeof (aggdesc));
169 dest += offsetof(dtrace_aggdesc_t, dtagd_rec[0]);
171 for (act = agg->dtag_first; ; act = act->dta_next) {
172 dtrace_recdesc_t rec = act->dta_rec;
175 * See the comment in the above loop for why we pass
176 * over zero-length records.
178 if (rec.dtrd_size == 0) {
179 ASSERT(agg->dtag_hasarg);
186 rec.dtrd_offset -= offs;
187 bcopy(&rec, (void *)dest, sizeof (rec));
188 dest += sizeof (dtrace_recdesc_t);
190 if (act == &agg->dtag_action)
194 mutex_exit(&dtrace_lock);
196 if (copyout(buf, (void *) *paggdesc, dest - (uintptr_t)buf) != 0) {
197 kmem_free(buf, size);
201 kmem_free(buf, size);
204 case DTRACEIOC_AGGSNAP:
205 case DTRACEIOC_BUFSNAP: {
206 dtrace_bufdesc_t **pdesc = (dtrace_bufdesc_t **) addr;
207 dtrace_bufdesc_t desc;
209 dtrace_buffer_t *buf;
211 dtrace_debug_output();
213 if (copyin((void *) *pdesc, &desc, sizeof (desc)) != 0)
216 DTRACE_IOCTL_PRINTF("%s(%d): %s curcpu %d cpu %d\n",
218 cmd == DTRACEIOC_AGGSNAP ?
219 "DTRACEIOC_AGGSNAP":"DTRACEIOC_BUFSNAP",
220 curcpu, desc.dtbd_cpu);
222 if (desc.dtbd_cpu < 0 || desc.dtbd_cpu >= NCPU)
224 if (pcpu_find(desc.dtbd_cpu) == NULL)
227 mutex_enter(&dtrace_lock);
229 if (cmd == DTRACEIOC_BUFSNAP) {
230 buf = &state->dts_buffer[desc.dtbd_cpu];
232 buf = &state->dts_aggbuffer[desc.dtbd_cpu];
235 if (buf->dtb_flags & (DTRACEBUF_RING | DTRACEBUF_FILL)) {
236 size_t sz = buf->dtb_offset;
238 if (state->dts_activity != DTRACE_ACTIVITY_STOPPED) {
239 mutex_exit(&dtrace_lock);
244 * If this buffer has already been consumed, we're
245 * going to indicate that there's nothing left here
248 if (buf->dtb_flags & DTRACEBUF_CONSUMED) {
249 mutex_exit(&dtrace_lock);
253 desc.dtbd_errors = 0;
254 desc.dtbd_oldest = 0;
257 if (copyout(&desc, (void *) *pdesc, sz) != 0)
264 * If this is a ring buffer that has wrapped, we want
265 * to copy the whole thing out.
267 if (buf->dtb_flags & DTRACEBUF_WRAPPED) {
268 dtrace_buffer_polish(buf);
272 if (copyout(buf->dtb_tomax, desc.dtbd_data, sz) != 0) {
273 mutex_exit(&dtrace_lock);
278 desc.dtbd_drops = buf->dtb_drops;
279 desc.dtbd_errors = buf->dtb_errors;
280 desc.dtbd_oldest = buf->dtb_xamot_offset;
282 mutex_exit(&dtrace_lock);
284 if (copyout(&desc, (void *) *pdesc, sizeof (desc)) != 0)
287 buf->dtb_flags |= DTRACEBUF_CONSUMED;
292 if (buf->dtb_tomax == NULL) {
293 ASSERT(buf->dtb_xamot == NULL);
294 mutex_exit(&dtrace_lock);
298 cached = buf->dtb_tomax;
299 ASSERT(!(buf->dtb_flags & DTRACEBUF_NOSWITCH));
301 dtrace_xcall(desc.dtbd_cpu,
302 (dtrace_xcall_t)dtrace_buffer_switch, buf);
304 state->dts_errors += buf->dtb_xamot_errors;
307 * If the buffers did not actually switch, then the cross call
308 * did not take place -- presumably because the given CPU is
309 * not in the ready set. If this is the case, we'll return
312 if (buf->dtb_tomax == cached) {
313 ASSERT(buf->dtb_xamot != cached);
314 mutex_exit(&dtrace_lock);
318 ASSERT(cached == buf->dtb_xamot);
320 DTRACE_IOCTL_PRINTF("%s(%d): copyout the buffer snapshot\n",__func__,__LINE__);
323 * We have our snapshot; now copy it out.
325 if (copyout(buf->dtb_xamot, desc.dtbd_data,
326 buf->dtb_xamot_offset) != 0) {
327 mutex_exit(&dtrace_lock);
331 desc.dtbd_size = buf->dtb_xamot_offset;
332 desc.dtbd_drops = buf->dtb_xamot_drops;
333 desc.dtbd_errors = buf->dtb_xamot_errors;
334 desc.dtbd_oldest = 0;
336 mutex_exit(&dtrace_lock);
338 DTRACE_IOCTL_PRINTF("%s(%d): copyout buffer desc: size %zd drops %lu errors %lu\n",__func__,__LINE__,(size_t) desc.dtbd_size,(u_long) desc.dtbd_drops,(u_long) desc.dtbd_errors);
341 * Finally, copy out the buffer description.
343 if (copyout(&desc, (void *) *pdesc, sizeof (desc)) != 0)
348 case DTRACEIOC_CONF: {
351 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_CONF\n",__func__,__LINE__);
353 bzero(&conf, sizeof (conf));
354 conf.dtc_difversion = DIF_VERSION;
355 conf.dtc_difintregs = DIF_DIR_NREGS;
356 conf.dtc_diftupregs = DIF_DTR_NREGS;
357 conf.dtc_ctfmodel = CTF_MODEL_NATIVE;
359 *((dtrace_conf_t *) addr) = conf;
363 case DTRACEIOC_DOFGET: {
364 dof_hdr_t **pdof = (dof_hdr_t **) addr;
365 dof_hdr_t hdr, *dof = *pdof;
369 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_DOFGET\n",__func__,__LINE__);
371 if (copyin((void *)dof, &hdr, sizeof (hdr)) != 0)
374 mutex_enter(&dtrace_lock);
375 dof = dtrace_dof_create(state);
376 mutex_exit(&dtrace_lock);
378 len = MIN(hdr.dofh_loadsz, dof->dofh_loadsz);
379 rval = copyout(dof, (void *) *pdof, len);
380 dtrace_dof_destroy(dof);
382 return (rval == 0 ? 0 : EFAULT);
384 case DTRACEIOC_ENABLE: {
385 dof_hdr_t *dof = NULL;
386 dtrace_enabling_t *enab = NULL;
387 dtrace_vstate_t *vstate;
390 dtrace_enable_io_t *p = (dtrace_enable_io_t *) addr;
392 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_ENABLE\n",__func__,__LINE__);
395 * If a NULL argument has been passed, we take this as our
396 * cue to reevaluate our enablings.
398 if (p->dof == NULL) {
399 dtrace_enabling_matchall();
404 if ((dof = dtrace_dof_copyin((uintptr_t) p->dof, &rval)) == NULL)
407 mutex_enter(&cpu_lock);
408 mutex_enter(&dtrace_lock);
409 vstate = &state->dts_vstate;
411 if (state->dts_activity != DTRACE_ACTIVITY_INACTIVE) {
412 mutex_exit(&dtrace_lock);
413 mutex_exit(&cpu_lock);
414 dtrace_dof_destroy(dof);
418 if (dtrace_dof_slurp(dof, vstate, td->td_ucred, &enab, 0, B_TRUE) != 0) {
419 mutex_exit(&dtrace_lock);
420 mutex_exit(&cpu_lock);
421 dtrace_dof_destroy(dof);
425 if ((rval = dtrace_dof_options(dof, state)) != 0) {
426 dtrace_enabling_destroy(enab);
427 mutex_exit(&dtrace_lock);
428 mutex_exit(&cpu_lock);
429 dtrace_dof_destroy(dof);
433 if ((err = dtrace_enabling_match(enab, &p->n_matched)) == 0) {
434 err = dtrace_enabling_retain(enab);
436 dtrace_enabling_destroy(enab);
439 mutex_exit(&cpu_lock);
440 mutex_exit(&dtrace_lock);
441 dtrace_dof_destroy(dof);
445 case DTRACEIOC_EPROBE: {
446 dtrace_eprobedesc_t **pepdesc = (dtrace_eprobedesc_t **) addr;
447 dtrace_eprobedesc_t epdesc;
449 dtrace_action_t *act;
455 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_EPROBE\n",__func__,__LINE__);
457 if (copyin((void *)*pepdesc, &epdesc, sizeof (epdesc)) != 0)
460 mutex_enter(&dtrace_lock);
462 if ((ecb = dtrace_epid2ecb(state, epdesc.dtepd_epid)) == NULL) {
463 mutex_exit(&dtrace_lock);
467 if (ecb->dte_probe == NULL) {
468 mutex_exit(&dtrace_lock);
472 epdesc.dtepd_probeid = ecb->dte_probe->dtpr_id;
473 epdesc.dtepd_uarg = ecb->dte_uarg;
474 epdesc.dtepd_size = ecb->dte_size;
476 nrecs = epdesc.dtepd_nrecs;
477 epdesc.dtepd_nrecs = 0;
478 for (act = ecb->dte_action; act != NULL; act = act->dta_next) {
479 if (DTRACEACT_ISAGG(act->dta_kind) || act->dta_intuple)
482 epdesc.dtepd_nrecs++;
486 * Now that we have the size, we need to allocate a temporary
487 * buffer in which to store the complete description. We need
488 * the temporary buffer to be able to drop dtrace_lock()
489 * across the copyout(), below.
491 size = sizeof (dtrace_eprobedesc_t) +
492 (epdesc.dtepd_nrecs * sizeof (dtrace_recdesc_t));
494 buf = kmem_alloc(size, KM_SLEEP);
495 dest = (uintptr_t)buf;
497 bcopy(&epdesc, (void *)dest, sizeof (epdesc));
498 dest += offsetof(dtrace_eprobedesc_t, dtepd_rec[0]);
500 for (act = ecb->dte_action; act != NULL; act = act->dta_next) {
501 if (DTRACEACT_ISAGG(act->dta_kind) || act->dta_intuple)
507 bcopy(&act->dta_rec, (void *)dest,
508 sizeof (dtrace_recdesc_t));
509 dest += sizeof (dtrace_recdesc_t);
512 mutex_exit(&dtrace_lock);
514 if (copyout(buf, (void *) *pepdesc, dest - (uintptr_t)buf) != 0) {
515 kmem_free(buf, size);
519 kmem_free(buf, size);
522 case DTRACEIOC_FORMAT: {
523 dtrace_fmtdesc_t *fmt = (dtrace_fmtdesc_t *) addr;
527 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_FORMAT\n",__func__,__LINE__);
529 mutex_enter(&dtrace_lock);
531 if (fmt->dtfd_format == 0 ||
532 fmt->dtfd_format > state->dts_nformats) {
533 mutex_exit(&dtrace_lock);
538 * Format strings are allocated contiguously and they are
539 * never freed; if a format index is less than the number
540 * of formats, we can assert that the format map is non-NULL
541 * and that the format for the specified index is non-NULL.
543 ASSERT(state->dts_formats != NULL);
544 str = state->dts_formats[fmt->dtfd_format - 1];
547 len = strlen(str) + 1;
549 if (len > fmt->dtfd_length) {
550 fmt->dtfd_length = len;
552 if (copyout(str, fmt->dtfd_string, len) != 0) {
553 mutex_exit(&dtrace_lock);
558 mutex_exit(&dtrace_lock);
563 processorid_t *cpuid = (processorid_t *) addr;
565 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_GO\n",__func__,__LINE__);
567 rval = dtrace_state_go(state, cpuid);
571 case DTRACEIOC_PROBEARG: {
572 dtrace_argdesc_t *desc = (dtrace_argdesc_t *) addr;
573 dtrace_probe_t *probe;
574 dtrace_provider_t *prov;
576 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_PROBEARG\n",__func__,__LINE__);
578 if (desc->dtargd_id == DTRACE_IDNONE)
581 if (desc->dtargd_ndx == DTRACE_ARGNONE)
584 mutex_enter(&dtrace_provider_lock);
585 mutex_enter(&mod_lock);
586 mutex_enter(&dtrace_lock);
588 if (desc->dtargd_id > dtrace_nprobes) {
589 mutex_exit(&dtrace_lock);
590 mutex_exit(&mod_lock);
591 mutex_exit(&dtrace_provider_lock);
595 if ((probe = dtrace_probes[desc->dtargd_id - 1]) == NULL) {
596 mutex_exit(&dtrace_lock);
597 mutex_exit(&mod_lock);
598 mutex_exit(&dtrace_provider_lock);
602 mutex_exit(&dtrace_lock);
604 prov = probe->dtpr_provider;
606 if (prov->dtpv_pops.dtps_getargdesc == NULL) {
608 * There isn't any typed information for this probe.
609 * Set the argument number to DTRACE_ARGNONE.
611 desc->dtargd_ndx = DTRACE_ARGNONE;
613 desc->dtargd_native[0] = '\0';
614 desc->dtargd_xlate[0] = '\0';
615 desc->dtargd_mapping = desc->dtargd_ndx;
617 prov->dtpv_pops.dtps_getargdesc(prov->dtpv_arg,
618 probe->dtpr_id, probe->dtpr_arg, desc);
621 mutex_exit(&mod_lock);
622 mutex_exit(&dtrace_provider_lock);
626 case DTRACEIOC_PROBEMATCH:
627 case DTRACEIOC_PROBES: {
628 dtrace_probedesc_t *p_desc = (dtrace_probedesc_t *) addr;
629 dtrace_probe_t *probe = NULL;
630 dtrace_probekey_t pkey;
637 DTRACE_IOCTL_PRINTF("%s(%d): %s\n",__func__,__LINE__,
638 cmd == DTRACEIOC_PROBEMATCH ?
639 "DTRACEIOC_PROBEMATCH":"DTRACEIOC_PROBES");
641 p_desc->dtpd_provider[DTRACE_PROVNAMELEN - 1] = '\0';
642 p_desc->dtpd_mod[DTRACE_MODNAMELEN - 1] = '\0';
643 p_desc->dtpd_func[DTRACE_FUNCNAMELEN - 1] = '\0';
644 p_desc->dtpd_name[DTRACE_NAMELEN - 1] = '\0';
647 * Before we attempt to match this probe, we want to give
648 * all providers the opportunity to provide it.
650 if (p_desc->dtpd_id == DTRACE_IDNONE) {
651 mutex_enter(&dtrace_provider_lock);
652 dtrace_probe_provide(p_desc, NULL);
653 mutex_exit(&dtrace_provider_lock);
657 if (cmd == DTRACEIOC_PROBEMATCH) {
658 dtrace_probekey(p_desc, &pkey);
659 pkey.dtpk_id = DTRACE_IDNONE;
662 dtrace_cred2priv(td->td_ucred, &priv, &uid, &zoneid);
664 mutex_enter(&dtrace_lock);
666 if (cmd == DTRACEIOC_PROBEMATCH) {
667 for (i = p_desc->dtpd_id; i <= dtrace_nprobes; i++) {
668 if ((probe = dtrace_probes[i - 1]) != NULL &&
669 (m = dtrace_match_probe(probe, &pkey,
670 priv, uid, zoneid)) != 0)
675 mutex_exit(&dtrace_lock);
680 for (i = p_desc->dtpd_id; i <= dtrace_nprobes; i++) {
681 if ((probe = dtrace_probes[i - 1]) != NULL &&
682 dtrace_match_priv(probe, priv, uid, zoneid))
688 mutex_exit(&dtrace_lock);
692 dtrace_probe_description(probe, p_desc);
693 mutex_exit(&dtrace_lock);
697 case DTRACEIOC_PROVIDER: {
698 dtrace_providerdesc_t *pvd = (dtrace_providerdesc_t *) addr;
699 dtrace_provider_t *pvp;
701 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_PROVIDER\n",__func__,__LINE__);
703 pvd->dtvd_name[DTRACE_PROVNAMELEN - 1] = '\0';
704 mutex_enter(&dtrace_provider_lock);
706 for (pvp = dtrace_provider; pvp != NULL; pvp = pvp->dtpv_next) {
707 if (strcmp(pvp->dtpv_name, pvd->dtvd_name) == 0)
711 mutex_exit(&dtrace_provider_lock);
716 bcopy(&pvp->dtpv_priv, &pvd->dtvd_priv, sizeof (dtrace_ppriv_t));
717 bcopy(&pvp->dtpv_attr, &pvd->dtvd_attr, sizeof (dtrace_pattr_t));
721 case DTRACEIOC_REPLICATE: {
722 dtrace_repldesc_t *desc = (dtrace_repldesc_t *) addr;
723 dtrace_probedesc_t *match = &desc->dtrpd_match;
724 dtrace_probedesc_t *create = &desc->dtrpd_create;
727 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_REPLICATE\n",__func__,__LINE__);
729 match->dtpd_provider[DTRACE_PROVNAMELEN - 1] = '\0';
730 match->dtpd_mod[DTRACE_MODNAMELEN - 1] = '\0';
731 match->dtpd_func[DTRACE_FUNCNAMELEN - 1] = '\0';
732 match->dtpd_name[DTRACE_NAMELEN - 1] = '\0';
734 create->dtpd_provider[DTRACE_PROVNAMELEN - 1] = '\0';
735 create->dtpd_mod[DTRACE_MODNAMELEN - 1] = '\0';
736 create->dtpd_func[DTRACE_FUNCNAMELEN - 1] = '\0';
737 create->dtpd_name[DTRACE_NAMELEN - 1] = '\0';
739 mutex_enter(&dtrace_lock);
740 err = dtrace_enabling_replicate(state, match, create);
741 mutex_exit(&dtrace_lock);
745 case DTRACEIOC_STATUS: {
746 dtrace_status_t *stat = (dtrace_status_t *) addr;
747 dtrace_dstate_t *dstate;
751 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_STATUS\n",__func__,__LINE__);
754 * See the comment in dtrace_state_deadman() for the reason
755 * for setting dts_laststatus to INT64_MAX before setting
756 * it to the correct value.
758 state->dts_laststatus = INT64_MAX;
759 dtrace_membar_producer();
760 state->dts_laststatus = dtrace_gethrtime();
762 bzero(stat, sizeof (*stat));
764 mutex_enter(&dtrace_lock);
766 if (state->dts_activity == DTRACE_ACTIVITY_INACTIVE) {
767 mutex_exit(&dtrace_lock);
771 if (state->dts_activity == DTRACE_ACTIVITY_DRAINING)
772 stat->dtst_exiting = 1;
774 nerrs = state->dts_errors;
775 dstate = &state->dts_vstate.dtvs_dynvars;
777 for (i = 0; i < NCPU; i++) {
779 if (pcpu_find(i) == NULL)
782 dtrace_dstate_percpu_t *dcpu = &dstate->dtds_percpu[i];
784 stat->dtst_dyndrops += dcpu->dtdsc_drops;
785 stat->dtst_dyndrops_dirty += dcpu->dtdsc_dirty_drops;
786 stat->dtst_dyndrops_rinsing += dcpu->dtdsc_rinsing_drops;
788 if (state->dts_buffer[i].dtb_flags & DTRACEBUF_FULL)
791 nerrs += state->dts_buffer[i].dtb_errors;
793 for (j = 0; j < state->dts_nspeculations; j++) {
794 dtrace_speculation_t *spec;
795 dtrace_buffer_t *buf;
797 spec = &state->dts_speculations[j];
798 buf = &spec->dtsp_buffer[i];
799 stat->dtst_specdrops += buf->dtb_xamot_drops;
803 stat->dtst_specdrops_busy = state->dts_speculations_busy;
804 stat->dtst_specdrops_unavail = state->dts_speculations_unavail;
805 stat->dtst_stkstroverflows = state->dts_stkstroverflows;
806 stat->dtst_dblerrors = state->dts_dblerrors;
808 (state->dts_activity == DTRACE_ACTIVITY_KILLED);
809 stat->dtst_errors = nerrs;
811 mutex_exit(&dtrace_lock);
815 case DTRACEIOC_STOP: {
817 processorid_t *cpuid = (processorid_t *) addr;
819 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_STOP\n",__func__,__LINE__);
821 mutex_enter(&dtrace_lock);
822 rval = dtrace_state_stop(state, cpuid);
823 mutex_exit(&dtrace_lock);