2 * Copyright 2008 John Birrell <jb@FreeBSD.org>
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 #include <sys/cdefs.h>
29 #include <sys/types.h>
30 #include <sys/param.h>
31 #include <sys/systm.h>
34 #include <sys/kernel.h>
35 #include <sys/module.h>
37 #include <sys/sysctl.h>
38 #include <sys/vnode.h>
40 SDT_PROVIDER_DEFINE(test);
42 SDT_PROBE_DEFINE7(test, , , sdttest, "int", "int", "int", "int", "int",
46 * These are variables that the DTrace test suite references in the
47 * Solaris kernel. We define them here so that the tests function
52 typedef struct vnode vnode_t;
54 vnode_t *rootvp = &dummy;
57 * Test SDT probes with more than 5 arguments. On amd64, such probes require
58 * special handling since only the first 5 arguments will be passed to
59 * dtrace_probe() in registers; the rest must be fetched off the stack.
62 dtrace_test_sdttest(SYSCTL_HANDLER_ARGS)
67 error = sysctl_handle_int(oidp, &val, 0, req);
68 if (error || req->newptr == NULL)
73 SDT_PROBE7(test, , , sdttest, 1, 2, 3, 4, 5, 6, 7);
78 static SYSCTL_NODE(_debug, OID_AUTO, dtracetest, CTLFLAG_RD, 0, "");
80 SYSCTL_PROC(_debug_dtracetest, OID_AUTO, sdttest, CTLTYPE_INT | CTLFLAG_RW,
81 NULL, 0, dtrace_test_sdttest, "I", "Trigger the SDT test probe");
84 dtrace_test_modevent(module_t mod, int type, void *data)
106 DEV_MODULE(dtrace_test, dtrace_test_modevent, NULL);
107 MODULE_VERSION(dtrace_test, 1);
108 MODULE_DEPEND(dtrace_test, dtraceall, 1, 1, 1);