copyinstr Subroutine

string copyinstr(uintptr_t addr)
string copyinstr(uintptr_t addr, size_t maxlength)

copyinstr copies a null-terminated C string from the specified user address into a DTrace scratch buffer, and returns the address of this buffer. The user address is interpreted as an address in the space of the process associated with the current thread. The maxlength parameter, if specified, sets a limit on the number of bytes past addr which will be examined (the resulting string will always be null-terminated). The resulting string's length is limited to the value set by the strsize option; see DTrace Options and Tunables for details. As with copyin, the specified address must correspond to a faulted-in page in the current process. If the address does not correspond to a faulted-in page, or if insufficient scratch space is available, NULL is returned, and an error is generated. See User Process Tracing for techniques to reduce the likelihood of copyinstr errors.