Small markup improvements.

This commit is contained in:
jruoho 2010-04-26 07:36:33 +00:00
parent a0542f149f
commit b8b5c1efc1

View File

@ -1,4 +1,4 @@
.\" $NetBSD: uiomove.9,v 1.15 2010/03/22 18:58:33 joerg Exp $
.\" $NetBSD: uiomove.9,v 1.16 2010/04/26 07:36:33 jruoho Exp $
.\"
.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -24,7 +24,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd March 7, 2007
.Dd April 26, 2010
.Dt UIOMOVE 9
.Os
.Sh NAME
@ -36,7 +36,7 @@
.Fn uiomove "void *buf" "size_t n" "struct uio *uio"
.Sh DESCRIPTION
The
.Nm
.Fn uiomove
function copies up to
.Fa n
bytes between the kernel-space address pointed
@ -49,53 +49,61 @@ which may be in user-space or kernel-space.
The
.Fa uio
argument is a pointer to a
.Fa struct uio
.Va struct uio
as defined by
.In sys/uio.h :
.Bd -literal
.Bd -literal -offset indent
struct uio {
struct iovec *uio_iov; /* pointer to array of iovecs */
int uio_iovcnt; /* number of iovecs in array */
off_t uio_offset; /* offset into file this uio corresponds to */
size_t uio_resid; /* residual i/o count */
struct iovec *uio_iov;
int uio_iovcnt;
off_t uio_offset;
size_t uio_resid;
enum uio_rw uio_rw;
struct vmspace *uio_vmspace;
};
.Ed
.Pp
A
.Fa struct uio
.Va struct uio
typically describes data in motion.
Several of the fields described below reflect that expectation.
.Pp
.Bl -tag -width uio_xxxxxx
.It uio_iov
.Bl -tag -width "uio_vmspace "
.It Va uio_iov
Pointer to array of
.Fa struct iovecs :
.Tn I/O
vectors to be processed.
The
.Va struct iovec
is defined to be:
.Bd -literal
struct iovec {
void *iov_base; /* Base address. */
size_t iov_len; /* Length. */
};
.Ed
.It uio_iovcnt
The number of iovecs in the array.
.It uio_offset
.It Va uio_iovcnt
The number of
.Tn I/O
vectors in the
.Va uio_iov
array.
.It Va uio_offset
An offset into the corresponding object.
.It uio_resid
.It Va uio_resid
The amount of space described by the structure; notionally, the amount
of data remaining to be transferred.
.It uio_rw
.It Va uio_rw
A flag indicating whether data should be read into the space
(UIO_READ) or written from the space (UIO_WRITE).
.It uio_vmspace
.It Va uio_vmspace
A pointer to the address space which is being transferred to or from.
.El
.Pp
The value of
.Fa uio-\*[Gt]uio_rw
.Va uio-\*[Gt]uio_rw
controls whether
.Nm
.Fn uiomove
copies data from
.Fa buf
to
@ -105,24 +113,28 @@ or vice versa.
The lesser of
.Fa n
or
.Fa uio-\*[Gt]uio_resid
.Va uio-\*[Gt]uio_resid
bytes are copied.
.Pp
.Nm
.Fn uiomove
changes fields of the structure pointed to by
.Fa uio ,
such that
.Fa uio-\*[Gt]uio_resid
.Va uio-\*[Gt]uio_resid
is decremented by the amount of data moved,
.Fa uio-\*[Gt]uio_offset
.Va uio-\*[Gt]uio_offset
is incremented by the same amount, and the array of iovecs is adjusted
to point that much farther into the region described.
This allows multiple calls to
.Nm
.Fn uiomove
to easily be used to fill or drain the region of data.
.Sh RETURN VALUES
.Nm
returns 0 on success or EFAULT if a bad address is encountered.
Upon successful completion,
.Fn uiomove
returns 0.
If a bad address is encountered,
.Er EFAULT
is returned.
.Sh SEE ALSO
.Xr copy 9 ,
.Xr fetch 9 ,