.TH copyin() "" "" "DDI/DKI Kernel Routine"
.PC "Copy data into a driver buffer from a user buffer"
.B "#include <sys/types.h>"
\fBint copyin(\fIuser\^\fB, \fIdriver\^\fB, \fIbytes\^\fB)\fR
\fBcaddr_t \fIuser\fB, \fIdriver\^\fB; size_t \fIbytes\^\fB;\fR
.PP
.B copyin()
copies
.I bytes
of data from address
.IR user ,
which lies within the user's data space, to address
.IR driver ,
which lies within the kernel's data space.
.I driver
must point to at least
.I bytes
of allocated memory.
If the memory to which
.I driver
points does not lie entirely within the kernel's space, the system may panic.
.PP
If all goes well,
.B copyin()
returns zero;
otherwise, it returns \-1.
.SH "See Also"
.B
copyout(),
DDI/DKI kernel routines,
uiomove(),
ureadc(),
uwritec()
.R
.SH Notes
.B copyin()
has base level.
It can sleep.
.PP
A driver cannot hold
a driver-defined basic lock or a read/write lock across
a call to this function;
it can, however, hold a driver-defined sleep lock.
When it holds a sleep lock, a driver must be careful to avoid creating
a deadlock.
.PP
As data are being transferred,
resolution of a page fault may result in another I/O to the same device.
.PP
This function is equivalent to the internal-kernel routine
.BR ukcopy() .
