Pwrite
—
write data to the address space of a process
Process Control Library (libproc, -lproc)
#include
<libproc.h>
ssize_t
Pwrite
(
struct
ps_prochandle *P,
const void *buf,
size_t nbyte,
uintptr_t address);
The
Pwrite
() function writes data from
buf to the process handle
P starting at the address
address. It writes at most
nbyte of data. The
Pwrite
() function is logically analogous to
the
pwrite(2) function.
For live processes, this function is equivalent to writing to the /proc file
system
as file for the process. For core files,
it writes to the logical address space of what was once the process and not
the corresponding offset in the on-disk file. ELF objects grabbed through
Pgrab_file(3PROC) do not support being written
to.
The
Pwrite
() function cannot be used to
extend the size of a mapping; writing to an
unmapped region generates an error.
Upon successful completion, the
Pwrite
()
function returns the number of bytes successfully written to
P. This number is never greater than
nbyte. Otherwise, it returns
-1 and
errno is set
to indicate an error. For the full list of errors see the
DIAGNOSTICS section in
proc(4) and the
ERRORS section in
pwrite(2).
In addition, the
Pwrite
() function will fail
if:
-
-
EIO
- P refers to an ELF object and not a core
file or active process.
Uncommitted
See
LOCKING in
libproc(3LIB).
pwrite(2),
libproc(3LIB),
proc(4)