diff options
author | avg <avg@FreeBSD.org> | 2014-01-17 10:58:59 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2014-01-17 10:58:59 +0000 |
commit | c1dbdbde60b3dce381c43d96c9f234e354d4e721 (patch) | |
tree | a1c1799e85d009b4d890296ecdffb29fccab0554 /sys/cddl/dev | |
parent | c2040a08a94d89c7d0fc7c42c2cefcfb4d2cd271 (diff) | |
download | FreeBSD-src-c1dbdbde60b3dce381c43d96c9f234e354d4e721.zip FreeBSD-src-c1dbdbde60b3dce381c43d96c9f234e354d4e721.tar.gz |
MFC r258622: dtrace sdt: remove the ugly sname parameter of SDT_PROBE_DEFINE
Diffstat (limited to 'sys/cddl/dev')
-rw-r--r-- | sys/cddl/dev/dtrace/dtrace_test.c | 2 | ||||
-rw-r--r-- | sys/cddl/dev/sdt/sdt.c | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/sys/cddl/dev/dtrace/dtrace_test.c b/sys/cddl/dev/dtrace/dtrace_test.c index f50ad89..f8601d0 100644 --- a/sys/cddl/dev/dtrace/dtrace_test.c +++ b/sys/cddl/dev/dtrace/dtrace_test.c @@ -41,7 +41,7 @@ SDT_PROVIDER_DEFINE(test); -SDT_PROBE_DEFINE7(test, , , sdttest, sdttest, "int", "int", "int", "int", "int", +SDT_PROBE_DEFINE7(test, , , sdttest, "int", "int", "int", "int", "int", "int", "int"); /* diff --git a/sys/cddl/dev/sdt/sdt.c b/sys/cddl/dev/sdt/sdt.c index 41d3610..e0e812f 100644 --- a/sys/cddl/dev/sdt/sdt.c +++ b/sys/cddl/dev/sdt/sdt.c @@ -133,6 +133,8 @@ sdt_create_probe(struct sdt_probe *probe) char mod[DTRACE_MODNAMELEN]; char func[DTRACE_FUNCNAMELEN]; char name[DTRACE_NAMELEN]; + const char *from; + char *to; size_t len; TAILQ_FOREACH(prov, &sdt_prov_list, prov_entry) @@ -156,7 +158,18 @@ sdt_create_probe(struct sdt_probe *probe) * in the C compiler, so we have to respect const vs non-const. */ strlcpy(func, probe->func, sizeof(func)); - strlcpy(name, probe->name, sizeof(name)); + + from = probe->name; + to = name; + for (len = 0; len < (sizeof(name) - 1) && *from != '\0'; + len++, from++, to++) { + if (from[0] == '_' && from[1] == '_') { + *to = '-'; + from++; + } else + *to = *from; + } + *to = '\0'; if (dtrace_probe_lookup(prov->id, mod, func, name) != DTRACE_IDNONE) return; |