1 PGETAREG(3PROC)        Process Control Library Functions       PGETAREG(3PROC)
   2 
   3 NAME
   4      Pgetareg, Pputareg, Lgetareg, Lputareg - set and get a register from a
   5      stopped process or thread
   6 
   7 LIBRARY
   8      Process Control Library (libproc, -lproc)
   9 
  10 SYNOPSIS
  11      #include <libproc.h>
  12 
  13      int
  14      Pgetareg(struct ps_prochandle *P, int regno, prgreg_t *preg);
  15 
  16      int
  17      Pputareg(struct ps_prochandle *P, int regno, prgreg_t preg);
  18 
  19      int
  20      Lgetareg(struct ps_lwphandle *L, int regno, prgreg_t *preg);
  21 
  22      int
  23      Lputareg(struct ps_lwphandle *L, int regno, prgreg_t preg);
  24 
  25 DESCRIPTION
  26      The Pgetareg() and Pputareg() functions read and update the registers of
  27      the process handle referred to by P.  The getting and setting of
  28      registers of the process operates on the representative thread (LWP).
  29      For more information on how the representative is chosen, see proc(4).
  30 
  31      To change the registers of a specific thread, use the Lgetareg() and
  32      Lputareg() functions.
  33 
  34      The getting and setting of registers only applies to stopped processes.
  35      In addition, one may obtain registers from core files, but not set them.
  36      To stop a process, see the Pstop(3PROC) function.
  37 
  38      The register to get or set is indicated by the regno argument.  For a
  39      list of registers, see <sys/regset.h>.  The set of   registers is specific
  40      to each architecture of the system.  The Pgetareg() function will fill in
  41      the value of preg with the value of the register regno, while the
  42      Pputareg() function will update the value of the register regno with the
  43      value in preg.  Updated registers will be set when the process resumes
  44      execution.
  45 
  46      The Lgetareg() and Lputareg() functions are equivalent to the Pgetareg()
  47      and Psetareg() functions, except rather than operating on the process and
  48      its representative thread, they instead operate on the thread handle L.
  49 
  50 RETURN VALUES
  51      Upon successful completion, the Pgetareg() and Pputareg() function return
  52      0.  Otherwise, -1 is returned, errno is set, and no registers will have
  53      been gotten or updated.
  54 
  55 ERRORS
  56      The Pgetareg() and Lgetareg() functions will fail if:
  57 
  58      EINVAL             The value of regno is invalid.  This means it is less
  59                         than 0 and greater than NPRGREG.  Note, NPRGREG's
  60                         value varies based on process architecture.
  61 
  62      EBUSY              The handle P is neither stopped nor a core file.
  63 
  64      ENODATA            The handle P refers to a file obtained through
  65                         Pgrab_file(3PROC).
  66 
  67      The Pputareg() and Lputareg() functions will fail if:
  68 
  69      EINVAL             The value of regno is invalid.  This means it is less
  70                         than 0 and greater than NPRGREG.  Note, NPRGREG's
  71                         value varies based on process architecture.
  72 
  73      EBUSY              The handle P is not stopped or refers to a non-active
  74                         process.
  75 
  76 INTERFACE STABILITY
  77      Uncommitted
  78 
  79 MT-LEVEL
  80      See LOCKING in libproc(3LIB).
  81 
  82 SEE ALSO
  83      errno(3C), libproc(3LIB), Lgrab(3PROC), Pgrab_file(3PROC), Pstop(3PROC),
  84      proc(4)
  85 
  86 illumos                          May 11, 2016                          illumos