Writes a character to a buffer described by a uio structure.
#include <sys/types.h> #include <sys/errno.h> #include <sys/uio.h>
int ureadc (c, uiop) int c; struct uio *uiop;
|c||Specifies a character to be written to the buffer.|
|uiop||Points to a uio structure describing the buffer in which to place a character.|
The ureadc kernel service writes a character to a buffer described by a uio structure. Device driver top half routines, especially character device drivers, frequently use the ureadc kernel service to transfer data into a user area.
The uio_resid and uio_iovcnt fields in the uio structure describing the data area must be greater than 0. If these fields are not greater than 0, an error is returned. The uio_segflg field in the uio structure is used to indicate whether the data is being written to a user- or kernel-data area. It is also used to indicate if the caller requires cross-memory operations and has provided the required cross-memory descriptors. The values for the flag are defined in the /usr/include/sys/uio.h file.
If the data is successfully written, 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 current xmem element to use (used for cross-memory copy).|
|uio_iovcnt||Specifies the number of remaining iovec elements.|
|uio_iovdcnt||Specifies the number of iovec elements already processed.|
|uio_offset||Specifies the character offset on the device from which data is read.|
|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 next available character in 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.|
The ureadc kernel service can be called from the process environment only.
|0||Indicates successful completion.|
|ENOMEM||Indicates that there is no room in the buffer.|
|EFAULT||Indicates that the user location is not valid for one of these reasons:|
The ureadc kernel service is part of Base Operating System (BOS) Runtime.
The uiomove kernel service, uphysio kernel service, uwritec kernel service.
The uio structure.
Memory Kernel Services in AIX Kernel Extensions and Device Support Programming Concepts.