p The .Fa uio argument is a pointer to a .Va struct uio as defined by n sys/uio.h : d -literal -offset indent struct uio { 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
p A .Va struct uio typically describes data in motion. Several of the fields described below reflect that expectation. l -tag -width "uio_vmspace " t Va uio_iov Pointer to array of .Tn I/O vectors to be processed. The .Va struct iovec is defined to be: d -literal -offset indent struct iovec { void *iov_base; size_t iov_len; }; .Ed
p The members in the .Va struct iovec should only be initialized. These are: l -tag -width "*iov_base " -offset indent t Va iov_base The address for a range of memory to or from which data is transferred. t Va iov_len The number of bytes of data to be transferred to or from the range of memory starting at .Va iov_base . .El t Va uio_iovcnt The number of .Tn I/O vectors in the .Va uio_iov array. t Va uio_offset An offset into the corresponding object. t Va uio_resid The amount of space described by the structure; notionally, the amount of data remaining to be transferred. t Va uio_rw A flag indicating whether data should be read into the space (UIO_READ) or written from the space (UIO_WRITE). t Va uio_vmspace A pointer to the address space which is being transferred to or from. .El
p The value of .Va uio->uio_rw controls whether .Fn uiomove copies data from .Fa buf to .Fa uio or vice versa.
p The lesser of .Fa n or .Va uio->uio_resid bytes are copied.
p .Fn uiomove changes fields of the structure pointed to by .Fa uio , such that .Va uio->uio_resid is decremented by the amount of data moved, .Va uio->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 .Fn uiomove to easily be used to fill or drain the region of data.
p The .Fn uiopeek function copies up to .Fa n bytes of data without updating .Fa uio ; the .Fn uioskip function updates .Fa uio without copying any data, and is guaranteed never to sleep or fault even if the buffers are in userspace and memory access via .Fn uiomove or .Fn uiopeek would trigger paging. A successful .Fn uiomove buf n uio call is equivalent to a successful .Fn uiopeek buf n uio followed by .Fn uioskip n uio . .Sh RETURN VALUES Upon successful completion, .Fn uiomove and .Fn uiopeek return 0. If a bad address is encountered, .Er EFAULT is returned. .Sh SEE ALSO .Xr copy 9 , .Xr ufetch 9 , .Xr ustore 9