I have a char* in my DTrace script that I know points to a zero-terminated string. How to access this string?
Is there some function like copyin() that handles zero-terminated strings?
I have a char* in my DTrace script that I know points to a zero-terminated string. How to access this string?
Is there some function like copyin() that handles zero-terminated strings?
copyinstr() does exactly that. It accepts a pointer as a parameter, treats it as a pointer to zero-terminated string and returns a copy of that string in kernel memory accessible by the script.
note that unlike C, DTrace has a string type. copyinstr() returns that type.
See Sun's Solaris Dynamic Tracing Guide