PREAD(3PROC) Process Control Library Functions PREAD(3PROC)

Pread, Pread_stringread data from a process

Process Control Library (libproc, -lproc)

#include <libproc.h>

ssize_t
Pread(struct ps_prochandle *P, void *buf, size_t nbytes, uintptr_t address);

ssize_t
Pread_string(struct ps_prochandle *P, char *buf, size_t nbytes, uintptr_t address);

The () function reads data from the process handle P starting at address in the address space of the process and reads at most nbytes of data into buf and is logically analogous to the pread(2) function.

For live processes, this function is equivalent to reading from the /proc file system file for the process. For core files and file handles, it reads and writes from the logical address space and not the corresponding offset of the file itself. For example, a core file contains a sparse representation of the address space of a crashed process and unmapped regions are not present in the file. However, address still refers to the virtual addresses that were present at run-time and not those in the core file.

The () function is similar to the Pread() function, except that it attempts to interpret address as a null terminated character string and will stop reading characters into buf if either nbytes has been read or a null terminator is encountered. The resulting data in buf will always be null terminated, even if no null terminator was found in the first nbytes of data.

Upon successful completion, the Pread() and Pread_string() functions return a non-negative integer indicating the number of bytes actually read. Otherwise, the functions return and set to indicate the error.

For a full list of possible errors also see the section in proc(5) and the ERRORS section in pread(2).

See in libproc(3LIB).

pread(2), libproc(3LIB), proc(5)

May 11, 2016 OmniOS