uiomove(D3)uiomove(D3)NAMEuiomove - copy data using uio(D4) structure
SYNOPSIS
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/ddi.h>
int uiomove(caddr_t addr, long nbytes, uio_rw_t rwflag,
uio_t *uiop);
Arguments
addr Source/destination kernel address of the copy.
nbytes Number of bytes to copy.
rwflag Flag indicating read or write operation. Valid values are
UIO_READ and UIO_WRITE.
uiop Pointer to the uio structure for the copy.
DESCRIPTION
The uiomove function copies nbytes of data between the kernel address
addr and the space defined by the uio structure pointed to by uiop. If
rwflag is UIO_READ, the data is copied from addr to the space described
by the uio structure. If rwflag is UIO_WRITE, the data is copied from
the space described by the uio structure to addr.
The uio_segflg member of the uio structure specifies the type of space
described by the uio structure. If uio_segflg is set to UIO_SYSSPACE the
uio structure describes a portion of the kernel address space. If
uio_segflg is set to UIO_USERSPACE the uio structure describes a portion
of the user address space.
If the copy is successful, uiomove updates the appropriate members of the
uio and iovec(D4) structures to reflect the copy (uio_offset and iov_base
are increased by nbytes and uio_resid and iov_len are decrease by
nbytes).
Return Values
uiomove returns 0 on success or an error number on failure.
USAGE
Level
Base only if uio_segflg is set to UIO_USERSPACE.
Base or Interrupt if uio_segflg is set to UIO_SYSSPACE.
Synchronization Constraints
May sleep if uio_segflg is set to UIO_USERSPACE.
Page 1
uiomove(D3)uiomove(D3)
Driver-defined basic locks and read/write locks may be held across calls
to this function if uio_segflg is UIO_SYSSPACE but may not be held if
uio_segflg is UIO_USERSPACE.
Driver-defined sleep locks may be held across calls to this function
regardless of the value of uio_segflg.
Warnings
If addr specifies an address in user space or if the value of uio_segflg
is not consistent with the type of address space described by the uio
structure, the system can panic.
When holding locks across calls to this function, multithreaded drivers
must be careful to avoid creating a deadlock. During the data transfer,
page fault resolution might result in another I/O to the same device.
For example, this could occur if the driver controls the disk drive used
as the swap device.
REFERENCESbcopy(D3), copyin(D3), copyout(D3), ureadc(D3), uwritec(D3), iovec(D4),
uio(D4)
Page 2