Reputation: 8345
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?
Upvotes: 1
Views: 740
Reputation: 8345
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
Upvotes: 1