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 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 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 /* 22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #pragma ident "%Z%%M% %I% %E% SMI" 27 28 #include <sys/sdt_impl.h> 29 30 static dtrace_pattr_t vtrace_attr = { 31 { DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_ISA }, 32 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 33 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 34 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 35 { DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_ISA }, 36 }; 37 38 static dtrace_pattr_t info_attr = { 39 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 40 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 41 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 42 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 43 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 44 }; 45 46 static dtrace_pattr_t fpu_attr = { 47 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 48 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 49 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 50 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_CPU }, 51 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 52 }; 53 54 static dtrace_pattr_t fsinfo_attr = { 55 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 56 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 57 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 58 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 59 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 60 }; 61 62 static dtrace_pattr_t stab_attr = { 63 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 64 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 65 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 66 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 67 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 68 }; 69 70 static dtrace_pattr_t sdt_attr = { 71 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 72 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 73 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 74 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 75 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 76 }; 77 78 sdt_provider_t sdt_providers[] = { 79 { "vtrace", "__vtrace_", &vtrace_attr, 0 }, 80 { "sysinfo", "__cpu_sysinfo_", &info_attr, 0 }, 81 { "vminfo", "__cpu_vminfo_", &info_attr, 0 }, 82 { "fpuinfo", "__fpuinfo_", &fpu_attr, 0 }, 83 { "sched", "__sched_", &stab_attr, 0 }, 84 { "proc", "__proc_", &stab_attr, 0 }, 85 { "io", "__io_", &stab_attr, 0 }, 86 { "mib", "__mib_", &stab_attr, 0 }, 87 { "fsinfo", "__fsinfo_", &fsinfo_attr, 0 }, 88 { "sysevent", "__sysevent_", &stab_attr, 0 }, 89 { "sdt", NULL, &sdt_attr, 0 }, 90 { NULL } 91 }; 92 93 sdt_argdesc_t sdt_args[] = { 94 { "sched", "wakeup", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 95 { "sched", "wakeup", 1, 0, "kthread_t *", "psinfo_t *" }, 96 { "sched", "dequeue", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 97 { "sched", "dequeue", 1, 0, "kthread_t *", "psinfo_t *" }, 98 { "sched", "dequeue", 2, 1, "disp_t *", "cpuinfo_t *" }, 99 { "sched", "enqueue", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 100 { "sched", "enqueue", 1, 0, "kthread_t *", "psinfo_t *" }, 101 { "sched", "enqueue", 2, 1, "disp_t *", "cpuinfo_t *" }, 102 { "sched", "enqueue", 3, 2, "int" }, 103 { "sched", "off-cpu", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 104 { "sched", "off-cpu", 1, 0, "kthread_t *", "psinfo_t *" }, 105 { "sched", "tick", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 106 { "sched", "tick", 1, 0, "kthread_t *", "psinfo_t *" }, 107 { "sched", "change-pri", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 108 { "sched", "change-pri", 1, 0, "kthread_t *", "psinfo_t *" }, 109 { "sched", "change-pri", 2, 1, "pri_t" }, 110 { "sched", "schedctl-nopreempt", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 111 { "sched", "schedctl-nopreempt", 1, 0, "kthread_t *", "psinfo_t *" }, 112 { "sched", "schedctl-nopreempt", 2, 1, "int" }, 113 { "sched", "schedctl-preempt", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 114 { "sched", "schedctl-preempt", 1, 0, "kthread_t *", "psinfo_t *" }, 115 { "sched", "schedctl-yield", 0, 0, "int" }, 116 { "sched", "surrender", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 117 { "sched", "surrender", 1, 0, "kthread_t *", "psinfo_t *" }, 118 { "proc", "create", 0, 0, "proc_t *", "psinfo_t *" }, 119 { "proc", "exec", 0, 0, "string" }, 120 { "proc", "exec-failure", 0, 0, "int" }, 121 { "proc", "exit", 0, 0, "int" }, 122 { "proc", "fault", 0, 0, "int" }, 123 { "proc", "fault", 1, 1, "siginfo_t *" }, 124 { "proc", "lwp-create", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 125 { "proc", "lwp-create", 1, 0, "kthread_t *", "psinfo_t *" }, 126 { "proc", "signal-clear", 0, 0, "int" }, 127 { "proc", "signal-clear", 1, 1, "siginfo_t *" }, 128 { "proc", "signal-discard", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 129 { "proc", "signal-discard", 1, 1, "proc_t *", "psinfo_t *" }, 130 { "proc", "signal-discard", 2, 2, "int" }, 131 { "proc", "signal-handle", 0, 0, "int" }, 132 { "proc", "signal-handle", 1, 1, "siginfo_t *" }, 133 { "proc", "signal-handle", 2, 2, "void (*)(void)" }, 134 { "proc", "signal-send", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 135 { "proc", "signal-send", 1, 0, "kthread_t *", "psinfo_t *" }, 136 { "proc", "signal-send", 2, 1, "int" }, 137 { "io", "start", 0, 0, "buf_t *", "bufinfo_t *" }, 138 { "io", "start", 1, 0, "buf_t *", "devinfo_t *" }, 139 { "io", "start", 2, 0, "buf_t *", "fileinfo_t *" }, 140 { "io", "done", 0, 0, "buf_t *", "bufinfo_t *" }, 141 { "io", "done", 1, 0, "buf_t *", "devinfo_t *" }, 142 { "io", "done", 2, 0, "buf_t *", "fileinfo_t *" }, 143 { "io", "wait-start", 0, 0, "buf_t *", "bufinfo_t *" }, 144 { "io", "wait-start", 1, 0, "buf_t *", "devinfo_t *" }, 145 { "io", "wait-start", 2, 0, "buf_t *", "fileinfo_t *" }, 146 { "io", "wait-done", 0, 0, "buf_t *", "bufinfo_t *" }, 147 { "io", "wait-done", 1, 0, "buf_t *", "devinfo_t *" }, 148 { "io", "wait-done", 2, 0, "buf_t *", "fileinfo_t *" }, 149 { "mib", NULL, 0, 0, "int" }, 150 { "fsinfo", NULL, 0, 0, "vnode_t *", "fileinfo_t *" }, 151 { "fsinfo", NULL, 1, 1, "int", "int" }, 152 { "sysevent", "post", 0, 0, "evch_bind_t *", "syseventchaninfo_t *" }, 153 { "sysevent", "post", 1, 1, "sysevent_impl_t *", "syseventinfo_t *" }, 154 { NULL } 155 }; 156 157 /*ARGSUSED*/ 158 void 159 sdt_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc) 160 { 161 sdt_probe_t *sdp = parg; 162 int i; 163 164 desc->dtargd_native[0] = '\0'; 165 desc->dtargd_xlate[0] = '\0'; 166 167 for (i = 0; sdt_args[i].sda_provider != NULL; i++) { 168 sdt_argdesc_t *a = &sdt_args[i]; 169 170 if (strcmp(sdp->sdp_provider->sdtp_name, a->sda_provider) != 0) 171 continue; 172 173 if (a->sda_name != NULL && 174 strcmp(sdp->sdp_name, a->sda_name) != 0) 175 continue; 176 177 if (desc->dtargd_ndx != a->sda_ndx) 178 continue; 179 180 if (a->sda_native != NULL) 181 (void) strcpy(desc->dtargd_native, a->sda_native); 182 183 if (a->sda_xlate != NULL) 184 (void) strcpy(desc->dtargd_xlate, a->sda_xlate); 185 186 desc->dtargd_mapping = a->sda_mapping; 187 return; 188 } 189 190 desc->dtargd_ndx = DTRACE_ARGNONE; 191 } 192