Date: Wed, 18 Sep 2013 15:19:12 +0200 From: Fabian Keil <freebsd-listen@fabiankeil.de> To: Mark Johnston <markj@freebsd.org> Cc: dtrace-discuss@lists.dtrace.org, freebsd-dtrace@freebsd.org Subject: Re: pr_psargs on FreeBSD Message-ID: <5e28d134.49bf1edd@fabiankeil.de> In-Reply-To: <20130915221622.GA2981@raichu> References: <20130915221622.GA2981@raichu>
next in thread | previous in thread | raw e-mail | index | archive | help
--Sig_/1=JbcjTFsUTqjTHqYcnOBU1 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Mark Johnston <markj@freebsd.org> wrote: > It's kind of a strong-armed approach, but the problem's been around for a > while and I can't think of any clever solutions - I'd love to see an > alternative solution. >=20 > My patch against FreeBSD (pasted below) adds a function called memstr() > to DTrace. memstr() takes three arguments: addr, c, and len, and returns > a copy of addr of length len with all null-terminators replaced by c, > and with the last byte replaced by a null-terminator. In particular, > memstr() always returns a string of length len - 1, unless len =3D=3D 0, = in > which case we return the empty string. [...] > and execsnoop works properly. Any thoughts on this function? Have I missed > a better solution? A patch for FreeBSD is below. Looks good (and clever) to me and seems to work as expected. Thanks a lot. I briefly looked into this a couple of months ago and was under the impression that it would require a lot more code ... Fabian --Sig_/1=JbcjTFsUTqjTHqYcnOBU1 Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.21 (FreeBSD) iEYEARECAAYFAlI5qE8ACgkQBYqIVf93VJ2gjgCglcTYYrq47+tzbIkHxKb5r1wK n0cAniU/bnpvEzYZZfOks505a39Z/Gfy =x+E/ -----END PGP SIGNATURE----- --Sig_/1=JbcjTFsUTqjTHqYcnOBU1--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5e28d134.49bf1edd>
