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 .SH DESCRIPTION
The The
.BR process_vm_readv () .BR process_vm_readv ()
function reads from the memory locations described by the \fIriovcnt\fP function reads from the memory locations described by the
buffers from \fIrvec\fP in the process identified by \fIpid\fP into .I riovcnt
\fIliovcnt\fP buffers described by \fIlvec\fP in the current process. buffers from
.I rvec
in the process identified by
.I pid
into
.I liovcnt
buffers described by
.I lvec
in the current process.
The The
.BR process_vm_writev () .BR process_vm_writev ()
function is the inverse of function is the inverse of
.BR process_vm_readv () .BR process_vm_readv ()\(emit
\-\- it writes into the memory locations described by \fIriovcnt\fP buffers writes into the memory locations described by
from \fIrvec\fP in the process identified by \fIpid\fP into \fIliovcnt\fP .I riovcnt
buffers described by \fIlvec\fP in the current process. 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 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 of emulating the limit it exposes (if it is bigger) so the user only needs to
care about that (what the C library defines). care about that (what the C library defines).
The pointers \fIlvec\fP and \fIrvec\fP point to an array of iovec structures The pointers
defined in .I lvec
and
.I rvec
point to an array of
.I iovec
structures, defined in
.IR <sys/uio.h> .IR <sys/uio.h>
as: as:
@ -86,17 +109,35 @@ struct iovec {
Buffers are processed in array order. This means that Buffers are processed in array order. This means that
.BR process_vm_readv () .BR process_vm_readv ()
completely fills \fIlvec[0]\fP before proceeding to \fIlvec[1]\fP, and completely fills
so on. Along those lines, \fIrvec[0]\fP is completely read before .I lvec[0]
proceeding to \fIrvec[1]\fP and so on. 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, Similarly,
.BR process_vm_writev () .BR process_vm_writev ()
writes out the entire contents of \fIlvec[0]\fP before proceeding to writes out the entire contents of
\fIlvec[1]\fP, and it completely fills \fIrevc[0]\fP before proceeding .I lvec[0]
to \fIrvec[1]\fP. 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, This allows you to split a single local buffer into multiple remote buffers,
or vice versa. 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) extract data of unknown length (such as C strings which are NULL terminated)
by avoiding spanning memory pages (typically 4KiB). 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 In order to read or write from or to another process you must have
the capability the capability
@ -138,41 +181,62 @@ is set appropriately.
.SH ERRORS .SH ERRORS
.TP .TP
.B EINVAL .B EINVAL
The sum of the \fIiov_len\fP values of either \fIlvec\fP or \fIrvec\fP The sum of the
overflows a ssize_t value. .I iov_len
values of either
.I lvec
or
.I rvec
overflows a
.I ssize_t
value.
.TP .TP
.B EINVAL .B EINVAL
The value of the \fIflags\fP parameter is not 0. The value of the
.I flags
parameter is not 0.
.TP .TP
.B EFAULT .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 .TP
.B EFAULT .B EFAULT
The memory described by \fIrvec\fP is outside the accessible address space The memory described by
of process \fIpid\fP. .I rvec
is outside the accessible address space
of process
.IR pid .
.TP .TP
.B ENOMEM .B ENOMEM
Out of memory. Out of memory.
.TP .TP
.B EPERM .B EPERM
.RB ( process_vm_readv ()) .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 .TP
.B EPERM .B EPERM
.RB ( process_vm_writev ()) .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 .TP
.B ESRCH .B ESRCH
\fIpid\fP does not exist. .I pid
does not exist.
.SH VERSIONS .SH VERSIONS
These functions are available since glibc 2.15 and Linux 3.2. These functions are available since glibc 2.15 and Linux 3.2.
.SH "CONFORMING TO" .SH "CONFORMING TO"
These functions are Linux extensions, not in C or POSIX. These functions are Linux extensions, not in C or POSIX.
.SH EXAMPLE .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 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 and writes the first 10 bytes into
buf2. .I buf1
and the second 10 bytes into
.IR buf2 .
.sp .sp
.nf .nf
#include <sys/uio.h> #include <sys/uio.h>