process_vm_readv.2: Formatting fixes

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2012-03-20 09:33:53 +13:00
parent 5e5ab35394
commit 529b74009b
1 changed files with 94 additions and 30 deletions

View File

@ -53,25 +53,48 @@ process_vm_readv, process_vm_writev \- read/write from/to another processes' add
.SH DESCRIPTION
The
.BR process_vm_readv ()
function reads from the memory locations described by the \fIriovcnt\fP
buffers from \fIrvec\fP in the process identified by \fIpid\fP into
\fIliovcnt\fP buffers described by \fIlvec\fP in the current process.
function reads from the memory locations described by the
.I riovcnt
buffers from
.I rvec
in the process identified by
.I pid
into
.I liovcnt
buffers described by
.I lvec
in the current process.
The
.BR process_vm_writev ()
function is the inverse of
.BR process_vm_readv ()
\-\- it writes into the memory locations described by \fIriovcnt\fP buffers
from \fIrvec\fP in the process identified by \fIpid\fP into \fIliovcnt\fP
buffers described by \fIlvec\fP in the current process.
.BR process_vm_readv ()\(emit
writes into the memory locations described by
.I riovcnt
buffers
from
.I rvec
in the process identified by
.I pid
into
.I liovcnt
buffers described by
.I lvec
in the current process.
The count values might be individually capped according to \fIUIO_MAXIOV\fP.
The count values might be individually capped according to
.BR UIO_MAXIOV .
If the Linux kernel is capped at smaller values, the C library will take care
of emulating the limit it exposes (if it is bigger) so the user only needs to
care about that (what the C library defines).
The pointers \fIlvec\fP and \fIrvec\fP point to an array of iovec structures
defined in
The pointers
.I lvec
and
.I rvec
point to an array of
.I iovec
structures, defined in
.IR <sys/uio.h>
as:
@ -86,17 +109,35 @@ struct iovec {
Buffers are processed in array order. This means that
.BR process_vm_readv ()
completely fills \fIlvec[0]\fP before proceeding to \fIlvec[1]\fP, and
so on. Along those lines, \fIrvec[0]\fP is completely read before
proceeding to \fIrvec[1]\fP and so on.
completely fills
.I lvec[0]
before proceeding to
.IR lvec[1] ,
and
so on.
Along those lines,
.I rvec[0]
is completely read before proceeding to
.I rvec[1]
and so on.
Similarly,
.BR process_vm_writev ()
writes out the entire contents of \fIlvec[0]\fP before proceeding to
\fIlvec[1]\fP, and it completely fills \fIrevc[0]\fP before proceeding
to \fIrvec[1]\fP.
writes out the entire contents of
.I lvec[0]
before proceeding to
.IR lvec[1] ,
and it completely fills
.I revc[0]
before proceeding
to
.IR rvec[1] .
The lengths of \fIrvec[i]\fP and \fIlvec[i]\fP do not have to be the same.
The lengths of
.I rvec[i]
and
.I lvec[i]
do not have to be the same.
This allows you to split a single local buffer into multiple remote buffers,
or vice versa.
@ -113,7 +154,9 @@ error will be returned immediately. Keep this in mind when attempting to
extract data of unknown length (such as C strings which are NULL terminated)
by avoiding spanning memory pages (typically 4KiB).
The \fIflags\fP parameter is currently unused and must be set to 0.
The
.I flags
parameter is currently unused and must be set to 0.
In order to read or write from or to another process you must have
the capability
@ -138,41 +181,62 @@ is set appropriately.
.SH ERRORS
.TP
.B EINVAL
The sum of the \fIiov_len\fP values of either \fIlvec\fP or \fIrvec\fP
overflows a ssize_t value.
The sum of the
.I iov_len
values of either
.I lvec
or
.I rvec
overflows a
.I ssize_t
value.
.TP
.B EINVAL
The value of the \fIflags\fP parameter is not 0.
The value of the
.I flags
parameter is not 0.
.TP
.B EFAULT
The memory described by \fIlvec\fP is outside your accessible address space.
The memory described by
.I lvec
is outside your accessible address space.
.TP
.B EFAULT
The memory described by \fIrvec\fP is outside the accessible address space
of process \fIpid\fP.
The memory described by
.I rvec
is outside the accessible address space
of process
.IR pid .
.TP
.B ENOMEM
Out of memory.
.TP
.B EPERM
.RB ( process_vm_readv ())
You do not have permission to read from process \fIpid\fP.
You do not have permission to read from process
.IR pid .
.TP
.B EPERM
.RB ( process_vm_writev ())
You do not have permission to write to process \fIpid\fP.
You do not have permission to write to process
.IR pid .
.TP
.B ESRCH
\fIpid\fP does not exist.
.I pid
does not exist.
.SH VERSIONS
These functions are available since glibc 2.15 and Linux 3.2.
.SH "CONFORMING TO"
These functions are Linux extensions, not in C or POSIX.
.SH EXAMPLE
The following code sample demonstrates the use of process_vm_readv().
The following code sample demonstrates the use of
.BR process_vm_readv ().
It reads 20 bytes at the address 0x10000 from the process with PID 10
and writes the first 10 bytes into buf1 and the second 10 bytes into
buf2.
and writes the first 10 bytes into
.I buf1
and the second 10 bytes into
.IR buf2 .
.sp
.nf
#include <sys/uio.h>