1 PREAD(3PROC)           Process Control Library Functions          PREAD(3PROC)
   2 
   3 NAME
   4      Pread, Pread_string - read data from a process
   5 
   6 LIBRARY
   7      Process Control Library (libproc, -lproc)
   8 
   9 SYNOPSIS
  10      #include <libproc.h>
  11 
  12      ssize_t
  13      Pread(struct ps_prochandle *P, void *buf, size_t nbytes,
  14          uintptr_t address);
  15 
  16      ssize_t
  17      Pread_string(struct ps_prochandle *P, char *buf, size_t nbytes,
  18          uintptr_t address);
  19 
  20 DESCRIPTION
  21      The Pread() function reads data from the process handle P starting at
  22      address in the address space of the process and reads at most nbytes of
  23      data into buf and is logically analogous to the pread(2) function.
  24 
  25      For live processes, this function is equivalent to reading from the /proc
  26      file system as file for the process.  For core files and file handles, it
  27      reads and writes from the logical address space and not the corresponding
  28      offset of the file itself.  For example, a core file contains a sparse
  29      representation of the address space of a crashed process and unmapped
  30      regions are not present in the file.  However, address still refers to
  31      the virtual addresses that were present at run-time and not those in the
  32      core file.
  33 
  34      The Pread_string() function is similar to the Pread() function, except
  35      that it attempts to interpret address as a null terminated character
  36      string and will stop reading characters into buf if either nbytes has
  37      been read or a null terminator is encountered.  The resulting data in buf
  38      will always be null terminated, even if no null terminator was found in
  39      the first nbytes of data.
  40 
  41 RETURN VALUES
  42      Upon successful completion, the Pread() and Pread_string() functions
  43      return a non-negative integer indicating the number of bytes actually
  44      read.  Otherwise, the functions return -1 and set errno to indicate the
  45      error.
  46 
  47 ERRORS
  48      For a full list of possible errors also see the DIAGNOSTICS section in
  49      proc(4) and the ERRORS section in pread(2).
  50 
  51 INTERFACE STABILITY
  52      Uncommitted
  53 
  54 MT-LEVEL
  55      See LOCKING in libproc(3LIB).
  56 
  57 SEE ALSO
  58      pread(2), libproc(3LIB), proc(4)
  59 
  60 illumos                          May 11, 2016                          illumos