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

Pgetareg, Pputareg, Lgetareg, Lputaregset and get a register from a stopped process or thread

Process Control Library (libproc, -lproc)

#include <libproc.h>

int
Pgetareg(struct ps_prochandle *P, int regno, prgreg_t *preg);

int
Pputareg(struct ps_prochandle *P, int regno, prgreg_t preg);

int
Lgetareg(struct ps_lwphandle *L, int regno, prgreg_t *preg);

int
Lputareg(struct ps_lwphandle *L, int regno, prgreg_t preg);

The () and () functions read and update the registers of the process handle referred to by P. The getting and setting of registers of the process operates on the representative thread (LWP). For more information on how the representative is chosen, see proc(5).

To change the registers of a specific thread, use the () and () functions.

The getting and setting of registers only applies to stopped processes. In addition, one may obtain registers from core files, but not set them. To stop a process, see the Pstop(3PROC) function.

The register to get or set is indicated by the regno argument. For a list of registers, see <sys/regset.h>. The set of registers is specific to each architecture of the system. The () function will fill in the value of preg with the value of the register regno, while the () function will update the value of the register regno with the value in preg. Updated registers will be set when the process resumes execution.

The () and () functions are equivalent to the Pgetareg() and () functions, except rather than operating on the process and its representative thread, they instead operate on the thread handle L.

Upon successful completion, the Pgetareg() and Pputareg() function return 0. Otherwise, is returned, is set, and no registers will have been gotten or updated.

The Pgetareg() and Lgetareg() functions will fail if:

The value of regno is invalid. This means it is less than 0 and greater than NPRGREG. Note, NPRGREG's value varies based on process architecture.
The handle P is neither stopped nor a core file.
The handle P refers to a file obtained through Pgrab_file(3PROC).

The Pputareg() and Lputareg() functions will fail if:

The value of regno is invalid. This means it is less than 0 and greater than NPRGREG. Note, NPRGREG's value varies based on process architecture.
The handle P is not stopped or refers to a non-active process.

See in libproc(3LIB).

errno(3C), libproc(3LIB), Lgrab(3PROC), Pgrab_file(3PROC), Pstop(3PROC), proc(5)

May 11, 2016 OmniOS