From a7b2cd95aac0cdfa265d914e538385c6379b2f1b Mon Sep 17 00:00:00 2001 From: markj Date: Sat, 17 Aug 2013 22:02:26 +0000 Subject: 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 --- sys/cddl/dev/sdt/sdt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sys/cddl/dev') diff --git a/sys/cddl/dev/sdt/sdt.c b/sys/cddl/dev/sdt/sdt.c index a1cd1e2..b65d1ad 100644 --- a/sys/cddl/dev/sdt/sdt.c +++ b/sys/cddl/dev/sdt/sdt.c @@ -201,11 +201,15 @@ sdt_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc) if (desc->dtargd_ndx < probe->n_args) { TAILQ_FOREACH(argtype, &probe->argtype_list, argtype_entry) { if (desc->dtargd_ndx == argtype->ndx) { - /* XXX */ desc->dtargd_mapping = desc->dtargd_ndx; strlcpy(desc->dtargd_native, argtype->type, sizeof(desc->dtargd_native)); - desc->dtargd_xlate[0] = '\0'; /* XXX */ + if (argtype->xtype != NULL) + strlcpy(desc->dtargd_xlate, + argtype->xtype, + sizeof(desc->dtargd_xlate)); + else + desc->dtargd_xlate[0] = '\0'; } } } else -- cgit v1.1