[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel and Subsystems Technical Reference, Volume 1

uiomove Kernel Service

Purpose

Moves a block of data between kernel space and a space defined by a uio structure.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/uio.h>
int uiomove (cp, n, rw, uiop)
caddr_t cp;
int n;
uio_rw rw;
struct uio *uiop;

Parameters

cp Specifies the address in kernel memory to or from which data is moved.
n Specifies the number of bytes to move.
rw Indicates the direction of the move:
UIO_READ Copies data from kernel space to space described by the uio structure.
UIO_WRITE Copies data from space described by the uio structure to kernel space.
uiop Points to a uio structure describing the buffer used in the data transfer.

Description

The uiomove kernel service moves the specified number of bytes of data between kernel space and a space described by a uio structure. Device driver top halves, especially character device drivers, frequently use the uiomove service to transfer data into or out of a user area. The uio_resid and uio_iovcnt fields in the uio structure describing the data area must be greater than 0 or an error is returned.

The uiomove service moves the number of bytes of data specified by either the n or uio_resid parameter, whichever is less. If either the n or uio_resid parameter is 0, no data is moved. The uio_segflg field in the uio structure is used to indicate if the move is accessing a user- or kernel-data area, or if the caller requires cross-memory operations and has provided the required cross-memory descriptors. If a cross-memory operation is indicated, there must be a cross-memory descriptor in the uio_xmem array for each iovec element.

If the move is successful, the following fields in the uio structure are updated:

uio_iov Specifies the address of current iovec element to use.
uio_xmem Specifies the address of the current xmem element to use.
uio_iovcnt Specifies the number of remaining iovec elements.
uio_iovdcnt Specifies the number of already processed iovec elements.
uio_offset Specifies the character offset on the device performing the I/O.
uio_resid Specifies the total number of characters remaining in the data area described by the uio structure.
iov_base Specifies the address of the data area described by the current iovec element.
iov_len Specifies the length of remaining data area in the buffer described by the current iovec element.

Execution Environment

The uiomove kernel service can be called from the process environment only.

Return Values

0 Indicates successful completion.
-1 Indicates that an error occurred for one of the following conditions:
ENOMEM Indicates there was no room in the buffer.
EIO Indicates a permanent I/O error file space.
ENOSPC Out of file-space blocks.
EFAULT Indicates a user location that is not valid.

Implementation Specifics

The uiomove kernel service is part of Base Operating System (BOS) Runtime.

Related Information

The uphysio kernel service, ureadc kernel service, uwritec kernel service.

The uio structure.

Memory Kernel Services in AIX Kernel Extensions and Device Support Programming Concepts.


[ Previous | Next | Contents | Home | Search ]