Date: Sat, 6 Jul 2013 03:39:41 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252860 - stable/9/sys/cddl/dev/dtmalloc Message-ID: <201307060339.r663dfkM098340@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Sat Jul 6 03:39:40 2013 New Revision: 252860 URL: http://svnweb.freebsd.org/changeset/base/252860 Log: MFC r252325: The dtmalloc provider uses the short description of a malloc type as the function name of its corresponding DTrace probes. These descriptions may contain whitespace, but probe names cannot, so just replace any whitespace with underscores when creating probes. Modified: stable/9/sys/cddl/dev/dtmalloc/dtmalloc.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cddl/dev/dtmalloc/dtmalloc.c ============================================================================== --- stable/9/sys/cddl/dev/dtmalloc/dtmalloc.c Sat Jul 6 02:50:22 2013 (r252859) +++ stable/9/sys/cddl/dev/dtmalloc/dtmalloc.c Sat Jul 6 03:39:40 2013 (r252860) @@ -28,6 +28,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/conf.h> +#include <sys/ctype.h> #include <sys/kernel.h> #include <sys/malloc.h> #include <sys/module.h> @@ -111,8 +112,17 @@ dtmalloc_type_cb(struct malloc_type *mtp { char name[DTRACE_FUNCNAMELEN]; struct malloc_type_internal *mtip = mtp->ks_handle; + int i; + /* + * malloc_type descriptions are allowed to contain whitespace, but + * DTrace probe identifiers are not, so replace the whitespace with + * underscores. + */ strlcpy(name, mtp->ks_shortdesc, sizeof(name)); + for (i = 0; name[i] != 0; i++) + if (isspace(name[i])) + name[i] = '_'; if (dtrace_probe_lookup(dtmalloc_id, NULL, name, "malloc") != 0) return;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307060339.r663dfkM098340>