aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/sdt.h
diff options
context:
space:
mode:
authorRui Paulo <rpaulo@FreeBSD.org>2010-08-22 11:18:57 +0000
committerRui Paulo <rpaulo@FreeBSD.org>2010-08-22 11:18:57 +0000
commit79856499bd6f3f11cd2bd6b140d36a1183cd49ad (patch)
tree6ac97777920c38ee27a1167a56b6790fef911dd1 /sys/sys/sdt.h
parent5b5779d0007bb7bd91b42d7853551b9433bc0a02 (diff)
downloadsrc-79856499bd6f3f11cd2bd6b140d36a1183cd49ad.tar.gz
src-79856499bd6f3f11cd2bd6b140d36a1183cd49ad.zip
Add an extra comment to the SDT probes definition. This allows us to get
use '-' in probe names, matching the probe names in Solaris.[1] Add userland SDT probes definitions to sys/sdt.h. Sponsored by: The FreeBSD Foundation Discussed with: rwaston [1]
Notes
Notes: svn path=/head/; revision=211616
Diffstat (limited to 'sys/sys/sdt.h')
-rw-r--r--sys/sys/sdt.h89
1 files changed, 61 insertions, 28 deletions
diff --git a/sys/sys/sdt.h b/sys/sys/sdt.h
index eeae665c1413..d9031023c4c7 100644
--- a/sys/sys/sdt.h
+++ b/sys/sys/sdt.h
@@ -31,33 +31,66 @@
#ifndef _SYS_SDT_H
#define _SYS_SDT_H
-/* Stub these for the time being. */
-#define DTRACE_PROBE(name)
-#define DTRACE_PROBE1(name, type1, arg1)
-#define DTRACE_PROBE2(name, type1, arg1, type2, arg2)
-#define DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3)
-#define DTRACE_PROBE4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4)
-
#ifndef _KERNEL
-/* The promise of things to come. Worlds to explore. People to meet. Things to do. */
-
-#else
+#define _DTRACE_VERSION 1
+
+#define DTRACE_PROBE(prov, name) { \
+ extern void __dtrace_##prov##___##name(void); \
+ __dtrace_##prov##___##name(); \
+}
+
+#define DTRACE_PROBE1(prov, name, arg1) { \
+ extern void __dtrace_##prov##___##name(unsigned long); \
+ __dtrace_##prov##___##name((unsigned long)arg1); \
+}
+
+#define DTRACE_PROBE2(prov, name, arg1, arg2) { \
+ extern void __dtrace_##prov##___##name(unsigned long, \
+ unsigned long); \
+ __dtrace_##prov##___##name((unsigned long)arg1, \
+ (unsigned long)arg2); \
+}
+
+#define DTRACE_PROBE3(prov, name, arg1, arg2, arg3) { \
+ extern void __dtrace_##prov##___##name(unsigned long, \
+ unsigned long, unsigned long); \
+ __dtrace_##prov##___##name((unsigned long)arg1, \
+ (unsigned long)arg2, (unsigned long)arg3); \
+}
+
+#define DTRACE_PROBE4(prov, name, arg1, arg2, arg3, arg4) { \
+ extern void __dtrace_##prov##___##name(unsigned long, \
+ unsigned long, unsigned long, unsigned long); \
+ __dtrace_##prov##___##name((unsigned long)arg1, \
+ (unsigned long)arg2, (unsigned long)arg3, \
+ (unsigned long)arg4); \
+}
+
+#define DTRACE_PROBE5(prov, name, arg1, arg2, arg3, arg4, arg5) { \
+ extern void __dtrace_##prov##___##name(unsigned long, \
+ unsigned long, unsigned long, unsigned long, unsigned long);\
+ __dtrace_##prov##___##name((unsigned long)arg1, \
+ (unsigned long)arg2, (unsigned long)arg3, \
+ (unsigned long)arg4, (unsigned long)arg5); \
+}
+
+#else /* _KERNEL */
#ifndef KDTRACE_HOOKS
#define SDT_PROVIDER_DEFINE(prov)
#define SDT_PROVIDER_DECLARE(prov)
-#define SDT_PROBE_DEFINE(prov, mod, func, name)
+#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_DEFINE1(prov, mod, func, name, arg0)
-#define SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1)
-#define SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2)
-#define SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3)
-#define SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
+#define SDT_PROBE_DEFINE1(prov, mod, func, name, sname, arg0)
+#define SDT_PROBE_DEFINE2(prov, mod, func, name, sname, arg0, arg1)
+#define SDT_PROBE_DEFINE3(prov, mod, func, name, sname, arg0, arg1, arg2)
+#define SDT_PROBE_DEFINE4(prov, mod, func, name, sname, arg0, arg1, arg2, arg3)
+#define SDT_PROBE_DEFINE5(prov, mod, func, name, sname, arg0, arg1, arg2, arg3, arg4)
#define SDT_PROBE1(prov, mod, func, name, arg0)
#define SDT_PROBE2(prov, mod, func, name, arg0, arg1)
@@ -135,10 +168,10 @@ struct sdt_provider {
#define SDT_PROVIDER_DECLARE(prov) \
extern struct sdt_provider sdt_provider_##prov[1]
-#define SDT_PROBE_DEFINE(prov, mod, func, name) \
+#define SDT_PROBE_DEFINE(prov, mod, func, name, sname) \
struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1] = { \
{ sizeof(struct sdt_probe), 0, sdt_provider_##prov, \
- { NULL, NULL }, { NULL, NULL }, #mod, #func, #name, 0, 0 } \
+ { NULL, NULL }, { NULL, NULL }, #mod, #func, #sname, 0, 0 } \
}; \
SYSINIT(sdt_##prov##_##mod##_##func##_##name##_init, SI_SUB_KDTRACE, \
SI_ORDER_SECOND + 1, sdt_probe_register, \
@@ -168,30 +201,30 @@ struct sdt_provider {
SI_SUB_KDTRACE, SI_ORDER_SECOND + 2, sdt_argtype_deregister, \
sdt_##prov##_##mod##_##func##_##name##num )
-#define SDT_PROBE_DEFINE1(prov, mod, func, name, arg0) \
- SDT_PROBE_DEFINE(prov, mod, func, name); \
+#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)
-#define SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1) \
- SDT_PROBE_DEFINE(prov, mod, func, name); \
+#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)
-#define SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2) \
- SDT_PROBE_DEFINE(prov, mod, func, name); \
+#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)
-#define SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3) \
- SDT_PROBE_DEFINE(prov, mod, func, name); \
+#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)
-#define SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \
- SDT_PROBE_DEFINE(prov, mod, func, name); \
+#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); \