Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

uiomove(9) [netbsd man page]

UIOMOVE(9)						   BSD Kernel Developer's Manual						UIOMOVE(9)

NAME
uiomove -- move data described by a struct uio SYNOPSIS
#include <sys/systm.h> int uiomove(void *buf, size_t n, struct uio *uio); DESCRIPTION
The uiomove() function copies up to n bytes between the kernel-space address pointed to by buf and the addresses described by uio, which may be in user-space or kernel-space. The uio argument is a pointer to a struct uio as defined by <sys/uio.h>: 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; }; A struct uio typically describes data in motion. Several of the fields described below reflect that expectation. uio_iov Pointer to array of I/O vectors to be processed. The struct iovec is defined to be: struct iovec { void *iov_base; size_t iov_len; }; The members in the struct iovec should only be initialized. These are: iov_base The address for a range of memory to or from which data is transferred. iov_len The number of bytes of data to be transferred to or from the range of memory starting at iov_base. uio_iovcnt The number of I/O vectors in the uio_iov array. uio_offset An offset into the corresponding object. uio_resid The amount of space described by the structure; notionally, the amount of data remaining to be transferred. uio_rw A flag indicating whether data should be read into the space (UIO_READ) or written from the space (UIO_WRITE). uio_vmspace A pointer to the address space which is being transferred to or from. The value of uio->uio_rw controls whether uiomove() copies data from buf to uio or vice versa. The lesser of n or uio->uio_resid bytes are copied. uiomove() changes fields of the structure pointed to by uio, such that uio->uio_resid is decremented by the amount of data moved, 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 uiomove() to easily be used to fill or drain the region of data. RETURN VALUES
Upon successful completion, uiomove() returns 0. If a bad address is encountered, EFAULT is returned. SEE ALSO
copy(9), fetch(9), store(9) BSD
April 26, 2010 BSD

Check Out this Related Man Page

uiomove(9F)						   Kernel Functions for Drivers 					       uiomove(9F)

NAME
uiomove - copy kernel data using uio structure SYNOPSIS
#include <sys/types.h> #include <sys/uio.h> int uiomove(caddr_t address, size_t nbytes, enum uio_rw rwflag, uio_t *uio_p); INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). PARAMETERS
address Source/destination kernel address of the copy. nbytes Number of bytes to copy. rwflag Flag indicating read or write operation. Possible values are UIO_READ and UIO_WRITE. uio_p Pointer to the uio structure for the copy. DESCRIPTION
The uiomove() function copies nbytes of data to or from the space defined by the uio structure (described in uio(9S)) and the driver. The uio_segflg member of the uio(9S) structure determines the type of space to or from which the transfer is being made. If it is set to UIO_SYSSPACE, the data transfer is between addresses in the kernel. If it is set to UIO_USERSPACE, the transfer is between a user program and kernel space. rwflag indicates the direction of the transfer. If UIO_READ is set, the data will be transferred from address to the buffer(s) described by uio_p. If UIO_WRITE is set, the data will be transferred from the buffer(s) described by uio_p to address. In addition to moving the data, uiomove() adds the number of bytes moved to the iov_base member of the iovec(9S) structure, decreases the iov_len member, increases the uio_offset member of the uio(9S) structure, and decreases the uio_resid member. This function automatically handles page faults. nbytes does not have to be word-aligned. RETURN VALUES
uiomove() returns 0 upon success or EFAULT on failure. CONTEXT
User context only, if uio_segflg is set to UIO_USERSPACE. User or interrupt context, if uio_segflg is set to UIO_SYSSPACE. SEE ALSO
ureadc(9F), uwritec(9F), iovec(9S), uio(9S) Writing Device Drivers WARNINGS
If uio_segflg is set to UIO_SYSSPACE and address is selected from user space, the system may panic. SunOS 5.10 7 Feb 2003 uiomove(9F)
Man Page