'\"macro stdmacro
.if n .pH ddi_dki.uiomove @(#)uiomove	40.5 of 10/10/89
.\" Copyright 1989 AT&T
.de IX
.ie '\\n(.z'' .tm .Index: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9	\\n%
.el \\!.IX \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
..
.nr X
.if \nX=0 .ds x} uiomove D3DK "" "DDI/DKI" "\&"
.if \nX=1 .ds x} uiomove D3DK "" "DDI/DKI"
.if \nX=2 .ds x} uiomove D3DK "" "\&"
.if \nX=3 .ds x} uiomove "" "" "\&"
.TH \*(x}
.SH NAME
\f4uiomove\f1 \- copy kernel data using \f4uio\f1(D4DK) structure 
.IX "\f4uiomove\fP(D3DK)"
.SH SYNOPSIS
.nf
.na
\f4#include <sys/types.h>
#include <sys/uio.h>
.sp 0.5
int uiomove(\f4caddr_t\f1 \f2address, \f4long\f1 \f2nbytes, \f4enum uio_rw\f1 \f2rwflag,
	\f4struct uio *\f1 \f2uio_p\f4);\f1
.ad
.fi
.SH ARGUMENTS
.RS 0n 10
.IP "\f2address\f1" 10n
Source/destination kernel address of the copy.
.IP "\f2nbytes\f1" 10n
Number of bytes to copy.
.IP "\f2rwflag\f1" 10n
Flag indicating read or write operation.  Possible values are \f4UIO_READ\f1
and \f4UIO_WRITE\f1.
.IP "\f2uio_p\f1" 10n
Pointer to the \f4uio\f1 structure for the copy.
.RE
.SH DESCRIPTION
The \f4uiomove\f1 function copies \f2nbytes\f1 of data to or from 
the space defined by the \f4uio\f1 structure (described in
\f4uio.h\f1) and the driver.
.P
The \f4uio_segflg\f1 member of the \f4uio\f1 structure determines
the the type of space to or from which the transfer being made.  If it 
is set to \f4UIO_SYSSPACE\f1 the data transfer is 
between addresses in the kernel.  If it is set to \f4UIO_USERSPACE\f1 
the transfer is between a user program and kernel space.
.P
In addition to moving the data, \f4uiomove\f1 adds the number of bytes
moved to the \f4iov_base\f1 member of the \f4iovec\f1(D4DK)
structure, decreases the \f4iov_len\f1 member, increases the
\f4uio_offset\f1 member of the \f4uio\f1 structure, and decreases
the \f4uio_resid\f1 member.
.P
This function does automatic page boundary checking.
\f2nbytes\f1 does not have to be word-aligned.
.P
\f3CAUTION:\f1 If \f4uio_segflg\f1 is set to \f4UIO_SYSSPACE\f1 and
\f2address\f1 is selected from user space, the system panics.
.SH RETURN VALUE
\f4uiomove\f1 returns 0 upon success 
or \f4-1\f1 on failure.  The driver entry point
routine through which \f4uiomove\f1
was called should return \f4EFAULT\f1 if \f4-1\f1 is returned.
.SH LEVEL
Base.
.SH SEE ALSO
.na
\f4uio\f1(D4DK),
\f4ureadc\f1(D3DK),
\f4uwritec\f1(D3DK)
.ad
.SH EXAMPLE
See \f4rmalloc\f1.
