'\"macro stdmacro
.if n .pH ddi_dki.copyin @(#)copyin	40.6 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} copyin D3DK "" "DDI/DKI" "\&"
.if \nX=1 .ds x} copyin D3DK "" "DDI/DKI"
.if \nX=2 .ds x} copyin D3DK "" "\&"
.if \nX=3 .ds x} copyin "" "" "\&"
.TH \*(x}
.IX "\f4copyin\fP(D3DK)"
.SH NAME
\f4copyin\f1 \- copy data from a user program to a driver buffer
.SH SYNOPSIS
.nf
.na
\f4#include <sys/types.h>
.sp 0.5
int copyin(caddr_t \f2userbuf, \f4caddr_t \f1\f2driverbuf, \f4int \f2cn\f4);\f1
.ad
.fi
.SH ARGUMENTS
.RS 0n 13
.IP "\f2userbuf\f1" 10n
User program source address from which data is
transferred.
.IP "\f2driverbuf\f1" 10n
Driver destination address to which data is transferred.
.IP "\f2cn\f1" 10n
Number of bytes transferred.
.RE
.SH DESCRIPTION
\f4copyin\f1 copies data from a user program source address to a
driver buffer.  The driver developer must ensure that adequate space is
allocated for the destination address.
.P
Addresses that are word-aligned are moved most efficiently.  However,
the driver developer is not obligated to ensure alignment.  This
function automatically finds the most efficient move according to
address alignment.
.SH RETURN VALUE
Under normal conditions a \f40\f1 is returned indicating
a successful copy.  A \f4-1\f1 is returned if one of the following occurs: 
.IP
.IX "page fault"
paging fault; the driver tried to access a page of memory for which it
did not have read or write access
.IP
invalid user area or stack area
.IP
invalid address that would have resulted in data being copied into the user
block
.P
If a \f4-1\f1 is returned,
return \f4EFAULT\f1.
.SH LEVEL
Base Only  (Do not call from an interrupt routine)
.SH SEE ALSO
\f2BCI Driver Development Guide\f1, Chapter 6, ``Input/Output Operations''
.P
.na
\f4bcopy\f1(D3DK),
\f4copyout\f1(D3DK),
\f4uiomove\f1(D3DK)
.ad
