PREAD(3PROC) Process Control Library Functions PREAD(3PROC) NNAAMMEE PPrreeaadd, PPrreeaadd__ssttrriinngg - read data from a process LLIIBBRRAARRYY Process Control Library (libproc, -lproc) SSYYNNOOPPSSIISS ##iinncclluuddee <> _s_s_i_z_e___t PPrreeaadd(_s_t_r_u_c_t _p_s___p_r_o_c_h_a_n_d_l_e _*_P, _v_o_i_d _*_b_u_f, _s_i_z_e___t _n_b_y_t_e_s, _u_i_n_t_p_t_r___t _a_d_d_r_e_s_s); _s_s_i_z_e___t PPrreeaadd__ssttrriinngg(_s_t_r_u_c_t _p_s___p_r_o_c_h_a_n_d_l_e _*_P, _c_h_a_r _*_b_u_f, _s_i_z_e___t _n_b_y_t_e_s, _u_i_n_t_p_t_r___t _a_d_d_r_e_s_s); DDEESSCCRRIIPPTTIIOONN The PPrreeaadd() function reads data from the process handle _P starting at _a_d_d_r_e_s_s in the address space of the process and reads at most _n_b_y_t_e_s of data into _b_u_f and is logically analogous to the pread(2) function. For live processes, this function is equivalent to reading from the /proc file system aass 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, _a_d_d_r_e_s_s still refers to the virtual addresses that were present at run-time and not those in the core file. The PPrreeaadd__ssttrriinngg() function is similar to the PPrreeaadd() function, except that it attempts to interpret _a_d_d_r_e_s_s as a null terminated character string and will stop reading characters into _b_u_f if either _n_b_y_t_e_s has been read or a null terminator is encountered. The resulting data in _b_u_f will always be null terminated, even if no null terminator was found in the first _n_b_y_t_e_s of data. RREETTUURRNN VVAALLUUEESS Upon successful completion, the PPrreeaadd() and PPrreeaadd__ssttrriinngg() functions return a non-negative integer indicating the number of bytes actually read. Otherwise, the functions return --11 and set eerrrrnnoo to indicate the error. EERRRROORRSS For a full list of possible errors also see the DDIIAAGGNNOOSSTTIICCSS section in proc(4) and the EERRRROORRSS section in pread(2). IINNTTEERRFFAACCEE SSTTAABBIILLIITTYY UUnnccoommmmiitttteedd MMTT--LLEEVVEELL See LLOOCCKKIINNGG in libproc(3LIB). SSEEEE AALLSSOO pread(2), libproc(3LIB), proc(4) illumos May 11, 2016 illumos