0

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?

Tadeusz A. Kadłubowski
  • 8,047
  • 1
  • 30
  • 37

1 Answers1

1

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

alanc
  • 4,102
  • 21
  • 24
Tadeusz A. Kadłubowski
  • 8,047
  • 1
  • 30
  • 37