aboutsummaryrefslogtreecommitdiff
path: root/sys/sys
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2013-08-17 22:02:26 +0000
committerMark Johnston <markj@FreeBSD.org>2013-08-17 22:02:26 +0000
commit7bc992c037cb994f4fb31079587b47d5f12ee73a (patch)
treeb31841bcb2737c2f65bfe1334fd43729c52823d7 /sys/sys
parent1570438586ce977865ee94f3b2f7f4adc5a21091 (diff)
downloadsrc-7bc992c037cb994f4fb31079587b47d5f12ee73a.tar.gz
src-7bc992c037cb994f4fb31079587b47d5f12ee73a.zip
Add a "translated type" argument to SDT_PROBE_ARGTYPE() and add some macros
which allow one to define SDT probes that specify translated types. The idea is to make it easy to write SDT probe definitions that can work across multiple operating systems. In particular, this makes it possible to port illumos SDT probes to FreeBSD without changing their argument types, so long as the appropriate translators are defined. Then DTrace scripts written for Solaris/illumos will work on FreeBSD without any changes. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=254468
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/sdt.h145
1 files changed, 110 insertions, 35 deletions
diff --git a/sys/sys/sdt.h b/sys/sys/sdt.h
index 02b4eba22c98..820f4bba0cad 100644
--- a/sys/sys/sdt.h
+++ b/sys/sys/sdt.h
@@ -87,7 +87,7 @@
#define SDT_PROBE_DEFINE(prov, mod, func, name, sname)
#define SDT_PROBE_DECLARE(prov, mod, func, name)
#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
-#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type)
+#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype)
#define SDT_PROBE_DEFINE0(prov, mod, func, name, sname)
#define SDT_PROBE_DEFINE1(prov, mod, func, name, sname, arg0)
@@ -110,6 +110,22 @@
#define SDT_PROBE7(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5, \
arg6)
+#define SDT_PROBE_DEFINE0_XLATE(prov, mod, func, name, sname)
+#define SDT_PROBE_DEFINE1_XLATE(prov, mod, func, name, sname, arg0, xarg0)
+#define SDT_PROBE_DEFINE2_XLATE(prov, mod, func, name, sname, arg0, xarg0, \
+ arg1, xarg1)
+#define SDT_PROBE_DEFINE3_XLATE(prov, mod, func, name, sname, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2)
+#define SDT_PROBE_DEFINE4_XLATE(prov, mod, func, name, sname, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2, arg3, xarg3)
+#define SDT_PROBE_DEFINE5_XLATE(prov, mod, func, name, sname, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4)
+#define SDT_PROBE_DEFINE6_XLATE(prov, mod, func, name, sname, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5)
+#define SDT_PROBE_DEFINE7_XLATE(prov, mod, func, name, sname, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5, arg6, \
+ xarg6)
+
#else
SET_DECLARE(sdt_providers_set, struct sdt_provider);
@@ -143,9 +159,9 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype);
(uintptr_t) arg3, (uintptr_t) arg4); \
} while (0)
-#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type) \
+#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype) \
static struct sdt_argtype sdt_##prov##_##mod##_##func##_##name##num[1] \
- = { { num, type, { NULL, NULL }, \
+ = { { num, type, xtype, { NULL, NULL }, \
sdt_##prov##_##mod##_##func##_##name } \
}; \
DATA_SET(sdt_argtypes_set, sdt_##prov##_##mod##_##func##_##name##num);
@@ -155,54 +171,113 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype);
#define SDT_PROBE_DEFINE1(prov, mod, func, name, sname, arg0) \
SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0)
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL)
#define SDT_PROBE_DEFINE2(prov, mod, func, name, sname, arg0, arg1) \
SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1)
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL)
#define SDT_PROBE_DEFINE3(prov, mod, func, name, sname, arg0, arg1, arg2)\
SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2)
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL)
#define SDT_PROBE_DEFINE4(prov, mod, func, name, sname, arg0, arg1, arg2, arg3) \
SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3)
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL)
#define SDT_PROBE_DEFINE5(prov, mod, func, name, sname, arg0, arg1, arg2, arg3, arg4) \
SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4)
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, NULL)
#define SDT_PROBE_DEFINE6(prov, mod, func, name, sname, arg0, arg1, arg2, arg3,\
arg4, arg5) \
SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5);
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, NULL)
#define SDT_PROBE_DEFINE7(prov, mod, func, name, sname, arg0, arg1, arg2, arg3,\
arg4, arg5, arg6) \
SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 6, arg6);
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 6, arg6, NULL)
+
+#define SDT_PROBE_DEFINE0_XLATE(prov, mod, func, name, sname) \
+ SDT_PROBE_DEFINE(prov, mod, func, name, sname)
+
+#define SDT_PROBE_DEFINE1_XLATE(prov, mod, func, name, sname, arg0, xarg0) \
+ SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0)
+
+#define SDT_PROBE_DEFINE2_XLATE(prov, mod, func, name, sname, arg0, xarg0, \
+ arg1, xarg1) \
+ SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1)
+
+#define SDT_PROBE_DEFINE3_XLATE(prov, mod, func, name, sname, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2) \
+ SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2)
+
+#define SDT_PROBE_DEFINE4_XLATE(prov, mod, func, name, sname, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2, arg3, xarg3) \
+ SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3)
+
+#define SDT_PROBE_DEFINE5_XLATE(prov, mod, func, name, sname, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4) \
+ SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, xarg4)
+
+#define SDT_PROBE_DEFINE6_XLATE(prov, mod, func, name, sname, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5) \
+ SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, xarg4); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, xarg5)
+
+#define SDT_PROBE_DEFINE7_XLATE(prov, mod, func, name, sname, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5, arg6, \
+ xarg6) \
+ SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, xarg4); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, xarg5); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 6, arg6, xarg6)
#define SDT_PROBE0(prov, mod, func, name) \
SDT_PROBE(prov, mod, func, name, 0, 0, 0, 0, 0)
@@ -257,12 +332,12 @@ struct sdt_provider;
struct linker_file;
struct sdt_argtype {
- int ndx; /* Argument index. */
- const char *type; /* Argument type string. */
+ int ndx; /* Argument index. */
+ const char *type; /* Argument type string. */
+ const char *xtype; /* Translated argument type. */
TAILQ_ENTRY(sdt_argtype)
argtype_entry; /* Argument type list entry. */
- struct sdt_probe
- *probe; /* Ptr to the probe structure. */
+ struct sdt_probe *probe; /* Ptr to the probe structure. */
};
struct sdt_probe {