191eaf3e1SJohn Birrell /* 291eaf3e1SJohn Birrell * CDDL HEADER START 391eaf3e1SJohn Birrell * 491eaf3e1SJohn Birrell * The contents of this file are subject to the terms of the 591eaf3e1SJohn Birrell * Common Development and Distribution License (the "License"). 691eaf3e1SJohn Birrell * You may not use this file except in compliance with the License. 791eaf3e1SJohn Birrell * 891eaf3e1SJohn Birrell * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 991eaf3e1SJohn Birrell * or http://www.opensolaris.org/os/licensing. 1091eaf3e1SJohn Birrell * See the License for the specific language governing permissions 1191eaf3e1SJohn Birrell * and limitations under the License. 1291eaf3e1SJohn Birrell * 1391eaf3e1SJohn Birrell * When distributing Covered Code, include this CDDL HEADER in each 1491eaf3e1SJohn Birrell * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1591eaf3e1SJohn Birrell * If applicable, add the following below this CDDL HEADER, with the 1691eaf3e1SJohn Birrell * fields enclosed by brackets "[]" replaced with your own identifying 1791eaf3e1SJohn Birrell * information: Portions Copyright [yyyy] [name of copyright owner] 1891eaf3e1SJohn Birrell * 1991eaf3e1SJohn Birrell * CDDL HEADER END 2091eaf3e1SJohn Birrell * 2191eaf3e1SJohn Birrell * Portions Copyright 2006-2008 John Birrell jb@freebsd.org 2291eaf3e1SJohn Birrell * 2391eaf3e1SJohn Birrell * $FreeBSD$ 2491eaf3e1SJohn Birrell * 2591eaf3e1SJohn Birrell */ 2691eaf3e1SJohn Birrell 278776669bSMark Johnston #include "opt_kdtrace.h" 2891eaf3e1SJohn Birrell 2991eaf3e1SJohn Birrell #include <sys/cdefs.h> 3091eaf3e1SJohn Birrell #include <sys/param.h> 3191eaf3e1SJohn Birrell #include <sys/systm.h> 328776669bSMark Johnston 3391eaf3e1SJohn Birrell #include <sys/conf.h> 348776669bSMark Johnston #include <sys/eventhandler.h> 3591eaf3e1SJohn Birrell #include <sys/kernel.h> 3691eaf3e1SJohn Birrell #include <sys/limits.h> 3791eaf3e1SJohn Birrell #include <sys/linker.h> 388776669bSMark Johnston #include <sys/linker_set.h> 398776669bSMark Johnston #include <sys/lock.h> 408776669bSMark Johnston #include <sys/malloc.h> 4191eaf3e1SJohn Birrell #include <sys/module.h> 4291eaf3e1SJohn Birrell #include <sys/mutex.h> 438776669bSMark Johnston #include <sys/queue.h> 4491eaf3e1SJohn Birrell #include <sys/sdt.h> 4591eaf3e1SJohn Birrell 468776669bSMark Johnston #include <sys/dtrace.h> 478776669bSMark Johnston #include <sys/dtrace_bsd.h> 4891eaf3e1SJohn Birrell 498776669bSMark Johnston /* DTrace methods. */ 5091eaf3e1SJohn Birrell static void sdt_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *); 5191eaf3e1SJohn Birrell static void sdt_provide_probes(void *, dtrace_probedesc_t *); 5291eaf3e1SJohn Birrell static void sdt_destroy(void *, dtrace_id_t, void *); 5391eaf3e1SJohn Birrell static void sdt_enable(void *, dtrace_id_t, void *); 5491eaf3e1SJohn Birrell static void sdt_disable(void *, dtrace_id_t, void *); 558776669bSMark Johnston 568776669bSMark Johnston static d_open_t sdt_open; 5791eaf3e1SJohn Birrell static void sdt_load(void *); 588776669bSMark Johnston static int sdt_unload(void *); 598776669bSMark Johnston static void sdt_create_provider(struct sdt_provider *); 608776669bSMark Johnston static void sdt_create_probe(struct sdt_probe *); 6112ede07aSMark Johnston static void sdt_kld_load(void *, struct linker_file *); 62*29f4e216SMark Johnston static void sdt_kld_unload_try(void *, struct linker_file *, int *); 638776669bSMark Johnston 648776669bSMark Johnston static MALLOC_DEFINE(M_SDT, "SDT", "DTrace SDT providers"); 6591eaf3e1SJohn Birrell 6691eaf3e1SJohn Birrell static struct cdevsw sdt_cdevsw = { 6791eaf3e1SJohn Birrell .d_version = D_VERSION, 6891eaf3e1SJohn Birrell .d_open = sdt_open, 6991eaf3e1SJohn Birrell .d_name = "sdt", 7091eaf3e1SJohn Birrell }; 7191eaf3e1SJohn Birrell 7291eaf3e1SJohn Birrell static dtrace_pattr_t sdt_attr = { 7391eaf3e1SJohn Birrell { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, 7491eaf3e1SJohn Birrell { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 7591eaf3e1SJohn Birrell { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 7691eaf3e1SJohn Birrell { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, 7791eaf3e1SJohn Birrell { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 7891eaf3e1SJohn Birrell }; 7991eaf3e1SJohn Birrell 8091eaf3e1SJohn Birrell static dtrace_pops_t sdt_pops = { 8191eaf3e1SJohn Birrell sdt_provide_probes, 8291eaf3e1SJohn Birrell NULL, 8391eaf3e1SJohn Birrell sdt_enable, 8491eaf3e1SJohn Birrell sdt_disable, 8591eaf3e1SJohn Birrell NULL, 8691eaf3e1SJohn Birrell NULL, 8791eaf3e1SJohn Birrell sdt_getargdesc, 8891eaf3e1SJohn Birrell NULL, 8991eaf3e1SJohn Birrell NULL, 908776669bSMark Johnston sdt_destroy, 9191eaf3e1SJohn Birrell }; 9291eaf3e1SJohn Birrell 9391eaf3e1SJohn Birrell static struct cdev *sdt_cdev; 9491eaf3e1SJohn Birrell 958776669bSMark Johnston static TAILQ_HEAD(, sdt_provider) sdt_prov_list; 9691eaf3e1SJohn Birrell 9712ede07aSMark Johnston eventhandler_tag sdt_kld_load_tag; 98*29f4e216SMark Johnston eventhandler_tag sdt_kld_unload_try_tag; 9991eaf3e1SJohn Birrell 10091eaf3e1SJohn Birrell static void 1018776669bSMark Johnston sdt_create_provider(struct sdt_provider *prov) 10291eaf3e1SJohn Birrell { 1038776669bSMark Johnston struct sdt_provider *curr, *newprov; 10491eaf3e1SJohn Birrell 1058776669bSMark Johnston TAILQ_FOREACH(curr, &sdt_prov_list, prov_entry) 1068776669bSMark Johnston if (strcmp(prov->name, curr->name) == 0) { 1078776669bSMark Johnston /* The provider has already been defined. */ 1088776669bSMark Johnston curr->sdt_refs++; 10991eaf3e1SJohn Birrell return; 11091eaf3e1SJohn Birrell } 11191eaf3e1SJohn Birrell 1128776669bSMark Johnston /* 1138776669bSMark Johnston * Make a copy of prov so that we don't lose fields if its module is 1148776669bSMark Johnston * unloaded but the provider isn't destroyed. This could happen with 1158776669bSMark Johnston * a provider that spans multiple modules. 1168776669bSMark Johnston */ 1178776669bSMark Johnston newprov = malloc(sizeof(*newprov), M_SDT, M_WAITOK | M_ZERO); 1188776669bSMark Johnston newprov->name = strdup(prov->name, M_SDT); 1198776669bSMark Johnston prov->sdt_refs = newprov->sdt_refs = 1; 1208776669bSMark Johnston TAILQ_INIT(&newprov->probe_list); 1218776669bSMark Johnston 1228776669bSMark Johnston TAILQ_INSERT_TAIL(&sdt_prov_list, newprov, prov_entry); 1238776669bSMark Johnston 1248776669bSMark Johnston (void)dtrace_register(newprov->name, &sdt_attr, DTRACE_PRIV_USER, NULL, 1258776669bSMark Johnston &sdt_pops, NULL, (dtrace_provider_id_t *)&newprov->id); 1268776669bSMark Johnston prov->id = newprov->id; 1278776669bSMark Johnston } 1288776669bSMark Johnston 1298776669bSMark Johnston static void 1308776669bSMark Johnston sdt_create_probe(struct sdt_probe *probe) 13191eaf3e1SJohn Birrell { 1328776669bSMark Johnston struct sdt_provider *prov; 1338776669bSMark Johnston char mod[DTRACE_MODNAMELEN]; 1348776669bSMark Johnston char func[DTRACE_FUNCNAMELEN]; 1358776669bSMark Johnston char name[DTRACE_NAMELEN]; 1368776669bSMark Johnston size_t len; 1378776669bSMark Johnston 1388776669bSMark Johnston TAILQ_FOREACH(prov, &sdt_prov_list, prov_entry) 1398776669bSMark Johnston if (strcmp(prov->name, probe->prov->name) == 0) 1408776669bSMark Johnston break; 1418776669bSMark Johnston 1428776669bSMark Johnston KASSERT(prov != NULL, ("probe defined without a provider")); 1438776669bSMark Johnston 1448776669bSMark Johnston /* If no module name was specified, use the module filename. */ 1458776669bSMark Johnston if (*probe->mod == 0) { 1468776669bSMark Johnston len = strlcpy(mod, probe->sdtp_lf->filename, sizeof(mod)); 1478776669bSMark Johnston if (len > 3 && strcmp(mod + len - 3, ".ko") == 0) 1488776669bSMark Johnston mod[len - 3] = '\0'; 1498776669bSMark Johnston } else 1508776669bSMark Johnston strlcpy(mod, probe->mod, sizeof(mod)); 15191eaf3e1SJohn Birrell 15291eaf3e1SJohn Birrell /* 15391eaf3e1SJohn Birrell * Unfortunately this is necessary because the Solaris DTrace 15491eaf3e1SJohn Birrell * code mixes consts and non-consts with casts to override 15591eaf3e1SJohn Birrell * the incompatibilies. On FreeBSD, we use strict warnings 1568776669bSMark Johnston * in the C compiler, so we have to respect const vs non-const. 15791eaf3e1SJohn Birrell */ 15891eaf3e1SJohn Birrell strlcpy(func, probe->func, sizeof(func)); 15991eaf3e1SJohn Birrell strlcpy(name, probe->name, sizeof(name)); 16091eaf3e1SJohn Birrell 1618776669bSMark Johnston if (dtrace_probe_lookup(prov->id, mod, func, name) != DTRACE_IDNONE) 1628776669bSMark Johnston return; 16391eaf3e1SJohn Birrell 1648776669bSMark Johnston TAILQ_INSERT_TAIL(&prov->probe_list, probe, probe_entry); 16591eaf3e1SJohn Birrell 1668776669bSMark Johnston (void)dtrace_probe_create(prov->id, mod, func, name, 1, probe); 16791eaf3e1SJohn Birrell } 16891eaf3e1SJohn Birrell 1698776669bSMark Johnston /* Probes are created through the SDT module load/unload hook. */ 17091eaf3e1SJohn Birrell static void 17191eaf3e1SJohn Birrell sdt_provide_probes(void *arg, dtrace_probedesc_t *desc) 17291eaf3e1SJohn Birrell { 1738776669bSMark Johnston } 17491eaf3e1SJohn Birrell 1758776669bSMark Johnston static void 1768776669bSMark Johnston sdt_enable(void *arg __unused, dtrace_id_t id, void *parg) 1778776669bSMark Johnston { 1788776669bSMark Johnston struct sdt_probe *probe = parg; 1798776669bSMark Johnston 1808776669bSMark Johnston probe->id = id; 1818776669bSMark Johnston probe->sdtp_lf->nenabled++; 1828776669bSMark Johnston } 1838776669bSMark Johnston 1848776669bSMark Johnston static void 1858776669bSMark Johnston sdt_disable(void *arg __unused, dtrace_id_t id, void *parg) 1868776669bSMark Johnston { 1878776669bSMark Johnston struct sdt_probe *probe = parg; 1888776669bSMark Johnston 1898776669bSMark Johnston KASSERT(probe->sdtp_lf->nenabled > 0, ("no probes enabled")); 1908776669bSMark Johnston 1918776669bSMark Johnston probe->id = 0; 1928776669bSMark Johnston probe->sdtp_lf->nenabled--; 1938776669bSMark Johnston } 1948776669bSMark Johnston 1958776669bSMark Johnston static void 1968776669bSMark Johnston sdt_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc) 1978776669bSMark Johnston { 1988776669bSMark Johnston struct sdt_argtype *argtype; 1998776669bSMark Johnston struct sdt_probe *probe = parg; 2008776669bSMark Johnston 2018776669bSMark Johnston if (desc->dtargd_ndx < probe->n_args) { 2028776669bSMark Johnston TAILQ_FOREACH(argtype, &probe->argtype_list, argtype_entry) { 2038776669bSMark Johnston if (desc->dtargd_ndx == argtype->ndx) { 2048776669bSMark Johnston desc->dtargd_mapping = desc->dtargd_ndx; 2058776669bSMark Johnston strlcpy(desc->dtargd_native, argtype->type, 2068776669bSMark Johnston sizeof(desc->dtargd_native)); 2077bc992c0SMark Johnston if (argtype->xtype != NULL) 2087bc992c0SMark Johnston strlcpy(desc->dtargd_xlate, 2097bc992c0SMark Johnston argtype->xtype, 2107bc992c0SMark Johnston sizeof(desc->dtargd_xlate)); 2117bc992c0SMark Johnston else 2127bc992c0SMark Johnston desc->dtargd_xlate[0] = '\0'; 2138776669bSMark Johnston } 2148776669bSMark Johnston } 2158776669bSMark Johnston } else 2168776669bSMark Johnston desc->dtargd_ndx = DTRACE_ARGNONE; 21791eaf3e1SJohn Birrell } 21891eaf3e1SJohn Birrell 21991eaf3e1SJohn Birrell static void 22091eaf3e1SJohn Birrell sdt_destroy(void *arg, dtrace_id_t id, void *parg) 22191eaf3e1SJohn Birrell { 2228776669bSMark Johnston struct sdt_probe *probe; 2238776669bSMark Johnston 2248776669bSMark Johnston probe = parg; 2258776669bSMark Johnston TAILQ_REMOVE(&probe->prov->probe_list, probe, probe_entry); 2268776669bSMark Johnston } 2278776669bSMark Johnston 2288776669bSMark Johnston /* 2298776669bSMark Johnston * Called from the kernel linker when a module is loaded, before 2308776669bSMark Johnston * dtrace_module_loaded() is called. This is done so that it's possible to 2318776669bSMark Johnston * register new providers when modules are loaded. We cannot do this in the 2328776669bSMark Johnston * provide_module method since it's called with the provider lock held 2338776669bSMark Johnston * and dtrace_register() will try to acquire it again. 2348776669bSMark Johnston */ 2358776669bSMark Johnston static void 23612ede07aSMark Johnston sdt_kld_load(void *arg __unused, struct linker_file *lf) 2378776669bSMark Johnston { 2388776669bSMark Johnston struct sdt_provider **prov, **begin, **end; 2398776669bSMark Johnston struct sdt_probe **probe, **p_begin, **p_end; 2408776669bSMark Johnston struct sdt_argtype **argtype, **a_begin, **a_end; 2418776669bSMark Johnston 2428776669bSMark Johnston if (linker_file_lookup_set(lf, "sdt_providers_set", &begin, &end, NULL)) 2438776669bSMark Johnston return; 2448776669bSMark Johnston for (prov = begin; prov < end; prov++) 2458776669bSMark Johnston sdt_create_provider(*prov); 2468776669bSMark Johnston 2478776669bSMark Johnston if (linker_file_lookup_set(lf, "sdt_probes_set", &p_begin, &p_end, 2488776669bSMark Johnston NULL)) 2498776669bSMark Johnston return; 2508776669bSMark Johnston for (probe = p_begin; probe < p_end; probe++) { 2518776669bSMark Johnston (*probe)->sdtp_lf = lf; 2528776669bSMark Johnston sdt_create_probe(*probe); 2538776669bSMark Johnston TAILQ_INIT(&(*probe)->argtype_list); 2548776669bSMark Johnston } 2558776669bSMark Johnston 2568776669bSMark Johnston if (linker_file_lookup_set(lf, "sdt_argtypes_set", &a_begin, &a_end, 2578776669bSMark Johnston NULL)) 2588776669bSMark Johnston return; 2598776669bSMark Johnston for (argtype = a_begin; argtype < a_end; argtype++) { 2608776669bSMark Johnston (*argtype)->probe->n_args++; 2618776669bSMark Johnston TAILQ_INSERT_TAIL(&(*argtype)->probe->argtype_list, *argtype, 2628776669bSMark Johnston argtype_entry); 2638776669bSMark Johnston } 26491eaf3e1SJohn Birrell } 26591eaf3e1SJohn Birrell 26691eaf3e1SJohn Birrell static void 267*29f4e216SMark Johnston sdt_kld_unload_try(void *arg __unused, struct linker_file *lf, int *error __unused) 26891eaf3e1SJohn Birrell { 2698776669bSMark Johnston struct sdt_provider *prov, **curr, **begin, **end, *tmp; 27091eaf3e1SJohn Birrell 2718776669bSMark Johnston if (*error != 0) 2728776669bSMark Johnston /* We already have an error, so don't do anything. */ 2738776669bSMark Johnston return; 2748776669bSMark Johnston else if (linker_file_lookup_set(lf, "sdt_providers_set", &begin, &end, NULL)) 27512ede07aSMark Johnston /* No DTrace providers are declared in this file. */ 2768776669bSMark Johnston return; 2778776669bSMark Johnston 2788776669bSMark Johnston /* 27912ede07aSMark Johnston * Go through all the providers declared in this linker file and 28012ede07aSMark Johnston * unregister any that aren't declared in another loaded file. 2818776669bSMark Johnston */ 2828776669bSMark Johnston for (curr = begin; curr < end; curr++) { 2838776669bSMark Johnston TAILQ_FOREACH_SAFE(prov, &sdt_prov_list, prov_entry, tmp) { 2848776669bSMark Johnston if (strcmp(prov->name, (*curr)->name) == 0) { 2858776669bSMark Johnston if (prov->sdt_refs == 1) { 2868776669bSMark Johnston TAILQ_REMOVE(&sdt_prov_list, prov, 2878776669bSMark Johnston prov_entry); 2888776669bSMark Johnston dtrace_unregister(prov->id); 2898776669bSMark Johnston free(prov->name, M_SDT); 2908776669bSMark Johnston free(prov, M_SDT); 2918776669bSMark Johnston } else 2928776669bSMark Johnston prov->sdt_refs--; 2938776669bSMark Johnston break; 29491eaf3e1SJohn Birrell } 2958776669bSMark Johnston } 2968776669bSMark Johnston } 29791eaf3e1SJohn Birrell } 29891eaf3e1SJohn Birrell 29991eaf3e1SJohn Birrell static int 3008776669bSMark Johnston sdt_linker_file_cb(linker_file_t lf, void *arg __unused) 30191eaf3e1SJohn Birrell { 3028776669bSMark Johnston 30312ede07aSMark Johnston sdt_kld_load(NULL, lf); 3048776669bSMark Johnston 3058776669bSMark Johnston return (0); 30691eaf3e1SJohn Birrell } 30791eaf3e1SJohn Birrell 30891eaf3e1SJohn Birrell static void 3098776669bSMark Johnston sdt_load(void *arg __unused) 31091eaf3e1SJohn Birrell { 3118776669bSMark Johnston 3128776669bSMark Johnston TAILQ_INIT(&sdt_prov_list); 3138776669bSMark Johnston 31491eaf3e1SJohn Birrell /* Create the /dev/dtrace/sdt entry. */ 31591eaf3e1SJohn Birrell sdt_cdev = make_dev(&sdt_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, 31691eaf3e1SJohn Birrell "dtrace/sdt"); 31791eaf3e1SJohn Birrell 31891eaf3e1SJohn Birrell sdt_probe_func = dtrace_probe; 31991eaf3e1SJohn Birrell 32012ede07aSMark Johnston sdt_kld_load_tag = EVENTHANDLER_REGISTER(kld_load, sdt_kld_load, NULL, 3218776669bSMark Johnston EVENTHANDLER_PRI_ANY); 322*29f4e216SMark Johnston sdt_kld_unload_try_tag = EVENTHANDLER_REGISTER(kld_unload_try, 323*29f4e216SMark Johnston sdt_kld_unload_try, NULL, EVENTHANDLER_PRI_ANY); 3248776669bSMark Johnston 32512ede07aSMark Johnston /* Pick up probes from the kernel and already-loaded linker files. */ 3268776669bSMark Johnston linker_file_foreach(sdt_linker_file_cb, NULL); 32791eaf3e1SJohn Birrell } 32891eaf3e1SJohn Birrell 32991eaf3e1SJohn Birrell static int 3308776669bSMark Johnston sdt_unload(void *arg __unused) 33191eaf3e1SJohn Birrell { 3328776669bSMark Johnston struct sdt_provider *prov, *tmp; 33391eaf3e1SJohn Birrell 33412ede07aSMark Johnston EVENTHANDLER_DEREGISTER(kld_load, sdt_kld_load_tag); 335*29f4e216SMark Johnston EVENTHANDLER_DEREGISTER(kld_unload_try, sdt_kld_unload_try_tag); 33691eaf3e1SJohn Birrell 33791eaf3e1SJohn Birrell sdt_probe_func = sdt_probe_stub; 33891eaf3e1SJohn Birrell 3398776669bSMark Johnston TAILQ_FOREACH_SAFE(prov, &sdt_prov_list, prov_entry, tmp) { 3408776669bSMark Johnston TAILQ_REMOVE(&sdt_prov_list, prov, prov_entry); 3418776669bSMark Johnston dtrace_unregister(prov->id); 3428776669bSMark Johnston free(prov->name, M_SDT); 3438776669bSMark Johnston free(prov, M_SDT); 3448776669bSMark Johnston } 34591eaf3e1SJohn Birrell 34691eaf3e1SJohn Birrell destroy_dev(sdt_cdev); 34791eaf3e1SJohn Birrell 3488776669bSMark Johnston return (0); 34991eaf3e1SJohn Birrell } 35091eaf3e1SJohn Birrell 35191eaf3e1SJohn Birrell /* ARGSUSED */ 35291eaf3e1SJohn Birrell static int 35391eaf3e1SJohn Birrell sdt_modevent(module_t mod __unused, int type, void *data __unused) 35491eaf3e1SJohn Birrell { 35591eaf3e1SJohn Birrell int error = 0; 35691eaf3e1SJohn Birrell 35791eaf3e1SJohn Birrell switch (type) { 35891eaf3e1SJohn Birrell case MOD_LOAD: 35991eaf3e1SJohn Birrell break; 36091eaf3e1SJohn Birrell 36191eaf3e1SJohn Birrell case MOD_UNLOAD: 36291eaf3e1SJohn Birrell break; 36391eaf3e1SJohn Birrell 36491eaf3e1SJohn Birrell case MOD_SHUTDOWN: 36591eaf3e1SJohn Birrell break; 36691eaf3e1SJohn Birrell 36791eaf3e1SJohn Birrell default: 36891eaf3e1SJohn Birrell error = EOPNOTSUPP; 36991eaf3e1SJohn Birrell break; 37091eaf3e1SJohn Birrell } 37191eaf3e1SJohn Birrell 37291eaf3e1SJohn Birrell return (error); 37391eaf3e1SJohn Birrell } 37491eaf3e1SJohn Birrell 37591eaf3e1SJohn Birrell /* ARGSUSED */ 37691eaf3e1SJohn Birrell static int 3778776669bSMark Johnston sdt_open(struct cdev *dev __unused, int oflags __unused, int devtype __unused, 3788776669bSMark Johnston struct thread *td __unused) 37991eaf3e1SJohn Birrell { 3808776669bSMark Johnston 38191eaf3e1SJohn Birrell return (0); 38291eaf3e1SJohn Birrell } 38391eaf3e1SJohn Birrell 38491eaf3e1SJohn Birrell SYSINIT(sdt_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, sdt_load, NULL); 38591eaf3e1SJohn Birrell SYSUNINIT(sdt_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, sdt_unload, NULL); 38691eaf3e1SJohn Birrell 38791eaf3e1SJohn Birrell DEV_MODULE(sdt, sdt_modevent, NULL); 38891eaf3e1SJohn Birrell MODULE_VERSION(sdt, 1); 38991eaf3e1SJohn Birrell MODULE_DEPEND(sdt, dtrace, 1, 1, 1); 39091eaf3e1SJohn Birrell MODULE_DEPEND(sdt, opensolaris, 1, 1, 1); 391