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,
27 &dtrace_verbose_ioctl, 0, "log DTrace ioctls");
29 #define DTRACE_IOCTL_PRINTF(fmt, ...) if (dtrace_verbose_ioctl) printf(fmt, ## __VA_ARGS__ )
32 dtrace_ioctl_helper(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
44 case DTRACEHIOC_ADDDOF:
45 dhp = (dof_helper_t *)addr;
46 addr = (caddr_t)(uintptr_t)dhp->dofhp_dof;
50 if (dhp == NULL || p->p_pid == dhp->dofhp_pid) {
51 dof = dtrace_dof_copyin((uintptr_t)addr, &rval);
53 p = pfind(dhp->dofhp_pid);
56 if (!P_SHOULDSTOP(p) ||
57 (p->p_flag & (P_TRACED | P_WEXIT)) != P_TRACED ||
58 p->p_pptr != curproc) {
64 dof = dtrace_dof_copyin_proc(p, (uintptr_t)addr, &rval);
73 mutex_enter(&dtrace_lock);
74 if ((rval = dtrace_helper_slurp(dof, dhp, p)) != -1) {
76 dhp->dofhp_gen = rval;
77 copyout(dhp, addr, sizeof(*dhp));
83 mutex_exit(&dtrace_lock);
87 case DTRACEHIOC_REMOVE:
88 mutex_enter(&dtrace_lock);
89 rval = dtrace_helper_destroygen(NULL, *(int *)(uintptr_t)addr);
90 mutex_exit(&dtrace_lock);
101 dtrace_ioctl(struct cdev *dev, u_long cmd, caddr_t addr,
102 int flags __unused, struct thread *td)
104 dtrace_state_t *state;
105 devfs_get_cdevpriv((void **) &state);
111 if (state->dts_anon) {
112 ASSERT(dtrace_anon.dta_state == NULL);
113 state = state->dts_anon;
117 case DTRACEIOC_AGGDESC: {
118 dtrace_aggdesc_t **paggdesc = (dtrace_aggdesc_t **) addr;
119 dtrace_aggdesc_t aggdesc;
120 dtrace_action_t *act;
121 dtrace_aggregation_t *agg;
124 dtrace_recdesc_t *lrec;
129 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_AGGDESC\n",__func__,__LINE__);
131 if (copyin((void *) *paggdesc, &aggdesc, sizeof (aggdesc)) != 0)
134 mutex_enter(&dtrace_lock);
136 if ((agg = dtrace_aggid2agg(state, aggdesc.dtagd_id)) == NULL) {
137 mutex_exit(&dtrace_lock);
141 aggdesc.dtagd_epid = agg->dtag_ecb->dte_epid;
143 nrecs = aggdesc.dtagd_nrecs;
144 aggdesc.dtagd_nrecs = 0;
146 offs = agg->dtag_base;
147 lrec = &agg->dtag_action.dta_rec;
148 aggdesc.dtagd_size = lrec->dtrd_offset + lrec->dtrd_size - offs;
150 for (act = agg->dtag_first; ; act = act->dta_next) {
151 ASSERT(act->dta_intuple ||
152 DTRACEACT_ISAGG(act->dta_kind));
155 * If this action has a record size of zero, it
156 * denotes an argument to the aggregating action.
157 * Because the presence of this record doesn't (or
158 * shouldn't) affect the way the data is interpreted,
159 * we don't copy it out to save user-level the
160 * confusion of dealing with a zero-length record.
162 if (act->dta_rec.dtrd_size == 0) {
163 ASSERT(agg->dtag_hasarg);
167 aggdesc.dtagd_nrecs++;
169 if (act == &agg->dtag_action)
174 * Now that we have the size, we need to allocate a temporary
175 * buffer in which to store the complete description. We need
176 * the temporary buffer to be able to drop dtrace_lock()
177 * across the copyout(), below.
179 size = sizeof (dtrace_aggdesc_t) +
180 (aggdesc.dtagd_nrecs * sizeof (dtrace_recdesc_t));
182 buf = kmem_alloc(size, KM_SLEEP);
183 dest = (uintptr_t)buf;
185 bcopy(&aggdesc, (void *)dest, sizeof (aggdesc));
186 dest += offsetof(dtrace_aggdesc_t, dtagd_rec[0]);
188 for (act = agg->dtag_first; ; act = act->dta_next) {
189 dtrace_recdesc_t rec = act->dta_rec;
192 * See the comment in the above loop for why we pass
193 * over zero-length records.
195 if (rec.dtrd_size == 0) {
196 ASSERT(agg->dtag_hasarg);
203 rec.dtrd_offset -= offs;
204 bcopy(&rec, (void *)dest, sizeof (rec));
205 dest += sizeof (dtrace_recdesc_t);
207 if (act == &agg->dtag_action)
211 mutex_exit(&dtrace_lock);
213 if (copyout(buf, (void *) *paggdesc, dest - (uintptr_t)buf) != 0) {
214 kmem_free(buf, size);
218 kmem_free(buf, size);
221 case DTRACEIOC_AGGSNAP:
222 case DTRACEIOC_BUFSNAP: {
223 dtrace_bufdesc_t **pdesc = (dtrace_bufdesc_t **) addr;
224 dtrace_bufdesc_t desc;
226 dtrace_buffer_t *buf;
228 dtrace_debug_output();
230 if (copyin((void *) *pdesc, &desc, sizeof (desc)) != 0)
233 DTRACE_IOCTL_PRINTF("%s(%d): %s curcpu %d cpu %d\n",
235 cmd == DTRACEIOC_AGGSNAP ?
236 "DTRACEIOC_AGGSNAP":"DTRACEIOC_BUFSNAP",
237 curcpu, desc.dtbd_cpu);
239 if (desc.dtbd_cpu >= NCPU)
241 if (pcpu_find(desc.dtbd_cpu) == NULL)
244 mutex_enter(&dtrace_lock);
246 if (cmd == DTRACEIOC_BUFSNAP) {
247 buf = &state->dts_buffer[desc.dtbd_cpu];
249 buf = &state->dts_aggbuffer[desc.dtbd_cpu];
252 if (buf->dtb_flags & (DTRACEBUF_RING | DTRACEBUF_FILL)) {
253 size_t sz = buf->dtb_offset;
255 if (state->dts_activity != DTRACE_ACTIVITY_STOPPED) {
256 mutex_exit(&dtrace_lock);
261 * If this buffer has already been consumed, we're
262 * going to indicate that there's nothing left here
265 if (buf->dtb_flags & DTRACEBUF_CONSUMED) {
266 mutex_exit(&dtrace_lock);
270 desc.dtbd_errors = 0;
271 desc.dtbd_oldest = 0;
274 if (copyout(&desc, (void *) *pdesc, sz) != 0)
281 * If this is a ring buffer that has wrapped, we want
282 * to copy the whole thing out.
284 if (buf->dtb_flags & DTRACEBUF_WRAPPED) {
285 dtrace_buffer_polish(buf);
289 if (copyout(buf->dtb_tomax, desc.dtbd_data, sz) != 0) {
290 mutex_exit(&dtrace_lock);
295 desc.dtbd_drops = buf->dtb_drops;
296 desc.dtbd_errors = buf->dtb_errors;
297 desc.dtbd_oldest = buf->dtb_xamot_offset;
298 desc.dtbd_timestamp = dtrace_gethrtime();
300 mutex_exit(&dtrace_lock);
302 if (copyout(&desc, (void *) *pdesc, sizeof (desc)) != 0)
305 buf->dtb_flags |= DTRACEBUF_CONSUMED;
310 if (buf->dtb_tomax == NULL) {
311 ASSERT(buf->dtb_xamot == NULL);
312 mutex_exit(&dtrace_lock);
316 cached = buf->dtb_tomax;
317 ASSERT(!(buf->dtb_flags & DTRACEBUF_NOSWITCH));
319 dtrace_xcall(desc.dtbd_cpu,
320 (dtrace_xcall_t)dtrace_buffer_switch, buf);
322 state->dts_errors += buf->dtb_xamot_errors;
325 * If the buffers did not actually switch, then the cross call
326 * did not take place -- presumably because the given CPU is
327 * not in the ready set. If this is the case, we'll return
330 if (buf->dtb_tomax == cached) {
331 ASSERT(buf->dtb_xamot != cached);
332 mutex_exit(&dtrace_lock);
336 ASSERT(cached == buf->dtb_xamot);
338 DTRACE_IOCTL_PRINTF("%s(%d): copyout the buffer snapshot\n",__func__,__LINE__);
341 * We have our snapshot; now copy it out.
343 if (copyout(buf->dtb_xamot, desc.dtbd_data,
344 buf->dtb_xamot_offset) != 0) {
345 mutex_exit(&dtrace_lock);
349 desc.dtbd_size = buf->dtb_xamot_offset;
350 desc.dtbd_drops = buf->dtb_xamot_drops;
351 desc.dtbd_errors = buf->dtb_xamot_errors;
352 desc.dtbd_oldest = 0;
353 desc.dtbd_timestamp = buf->dtb_switched;
355 mutex_exit(&dtrace_lock);
357 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);
360 * Finally, copy out the buffer description.
362 if (copyout(&desc, (void *) *pdesc, sizeof (desc)) != 0)
367 case DTRACEIOC_CONF: {
370 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_CONF\n",__func__,__LINE__);
372 bzero(&conf, sizeof (conf));
373 conf.dtc_difversion = DIF_VERSION;
374 conf.dtc_difintregs = DIF_DIR_NREGS;
375 conf.dtc_diftupregs = DIF_DTR_NREGS;
376 conf.dtc_ctfmodel = CTF_MODEL_NATIVE;
378 *((dtrace_conf_t *) addr) = conf;
382 case DTRACEIOC_DOFGET: {
383 dof_hdr_t **pdof = (dof_hdr_t **) addr;
384 dof_hdr_t hdr, *dof = *pdof;
388 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_DOFGET\n",__func__,__LINE__);
390 if (copyin((void *)dof, &hdr, sizeof (hdr)) != 0)
393 mutex_enter(&dtrace_lock);
394 dof = dtrace_dof_create(state);
395 mutex_exit(&dtrace_lock);
397 len = MIN(hdr.dofh_loadsz, dof->dofh_loadsz);
398 rval = copyout(dof, (void *) *pdof, len);
399 dtrace_dof_destroy(dof);
401 return (rval == 0 ? 0 : EFAULT);
403 case DTRACEIOC_ENABLE: {
404 dof_hdr_t *dof = NULL;
405 dtrace_enabling_t *enab = NULL;
406 dtrace_vstate_t *vstate;
409 dtrace_enable_io_t *p = (dtrace_enable_io_t *) addr;
411 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_ENABLE\n",__func__,__LINE__);
414 * If a NULL argument has been passed, we take this as our
415 * cue to reevaluate our enablings.
417 if (p->dof == NULL) {
418 dtrace_enabling_matchall();
423 if ((dof = dtrace_dof_copyin((uintptr_t) p->dof, &rval)) == NULL)
426 mutex_enter(&cpu_lock);
427 mutex_enter(&dtrace_lock);
428 vstate = &state->dts_vstate;
430 if (state->dts_activity != DTRACE_ACTIVITY_INACTIVE) {
431 mutex_exit(&dtrace_lock);
432 mutex_exit(&cpu_lock);
433 dtrace_dof_destroy(dof);
437 if (dtrace_dof_slurp(dof, vstate, td->td_ucred, &enab, 0, B_TRUE) != 0) {
438 mutex_exit(&dtrace_lock);
439 mutex_exit(&cpu_lock);
440 dtrace_dof_destroy(dof);
444 if ((rval = dtrace_dof_options(dof, state)) != 0) {
445 dtrace_enabling_destroy(enab);
446 mutex_exit(&dtrace_lock);
447 mutex_exit(&cpu_lock);
448 dtrace_dof_destroy(dof);
452 if ((err = dtrace_enabling_match(enab, &p->n_matched)) == 0) {
453 err = dtrace_enabling_retain(enab);
455 dtrace_enabling_destroy(enab);
458 mutex_exit(&cpu_lock);
459 mutex_exit(&dtrace_lock);
460 dtrace_dof_destroy(dof);
464 case DTRACEIOC_EPROBE: {
465 dtrace_eprobedesc_t **pepdesc = (dtrace_eprobedesc_t **) addr;
466 dtrace_eprobedesc_t epdesc;
468 dtrace_action_t *act;
474 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_EPROBE\n",__func__,__LINE__);
476 if (copyin((void *)*pepdesc, &epdesc, sizeof (epdesc)) != 0)
479 mutex_enter(&dtrace_lock);
481 if ((ecb = dtrace_epid2ecb(state, epdesc.dtepd_epid)) == NULL) {
482 mutex_exit(&dtrace_lock);
486 if (ecb->dte_probe == NULL) {
487 mutex_exit(&dtrace_lock);
491 epdesc.dtepd_probeid = ecb->dte_probe->dtpr_id;
492 epdesc.dtepd_uarg = ecb->dte_uarg;
493 epdesc.dtepd_size = ecb->dte_size;
495 nrecs = epdesc.dtepd_nrecs;
496 epdesc.dtepd_nrecs = 0;
497 for (act = ecb->dte_action; act != NULL; act = act->dta_next) {
498 if (DTRACEACT_ISAGG(act->dta_kind) || act->dta_intuple)
501 epdesc.dtepd_nrecs++;
505 * Now that we have the size, we need to allocate a temporary
506 * buffer in which to store the complete description. We need
507 * the temporary buffer to be able to drop dtrace_lock()
508 * across the copyout(), below.
510 size = sizeof (dtrace_eprobedesc_t) +
511 (epdesc.dtepd_nrecs * sizeof (dtrace_recdesc_t));
513 buf = kmem_alloc(size, KM_SLEEP);
514 dest = (uintptr_t)buf;
516 bcopy(&epdesc, (void *)dest, sizeof (epdesc));
517 dest += offsetof(dtrace_eprobedesc_t, dtepd_rec[0]);
519 for (act = ecb->dte_action; act != NULL; act = act->dta_next) {
520 if (DTRACEACT_ISAGG(act->dta_kind) || act->dta_intuple)
526 bcopy(&act->dta_rec, (void *)dest,
527 sizeof (dtrace_recdesc_t));
528 dest += sizeof (dtrace_recdesc_t);
531 mutex_exit(&dtrace_lock);
533 if (copyout(buf, (void *) *pepdesc, dest - (uintptr_t)buf) != 0) {
534 kmem_free(buf, size);
538 kmem_free(buf, size);
541 case DTRACEIOC_FORMAT: {
542 dtrace_fmtdesc_t *fmt = (dtrace_fmtdesc_t *) addr;
546 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_FORMAT\n",__func__,__LINE__);
548 mutex_enter(&dtrace_lock);
550 if (fmt->dtfd_format == 0 ||
551 fmt->dtfd_format > state->dts_nformats) {
552 mutex_exit(&dtrace_lock);
557 * Format strings are allocated contiguously and they are
558 * never freed; if a format index is less than the number
559 * of formats, we can assert that the format map is non-NULL
560 * and that the format for the specified index is non-NULL.
562 ASSERT(state->dts_formats != NULL);
563 str = state->dts_formats[fmt->dtfd_format - 1];
566 len = strlen(str) + 1;
568 if (len > fmt->dtfd_length) {
569 fmt->dtfd_length = len;
571 if (copyout(str, fmt->dtfd_string, len) != 0) {
572 mutex_exit(&dtrace_lock);
577 mutex_exit(&dtrace_lock);
582 processorid_t *cpuid = (processorid_t *) addr;
584 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_GO\n",__func__,__LINE__);
586 rval = dtrace_state_go(state, cpuid);
590 case DTRACEIOC_PROBEARG: {
591 dtrace_argdesc_t *desc = (dtrace_argdesc_t *) addr;
592 dtrace_probe_t *probe;
593 dtrace_provider_t *prov;
595 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_PROBEARG\n",__func__,__LINE__);
597 if (desc->dtargd_id == DTRACE_IDNONE)
600 if (desc->dtargd_ndx == DTRACE_ARGNONE)
603 mutex_enter(&dtrace_provider_lock);
605 mutex_enter(&mod_lock);
607 mutex_enter(&dtrace_lock);
609 if (desc->dtargd_id > dtrace_nprobes) {
610 mutex_exit(&dtrace_lock);
612 mutex_exit(&mod_lock);
614 mutex_exit(&dtrace_provider_lock);
618 if ((probe = dtrace_probes[desc->dtargd_id - 1]) == NULL) {
619 mutex_exit(&dtrace_lock);
621 mutex_exit(&mod_lock);
623 mutex_exit(&dtrace_provider_lock);
627 mutex_exit(&dtrace_lock);
629 prov = probe->dtpr_provider;
631 if (prov->dtpv_pops.dtps_getargdesc == NULL) {
633 * There isn't any typed information for this probe.
634 * Set the argument number to DTRACE_ARGNONE.
636 desc->dtargd_ndx = DTRACE_ARGNONE;
638 desc->dtargd_native[0] = '\0';
639 desc->dtargd_xlate[0] = '\0';
640 desc->dtargd_mapping = desc->dtargd_ndx;
642 prov->dtpv_pops.dtps_getargdesc(prov->dtpv_arg,
643 probe->dtpr_id, probe->dtpr_arg, desc);
647 mutex_exit(&mod_lock);
649 mutex_exit(&dtrace_provider_lock);
653 case DTRACEIOC_PROBEMATCH:
654 case DTRACEIOC_PROBES: {
655 dtrace_probedesc_t *p_desc = (dtrace_probedesc_t *) addr;
656 dtrace_probe_t *probe = NULL;
657 dtrace_probekey_t pkey;
664 DTRACE_IOCTL_PRINTF("%s(%d): %s\n",__func__,__LINE__,
665 cmd == DTRACEIOC_PROBEMATCH ?
666 "DTRACEIOC_PROBEMATCH":"DTRACEIOC_PROBES");
668 p_desc->dtpd_provider[DTRACE_PROVNAMELEN - 1] = '\0';
669 p_desc->dtpd_mod[DTRACE_MODNAMELEN - 1] = '\0';
670 p_desc->dtpd_func[DTRACE_FUNCNAMELEN - 1] = '\0';
671 p_desc->dtpd_name[DTRACE_NAMELEN - 1] = '\0';
674 * Before we attempt to match this probe, we want to give
675 * all providers the opportunity to provide it.
677 if (p_desc->dtpd_id == DTRACE_IDNONE) {
678 mutex_enter(&dtrace_provider_lock);
679 dtrace_probe_provide(p_desc, NULL);
680 mutex_exit(&dtrace_provider_lock);
684 if (cmd == DTRACEIOC_PROBEMATCH) {
685 dtrace_probekey(p_desc, &pkey);
686 pkey.dtpk_id = DTRACE_IDNONE;
689 dtrace_cred2priv(td->td_ucred, &priv, &uid, &zoneid);
691 mutex_enter(&dtrace_lock);
693 if (cmd == DTRACEIOC_PROBEMATCH) {
694 for (i = p_desc->dtpd_id; i <= dtrace_nprobes; i++) {
695 if ((probe = dtrace_probes[i - 1]) != NULL &&
696 (m = dtrace_match_probe(probe, &pkey,
697 priv, uid, zoneid)) != 0)
702 mutex_exit(&dtrace_lock);
707 for (i = p_desc->dtpd_id; i <= dtrace_nprobes; i++) {
708 if ((probe = dtrace_probes[i - 1]) != NULL &&
709 dtrace_match_priv(probe, priv, uid, zoneid))
715 mutex_exit(&dtrace_lock);
719 dtrace_probe_description(probe, p_desc);
720 mutex_exit(&dtrace_lock);
724 case DTRACEIOC_PROVIDER: {
725 dtrace_providerdesc_t *pvd = (dtrace_providerdesc_t *) addr;
726 dtrace_provider_t *pvp;
728 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_PROVIDER\n",__func__,__LINE__);
730 pvd->dtvd_name[DTRACE_PROVNAMELEN - 1] = '\0';
731 mutex_enter(&dtrace_provider_lock);
733 for (pvp = dtrace_provider; pvp != NULL; pvp = pvp->dtpv_next) {
734 if (strcmp(pvp->dtpv_name, pvd->dtvd_name) == 0)
738 mutex_exit(&dtrace_provider_lock);
743 bcopy(&pvp->dtpv_priv, &pvd->dtvd_priv, sizeof (dtrace_ppriv_t));
744 bcopy(&pvp->dtpv_attr, &pvd->dtvd_attr, sizeof (dtrace_pattr_t));
748 case DTRACEIOC_REPLICATE: {
749 dtrace_repldesc_t *desc = (dtrace_repldesc_t *) addr;
750 dtrace_probedesc_t *match = &desc->dtrpd_match;
751 dtrace_probedesc_t *create = &desc->dtrpd_create;
754 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_REPLICATE\n",__func__,__LINE__);
756 match->dtpd_provider[DTRACE_PROVNAMELEN - 1] = '\0';
757 match->dtpd_mod[DTRACE_MODNAMELEN - 1] = '\0';
758 match->dtpd_func[DTRACE_FUNCNAMELEN - 1] = '\0';
759 match->dtpd_name[DTRACE_NAMELEN - 1] = '\0';
761 create->dtpd_provider[DTRACE_PROVNAMELEN - 1] = '\0';
762 create->dtpd_mod[DTRACE_MODNAMELEN - 1] = '\0';
763 create->dtpd_func[DTRACE_FUNCNAMELEN - 1] = '\0';
764 create->dtpd_name[DTRACE_NAMELEN - 1] = '\0';
766 mutex_enter(&dtrace_lock);
767 err = dtrace_enabling_replicate(state, match, create);
768 mutex_exit(&dtrace_lock);
772 case DTRACEIOC_STATUS: {
773 dtrace_status_t *stat = (dtrace_status_t *) addr;
774 dtrace_dstate_t *dstate;
778 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_STATUS\n",__func__,__LINE__);
781 * See the comment in dtrace_state_deadman() for the reason
782 * for setting dts_laststatus to INT64_MAX before setting
783 * it to the correct value.
785 state->dts_laststatus = INT64_MAX;
786 dtrace_membar_producer();
787 state->dts_laststatus = dtrace_gethrtime();
789 bzero(stat, sizeof (*stat));
791 mutex_enter(&dtrace_lock);
793 if (state->dts_activity == DTRACE_ACTIVITY_INACTIVE) {
794 mutex_exit(&dtrace_lock);
798 if (state->dts_activity == DTRACE_ACTIVITY_DRAINING)
799 stat->dtst_exiting = 1;
801 nerrs = state->dts_errors;
802 dstate = &state->dts_vstate.dtvs_dynvars;
804 for (i = 0; i < NCPU; i++) {
806 if (pcpu_find(i) == NULL)
809 dtrace_dstate_percpu_t *dcpu = &dstate->dtds_percpu[i];
811 stat->dtst_dyndrops += dcpu->dtdsc_drops;
812 stat->dtst_dyndrops_dirty += dcpu->dtdsc_dirty_drops;
813 stat->dtst_dyndrops_rinsing += dcpu->dtdsc_rinsing_drops;
815 if (state->dts_buffer[i].dtb_flags & DTRACEBUF_FULL)
818 nerrs += state->dts_buffer[i].dtb_errors;
820 for (j = 0; j < state->dts_nspeculations; j++) {
821 dtrace_speculation_t *spec;
822 dtrace_buffer_t *buf;
824 spec = &state->dts_speculations[j];
825 buf = &spec->dtsp_buffer[i];
826 stat->dtst_specdrops += buf->dtb_xamot_drops;
830 stat->dtst_specdrops_busy = state->dts_speculations_busy;
831 stat->dtst_specdrops_unavail = state->dts_speculations_unavail;
832 stat->dtst_stkstroverflows = state->dts_stkstroverflows;
833 stat->dtst_dblerrors = state->dts_dblerrors;
835 (state->dts_activity == DTRACE_ACTIVITY_KILLED);
836 stat->dtst_errors = nerrs;
838 mutex_exit(&dtrace_lock);
842 case DTRACEIOC_STOP: {
844 processorid_t *cpuid = (processorid_t *) addr;
846 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_STOP\n",__func__,__LINE__);
848 mutex_enter(&dtrace_lock);
849 rval = dtrace_state_stop(state, cpuid);
850 mutex_exit(&dtrace_lock);