freebsd-dev/cddl/contrib/opensolaris/lib
Mark Johnston e572bc11ec Add a function, memstr, which can be used to convert a buffer of
null-separated strings to a single string. This can be used to print the
full arguments of a process using execsnoop (from the DTrace toolkit) or
with the following one-liner:

dtrace -n 'syscall::execve:return {trace(curpsinfo->pr_psargs);}'

Note that this relies on the process arguments being cached via the struct
proc, which means that it will not work for argvs longer than
kern.ps_arg_cache_limit. However, the following rather non-portable
script can be used to extract any argv at exec time:

fbt::kern_execve:entry
{
    printf("%s", memstr(args[1]->begin_argv, ' ',
        args[1]->begin_envv - args[1]->begin_argv));
}

The debug.dtrace.memstr_max sysctl limits the maximum argument size to
memstr(). Thanks to Brendan Gregg for helpful comments on freebsd-dtrace.

Tested by:	Fabian Keil (earlier version)
MFC after:	2 weeks
2013-10-16 01:39:26 +00:00
..
libctf/common MFV r254746: 2013-08-23 23:58:56 +00:00
libdtrace Add a function, memstr, which can be used to convert a buffer of 2013-10-16 01:39:26 +00:00
libgen/common MFV OpenSolaris DTrace userland bits. 2010-08-02 13:40:53 +00:00
libnvpair Introduce "feature flags" for ZFS pools (bump SPA version to 5000). 2012-06-11 11:35:22 +00:00
libuutil/common Merge recent zfs vendor changes, sync code and adjust userland DEBUG. 2012-09-12 18:05:43 +00:00
libzfs/common MFV r254750: 2013-09-21 00:17:26 +00:00
libzfs_core/common MFV r254421: 2013-08-21 00:04:31 +00:00
libzpool/common MFV r247844 (illumos-gate 13975:ef6409bc370f) 2013-09-10 01:46:47 +00:00
pyzfs/common Finally... Import the latest open-source ZFS version - (SPA) 28. 2011-02-27 19:41:40 +00:00