pr_psargs on FreeBSD

Fabian Keil freebsd-listen at fabiankeil.de
Wed Sep 18 13:34:47 UTC 2013


Mark Johnston <markj at 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.
> 
> 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 == 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-dtrace/attachments/20130918/ad302e6c/attachment.sig>


More information about the freebsd-dtrace mailing list